@bensandee/tooling 0.27.0 → 0.27.1

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.
Files changed (2) hide show
  1. package/dist/bin.mjs +85 -35
  2. package/package.json +1 -1
package/dist/bin.mjs CHANGED
@@ -664,6 +664,10 @@ function ensureSchemaComment(content, ci) {
664
664
  if (content.includes("yaml-language-server")) return content;
665
665
  return FORGEJO_SCHEMA_COMMENT + content;
666
666
  }
667
+ /** Migrate content from old tooling binary name to new. */
668
+ function migrateToolingBinary(content) {
669
+ return content.replaceAll("pnpm exec tooling ", "pnpm exec bst ");
670
+ }
667
671
  /** Check if a YAML file has an opt-out comment in the first 10 lines. */
668
672
  function isToolingIgnored(content) {
669
673
  return content.split("\n", 10).some((line) => line.includes(IGNORE_PATTERN));
@@ -898,22 +902,33 @@ async function generateDeployCi(ctx) {
898
902
  const nodeVersionYaml = hasEnginesNode$2(ctx) ? "node-version-file: package.json" : "node-version: \"24\"";
899
903
  const content = deployWorkflow(ctx.config.ci, nodeVersionYaml);
900
904
  if (ctx.exists(workflowPath)) {
901
- const existing = ctx.read(workflowPath);
902
- if (existing) {
903
- if (existing === content || ensureSchemaComment(existing, ctx.config.ci) === content) return {
904
- filePath: workflowPath,
905
- action: "skipped",
906
- description: "Deploy workflow already up to date"
907
- };
905
+ const raw = ctx.read(workflowPath);
906
+ if (raw) {
907
+ const existing = migrateToolingBinary(raw);
908
+ if (existing === content || ensureSchemaComment(existing, ctx.config.ci) === content) {
909
+ if (existing !== raw) {
910
+ ctx.write(workflowPath, ensureSchemaComment(existing, ctx.config.ci));
911
+ return {
912
+ filePath: workflowPath,
913
+ action: "updated",
914
+ description: "Migrated tooling binary name in deploy workflow"
915
+ };
916
+ }
917
+ return {
918
+ filePath: workflowPath,
919
+ action: "skipped",
920
+ description: "Deploy workflow already up to date"
921
+ };
922
+ }
908
923
  const merged = mergeWorkflowSteps(existing, "deploy", requiredDeploySteps());
909
924
  const withComment = ensureSchemaComment(merged.content, ctx.config.ci);
910
925
  if (!merged.changed) {
911
- if (withComment !== existing) {
926
+ if (withComment !== raw) {
912
927
  ctx.write(workflowPath, withComment);
913
928
  return {
914
929
  filePath: workflowPath,
915
930
  action: "updated",
916
- description: "Added schema comment to deploy workflow"
931
+ description: existing !== raw ? "Migrated tooling binary name in deploy workflow" : "Added schema comment to deploy workflow"
917
932
  };
918
933
  }
919
934
  return {
@@ -969,13 +984,21 @@ const STANDARD_SCRIPTS_MONOREPO = {
969
984
  };
970
985
  /** Scripts that tooling owns — map from script name to keyword that must appear in the value. */
971
986
  const MANAGED_SCRIPTS = {
972
- check: "checks:run",
987
+ check: "bst checks:run",
973
988
  "ci:check": "pnpm check",
974
- "tooling:check": "repo:sync --check",
975
- "tooling:sync": "repo:sync",
976
- "docker:build": "docker:build",
977
- "docker:check": "docker:check"
989
+ "tooling:check": "bst repo:sync --check",
990
+ "tooling:sync": "bst repo:sync",
991
+ "trigger-release": "bst release:trigger",
992
+ "docker:build": "bst docker:build",
993
+ "docker:check": "bst docker:check"
978
994
  };
995
+ /** Check if an existing script value satisfies a managed script requirement.
996
+ * Accepts both `bst <cmd>` and `bin.mjs <cmd>` (used in the tooling repo itself). */
997
+ function matchesManagedScript(scriptValue, expectedFragment) {
998
+ if (scriptValue.includes(expectedFragment)) return true;
999
+ const binMjsFragment = expectedFragment.replace(/^bst /, "bin.mjs ");
1000
+ return scriptValue.includes(binMjsFragment);
1001
+ }
979
1002
  /** Deprecated scripts to remove during migration. */
980
1003
  const DEPRECATED_SCRIPTS = ["tooling:init", "tooling:update"];
981
1004
  /** DevDeps that belong in every project (single repo) or per-package (monorepo). */
@@ -1031,7 +1054,7 @@ function getAddedDevDepNames(config) {
1031
1054
  const deps = { ...ROOT_DEV_DEPS };
1032
1055
  if (config.structure !== "monorepo") Object.assign(deps, PER_PACKAGE_DEV_DEPS);
1033
1056
  deps["@bensandee/config"] = "0.9.1";
1034
- deps["@bensandee/tooling"] = "0.27.0";
1057
+ deps["@bensandee/tooling"] = "0.27.1";
1035
1058
  if (config.formatter === "oxfmt") deps["oxfmt"] = "0.35.0";
1036
1059
  if (config.formatter === "prettier") deps["prettier"] = "3.8.1";
1037
1060
  addReleaseDeps(deps, config);
@@ -1056,7 +1079,7 @@ async function generatePackageJson(ctx) {
1056
1079
  const devDeps = { ...ROOT_DEV_DEPS };
1057
1080
  if (!isMonorepo) Object.assign(devDeps, PER_PACKAGE_DEV_DEPS);
1058
1081
  devDeps["@bensandee/config"] = isWorkspacePackage(ctx, "@bensandee/config") ? "workspace:*" : "0.9.1";
1059
- devDeps["@bensandee/tooling"] = isWorkspacePackage(ctx, "@bensandee/tooling") ? "workspace:*" : "0.27.0";
1082
+ devDeps["@bensandee/tooling"] = isWorkspacePackage(ctx, "@bensandee/tooling") ? "workspace:*" : "0.27.1";
1060
1083
  if (ctx.config.useEslintPlugin) devDeps["@bensandee/eslint-plugin"] = isWorkspacePackage(ctx, "@bensandee/eslint-plugin") ? "workspace:*" : "0.9.2";
1061
1084
  if (ctx.config.formatter === "oxfmt") devDeps["oxfmt"] = "0.35.0";
1062
1085
  if (ctx.config.formatter === "prettier") devDeps["prettier"] = "3.8.1";
@@ -1074,10 +1097,14 @@ async function generatePackageJson(ctx) {
1074
1097
  changes.push("set type: \"module\"");
1075
1098
  }
1076
1099
  const existingScripts = pkg.scripts ?? {};
1100
+ for (const [key, value] of Object.entries(existingScripts)) if (typeof value === "string" && value.includes("pnpm exec tooling ")) {
1101
+ existingScripts[key] = migrateToolingBinary(value);
1102
+ changes.push(`migrated script: ${key}`);
1103
+ }
1077
1104
  for (const [key, value] of Object.entries(allScripts)) if (!(key in existingScripts)) {
1078
1105
  existingScripts[key] = value;
1079
1106
  changes.push(`added script: ${key}`);
1080
- } else if (key in MANAGED_SCRIPTS && !existingScripts[key]?.includes(MANAGED_SCRIPTS[key])) {
1107
+ } else if (key in MANAGED_SCRIPTS && !matchesManagedScript(existingScripts[key] ?? "", MANAGED_SCRIPTS[key] ?? "")) {
1081
1108
  existingScripts[key] = value;
1082
1109
  changes.push(`updated script: ${key}`);
1083
1110
  }
@@ -2299,18 +2326,30 @@ function buildWorkflow(strategy, ci, nodeVersionYaml, publishesNpm) {
2299
2326
  }
2300
2327
  function generateChangesetsReleaseCi(ctx, publishesNpm) {
2301
2328
  const ciPath = ciWorkflowPath(ctx.config.ci, ctx.config.releaseStrategy);
2302
- const existing = ctx.read(ciPath);
2303
- if (!existing) return {
2329
+ const raw = ctx.read(ciPath);
2330
+ if (!raw) return {
2304
2331
  filePath: ciPath,
2305
2332
  action: "skipped",
2306
2333
  description: "CI workflow not found — run check generator first"
2307
2334
  };
2335
+ const existing = migrateToolingBinary(raw);
2308
2336
  const merged = mergeWorkflowSteps(existing, "check", [changesetsReleaseStep(ctx.config.ci, publishesNpm)]);
2309
- if (!merged.changed) return {
2310
- filePath: ciPath,
2311
- action: "skipped",
2312
- description: "Release step in CI workflow already up to date"
2313
- };
2337
+ if (!merged.changed) {
2338
+ if (existing !== raw) {
2339
+ const withComment = ensureSchemaComment(existing, ctx.config.ci);
2340
+ ctx.write(ciPath, withComment);
2341
+ return {
2342
+ filePath: ciPath,
2343
+ action: "updated",
2344
+ description: "Migrated tooling binary name in CI workflow"
2345
+ };
2346
+ }
2347
+ return {
2348
+ filePath: ciPath,
2349
+ action: "skipped",
2350
+ description: "Release step in CI workflow already up to date"
2351
+ };
2352
+ }
2314
2353
  const withComment = ensureSchemaComment(merged.content, ctx.config.ci);
2315
2354
  ctx.write(ciPath, withComment);
2316
2355
  return {
@@ -2338,22 +2377,33 @@ async function generateReleaseCi(ctx) {
2338
2377
  description: "Release CI workflow not applicable"
2339
2378
  };
2340
2379
  if (ctx.exists(workflowPath)) {
2341
- const existing = ctx.read(workflowPath);
2342
- if (existing) {
2343
- if (existing === content || ensureSchemaComment(existing, ctx.config.ci) === content) return {
2344
- filePath: workflowPath,
2345
- action: "skipped",
2346
- description: "Release workflow already up to date"
2347
- };
2380
+ const raw = ctx.read(workflowPath);
2381
+ if (raw) {
2382
+ const existing = migrateToolingBinary(raw);
2383
+ if (existing === content || ensureSchemaComment(existing, ctx.config.ci) === content) {
2384
+ if (existing !== raw) {
2385
+ ctx.write(workflowPath, ensureSchemaComment(existing, ctx.config.ci));
2386
+ return {
2387
+ filePath: workflowPath,
2388
+ action: "updated",
2389
+ description: "Migrated tooling binary name in release workflow"
2390
+ };
2391
+ }
2392
+ return {
2393
+ filePath: workflowPath,
2394
+ action: "skipped",
2395
+ description: "Release workflow already up to date"
2396
+ };
2397
+ }
2348
2398
  const merged = mergeWorkflowSteps(existing, "release", requiredReleaseSteps(ctx.config.releaseStrategy, nodeVersionYaml, publishesNpm));
2349
2399
  const withComment = ensureSchemaComment(merged.content, ctx.config.ci);
2350
2400
  if (!merged.changed) {
2351
- if (withComment !== existing) {
2401
+ if (withComment !== raw) {
2352
2402
  ctx.write(workflowPath, withComment);
2353
2403
  return {
2354
2404
  filePath: workflowPath,
2355
2405
  action: "updated",
2356
- description: "Added schema comment to release workflow"
2406
+ description: existing !== raw ? "Migrated tooling binary name in release workflow" : "Added schema comment to release workflow"
2357
2407
  };
2358
2408
  }
2359
2409
  return {
@@ -4754,7 +4804,7 @@ const dockerCheckCommand = defineCommand({
4754
4804
  const main = defineCommand({
4755
4805
  meta: {
4756
4806
  name: "bst",
4757
- version: "0.27.0",
4807
+ version: "0.27.1",
4758
4808
  description: "Bootstrap and maintain standardized TypeScript project tooling"
4759
4809
  },
4760
4810
  subCommands: {
@@ -4770,7 +4820,7 @@ const main = defineCommand({
4770
4820
  "docker:check": dockerCheckCommand
4771
4821
  }
4772
4822
  });
4773
- console.log(`@bensandee/tooling v0.27.0`);
4823
+ console.log(`@bensandee/tooling v0.27.1`);
4774
4824
  async function run() {
4775
4825
  await runMain(main);
4776
4826
  process.exit(process.exitCode ?? 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bensandee/tooling",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "description": "CLI tool to bootstrap and maintain standardized TypeScript project tooling",
5
5
  "bin": {
6
6
  "bst": "./dist/bin.mjs"