fix npm init flag handling in create-astro (#1862)
* fix npm init flag handling * Update index.ts * Update real-cats-act.md
This commit is contained in:
parent
59eecad418
commit
6c66d4834b
2 changed files with 12 additions and 1 deletions
5
.changeset/real-cats-act.md
Normal file
5
.changeset/real-cats-act.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'create-astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix issue with v7.x+ versions of npm init, which changed default flag handling
|
|
@ -8,7 +8,13 @@ import yargs from 'yargs-parser';
|
||||||
import { FRAMEWORKS, COUNTER_COMPONENTS } from './frameworks.js';
|
import { FRAMEWORKS, COUNTER_COMPONENTS } from './frameworks.js';
|
||||||
import { TEMPLATES } from './templates.js';
|
import { TEMPLATES } from './templates.js';
|
||||||
import { createConfig } from './config.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);
|
prompts.override(args);
|
||||||
|
|
||||||
export function mkdirp(dir: string) {
|
export function mkdirp(dir: string) {
|
||||||
|
|
Loading…
Reference in a new issue