@jarwizz/create-jarshop 0.1.6 → 0.1.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/README.md CHANGED
@@ -3,9 +3,14 @@
3
3
  Pre-release generator for independent JarShop Client Projects.
4
4
 
5
5
  ```shell
6
- pnpm dlx @jarwizz/create-jarshop@0.1.1 new demo-shop --preset sk-standard
6
+ pnpm dlx @jarwizz/create-jarshop@next new demo-shop --preset sk-standard
7
7
  ```
8
8
 
9
+ The tag rather than a number: releases are published under `next`, so a pinned
10
+ version in this line goes stale the moment the next one ships — and the version
11
+ it pinned was the one whose generator did nothing when its bin was reached
12
+ through a symlink.
13
+
9
14
  The default path performs one frozen install for the complete generated Client
10
15
  Project workspace. `--no-install` is an explicit offline/CI escape hatch. The
11
16
  generator never uses telemetry. In restricted local runners, set
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  export { createProject, parseArgs } from "./generator.js";
3
+ /**
4
+ * Whether this module is the program being run, rather than one being imported.
5
+ *
6
+ * The paths are compared after following symlinks, because the ordinary way to start a
7
+ * project is `pnpm dlx @jarwizz/create-jarshop new shop`, and a package manager runs a
8
+ * package's bin through a link in `node_modules/.bin`. Node then reports that link as
9
+ * `process.argv[1]` while `import.meta.url` is the file it points at. Comparing the two as
10
+ * written makes the generator decide it is merely being imported: it exits zero, prints
11
+ * nothing, and creates no project.
12
+ *
13
+ * A path that cannot be resolved is not the entrypoint. Nothing is run from a file that
14
+ * does not exist, and refusing beats throwing out of a module's top level.
15
+ */
16
+ export declare function isCliEntrypoint(scriptPath: string | undefined, moduleUrl: string): boolean;
package/dist/cli.js CHANGED
@@ -1,11 +1,35 @@
1
1
  #!/usr/bin/env node
2
+ import { realpathSync } from "node:fs";
2
3
  import { resolve } from "node:path";
3
4
  import { fileURLToPath } from "node:url";
4
5
  import { createProject } from "./generator.js";
5
6
  export { createProject, parseArgs } from "./generator.js";
6
- const isEntrypoint = process.argv[1] !== undefined &&
7
- resolve(process.argv[1]) === fileURLToPath(import.meta.url);
8
- if (isEntrypoint) {
7
+ /**
8
+ * Whether this module is the program being run, rather than one being imported.
9
+ *
10
+ * The paths are compared after following symlinks, because the ordinary way to start a
11
+ * project is `pnpm dlx @jarwizz/create-jarshop new shop`, and a package manager runs a
12
+ * package's bin through a link in `node_modules/.bin`. Node then reports that link as
13
+ * `process.argv[1]` while `import.meta.url` is the file it points at. Comparing the two as
14
+ * written makes the generator decide it is merely being imported: it exits zero, prints
15
+ * nothing, and creates no project.
16
+ *
17
+ * A path that cannot be resolved is not the entrypoint. Nothing is run from a file that
18
+ * does not exist, and refusing beats throwing out of a module's top level.
19
+ */
20
+ export function isCliEntrypoint(scriptPath, moduleUrl) {
21
+ if (scriptPath === undefined) {
22
+ return false;
23
+ }
24
+ try {
25
+ return (realpathSync(resolve(scriptPath)) ===
26
+ realpathSync(fileURLToPath(moduleUrl)));
27
+ }
28
+ catch {
29
+ return false;
30
+ }
31
+ }
32
+ if (isCliEntrypoint(process.argv[1], import.meta.url)) {
9
33
  createProject({ argv: process.argv.slice(2), cwd: process.cwd() }).catch((error) => {
10
34
  console.error(error instanceof Error ? error.message : error);
11
35
  process.exitCode = 1;
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,YAAY,GAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;IAC7B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,aAAa,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I,CAAC,GAAG,CAAC,EAAE,CAAC;IACtD,aAAa,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CACtE,CAAC,KAAc,EAAE,EAAE;QACjB,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -26,7 +26,7 @@ Open the generated applications at:
26
26
 
27
27
  - Storefront SK: <http://localhost:3001/sk>
28
28
  - Storefront EN: <http://localhost:3001/en>
29
- - Vendure Dashboard: <http://localhost:3000/dashboard>
29
+ - JarShop Dashboard: <http://localhost:3000/dashboard>
30
30
  - Health check: <http://localhost:3000/health>
31
31
 
32
32
  Sign in to the local Dashboard with `SUPERADMIN_USERNAME` and