@hublo/sentinel 1.4.0-alpha.7 → 1.4.0-alpha.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.
@@ -16,7 +16,7 @@ import {
16
16
  registerAdapters,
17
17
  resolve,
18
18
  resolveBin
19
- } from "../chunk-KDKOKRS2.js";
19
+ } from "../chunk-QP37G2HO.js";
20
20
  import {
21
21
  WORKSPACE_ROOT_MARKER,
22
22
  ensureWorkspacePrep,
@@ -5481,7 +5481,7 @@ function testTarget(options) {
5481
5481
  }
5482
5482
 
5483
5483
  // src/roles/test/jest-migration.ts
5484
- import { existsSync as existsSync29, readFileSync as readFileSync28 } from "fs";
5484
+ import { existsSync as existsSync29, readFileSync as readFileSync28, readdirSync as readdirSync8 } from "fs";
5485
5485
  import { join as join35 } from "path";
5486
5486
 
5487
5487
  // src/roles/test/codemod/migrate-module.ts
@@ -8188,31 +8188,56 @@ function specTypesOperation(cwd) {
8188
8188
  return void 0;
8189
8189
  }
8190
8190
  const types = config?.compilerOptions?.types;
8191
- const include = config?.include;
8192
- const rewrittenInclude = Array.isArray(include) ? rewriteSpecInclude(include) : void 0;
8193
- const typesChanged = Array.isArray(types) && types.includes("jest");
8194
- if (!typesChanged && rewrittenInclude === void 0) return void 0;
8191
+ if (!Array.isArray(types) || !types.includes("jest")) return void 0;
8195
8192
  return {
8196
8193
  kind: "merge-json",
8197
8194
  path: SPEC_TSCONFIG,
8198
8195
  value: {
8199
- ...typesChanged ? {
8200
- compilerOptions: {
8201
- types: types.map(
8202
- (entry) => entry === "jest" ? VITEST_GLOBAL_TYPES : entry
8203
- )
8204
- }
8205
- } : {},
8206
- ...rewrittenInclude === void 0 ? {} : { include: rewrittenInclude }
8196
+ compilerOptions: {
8197
+ types: types.map((entry) => entry === "jest" ? VITEST_GLOBAL_TYPES : entry)
8198
+ }
8207
8199
  }
8208
8200
  };
8209
8201
  }
8210
- function rewriteSpecInclude(include) {
8211
- const rewritten = include.filter((entry) => typeof entry !== "string" || !JEST_CONFIG_ENTRY.test(entry)).map((entry) => typeof entry === "string" ? vitestSupportName(entry) : entry);
8212
- const unchanged = rewritten.length === include.length && rewritten.every((entry, index) => entry === include[index]);
8202
+ function tsconfigFileListOperations(cwd) {
8203
+ const operations = [];
8204
+ let names;
8205
+ try {
8206
+ names = readdirSync8(cwd).filter((name) => TSCONFIG_FILE.test(name));
8207
+ } catch {
8208
+ return operations;
8209
+ }
8210
+ for (const name of names) {
8211
+ let config;
8212
+ try {
8213
+ config = parseJsonc(
8214
+ readFileSync28(join35(cwd, name), "utf8"),
8215
+ name
8216
+ );
8217
+ } catch {
8218
+ continue;
8219
+ }
8220
+ const include = Array.isArray(config?.include) ? rewriteFileList(config.include) : void 0;
8221
+ const exclude = Array.isArray(config?.exclude) ? rewriteFileList(config.exclude) : void 0;
8222
+ if (include === void 0 && exclude === void 0) continue;
8223
+ operations.push({
8224
+ kind: "merge-json",
8225
+ path: name,
8226
+ value: {
8227
+ ...include === void 0 ? {} : { include },
8228
+ ...exclude === void 0 ? {} : { exclude }
8229
+ }
8230
+ });
8231
+ }
8232
+ return operations;
8233
+ }
8234
+ function rewriteFileList(entries) {
8235
+ const rewritten = entries.filter((entry) => typeof entry !== "string" || !JEST_CONFIG_ENTRY.test(entry)).map((entry) => typeof entry === "string" ? vitestSupportName(entry) : entry);
8236
+ const unchanged = rewritten.length === entries.length && rewritten.every((entry, index) => entry === entries[index]);
8213
8237
  return unchanged ? void 0 : rewritten;
8214
8238
  }
8215
8239
  var JEST_CONFIG_ENTRY = /(^|\/)jest\.[\w.-]*config\.[cm]?[jt]s$/;
8240
+ var TSCONFIG_FILE = /^tsconfig[\w.-]*\.json$/;
8216
8241
  function siblingScriptRewrites(cwd) {
8217
8242
  const rewrites = {};
8218
8243
  for (const [name, command] of Object.entries(moduleScripts(cwd))) {
@@ -8278,6 +8303,7 @@ function planJestMigration(context, adoption) {
8278
8303
  })),
8279
8304
  ...migration.operations,
8280
8305
  ...specTypes === void 0 ? [] : [specTypes],
8306
+ ...tsconfigFileListOperations(context.cwd),
8281
8307
  manifestOperation(context.cwd, { ...scripts, ...siblings }),
8282
8308
  ...prepared.flatMap(
8283
8309
  ({ mode }) => nxTargetOperations({
@@ -9800,7 +9826,7 @@ function applyPlan(cwd, plan4) {
9800
9826
  }
9801
9827
 
9802
9828
  // src/core/config/preset-evidence.ts
9803
- import { existsSync as existsSync33, readdirSync as readdirSync8, readFileSync as readFileSync34 } from "fs";
9829
+ import { existsSync as existsSync33, readdirSync as readdirSync9, readFileSync as readFileSync34 } from "fs";
9804
9830
  import { join as join40 } from "path";
9805
9831
  var PATH_SIGNALS = [
9806
9832
  {
@@ -9829,7 +9855,7 @@ function sourceImports(cwd, pattern) {
9829
9855
  const dir = stack.pop();
9830
9856
  let entries;
9831
9857
  try {
9832
- entries = readdirSync8(dir, { withFileTypes: true });
9858
+ entries = readdirSync9(dir, { withFileTypes: true });
9833
9859
  } catch {
9834
9860
  continue;
9835
9861
  }
@@ -9867,7 +9893,7 @@ function dependencyNames(cwd) {
9867
9893
  function declaresJsx(cwd) {
9868
9894
  let entries;
9869
9895
  try {
9870
- entries = readdirSync8(cwd).filter(
9896
+ entries = readdirSync9(cwd).filter(
9871
9897
  (name) => name.startsWith("tsconfig") && name.endsWith(".json")
9872
9898
  );
9873
9899
  } catch {
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  registerAdapters,
8
8
  resolve,
9
9
  setDefaultRunner
10
- } from "./chunk-KDKOKRS2.js";
10
+ } from "./chunk-QP37G2HO.js";
11
11
  import "./chunk-WLFE5RUU.js";
12
12
  export {
13
13
  BaseAdapter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.4.0-alpha.7",
3
+ "version": "1.4.0-alpha.8",
4
4
  "description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
5
5
  "type": "module",
6
6
  "license": "MIT",