mirror of
https://github.com/zen-browser/surfer.git
synced 2025-07-08 01:10:03 +02:00
🎨 Run prettier
This commit is contained in:
parent
7a81587f9f
commit
4714fb4bc8
42 changed files with 1786 additions and 2445 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue