Skip to content

Commit

Permalink
run fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz committed Aug 23, 2023
1 parent 0678e57 commit 4da5e7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .changeset/clever-cooks-smell.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ adjusted arguments passing so that arguments following an extra `--` are
passed to the underlying cli (if any)

For example:

```
$ npm create cloudflare -- --framework=X -- -a -b
```

now will run the framework X's cli with the `-a` and `-b` arguments
(such arguments will be completely ignored by C3)
10 changes: 7 additions & 3 deletions packages/create-cloudflare/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ const printBanner = () => {
};

const parseArgs = async (argv: string[]): Promise<Partial<C3Args>> => {
const doubleDashesIdx = argv.indexOf('--');
const c3Args = doubleDashesIdx < 0 ? argv : argv.slice(0, doubleDashesIdx < 0 ? undefined : doubleDashesIdx);
const additionalArgs = doubleDashesIdx < 0 ? [] : argv.slice(doubleDashesIdx + 1);
const doubleDashesIdx = argv.indexOf("--");
const c3Args = argv.slice(
0,
doubleDashesIdx < 0 ? undefined : doubleDashesIdx
);
const additionalArgs =
doubleDashesIdx < 0 ? [] : argv.slice(doubleDashesIdx + 1);

const args = await yargs(hideBin(c3Args))
.scriptName("create-cloudflare")
Expand Down
2 changes: 1 addition & 1 deletion packages/create-cloudflare/src/helpers/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export const runFrameworkGenerator = async (
ctx: PagesGeneratorContext,
cmd: string
) => {
if(ctx.framework?.args?.length) {
if (ctx.framework?.args?.length) {
cmd = `${cmd} ${ctx.framework.args.join(" ")}`;
}

Expand Down

0 comments on commit 4da5e7f

Please sign in to comment.