Skip to content

Commit 8154264

Browse files
committed
chore: yarn format
1 parent 20bf594 commit 8154264

File tree

2 files changed

+23
-25
lines changed

2 files changed

+23
-25
lines changed

src/commands/flarum/change.ts

+21-23
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {Command} from "@oclif/core";
2-
import path from "path";
3-
import {PromptsIO} from "boilersmith/io";
4-
import {exit} from "@oclif/errors";
5-
import {execSync, exec} from "child_process";
6-
import util from "util";
7-
import chalk from "chalk";
1+
import { Command } from '@oclif/core';
2+
import path from 'path';
3+
import { PromptsIO } from 'boilersmith/io';
4+
import { exit } from '@oclif/errors';
5+
import { execSync, exec } from 'child_process';
6+
import util from 'util';
7+
import chalk from 'chalk';
88

99
const execAsync = util.promisify(exec);
1010

@@ -14,7 +14,7 @@ export default class Info extends Command {
1414
/**
1515
* Should only need to keep two registered at all times.
1616
*/
17-
static map: {cli:string|number,flarum:string|number}[] = [
17+
static map: { cli: string | number; flarum: string | number }[] = [
1818
{ cli: 3, flarum: 2 },
1919
{ cli: 2, flarum: 1 },
2020
];
@@ -26,9 +26,9 @@ export default class Info extends Command {
2626
const currentFlarumVersion = Number(json.flarum.split('.')[0]);
2727
const currentCliVersion = Number(json.version.split('.')[0]);
2828

29-
const other = Info.map.find(i => i.cli !== currentCliVersion);
29+
const other = Info.map.find((i) => i.cli !== currentCliVersion);
3030

31-
if (! other) {
31+
if (!other) {
3232
this.error('No other versions to switch to.');
3333
}
3434

@@ -53,7 +53,7 @@ export default class Info extends Command {
5353
initial: true,
5454
});
5555

56-
if (! yes) {
56+
if (!yes) {
5757
return;
5858
}
5959

@@ -63,30 +63,30 @@ export default class Info extends Command {
6363
const otherBin = `fl${otherFlarumVersion}`;
6464
let otherBinPath = this.binPath(otherBin);
6565

66-
if (! otherBinPath) {
66+
if (!otherBinPath) {
6767
this.install(otherCliVersion, otherFlarumVersion);
6868
otherBinPath = this.binPath(otherBin);
6969

70-
if (! otherBinPath) {
70+
if (!otherBinPath) {
7171
this.error('Could not install the other version.');
7272
}
7373
}
7474

7575
const defaultBinPath = otherBinPath.split('/').slice(0, -1).join('/') + '/fl';
7676

7777
if (!this.isWindows()) {
78-
const which = execSync('which '+otherBin, { encoding: 'utf8' }).trim();
78+
const which = execSync('which ' + otherBin, { encoding: 'utf8' }).trim();
7979
// replace the default fl bin with the now installed fl2 or fl1 bin
8080
// the path to the fl bin is the same as the path to the fl2 or fl1 bin, just without the 2 or 1
8181
this.execRetryingAsSudo(`ln -sf ${which} ${defaultBinPath}`);
8282
} else {
83-
const where = execSync('where '+otherBin, { encoding: 'utf8' }).trim();
83+
const where = execSync('where ' + otherBin, { encoding: 'utf8' }).trim();
8484
execSync(`mklink /H C:\\Windows\\System32\\fl.exe ${where}`, { stdio: 'inherit' });
8585
}
8686
}
8787

88-
install(cli: number|string, flarum: number|string, sudo = false) {
89-
execAsync((sudo ? 'sudo ' : '') + `npm install -g fl${flarum}@npm:@flarum/cli@${cli} --force`).then(({stdout, stderr}) => {
88+
install(cli: number | string, flarum: number | string, sudo = false) {
89+
execAsync((sudo ? 'sudo ' : '') + `npm install -g fl${flarum}@npm:@flarum/cli@${cli} --force`).then(({ stdout }) => {
9090
if (stdout && stdout.toString().includes('Permission denied') && !sudo && !this.isWindows()) {
9191
this.log(chalk.red('Permission denied. Running with sudo.'));
9292
this.install(cli, flarum, true);
@@ -98,21 +98,19 @@ export default class Info extends Command {
9898
return process.platform === 'win32';
9999
}
100100

101-
binPath(bin: string): null|string {
102-
const result = this.isWindows()
103-
? execSync('where '+bin, { encoding: 'utf8' }).trim()
104-
: execSync('which '+bin, { encoding: 'utf8' }).trim();
101+
binPath(bin: string): null | string {
102+
const result = this.isWindows() ? execSync('where ' + bin, { encoding: 'utf8' }).trim() : execSync('which ' + bin, { encoding: 'utf8' }).trim();
105103

106104
this.log(result);
107105

108106
return result || null;
109107
}
110108

111109
protected execRetryingAsSudo(command: string): void {
112-
execAsync(command).catch(({stderr}) => {
110+
execAsync(command).catch(({ stderr }) => {
113111
if (stderr && stderr.toString().includes('Permission denied')) {
114112
this.log(chalk.red('Permission denied. Running with sudo.'));
115-
execSync('sudo '+command, { stdio: 'inherit' });
113+
execSync('sudo ' + command, { stdio: 'inherit' });
116114
}
117115
});
118116
}

src/commands/flarum/info.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {Command} from "@oclif/core";
2-
import path from "path";
1+
import { Command } from '@oclif/core';
2+
import path from 'path';
33

44
export default class Info extends Command {
55
static description = 'Related Flarum version information.';

0 commit comments

Comments
 (0)