create-stackflow 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +1 -1
- package/package.json +1 -1
- package/src/commands/create.js +1 -1
- package/src/generators/frontend.js +27 -6
package/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ const program = new Command();
|
|
|
8
8
|
program
|
|
9
9
|
.name("create-stackflow")
|
|
10
10
|
.description("Generate a production-minded MERN starter with frontend, backend, auth, CRUD, and dashboard UI.")
|
|
11
|
-
.version("1.0.
|
|
11
|
+
.version("1.0.8")
|
|
12
12
|
.argument("[project-name]", "project folder name")
|
|
13
13
|
.option("--skip-install", "generate files without installing dependencies")
|
|
14
14
|
.option("--yes", "use recommended defaults")
|
package/package.json
CHANGED
package/src/commands/create.js
CHANGED
|
@@ -47,9 +47,9 @@ export async function createStackFlow(options) {
|
|
|
47
47
|
|
|
48
48
|
await fs.ensureDir(projectDir);
|
|
49
49
|
|
|
50
|
-
await step("Creating root workspace", () => createRootFiles(context));
|
|
51
50
|
await createFrontend(context);
|
|
52
51
|
await createBackend(context);
|
|
52
|
+
await step("Writing project gitignore files", () => createRootFiles(context));
|
|
53
53
|
|
|
54
54
|
if (!context.skipInstall) {
|
|
55
55
|
await step("Installing dependencies (root node_modules)", () =>
|
|
@@ -27,14 +27,25 @@ async function scaffoldOfficialFrontend(context) {
|
|
|
27
27
|
"--import-alias",
|
|
28
28
|
"@/*"
|
|
29
29
|
];
|
|
30
|
-
await execa("npx", args, { cwd: context.projectDir, stdio: "
|
|
30
|
+
await execa("npx", args, { cwd: context.projectDir, stdio: "inherit" });
|
|
31
31
|
} else {
|
|
32
32
|
const template = context.language === "typescript" ? "react-ts" : "react";
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const frontendName = path.basename(context.frontendDir);
|
|
34
|
+
if (await fs.pathExists(context.frontendDir)) {
|
|
35
|
+
const existing = await fs.readdir(context.frontendDir);
|
|
36
|
+
if (existing.length > 0) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`Frontend folder "${frontendName}" already exists and is not empty. Remove it or choose another frontend folder name.`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
await execa(
|
|
43
|
+
"npm",
|
|
44
|
+
["create", "vite@latest", frontendName, "--", "--template", template, "--no-interactive"],
|
|
45
|
+
{ cwd: context.projectDir, stdio: "inherit" },
|
|
46
|
+
);
|
|
37
47
|
}
|
|
48
|
+
await assertFrontendScaffolded(context);
|
|
38
49
|
spinner.succeed("Creating frontend with official generator");
|
|
39
50
|
} catch (error) {
|
|
40
51
|
spinner.fail("Creating frontend with official generator");
|
|
@@ -42,6 +53,16 @@ async function scaffoldOfficialFrontend(context) {
|
|
|
42
53
|
}
|
|
43
54
|
}
|
|
44
55
|
|
|
56
|
+
async function assertFrontendScaffolded(context) {
|
|
57
|
+
const packageFile = path.join(context.frontendDir, "package.json");
|
|
58
|
+
if (!(await fs.pathExists(packageFile))) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`Frontend scaffold did not create package.json at ${packageFile}. ` +
|
|
61
|
+
"The official generator may have been cancelled or failed. Try again in an empty project folder.",
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
45
66
|
async function installFrontendDependencies(context) {
|
|
46
67
|
await updateFrontendPackage(context);
|
|
47
68
|
}
|
|
@@ -75,7 +96,7 @@ async function updateFrontendPackage(context) {
|
|
|
75
96
|
|
|
76
97
|
const backendName = path.basename(context.backendDir);
|
|
77
98
|
pkg.devDependencies = pkg.devDependencies || {};
|
|
78
|
-
pkg.devDependencies.concurrently = "
|
|
99
|
+
pkg.devDependencies.concurrently = "^9.2.1";
|
|
79
100
|
|
|
80
101
|
if (context.frontend === "react") {
|
|
81
102
|
pkg.scripts = {
|