Skip to content

Commit 9473007

Browse files
Add a new "create-next-on-firebase" package (#161)
This package shells out to @apphosting/create Co-authored-by: James Daniels <jamesdaniels@google.com>
1 parent d324424 commit 9473007

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "create-next-on-firebase",
3+
"version": "0.1.0",
4+
"description": "Experimental CLI to init a Next.js project for deployment on Firebase",
5+
"main": "dist/index.js",
6+
"scripts": {
7+
"build": "rm -rf dist && tsc && chmod +x ./dist/bin/*"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/FirebaseExtended/firebase-framework-tools.git"
12+
},
13+
"author": "Firebase",
14+
"license": "Apache-2.0",
15+
"bugs": {
16+
"url": "https://github.com/FirebaseExtended/firebase-framework-tools/issues"
17+
},
18+
"homepage": "https://github.com/FirebaseExtended/firebase-framework-tools#readme"
19+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#! /usr/bin/env node
2+
import { spawn } from "node:child_process";
3+
import { program } from "commander";
4+
5+
program.argument("<directory>", "path to the project's root directory").action((directory) => {
6+
console.log(`Shelling out to @apphosting/create:`);
7+
8+
const createProcess = spawn("npx", ["@apphosting/create", "--framework=nextjs", directory], {
9+
shell: true,
10+
stdio: "inherit",
11+
});
12+
13+
// print out the shell command that spawn created
14+
console.log(createProcess.spawnargs.at(-1));
15+
16+
createProcess.stdout?.on("data", (data) => {
17+
console.log(`i: ${data}`);
18+
});
19+
20+
createProcess.stderr?.on("data", (data) => {
21+
console.error(`error: ${data}`);
22+
});
23+
24+
createProcess.on("close", (code) => {
25+
if (code === 0) {
26+
console.log("Success!");
27+
} else {
28+
console.log(`There was a problem, exited with code ${code}`);
29+
}
30+
});
31+
});
32+
33+
program.parse();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": false,
5+
"outDir": "dist"
6+
},
7+
"include": ["src/index.ts", "src/bin/*.ts"]
8+
}

0 commit comments

Comments
 (0)