Skip to content

Commit

Permalink
Push everything through NPX
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels committed May 13, 2024
1 parent 1e90b02 commit e9ea13d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/create-next-on-firebase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-on-firebase",
"version": "0.2.0",
"version": "0.2.1",
"description": "Experimental CLI to init a Next.js project for deployment on Firebase",
"main": "dist/index.js",
"bin": {
Expand Down
29 changes: 12 additions & 17 deletions packages/create-next-on-firebase/src/bin/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,27 @@ program
.argument("[directory]", "path to the project's root directory")
.action(async (directory) => {
let packageManager: string | undefined = undefined;
let packageManagerVersion = "*";
if (contextIsNpmCreate) {
packageManager = "npm";
} else if (npmUserAgent.pnpm) {
packageManager = "pnpm";
packageManagerVersion = npmUserAgent.pnpm;
} else if (npmUserAgent.yarn) {
packageManager = "yarn";
packageManagerVersion = npmUserAgent.yarn;
}
const args = ["--yes", "@apphosting/create@latest", "--framework=nextjs"];
if (packageManager) {
await spawn(
packageManager,
["create", "@apphosting", "--framework=nextjs", directory].filter((it) => it),
{
shell: true,
stdio: "inherit",
},
);
} else {
await spawn(
"npx",
["@apphosting/create", "--framework=nextjs", directory].filter((it) => it),
{
shell: true,
stdio: "inherit",
},
);
args.push(`--package-manager=${packageManager}@${packageManagerVersion}`);
}
if (directory) {
args.push(directory);
}
await spawn("npx", args, {
shell: true,
stdio: "inherit",
});
});

program.parse();

0 comments on commit e9ea13d

Please sign in to comment.