@bensandee/tooling 0.25.1 → 0.25.3

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/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { l as createRealExecutor$1, t as runDockerCheck, u as isExecSyncError } from "./check-VAgrEX2D.mjs";
2
+ import { l as createRealExecutor$1, t as runDockerCheck, u as isExecSyncError } from "./check-D41R218h.mjs";
3
3
  import { defineCommand, runMain } from "citty";
4
4
  import * as p from "@clack/prompts";
5
5
  import path from "node:path";
@@ -983,7 +983,7 @@ function getAddedDevDepNames(config) {
983
983
  const deps = { ...ROOT_DEV_DEPS };
984
984
  if (config.structure !== "monorepo") Object.assign(deps, PER_PACKAGE_DEV_DEPS);
985
985
  deps["@bensandee/config"] = "0.9.0";
986
- deps["@bensandee/tooling"] = "0.25.1";
986
+ deps["@bensandee/tooling"] = "0.25.3";
987
987
  if (config.formatter === "oxfmt") deps["oxfmt"] = "0.35.0";
988
988
  if (config.formatter === "prettier") deps["prettier"] = "3.8.1";
989
989
  addReleaseDeps(deps, config);
@@ -1008,7 +1008,7 @@ async function generatePackageJson(ctx) {
1008
1008
  const devDeps = { ...ROOT_DEV_DEPS };
1009
1009
  if (!isMonorepo) Object.assign(devDeps, PER_PACKAGE_DEV_DEPS);
1010
1010
  devDeps["@bensandee/config"] = isWorkspacePackage(ctx, "@bensandee/config") ? "workspace:*" : "0.9.0";
1011
- devDeps["@bensandee/tooling"] = isWorkspacePackage(ctx, "@bensandee/tooling") ? "workspace:*" : "0.25.1";
1011
+ devDeps["@bensandee/tooling"] = isWorkspacePackage(ctx, "@bensandee/tooling") ? "workspace:*" : "0.25.3";
1012
1012
  if (ctx.config.useEslintPlugin) devDeps["@bensandee/eslint-plugin"] = isWorkspacePackage(ctx, "@bensandee/eslint-plugin") ? "workspace:*" : "0.9.2";
1013
1013
  if (ctx.config.formatter === "oxfmt") devDeps["oxfmt"] = "0.35.0";
1014
1014
  if (ctx.config.formatter === "prettier") devDeps["prettier"] = "3.8.1";
@@ -2649,6 +2649,11 @@ function readPackageInfo(executor, packageJsonPath) {
2649
2649
  };
2650
2650
  }
2651
2651
  }
2652
+ /** Strip npm scope from a package name: "@scope/foo" → "foo", "foo" → "foo". */
2653
+ function stripScope(name) {
2654
+ const slashIndex = name.indexOf("/");
2655
+ return name.startsWith("@") && slashIndex !== -1 ? name.slice(slashIndex + 1) : name;
2656
+ }
2652
2657
  /** Convention paths to check for Dockerfiles in a package directory. */
2653
2658
  const CONVENTION_DOCKERFILE_PATHS = ["Dockerfile", "docker/Dockerfile"];
