@hublo/sentinel 1.2.0-alpha.31 → 1.2.0-alpha.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.
@@ -22,7 +22,7 @@ import {
22
22
  registerAdapters,
23
23
  resolve,
24
24
  resolveBin
25
- } from "../chunk-PLZ45MWU.js";
25
+ } from "../chunk-DJAN2UTQ.js";
26
26
 
27
27
  // bin/sentinel.ts
28
28
  import { program } from "commander";
@@ -5586,8 +5586,6 @@ function registerLint() {
5586
5586
 
5587
5587
  // src/roles/test/adapters/vitest/vitest.adapter.ts
5588
5588
  import { spawnSync as spawnSync5 } from "child_process";
5589
- import { existsSync as existsSync26 } from "fs";
5590
- import { join as join30 } from "path";
5591
5589
 
5592
5590
  // src/roles/test/presets/toolchain.json
5593
5591
  var toolchain_default2 = {
@@ -5643,13 +5641,15 @@ function rewriteVitestScript(command) {
5643
5641
  });
5644
5642
  }
5645
5643
  function testTarget(options) {
5646
- const { configFiles, outputs } = options;
5644
+ const { configFiles, outputs, dependsOn, configurations } = options;
5647
5645
  const cached = outputs !== void 0 && outputs.length > 0;
5648
5646
  return {
5649
5647
  [TEST_SCRIPT_NAME]: {
5650
5648
  cache: cached,
5651
5649
  inputs: ["default", "^default", ...configFiles.map((name) => `{projectRoot}/${name}`)],
5652
- ...cached ? { outputs: [...outputs] } : {}
5650
+ ...cached ? { outputs: [...outputs] } : {},
5651
+ ...dependsOn !== void 0 && dependsOn.length > 0 ? { dependsOn: [...dependsOn] } : {},
5652
+ ...configurations !== void 0 && Object.keys(configurations).length > 0 ? { configurations: { ...configurations } } : {}
5653
5653
  }
5654
5654
  };
5655
5655
  }
@@ -5803,6 +5803,16 @@ function plan3(context) {
5803
5803
  }
5804
5804
  const existing = projectTargets(context.cwd)?.[TEST_SCRIPT_NAME];
5805
5805
  const outputs = existing?.outputs ?? [];
