create-lumen 2.0.0-beta.3 → 2.0.0-beta.4
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/package.json +1 -1
- package/src/cleanup.js +1 -0
- package/src/css.js +15 -4
- package/src/dependencies.js +7 -0
- package/src/engine/composition.js +4 -0
- package/src/main.js +1 -1
- package/src/utils/dev-server.js +37 -10
package/package.json
CHANGED
package/src/cleanup.js
CHANGED
|
@@ -21,6 +21,7 @@ export async function cleanupBoilerplate(projectPath, responses = {}) {
|
|
|
21
21
|
await deleteIfExists(`${projectPath}/src/App.tsx`);
|
|
22
22
|
await deleteIfExists(`${projectPath}/src/App.jsx`);
|
|
23
23
|
await deleteIfExists(`${projectPath}/src/App.css`);
|
|
24
|
+
await deleteIfExists(`${projectPath}/src/shared/styles`);
|
|
24
25
|
|
|
25
26
|
const isPagesRouter =
|
|
26
27
|
responses?.framework?.variant === "pages-router" ||
|
package/src/css.js
CHANGED
|
@@ -24,15 +24,26 @@ export async function setupCssFramework({
|
|
|
24
24
|
// framework is "none"); type-based imports ./styles/globals.css (or
|
|
25
25
|
// main.css). The chosen framework's styles land in the file the architecture
|
|
26
26
|
// actually imports.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
let stylesDir;
|
|
28
|
+
if (fw.name === "next") {
|
|
29
|
+
stylesDir =
|
|
30
|
+
fw.variant === "pages-router"
|
|
31
|
+
? path.join(projectPath, "src", "styles")
|
|
32
|
+
: path.join(projectPath, "src", "app");
|
|
33
|
+
} else {
|
|
34
|
+
stylesDir =
|
|
35
|
+
architecture === "feature-based"
|
|
36
|
+
? path.join(projectPath, "src", "shared", "styles")
|
|
37
|
+
: path.join(projectPath, "src", "styles");
|
|
38
|
+
}
|
|
31
39
|
|
|
32
40
|
// Vanilla CSS gets a stylesheet named main.css; tailwind keeps
|
|
33
41
|
// globals.css (its idiomatic name — it injects framework directives).
|
|
34
42
|
const mainFileName = cssFramework === "none" ? "main.css" : "globals.css";
|
|
35
43
|
|
|
44
|
+
// Ensure the styles dir exists
|
|
45
|
+
await fsp.mkdir(stylesDir, { recursive: true });
|
|
46
|
+
|
|
36
47
|
async function writeCss(content, fileName) {
|
|
37
48
|
await fsp.writeFile(path.join(stylesDir, fileName), content, "utf8");
|
|
38
49
|
}
|
package/src/dependencies.js
CHANGED
|
@@ -34,6 +34,13 @@ export async function installAllDeps(responses, pkg, cwd) {
|
|
|
34
34
|
for (const batch of devDepBatches) {
|
|
35
35
|
await installDeps(pkg, true, batch, cwd);
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
if (responses.database === "prisma") {
|
|
39
|
+
try {
|
|
40
|
+
const runner = pkg === "npm" ? "npx" : pkg;
|
|
41
|
+
await execa(runner, ["prisma", "generate"], { cwd, stdio: "pipe" });
|
|
42
|
+
} catch {}
|
|
43
|
+
}
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
// Pure dependency computation — the package list for a given matrix cell,
|
|
@@ -384,6 +384,7 @@ export function resolveFragments(responses = {}, templatesDir) {
|
|
|
384
384
|
"db:push": "prisma db push",
|
|
385
385
|
"db:seed": "prisma db seed",
|
|
386
386
|
"db:studio": "prisma studio",
|
|
387
|
+
postinstall: "prisma generate",
|
|
387
388
|
},
|
|
388
389
|
action: async ({ projectPath, templatesDir: tDir }) => {
|
|
389
390
|
const prismaTplDir = path.join(tDir, "conditional", "database", "prisma");
|
|
@@ -753,6 +754,9 @@ export function resolveFragments(responses = {}, templatesDir) {
|
|
|
753
754
|
try {
|
|
754
755
|
await fsp.rm(path.join(projectPath, "src", "app", "page.tsx"), { force: true });
|
|
755
756
|
} catch {}
|
|
757
|
+
try {
|
|
758
|
+
await fsp.rm(path.join(projectPath, "src", "app", "page.module.css"), { force: true });
|
|
759
|
+
} catch {}
|
|
756
760
|
// Adjust existing test file if it imported @/app/page before route groups was applied
|
|
757
761
|
for (const testExt of ["tsx", "jsx", "ts", "js"]) {
|
|
758
762
|
const testPath = path.join(projectPath, "src", "__tests__", `page.test.${testExt}`);
|
package/src/main.js
CHANGED
package/src/utils/dev-server.js
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
import { isCancel, select } from "@clack/prompts";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { execa } from "execa";
|
|
4
|
+
import path from "path";
|
|
4
5
|
|
|
5
|
-
export async function handleDevServer(
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
export async function handleDevServer(
|
|
7
|
+
pkg,
|
|
8
|
+
projectPathOrName,
|
|
9
|
+
{
|
|
10
|
+
isNonInteractive = false,
|
|
11
|
+
projectName = null,
|
|
12
|
+
selectFn = select,
|
|
13
|
+
execaFn = execa,
|
|
14
|
+
isTTY = process.stdin.isTTY,
|
|
15
|
+
} = {}
|
|
16
|
+
) {
|
|
17
|
+
const targetDir = path.isAbsolute(projectPathOrName)
|
|
18
|
+
? projectPathOrName
|
|
19
|
+
: path.resolve(process.cwd(), projectPathOrName);
|
|
20
|
+
const displayName = projectName || path.basename(projectPathOrName);
|
|
21
|
+
|
|
22
|
+
if (isNonInteractive || process.env.CI || !isTTY) {
|
|
23
|
+
printNextSteps(displayName, pkg);
|
|
8
24
|
return;
|
|
9
25
|
}
|
|
10
26
|
|
|
11
|
-
const startDev = await
|
|
27
|
+
const startDev = await selectFn({
|
|
12
28
|
message: "Start the development server?",
|
|
13
29
|
options: [
|
|
14
30
|
{ label: "Yes", value: true },
|
|
@@ -18,22 +34,33 @@ export async function handleDevServer(pkg, projectName, { isNonInteractive = fal
|
|
|
18
34
|
});
|
|
19
35
|
|
|
20
36
|
if (isCancel(startDev)) {
|
|
21
|
-
printNextSteps(
|
|
37
|
+
printNextSteps(displayName, pkg);
|
|
22
38
|
return;
|
|
23
39
|
}
|
|
24
40
|
|
|
25
41
|
if (startDev) {
|
|
26
42
|
console.log(chalk.green("\nStarting dev server...\n"));
|
|
27
|
-
|
|
43
|
+
try {
|
|
44
|
+
await execaFn(pkg, ["run", "dev"], { cwd: targetDir, stdio: "inherit" });
|
|
45
|
+
} catch (err) {
|
|
46
|
+
if (
|
|
47
|
+
err?.signal === "SIGINT" ||
|
|
48
|
+
err?.signal === "SIGTERM" ||
|
|
49
|
+
err?.exitCode === 130
|
|
50
|
+
) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
28
55
|
} else {
|
|
29
|
-
printNextSteps(
|
|
56
|
+
printNextSteps(displayName, pkg);
|
|
30
57
|
}
|
|
31
58
|
}
|
|
32
59
|
|
|
33
|
-
function printNextSteps(
|
|
60
|
+
function printNextSteps(displayName, pkg) {
|
|
34
61
|
console.log(chalk.bold("\nNext steps:"));
|
|
35
|
-
if (
|
|
36
|
-
console.log(chalk.gray(` cd ${
|
|
62
|
+
if (displayName !== "." && displayName !== "") {
|
|
63
|
+
console.log(chalk.gray(` cd ${displayName}`));
|
|
37
64
|
}
|
|
38
65
|
console.log(chalk.gray(` ${pkg} run dev\n`));
|
|
39
66
|
}
|