summaryrefslogtreecommitdiff
path: root/packages/create-astro/src
diff options
context:
space:
mode:
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) {