rig-create 1.2.1 → 1.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-create",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "description": "Create a rig project: its folder, decision record, repository and pinned rig-c packages",
6
6
  "license": "MIT",
@@ -46,8 +46,13 @@ export class PartsUnreadable extends Error {
46
46
  }
47
47
  }
48
48
 
49
- /** The create repository's own install, used when a project has none (running the check in this repo, or before `bun install` in a project). */
50
- export const OWN_NODE_MODULES = join(import.meta.dir, '..', 'node_modules');
49
+ const load = createRequire(import.meta.url);
50
+
51
+ /** Create's runtime-resolved dependency install, used when a project has none (running the check in this repo, or before `bun install` in a project). */
52
+ const checkoutNodeModules = join(import.meta.dir, '..', 'node_modules');
53
+ export const OWN_NODE_MODULES = existsSync(join(checkoutNodeModules, PARTS_PACKAGE, 'package.json'))
54
+ ? checkoutNodeModules
55
+ : dirname(dirname(dirname(load.resolve(`${PARTS_PACKAGE}/package.json`))));
51
56
 
52
57
  /**
53
58
  * Where the installed package is looked for, in order: the project's own
@@ -67,8 +72,6 @@ export function locateParts(projectDir: string): string | null {
67
72
  return null;
68
73
  }
69
74
 
70
- const load = createRequire(import.meta.url);
71
-
72
75
  function isSections(v: unknown): v is Sections {
73
76
  return Array.isArray(v) && v.length > 0 && v.every((s) => typeof s === 'string');
74
77
  }