@nightkatana/kronosys-app 1.0.0-beta.7 → 1.0.0-beta.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/bin/kronosys.mjs +17 -8
- package/package.json +1 -1
package/bin/kronosys.mjs
CHANGED
|
@@ -22,13 +22,15 @@ const packageVersion = packageJson.version;
|
|
|
22
22
|
const inNodeModules =
|
|
23
23
|
projectRoot.includes("/node_modules/") ||
|
|
24
24
|
projectRoot.includes("\\node_modules\\");
|
|
25
|
+
const npmBin = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
26
|
+
const npxBin = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
25
27
|
|
|
26
28
|
const [, , command = "start", ...rest] = process.argv;
|
|
27
29
|
|
|
28
30
|
const commands = {
|
|
29
|
-
start: [
|
|
31
|
+
start: [npxBin, "next", "start", "-p", "5555", ...rest],
|
|
30
32
|
dev: [
|
|
31
|
-
|
|
33
|
+
npxBin,
|
|
32
34
|
"next",
|
|
33
35
|
"dev",
|
|
34
36
|
"--webpack",
|
|
@@ -86,7 +88,8 @@ function prepareRuntimeRoot() {
|
|
|
86
88
|
.replace(/^\/+/, "");
|
|
87
89
|
if (!rel) return true;
|
|
88
90
|
if (rel === ".next" || rel.startsWith(".next/")) return false;
|
|
89
|
-
if (rel === "node_modules" || rel.startsWith("node_modules/"))
|
|
91
|
+
if (rel === "node_modules" || rel.startsWith("node_modules/"))
|
|
92
|
+
return false;
|
|
90
93
|
return true;
|
|
91
94
|
},
|
|
92
95
|
});
|
|
@@ -106,11 +109,12 @@ async function main() {
|
|
|
106
109
|
if (inNodeModules && !existsSync(resolve(runRoot, "node_modules"))) {
|
|
107
110
|
console.log("[kronosys] Installing runtime dependencies...");
|
|
108
111
|
const installCode = await runCommand(
|
|
109
|
-
|
|
112
|
+
npmBin,
|
|
110
113
|
["install", "--omit=dev", "--ignore-scripts", "--no-audit", "--no-fund"],
|
|
111
114
|
{
|
|
112
115
|
...env,
|
|
113
|
-
npm_config_cache:
|
|
116
|
+
npm_config_cache:
|
|
117
|
+
process.env.npm_config_cache ?? resolve(homedir(), ".npm"),
|
|
114
118
|
},
|
|
115
119
|
runRoot,
|
|
116
120
|
);
|
|
@@ -120,10 +124,15 @@ async function main() {
|
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
// Production mode requires a Next build. Build once on first run.
|
|
123
|
-
if (
|
|
124
|
-
|
|
127
|
+
if (
|
|
128
|
+
command === "start" &&
|
|
129
|
+
!existsSync(resolve(runRoot, ".next", "BUILD_ID"))
|
|
130
|
+
) {
|
|
131
|
+
console.log(
|
|
132
|
+
"[kronosys] No production build found. Running `next build`...",
|
|
133
|
+
);
|
|
125
134
|
const buildCode = await runCommand(
|
|
126
|
-
|
|
135
|
+
npxBin,
|
|
127
136
|
["next", "build", "--webpack"],
|
|
128
137
|
env,
|
|
129
138
|
runRoot,
|