🎨 Run prettier

This commit is contained in:
trickypr 2021-09-20 11:10:52 +10:00
parent 7a81587f9f
commit 4714fb4bc8
42 changed files with 1786 additions and 2445 deletions

View file

@ -1,68 +1,53 @@
import { Command } from "commander";
import { existsSync, readFileSync } from "fs";
import { resolve } from "path";
import { bin_name, log } from "..";
import { dispatch } from "../utils";
import { Command } from 'commander'
import { existsSync, readFileSync } from 'fs'
import { resolve } from 'path'
import { bin_name, log } from '..'
import { dispatch } from '../utils'
export const init = async (directory: Command) => {
if (process.platform == "win32") {
// Because Windows cannot handle paths correctly, we're just calling a script as the workaround.
log.info(
"Successfully downloaded browser source. Please run |./windows-init.sh| to finish up."
);
process.exit(0);
}
if (process.platform == 'win32') {
// Because Windows cannot handle paths correctly, we're just calling a script as the workaround.
log.info(
'Successfully downloaded browser source. Please run |./windows-init.sh| to finish up.'
)
process.exit(0)
}
const cwd = process.cwd();
const cwd = process.cwd()
const dir = resolve(
cwd as string,
directory.toString()
);
const dir = resolve(cwd as string, directory.toString())
if (!existsSync(dir)) {
log.error(
`Directory "${directory}" not found.\nCheck the directory exists and run |${bin_name} init| again.`
);
}
if (!existsSync(dir)) {
log.error(
`Directory "${directory}" not found.\nCheck the directory exists and run |${bin_name} init| again.`
)
}
let version = readFileSync(
resolve(
cwd,
directory.toString(),
"browser",
"config",
"version_display.txt"
),
"utf-8"
);
let version = readFileSync(
resolve(
cwd,
directory.toString(),
'browser',
'config',
'version_display.txt'
),
'utf-8'
)
if (!version)
log.error(
`Directory "${directory}" not found.\nCheck the directory exists and run |${bin_name} init| again.`
);
if (!version)
log.error(
`Directory "${directory}" not found.\nCheck the directory exists and run |${bin_name} init| again.`
)
version = version.trim().replace(/\\n/g, "");
version = version.trim().replace(/\\n/g, '')
await dispatch("git", ["init"], dir as string);
await dispatch(
"git",
["checkout", "--orphan", version],
dir as string
);
await dispatch(
"git",
["add", "-v", "-f", "."],
dir as string
);
await dispatch(
"git",
["commit", "-am", `"Firefox ${version}"`],
dir as string
);
await dispatch(
"git",
["checkout", "-b", "dot"],
dir as string
);
};
await dispatch('git', ['init'], dir as string)
await dispatch('git', ['checkout', '--orphan', version], dir as string)
await dispatch('git', ['add', '-v', '-f', '.'], dir as string)
await dispatch(
'git',
['commit', '-am', `"Firefox ${version}"`],
dir as string
)
await dispatch('git', ['checkout', '-b', 'dot'], dir as string)
}