@nightkatana/kronosys-app 1.0.0-beta.0 → 1.0.0-beta.2

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 +47 -17
  2. package/package.json +5 -5
package/bin/kronosys.mjs CHANGED
@@ -3,13 +3,14 @@
3
3
  * kronosys CLI — entry point for `npx kronosys <command>`
4
4
  *
5
5
  * Supported commands:
6
- * start next start -p 5555 (production)
7
- * dev next dev --webpack -H kronosys -p 5555
6
+ * start -> next start -p 5555 (production, default; auto-build if needed)
7
+ * dev -> next dev --webpack -H kronosys -p 5555
8
8
  */
9
9
 
10
10
  import { spawn } from "node:child_process";
11
- import { fileURLToPath } from "node:url";
11
+ import { existsSync } from "node:fs";
12
12
  import { dirname, resolve } from "node:path";
13
+ import { fileURLToPath } from "node:url";
13
14
 
14
15
  const __dirname = dirname(fileURLToPath(import.meta.url));
15
16
  const projectRoot = resolve(__dirname, "..");
@@ -27,20 +28,49 @@ if (!commands[command]) {
27
28
  process.exit(1);
28
29
  }
29
30
 
30
- const [bin, ...args] = commands[command];
31
+ function runCommand(bin, args, env) {
32
+ return new Promise((resolvePromise, rejectPromise) => {
33
+ const child = spawn(bin, args, {
34
+ cwd: projectRoot,
35
+ stdio: "inherit",
36
+ shell: false,
37
+ env,
38
+ });
31
39
 
32
- const child = spawn(bin, args, {
33
- cwd: projectRoot,
34
- stdio: "inherit",
35
- shell: false,
36
- env: { ...process.env, NODE_ENV: command === "dev" ? "development" : "production" },
37
- });
40
+ child.on("error", (err) => {
41
+ rejectPromise(err);
42
+ });
38
43
 
39
- child.on("error", (err) => {
40
- console.error(`[kronosys] Failed to start: ${err.message}`);
41
- process.exit(1);
42
- });
44
+ child.on("exit", (code) => {
45
+ resolvePromise(code ?? 0);
46
+ });
47
+ });
48
+ }
49
+
50
+ async function main() {
51
+ const env = {
52
+ ...process.env,
53
+ NODE_ENV: command === "dev" ? "development" : "production",
54
+ };
43
55
 
44
- child.on("exit", (code) => {
45
- process.exit(code ?? 0);
46
- });
56
+ // Production mode requires a Next build. For global installs, build once automatically.
57
+ if (command === "start" && !existsSync(resolve(projectRoot, ".next", "BUILD_ID"))) {
58
+ console.log("[kronosys] No production build found. Running `next build`...");
59
+ const buildCode = await runCommand("npx", ["next", "build", "--webpack"], env);
60
+ if (buildCode !== 0) {
61
+ process.exit(buildCode);
62
+ }
63
+ }
64
+
65
+ const [bin, ...args] = commands[command];
66
+ const code = await runCommand(bin, args, env);
67
+ process.exit(code);
68
+ }
69
+
70
+ try {
71
+ await main();
72
+ } catch (err) {
73
+ const message = err instanceof Error ? err.message : String(err);
74
+ console.error(`[kronosys] Failed to start: ${message}`);
75
+ process.exit(1);
76
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nightkatana/kronosys-app",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Kronosys — application Next.js (UI + API + SQLite).",
5
5
  "license": "MIT",
6
6
  "author": "nightkatana",
@@ -55,6 +55,7 @@
55
55
  "@dnd-kit/core": "^6.3.1",
56
56
  "@dnd-kit/sortable": "^10.0.0",
57
57
  "@dnd-kit/utilities": "^3.2.2",
58
+ "@tailwindcss/postcss": "^4",
58
59
  "better-sqlite3": "^12.9.0",
59
60
  "date-fns": "^4.1.0",
60
61
  "fflate": "^0.8.2",
@@ -63,12 +64,13 @@
63
64
  "next": "16.2.3",
64
65
  "react": "19.2.4",
65
66
  "react-day-picker": "^9.14.0",
66
- "react-dom": "19.2.4"
67
+ "react-dom": "19.2.4",
68
+ "tailwindcss": "^4",
69
+ "typescript": "^5.9.3"
67
70
  },
68
71
  "devDependencies": {
69
72
  "@changesets/cli": "^2.31.0",
70
73
  "@playwright/test": "^1.59.1",
71
- "@tailwindcss/postcss": "^4",
72
74
  "@testing-library/react": "^16.3.0",
73
75
  "@testing-library/user-event": "^14.6.1",
74
76
  "@types/better-sqlite3": "^7.6.13",
@@ -80,8 +82,6 @@
80
82
  "eslint-config-next": "16.2.3",
81
83
  "husky": "^9.1.7",
82
84
  "jsdom": "^26.1.0",
83
- "tailwindcss": "^4",
84
- "typescript": "^5.9.3",
85
85
  "vitest": "^3.2.4"
86
86
  }
87
87
  }