summaryrefslogtreecommitdiff
path: root/packages/create-astro/src
diff options
context:
space:
mode:
authorGravatar Fred K. Schott <fkschott@gmail.com> 2021-11-17 10:30:12 -0800
committerGravatar GitHub <noreply@github.com> 2021-11-17 10:30:12 -0800
commit6c66d4834bf1feb192d6b2b5a29b77cc5e6a34f3 (patch)
treeb7afa0cd935265923adcfdd6523e3790a292abb8 /packages/create-astro/src
parent59eecad418eb3d46a66d851693fac3cb5a669863 (diff)
downloadastro-6c66d4834bf1feb192d6b2b5a29b77cc5e6a34f3.tar.gz
astro-6c66d4834bf1feb192d6b2b5a29b77cc5e6a34f3.tar.zst
astro-6c66d4834bf1feb192d6b2b5a29b77cc5e6a34f3.zip
fix npm init flag handling in create-astro (#1862)
* fix npm init flag handling * Update index.ts * Update real-cats-act.md
Diffstat (limited to 'packages/create-astro/src')
-rw-r--r--packages/create-astro/src/index.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/create-astro/src/index.ts b/packages/create-astro/src/index.ts
index 3b61333e0..9f09722d1 100644
--- a/packages/create-astro/src/index.ts
+++ b/packages/create-astro/src/index.ts
@@ -8,7 +8,13 @@ import yargs from 'yargs-parser';
import { FRAMEWORKS, COUNTER_COMPONENTS } from './frameworks.js';
import { TEMPLATES } from './templates.js';
import { createConfig } from './config.js';
-const args = yargs(process.argv);
+
+// NOTE: In the v7.x version of npm, the default behavior of `npm init` was changed
+// to no longer require `--` to pass args and instead pass `--` directly to us. This
+// 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);
prompts.override(args);
export function mkdirp(dir: string) {