5806
+ const dependsOn = existing?.dependsOn ?? [];
5807
+ const configurations = existing?.configurations ?? {};
5808
+ if (dependsOn.length > 0) {
5809
+ notes.push(`carried \`dependsOn\` from the replaced target: ${dependsOn.join(", ")}.`);
5810
+ }
5811
+ if (Object.keys(configurations).length > 0) {
5812
+ notes.push(
5813
+ `carried the \`${Object.keys(configurations).join("`, `")}\` configuration(s): CI invokes \`--configuration=ci\`, and a target that no longer offers it fails the caller, not the module.`
5814
+ );
5815
+ }
5806
5816
  if (outputs.length === 0) {
5807
5817
  notes.push(
5808
5818
  `this target declares no \`outputs\`, so it is left UNCACHED. Caching a run that restores nothing is the defect where nx reports a hit and the coverage directory is empty; if this module writes coverage, declare where and the target can cache.`
@@ -5828,7 +5838,7 @@ function plan3(context) {
5828
5838
  operations.push(
5829
5839
  ...nxTargetOperations({
5830
5840
  cwd: context.cwd,
5831
- targets: testTarget({ configFiles: [configFile], outputs })
5841
+ targets: testTarget({ configFiles: [configFile], outputs, dependsOn, configurations })
5832
5842
  })
5833
5843
  );
5834
5844
  const owned = ownedTestDependencies(context.cwd, adoption.ownDeclarations);
@@ -5848,12 +5858,10 @@ function plan3(context) {
5848
5858
 
5849
5859
  // src/roles/test/adapters/vitest/vitest.adapter.ts
5850
5860
  function resolveVitest(cwd) {
5851
- const fromSentinel = join30(
5852
- new URL("../../../../../node_modules/.bin/vitest", import.meta.url).pathname
5853
- );
5854
- if (existsSync26(fromSentinel)) return { bin: fromSentinel, origin: "sentinel" };
5855
- const fromModule = join30(cwd, "node_modules", ".bin", "vitest");
5856
- return existsSync26(fromModule) ? { bin: fromModule, origin: "module" } : { bin: void 0, origin: "module" };
5861
+ const fromSentinel = binFromOwnInstall("vitest", "vitest");
5862
+ if (fromSentinel !== void 0) return { bin: fromSentinel, origin: "sentinel" };
5863
+ const fromModule = resolveBin(cwd, "vitest");
5864
+ return fromModule !== void 0 ? { bin: fromModule, origin: "module" } : { bin: void 0, origin: "module" };
5857
5865
  }
5858
5866
  var VitestAdapter = class extends BaseAdapter {
5859
5867
  target = "test";
@@ -5930,9 +5938,9 @@ function registerTest() {
5930
5938
 
5931
5939
  // src/roles/typescript/adapters/tsc/tsc.adapter.ts
5932
5940
  import { spawnSync as spawnSync6 } from "child_process";
5933
- import { existsSync as existsSync27, readFileSync as readFileSync25 } from "fs";
5941
+ import { existsSync as existsSync26, readFileSync as readFileSync25 } from "fs";
5934
5942
  import { createRequire as createRequire4 } from "module";
5935
- import { join as join32 } from "path";
5943
+ import { join as join31 } from "path";
5936
5944
 
5937
5945
  // src/roles/typescript/presets/nest.json
5938
5946
  var nest_default2 = {
@@ -6114,7 +6122,7 @@ function readTsconfigAdoption(cwd) {
6114
6122
 
6115
6123
  // src/roles/typescript/adapters/tsc/plan.ts
6116
6124
  import { readFileSync as readFileSync24 } from "fs";
6117
- import { join as join31 } from "path";
6125
+ import { join as join30 } from "path";
6118
6126
 
6119
6127
  // src/roles/typescript/typecheck-script.ts
6120
6128
  var SENTINEL_TYPECHECK_COMMAND = "sentinel --run --typescript";
@@ -6207,7 +6215,7 @@ function planAdoption(context) {
6207
6215
  };
6208
6216
  }
6209
6217
  const existing = parseJsonc(
6210
- readFileSync24(join31(context.cwd, target.path), "utf8"),
6218
+ readFileSync24(join30(context.cwd, target.path), "utf8"),
6211
6219
  target.path
6212
6220
  );
6213
6221
  const extendsChain = composeExtends(existing.extends, preset);
@@ -6345,7 +6353,7 @@ var TscAdapter = class _TscAdapter extends BaseAdapter {
6345
6353
  let chain;
6346
6354
  try {
6347
6355
  const parsed = parseJsonc(
6348
- readFileSync25(join32(cwd, target.path), "utf8"),
6356
+ readFileSync25(join31(cwd, target.path), "utf8"),
6349
6357
  target.path
6350
6358
  );
6351
6359
  chain = parsed.extends;
@@ -6358,7 +6366,7 @@ var TscAdapter = class _TscAdapter extends BaseAdapter {
6358
6366
  );
6359
6367
  if (preset === void 0) return void 0;
6360
6368
  try {
6361
- createRequire4(join32(cwd, "noop.js")).resolve(preset);
6369
+ createRequire4(join31(cwd, "noop.js")).resolve(preset);
6362
6370
  return void 0;
6363
6371
  } catch {
6364
6372
  return preset;
@@ -6454,7 +6462,7 @@ var TscAdapter = class _TscAdapter extends BaseAdapter {
6454
6462
  referencedProjects(cwd, config) {
6455
6463
  try {
6456
6464
  const parsed = parseJsonc(
6457
- readFileSync25(join32(cwd, config), "utf8"),
6465
+ readFileSync25(join31(cwd, config), "utf8"),
6458
6466
  config
6459
6467
  );
6460
6468
  const referenced = (parsed.references ?? []).map((reference) => reference.path).filter((path) => typeof path === "string" && path.length > 0);
@@ -6470,7 +6478,7 @@ var TscAdapter = class _TscAdapter extends BaseAdapter {
6470
6478
  * check.
6471
6479
  */
6472
6480
  typecheckTarget(cwd) {
6473
- if (existsSync27(join32(cwd, "tsconfig.json"))) return "tsconfig.json";
6481
+ if (existsSync26(join31(cwd, "tsconfig.json"))) return "tsconfig.json";
6474
6482
  const target = resolveTsconfigTarget(cwd);
6475
6483
  return target.reason === "none" ? null : target.path;
6476
6484
  }
@@ -6675,7 +6683,7 @@ function replaceLines(current, replacements) {
6675
6683
  }
6676
6684
 
6677
6685
  // src/core/apply-plan.ts
6678
- import { existsSync as existsSync28, readFileSync as readFileSync26, renameSync, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "fs";
6686
+ import { existsSync as existsSync27, readFileSync as readFileSync26, renameSync, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "fs";
6679
6687
  import { resolve as resolve4, sep } from "path";
6680
6688
  import { applyEdits, findNodeAtLocation, modify, parseTree } from "jsonc-parser";
6681
6689
 
@@ -6694,7 +6702,7 @@ function resolveWithinRoot(cwd, relativePath) {
6694
6702
  return absolutePath;
6695
6703
  }
6696
6704
  function readIfExists(absolutePath) {
6697
- return existsSync28(absolutePath) ? readFileSync26(absolutePath, "utf8") : void 0;
6705
+ return existsSync27(absolutePath) ? readFileSync26(absolutePath, "utf8") : void 0;
6698
6706
  }
6699
6707
  function* leaves(value, prefix = []) {
6700
6708
  for (const [key, keyValue] of Object.entries(value)) {
@@ -6812,8 +6820,8 @@ function applyPlan(cwd, plan4) {
6812
6820
  }
6813
6821
 
6814
6822
  // src/core/config/preset-evidence.ts
6815
- import { existsSync as existsSync29, readdirSync as readdirSync4, readFileSync as readFileSync27 } from "fs";
6816
- import { join as join33 } from "path";
6823
+ import { existsSync as existsSync28, readdirSync as readdirSync4, readFileSync as readFileSync27 } from "fs";
6824
+ import { join as join32 } from "path";
6817
6825
  var PATH_SIGNALS = [
6818
6826
  {
6819
6827
  preset: "nest",
@@ -6827,8 +6835,8 @@ var DEPENDENCY_SIGNALS = [
6827
6835
  { preset: "nest", pattern: /^@nestjs\// }
6828
6836
  ];
6829
6837
  function dependencyNames(cwd) {
6830
- const path = join33(cwd, "package.json");
6831
- if (!existsSync29(path)) return [];
6838
+ const path = join32(cwd, "package.json");
6839
+ if (!existsSync28(path)) return [];
6832
6840
  try {
6833
6841
  const manifest = parseJsonc(
6834
6842
  readFileSync27(path, "utf8"),
@@ -6854,7 +6862,7 @@ function declaresJsx(cwd) {
6854
6862
  for (const name of entries) {
6855
6863
  try {
6856
6864
  const config = parseJsonc(
6857
- readFileSync27(join33(cwd, name), "utf8"),
6865
+ readFileSync27(join32(cwd, name), "utf8"),
6858
6866
  name
6859
6867
  );
6860
6868
  if (config.compilerOptions?.jsx !== void 0) return true;
@@ -7034,4 +7042,4 @@ export {
7034
7042
  detectFramework,
7035
7043
  dispatch
7036
7044
  };
7037
- //# sourceMappingURL=chunk-PLZ45MWU.js.map
7045
+ //# sourceMappingURL=chunk-DJAN2UTQ.js.map
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  registerAdapters,
8
8
  resolve,
9
9
  setDefaultRunner
10
- } from "./chunk-PLZ45MWU.js";
10
+ } from "./chunk-DJAN2UTQ.js";
11
11
  export {
12
12
  BaseAdapter,
13
13
  all,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.2.0-alpha.31",
3
+ "version": "1.2.0-alpha.33",
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",