@appchy/jarvis 0.1.32 → 0.1.33
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/jarvis.mjs +21 -23
- package/dist/bin.js +12 -6
- package/dist/bin.js.map +1 -1
- package/package.json +3 -3
package/bin/jarvis.mjs
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Jarvis CLI Launcher
|
|
4
|
+
* Jarvis CLI — Prod Launcher
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Always runs the bundled `dist/bin.js` (production: hits jarvis.appchy.com).
|
|
7
|
+
* For source-tree development, use `jarvis-dev` instead — it skips the
|
|
8
|
+
* dist/ check and always runs `tsx src/bin.ts` against the live source.
|
|
9
|
+
*
|
|
10
|
+
* The previous version of this launcher auto-detected dev vs prod based on
|
|
11
|
+
* whether `src/bin.ts` existed. That meant invoking `jarvis` from a source
|
|
12
|
+
* checkout silently flipped to dev mode against localhost — not what users
|
|
13
|
+
* who installed `@appchy/jarvis` globally expect. The split bins
|
|
14
|
+
* (`jarvis` / `jarvis-dev`) make the choice explicit and irreversible.
|
|
8
15
|
*/
|
|
9
16
|
|
|
10
17
|
import { fileURLToPath } from "url";
|
|
@@ -12,27 +19,18 @@ import { dirname, join } from "path";
|
|
|
12
19
|
import { existsSync } from "fs";
|
|
13
20
|
|
|
14
21
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
-
const
|
|
16
|
-
const srcEntry = join(root, "src", "bin.ts");
|
|
17
|
-
const distEntry = join(root, "dist", "bin.js");
|
|
22
|
+
const distEntry = join(__dirname, "..", "dist", "bin.js");
|
|
18
23
|
|
|
19
|
-
if (existsSync(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
env: { ...process.env, NODE_NO_WARNINGS: "1" },
|
|
28
|
-
});
|
|
29
|
-
} catch (err) {
|
|
30
|
-
process.exit(err.status ?? 1);
|
|
24
|
+
if (!existsSync(distEntry)) {
|
|
25
|
+
const isSourceCheckout = existsSync(join(__dirname, "..", "src", "bin.ts"));
|
|
26
|
+
console.error("Error: dist/bin.js not found.");
|
|
27
|
+
if (isSourceCheckout) {
|
|
28
|
+
console.error(" This is a source checkout. Use `jarvis-dev` for dev work,");
|
|
29
|
+
console.error(" or run `pnpm -C apps/cli build` to produce a prod bundle.");
|
|
30
|
+
} else {
|
|
31
|
+
console.error(" The package may be corrupted. Reinstall with `pnpm i -g @appchy/jarvis`.");
|
|
31
32
|
}
|
|
32
|
-
} else if (existsSync(distEntry)) {
|
|
33
|
-
// Prod: import bundled JS (no tsx needed)
|
|
34
|
-
await import(distEntry);
|
|
35
|
-
} else {
|
|
36
|
-
console.error("Error: No entry point found. Run `pnpm build` first.");
|
|
37
33
|
process.exit(1);
|
|
38
34
|
}
|
|
35
|
+
|
|
36
|
+
await import(distEntry);
|
package/dist/bin.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'module'; const require = __cr(import.meta.url);
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -29029,13 +29030,18 @@ import { fileURLToPath } from "url";
|
|
|
29029
29030
|
var __filename = fileURLToPath(import.meta.url);
|
|
29030
29031
|
var __dirname = path.dirname(__filename);
|
|
29031
29032
|
function isDev() {
|
|
29032
|
-
|
|
29033
|
-
|
|
29034
|
-
|
|
29035
|
-
|
|
29036
|
-
|
|
29037
|
-
|
|
29033
|
+
const candidates = [
|
|
29034
|
+
path.join(__dirname, "env.json"),
|
|
29035
|
+
path.join(__dirname, "..", "env.json")
|
|
29036
|
+
];
|
|
29037
|
+
for (const envFile of candidates) {
|
|
29038
|
+
try {
|
|
29039
|
+
const data = JSON.parse(fs.readFileSync(envFile, "utf-8"));
|
|
29040
|
+
return data.env === "development";
|
|
29041
|
+
} catch {
|
|
29042
|
+
}
|
|
29038
29043
|
}
|
|
29044
|
+
return false;
|
|
29039
29045
|
}
|
|
29040
29046
|
var PROD_APP_URL = "https://jarvis.appchy.com";
|
|
29041
29047
|
var DEV_APP_URL = "http://localhost:3000";
|