@nightkatana/kronosys-app 1.0.0-beta.7 → 1.0.0-beta.9

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.
Files changed (2) hide show
  1. package/bin/kronosys.mjs +20 -9
  2. package/package.json +1 -1
package/bin/kronosys.mjs CHANGED
@@ -22,13 +22,16 @@ const packageVersion = packageJson.version;
22
22
  const inNodeModules =
23
23
  projectRoot.includes("/node_modules/") ||
24
24
  projectRoot.includes("\\node_modules\\");
25
+ const isWindows = process.platform === "win32";
26
+ const npmBin = process.platform === "win32" ? "npm.cmd" : "npm";
27
+ const npxBin = process.platform === "win32" ? "npx.cmd" : "npx";
25
28
 
26
29
  const [, , command = "start", ...rest] = process.argv;
27
30
 
28
31
  const commands = {
29
- start: ["npx", "next", "start", "-p", "5555", ...rest],
32
+ start: [npxBin, "next", "start", "-p", "5555", ...rest],
30
33
  dev: [
31
- "npx",
34
+ npxBin,
32
35
  "next",
33
36
  "dev",
34
37
  "--webpack",
@@ -51,7 +54,8 @@ function runCommand(bin, args, env, cwd) {
51
54
  const child = spawn(bin, args, {
52
55
  cwd,
53
56
  stdio: "inherit",
54
- shell: false,
57
+ // Windows command dispatch is more reliable through shell for *.cmd wrappers.
58
+ shell: isWindows,
55
59
  env,
56
60
  });
57
61
 
@@ -86,7 +90,8 @@ function prepareRuntimeRoot() {
86
90
  .replace(/^\/+/, "");
87
91
  if (!rel) return true;
88
92
  if (rel === ".next" || rel.startsWith(".next/")) return false;
89
- if (rel === "node_modules" || rel.startsWith("node_modules/")) return false;
93
+ if (rel === "node_modules" || rel.startsWith("node_modules/"))
94
+ return false;
90
95
  return true;
91
96
  },
92
97
  });
@@ -106,11 +111,12 @@ async function main() {
106
111
  if (inNodeModules && !existsSync(resolve(runRoot, "node_modules"))) {
107
112
  console.log("[kronosys] Installing runtime dependencies...");
108
113
  const installCode = await runCommand(
109
- "npm",
114
+ npmBin,
110
115
  ["install", "--omit=dev", "--ignore-scripts", "--no-audit", "--no-fund"],
111
116
  {
112
117
  ...env,
113
- npm_config_cache: process.env.npm_config_cache ?? resolve(homedir(), ".npm"),
118
+ npm_config_cache:
119
+ process.env.npm_config_cache ?? resolve(homedir(), ".npm"),
114
120
  },
115
121
  runRoot,
116
122
  );
@@ -120,10 +126,15 @@ async function main() {
120
126
  }
121
127
 
122
128
  // Production mode requires a Next build. Build once on first run.
123
- if (command === "start" && !existsSync(resolve(runRoot, ".next", "BUILD_ID"))) {
124
- console.log("[kronosys] No production build found. Running `next build`...");
129
+ if (
130
+ command === "start" &&
131
+ !existsSync(resolve(runRoot, ".next", "BUILD_ID"))
132
+ ) {
133
+ console.log(
134
+ "[kronosys] No production build found. Running `next build`...",
135
+ );
125
136
  const buildCode = await runCommand(
126
- "npx",
137
+ npxBin,
127
138
  ["next", "build", "--webpack"],
128
139
  env,
129
140
  runRoot,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nightkatana/kronosys-app",
3
- "version": "1.0.0-beta.7",
3
+ "version": "1.0.0-beta.9",
4
4
  "description": "Kronosys — application Next.js (UI + API + SQLite).",
5
5
  "license": "MIT",
6
6
  "author": "nightkatana",