@inixiative/config 0.5.24 → 0.5.25

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/dist/cli.js CHANGED
@@ -7,8 +7,8 @@ import { join as join2, resolve } from "path";
7
7
 
8
8
  // src/lib.ts
9
9
  import { spawnSync } from "child_process";
10
- import { existsSync, readdirSync, readFileSync, rmSync, writeFileSync } from "fs";
11
- import { dirname, join } from "path";
10
+ import { existsSync, globSync, readdirSync, readFileSync, rmSync, writeFileSync } from "fs";
11
+ import { dirname, join, sep } from "path";
12
12
  import { fileURLToPath } from "url";
13
13
  var packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
14
14
  var REQUIRED_SCRIPTS = {
@@ -166,6 +166,18 @@ var missingRepos = (repos, manifest2) => {
166
166
  (name) => name !== "@inixiative/config" && !found.has(name)
167
167
  );
168
168
  };
169
+ var workspacePackagePaths = (dir2, pkg) => {
170
+ const raw = pkg.workspaces;
171
+ const globs = Array.isArray(raw) ? raw : Array.isArray(raw?.packages) ? raw.packages : [];
172
+ if (globs.length === 0) return [];
173
+ const paths = /* @__PURE__ */ new Set();
174
+ for (const pattern of globs) {
175
+ for (const match of globSync(`${pattern}/package.json`, { cwd: dir2 })) {
176
+ paths.add(match.split(sep).join("/"));
177
+ }
178
+ }
179
+ return [...paths].sort();
180
+ };
169
181
  var detectPreset = (pkg, override) => {
170
182
  if (override) return override;
171
183
  const hasReact = DEP_FIELDS.some((field) => pkg[field]?.react !== void 0);
@@ -177,7 +189,8 @@ function inspect(dir2, manifest2, presetOverride) {
177
189
  if (!existsSync(pkgPath)) {
178
190
  return {
179
191
  findings: [{ level: "error", message: `no package.json in ${dir2}` }],
180
- flush: () => false
192
+ flush: () => false,
193
+ packagePaths: []
181
194
  };
182
195
  }
183
196
  const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
@@ -185,6 +198,15 @@ function inspect(dir2, manifest2, presetOverride) {
185
198
  const touch = () => {
186
199
  pkgDirty = true;
187
200
  };
201
+ const members = workspacePackagePaths(dir2, pkg).map((rel) => {
202
+ const abs = join(dir2, rel);
203
+ return {
204
+ rel,
205
+ abs,
206
+ pkg: JSON.parse(readFileSync(abs, "utf8")),
207
+ dirty: false
208
+ };
209
+ });
188
210
  for (const [name, pin] of Object.entries(manifest2.toolchain)) {
189
211
  let present = false;
190
212
  for (const field of DEP_FIELDS) {
@@ -375,30 +397,42 @@ function inspect(dir2, manifest2, presetOverride) {
375
397
  });
376
398
  }
377
399
  }
378
- for (const [name, blessed] of Object.entries(manifest2.ecosystem)) {
379
- if (name === pkg.name) continue;
380
- for (const field of DEP_FIELDS) {
381
- const deps = pkg[field];
382
- const range = deps?.[name];
383
- if (!range || range.startsWith("file:") || range.startsWith("link:")) continue;
384
- const ok = admits(range, blessed);
385
- if (ok === false) {
386
- findings.push({
387
- level: "error",
388
- kind: "ecosystem-range",
389
- name,
390
- message: `${name} ${field} range ${range} does not admit blessed ${blessed} \u2192 ^${blessed}`,
391
- fix: () => {
392
- deps[name] = `^${blessed}`;
393
- touch();
394
- }
395
- });
400
+ const rangeTargets = [
401
+ { label: "", pkg, mark: touch },
402
+ ...members.map((member) => ({
403
+ label: `${member.rel}: `,
404
+ pkg: member.pkg,
405
+ mark: () => {
406
+ member.dirty = true;
396
407
  }
397
- if (ok === null) {
398
- findings.push({
399
- level: "warn",
400
- message: `${name} range ${range} not understood; verify manually against ${blessed}`
401
- });
408
+ }))
409
+ ];
410
+ for (const [name, blessed] of Object.entries(manifest2.ecosystem)) {
411
+ for (const target of rangeTargets) {
412
+ if (name === target.pkg.name) continue;
413
+ for (const field of DEP_FIELDS) {
414
+ const deps = target.pkg[field];
415
+ const range = deps?.[name];
416
+ if (!range || range.startsWith("file:") || range.startsWith("link:")) continue;
417
+ const ok = admits(range, blessed);
418
+ if (ok === false) {
419
+ findings.push({
420
+ level: "error",
421
+ kind: "ecosystem-range",
422
+ name,
423
+ message: `${target.label}${name} ${field} range ${range} does not admit blessed ${blessed} \u2192 ^${blessed}`,
424
+ fix: () => {
425
+ deps[name] = `^${blessed}`;
426
+ target.mark();
427
+ }
428
+ });
429
+ }
430
+ if (ok === null) {
431
+ findings.push({
432
+ level: "warn",
433
+ message: `${target.label}${name} range ${range} not understood; verify manually against ${blessed}`
434
+ });
435
+ }
402
436
  }
403
437
  }
404
438
  const installed = pkg.dependencies?.[name] ?? pkg.devDependencies?.[name];
@@ -477,11 +511,21 @@ function inspect(dir2, manifest2, presetOverride) {
477
511
  }
478
512
  return {
479
513
  findings,
514
+ packagePaths: ["package.json", ...members.map((member) => member.rel)],
480
515
  flush: () => {
481
- if (!pkgDirty) return false;
482
- writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
516
+ let wrote = false;
517
+ if (pkgDirty) {
518
+ writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
519
+ `);
520
+ wrote = true;
521
+ }
522
+ for (const member of members) {
523
+ if (!member.dirty) continue;
524
+ writeFileSync(member.abs, `${JSON.stringify(member.pkg, null, 2)}
483
525
  `);
484
- return true;
526
+ wrote = true;
527
+ }
528
+ return wrote;
485
529
  }
486
530
  };
487
531
  }
@@ -696,12 +740,13 @@ if (command === "train") {
696
740
  process.exit(1);
697
741
  }
698
742
  }
699
- const mutated = spawnSync2("git", ["status", "--porcelain", "package.json", "bun.lock"], {
743
+ const tracked = [...inspection.packagePaths, "bun.lock"];
744
+ const mutated = spawnSync2("git", ["status", "--porcelain", "--", ...tracked], {
700
745
  cwd: repo.dir,
701
746
  encoding: "utf8"
702
747
  });
703
748
  if (mutated.status === 0 && mutated.stdout.trim().length > 0) {
704
- spawnSync2("git", ["add", "package.json", "bun.lock"], { cwd: repo.dir });
749
+ spawnSync2("git", ["add", "--", ...tracked], { cwd: repo.dir });
705
750
  const commit = spawnSync2(
706
751
  "git",
707
752
  ["commit", "-m", "chore: sync ecosystem deps to blessed set"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inixiative/config",
3
- "version": "0.5.24",
3
+ "version": "0.5.25",
4
4
  "description": "Shared toolchain for the inixiative ecosystem: tsconfig/biome/tsup presets, a version manifest (BOM), and a sync/check CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/versions.json CHANGED
@@ -13,12 +13,13 @@
13
13
  "@types/bun"
14
14
  ],
15
15
  "ecosystem": {
16
- "@inixiative/config": "0.5.24",
16
+ "@inixiative/config": "0.5.25",
17
17
  "@inixiative/json-rules": "2.20.0",
18
18
  "@inixiative/permissions": "0.3.2",
19
19
  "@inixiative/transitions": "0.1.0",
20
20
  "@inixiative/rules-builder": "0.26.1",
21
21
  "@inixiative/prisma-map": "0.2.0",
22
- "@inixiative/atlas": "0.1.1"
22
+ "@inixiative/atlas": "0.1.1",
23
+ "@inixiative/gloss": "0.0.4"
23
24
  }
24
25
  }