2654
2659
  /**
@@ -2698,7 +2703,7 @@ function detectDockerPackages(executor, cwd, repoName) {
2698
2703
  const { name, version } = readPackageInfo(executor, path.join(cwd, "packages", dir, "package.json"));
2699
2704
  packages.push({
2700
2705
  dir,
2701
- imageName: `${repoName}-${name ?? dir}`,
2706
+ imageName: `${repoName}-${stripScope(name ?? dir)}`,
2702
2707
  version,
2703
2708
  docker
2704
2709
  });
@@ -2709,7 +2714,7 @@ function detectDockerPackages(executor, cwd, repoName) {
2709
2714
  const { name, version } = readPackageInfo(executor, path.join(cwd, "packages", dir, "package.json"));
2710
2715
  packages.push({
2711
2716
  dir,
2712
- imageName: `${repoName}-${name ?? dir}`,
2717
+ imageName: `${repoName}-${stripScope(name ?? dir)}`,
2713
2718
  version,
2714
2719
  docker
2715
2720
  });
@@ -2721,7 +2726,7 @@ function detectDockerPackages(executor, cwd, repoName) {
2721
2726
  const { name, version } = readPackageInfo(executor, path.join(cwd, "package.json"));
2722
2727
  packages.push({
2723
2728
  dir: ".",
2724
- imageName: name ?? repoName,
2729
+ imageName: stripScope(name ?? repoName),
2725
2730
  version,
2726
2731
  docker
2727
2732
  });
@@ -2741,7 +2746,7 @@ function readSinglePackageDocker(executor, cwd, packageDir, repoName) {
2741
2746
  const { name, version } = readPackageInfo(executor, path.join(cwd, "packages", dir, "package.json"));
2742
2747
  return {
2743
2748
  dir,
2744
- imageName: `${repoName}-${name ?? dir}`,
2749
+ imageName: `${repoName}-${stripScope(name ?? dir)}`,
2745
2750
  version,
2746
2751
  docker
2747
2752
  };
@@ -3093,9 +3098,7 @@ function logDetectionSummary(ctx) {
3093
3098
  }
3094
3099
  async function runInit(config, options = {}) {
3095
3100
  const detected = detectProject(config.targetDir);
3096
- const s = p.spinner();
3097
3101
  const { ctx, archivedFiles } = createContext(config, options.confirmOverwrite ?? (async (relativePath) => {
3098
- s.stop("Paused");
3099
3102
  const result = await p.select({
3100
3103
  message: `${relativePath} already exists. What do you want to do?`,
3101
3104
  options: [{
@@ -3106,20 +3109,12 @@ async function runInit(config, options = {}) {
3106
3109
  label: "Skip"
3107
3110
  }]
3108
3111
  });
3109
- s.start("Generating configuration files...");
3110
3112
  if (p.isCancel(result)) return "skip";
3111
3113
  return result;
3112
3114
  }));
3113
3115
  if (config.releaseStrategy !== "none" && !ctx.packageJson?.repository) p.log.warn(`package.json is missing a "repository" field — required for release strategy "${config.releaseStrategy}"`);
3114
3116
  logDetectionSummary(ctx);
3115
- s.start("Generating configuration files...");
3116
- let results;
3117
- try {
3118
- results = await runGenerators(ctx);
3119
- } catch (error) {
3120
- s.stop("Generation failed!");
3121
- throw error;
3122
- }
3117
+ const results = await runGenerators(ctx);
3123
3118
  const alreadyArchived = new Set(results.filter((r) => r.action === "archived").map((r) => r.filePath));
3124
3119
  for (const rel of archivedFiles) if (!alreadyArchived.has(rel)) results.push({
3125
3120
  filePath: rel,
@@ -3129,10 +3124,9 @@ async function runInit(config, options = {}) {
3129
3124
  const created = results.filter((r) => r.action === "created");
3130
3125
  const updated = results.filter((r) => r.action === "updated");
3131
3126
  if (!(created.length > 0 || updated.length > 0 || archivedFiles.length > 0) && options.noPrompt) {
3132
- s.stop("Repository is up to date.");
3127
+ p.log.success("Repository is up to date.");
3133
3128
  return results;
3134
3129
  }
3135
- s.stop("Done!");
3136
3130
  if (results.some((r) => r.action === "archived" && r.filePath.startsWith(".husky/"))) try {
3137
3131
  execSync("git config --unset core.hooksPath", {
3138
3132
  cwd: config.targetDir,
@@ -3154,16 +3148,15 @@ async function runInit(config, options = {}) {
3154
3148
  const bensandeeDeps = getAddedDevDepNames(config).filter((name) => name.startsWith("@bensandee/"));
3155
3149
  const hasLockfile = ctx.exists("pnpm-lock.yaml");
3156
3150
  if (bensandeeDeps.length > 0 && hasLockfile) {
3157
- s.start("Updating @bensandee/* packages...");
3151
+ p.log.info("Updating @bensandee/* packages...");
3158
3152
  try {
3159
3153
  execSync(`pnpm update --latest ${bensandeeDeps.join(" ")}`, {
3160
3154
  cwd: config.targetDir,
3161
- stdio: "ignore",
3155
+ stdio: "inherit",
3162
3156
  timeout: 6e4
3163
3157
  });
3164
- s.stop("Updated @bensandee/* packages");
3165
3158
  } catch (_error) {
3166
- s.stop("Could not update @bensandee/* packages — run pnpm install first");
3159
+ p.log.warn("Could not update @bensandee/* packages — run pnpm install manually");
3167
3160
  }
3168
3161
  }
3169
3162
  p.note([
@@ -4666,7 +4659,7 @@ const dockerCheckCommand = defineCommand({
4666
4659
  const main = defineCommand({
4667
4660
  meta: {
4668
4661
  name: "tooling",
4669
- version: "0.25.1",
4662
+ version: "0.25.3",
4670
4663
  description: "Bootstrap and maintain standardized TypeScript project tooling"
4671
4664
  },
4672
4665
  subCommands: {
@@ -4682,7 +4675,7 @@ const main = defineCommand({
4682
4675
  "docker:check": dockerCheckCommand
4683
4676
  }
4684
4677
  });
4685
- console.log(`@bensandee/tooling v0.25.1`);
4678
+ console.log(`@bensandee/tooling v0.25.3`);
4686
4679
  async function run() {
4687
4680
  await runMain(main);
4688
4681
  process.exit(process.exitCode ?? 0);
@@ -165,16 +165,21 @@ async function runDockerCheck(executor, config) {
165
165
  const healthStatus = new Map(config.healthChecks.map((c) => [c.name, false]));
166
166
  while (executor.now() - startTime < timeoutMs) {
167
167
  const containers = composePs(executor, compose);
168
- for (const service of compose.services) if (getContainerHealth(containers, service) === "unhealthy") {
169
- executor.logError(`Container ${service} is unhealthy`);
170
- composeLogs(executor, compose, service);
171
- cleanup();
172
- return {
173
- success: false,
174
- reason: "unhealthy-container",
175
- message: service,
176
- elapsedMs: executor.now() - startTime
177
- };
168
+ let allContainersHealthy = true;
169
+ for (const service of compose.services) {
170
+ const status = getContainerHealth(containers, service);
171
+ if (status === "unhealthy") {
172
+ executor.logError(`Container ${service} is unhealthy`);
173
+ composeLogs(executor, compose, service);
174
+ cleanup();
175
+ return {
176
+ success: false,
177
+ reason: "unhealthy-container",
178
+ message: service,
179
+ elapsedMs: executor.now() - startTime
180
+ };
181
+ }
182
+ if (status === "starting") allContainersHealthy = false;
178
183
  }
179
184
  for (const check of config.healthChecks) if (!healthStatus.get(check.name)) {
180
185
  if (await checkHttpHealth(executor, check)) {
@@ -182,7 +187,7 @@ async function runDockerCheck(executor, config) {
182
187
  executor.log(`${check.name} is healthy!`);
183
188
  }
184
189
  }
185
- if ([...healthStatus.values()].every(Boolean)) {
190
+ if (allContainersHealthy && [...healthStatus.values()].every(Boolean)) {
186
191
  executor.log("Check successful! All systems operational.");
187
192
  cleanup();
188
193
  return {
@@ -1,2 +1,2 @@
1
- import { a as composeDown, c as composeUp, i as composeCommand, l as createRealExecutor, n as checkHttpHealth, o as composeLogs, r as getContainerHealth, s as composePs, t as runDockerCheck } from "../check-VAgrEX2D.mjs";
1
+ import { a as composeDown, c as composeUp, i as composeCommand, l as createRealExecutor, n as checkHttpHealth, o as composeLogs, r as getContainerHealth, s as composePs, t as runDockerCheck } from "../check-D41R218h.mjs";
2
2
  export { checkHttpHealth, composeCommand, composeDown, composeLogs, composePs, composeUp, createRealExecutor, getContainerHealth, runDockerCheck };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bensandee/tooling",
3
- "version": "0.25.1",
3
+ "version": "0.25.3",
4
4
  "description": "CLI tool to bootstrap and maintain standardized TypeScript project tooling",
5
5
  "bin": {
6
6
  "tooling": "./dist/bin.mjs"