diff options
author | 2022-10-28 12:24:14 -0500 | |
---|---|---|
committer | 2022-10-28 12:24:14 -0500 | |
commit | 641b6d7d583886fde9529f296846d7e0a50e8624 (patch) | |
tree | 89176d5ca9a197baabb3693d07611b7778aa3e69 /packages/create-astro/src | |
parent | d7b27a17e3fccb7eb94a6dccf68c32bce9ecd665 (diff) | |
download | astro-641b6d7d583886fde9529f296846d7e0a50e8624.tar.gz astro-641b6d7d583886fde9529f296846d7e0a50e8624.tar.zst astro-641b6d7d583886fde9529f296846d7e0a50e8624.zip |
feat(create-astro): add --fancy flag (#5226)
Co-authored-by: Nate Moore <nate@astro.build>
Diffstat (limited to 'packages/create-astro/src')
-rw-r--r-- | packages/create-astro/src/index.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/create-astro/src/index.ts b/packages/create-astro/src/index.ts index 2c9da9d66..dcd5c98ab 100644 --- a/packages/create-astro/src/index.ts +++ b/packages/create-astro/src/index.ts @@ -1,5 +1,6 @@ /* eslint no-console: 'off' */ import { color, generateProjectName, label, say } from '@astrojs/cli-kit'; +import { forceUnicode } from '@astrojs/cli-kit/utils'; import { random } from '@astrojs/cli-kit/utils'; import { assign, parse, stringify } from 'comment-json'; import { execa, execaCommand } from 'execa'; @@ -29,9 +30,14 @@ import { TEMPLATES } from './templates.js'; // broke our arg parser, since `--` is a special kind of flag. Filtering for `--` here // fixes the issue so that create-astro now works on all npm version. const cleanArgv = process.argv.filter((arg) => arg !== '--'); -const args = yargs(cleanArgv); +const args = yargs(cleanArgv, { boolean: ['fancy']}); prompts.override(args); +// Enable full unicode support if the `--fancy` flag is passed +if (args.fancy) { + forceUnicode(); +} + export function mkdirp(dir: string) { try { fs.mkdirSync(dir, { recursive: true }); @@ -99,7 +105,7 @@ export async function main() { `${username}!`, ], random(welcome), - ]); + ], { hat: args.fancy ? '🎩' : undefined }); await banner(version); } |