[ci] format
This commit is contained in:
parent
d0777ad3af
commit
debdf11b19
2 changed files with 15 additions and 6 deletions
|
@ -18,7 +18,16 @@ import { printHelp, formatErrorMessage, formatConfigErrorMessage } from '../core
|
||||||
import { createSafeError } from '../core/util.js';
|
import { createSafeError } from '../core/util.js';
|
||||||
|
|
||||||
type Arguments = yargs.Arguments;
|
type Arguments = yargs.Arguments;
|
||||||
type CLICommand = 'help' | 'version' | 'add' | 'docs' | 'dev' | 'build' | 'preview' | 'reload' | 'check';
|
type CLICommand =
|
||||||
|
| 'help'
|
||||||
|
| 'version'
|
||||||
|
| 'add'
|
||||||
|
| 'docs'
|
||||||
|
| 'dev'
|
||||||
|
| 'build'
|
||||||
|
| 'preview'
|
||||||
|
| 'reload'
|
||||||
|
| 'check';
|
||||||
|
|
||||||
/** Display --help flag */
|
/** Display --help flag */
|
||||||
function printAstroHelp() {
|
function printAstroHelp() {
|
||||||
|
@ -27,7 +36,7 @@ function printAstroHelp() {
|
||||||
headline: 'Futuristic web development tool.',
|
headline: 'Futuristic web development tool.',
|
||||||
commands: [
|
commands: [
|
||||||
['add', 'Add an integration to your configuration.'],
|
['add', 'Add an integration to your configuration.'],
|
||||||
['docs', 'Launch Astro\'s Doc site directly from the terminal. '],
|
['docs', "Launch Astro's Doc site directly from the terminal. "],
|
||||||
['dev', 'Run Astro in development mode.'],
|
['dev', 'Run Astro in development mode.'],
|
||||||
['build', 'Build a pre-compiled production-ready site.'],
|
['build', 'Build a pre-compiled production-ready site.'],
|
||||||
['preview', 'Preview your build locally before deploying.'],
|
['preview', 'Preview your build locally before deploying.'],
|
||||||
|
@ -148,9 +157,9 @@ export async function cli(args: string[]) {
|
||||||
|
|
||||||
case 'docs': {
|
case 'docs': {
|
||||||
try {
|
try {
|
||||||
return await openInBrowser('https://docs.astro.build/')
|
return await openInBrowser('https://docs.astro.build/');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return throwAndExit(err)
|
return throwAndExit(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { execa } from 'execa';
|
||||||
* Credit: Azhar22
|
* Credit: Azhar22
|
||||||
* @see https://github.com/azhar22k/ourl/blob/master/index.js
|
* @see https://github.com/azhar22k/ourl/blob/master/index.js
|
||||||
*/
|
*/
|
||||||
const getPlatformSpecificCommand = (): [string]|[string, string[]] => {
|
const getPlatformSpecificCommand = (): [string] | [string, string[]] => {
|
||||||
const isGitPod = Boolean(process.env.GITPOD_REPO_ROOT);
|
const isGitPod = Boolean(process.env.GITPOD_REPO_ROOT);
|
||||||
const platform = isGitPod ? 'gitpod' : process.platform;
|
const platform = isGitPod ? 'gitpod' : process.platform;
|
||||||
|
|
||||||
|
@ -29,4 +29,4 @@ const getPlatformSpecificCommand = (): [string]|[string, string[]] => {
|
||||||
export async function openInBrowser(url: string): Promise<ExecaChildProcess> {
|
export async function openInBrowser(url: string): Promise<ExecaChildProcess> {
|
||||||
const [command, args = []] = getPlatformSpecificCommand();
|
const [command, args = []] = getPlatformSpecificCommand();
|
||||||
return execa(command, [...args, encodeURI(url)]);
|
return execa(command, [...args, encodeURI(url)]);
|
||||||
};
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue