@bensandee/tooling 0.25.2 → 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-
|
|
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.
|
|
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.
|
|
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";
|
|
@@ -3098,9 +3098,7 @@ function logDetectionSummary(ctx) {
|
|
|
3098
3098
|
}
|
|
3099
3099
|
async function runInit(config, options = {}) {
|
|
3100
3100
|
const detected = detectProject(config.targetDir);
|
|
3101
|
-
const s = p.spinner();
|
|
3102
3101
|
const { ctx, archivedFiles } = createContext(config, options.confirmOverwrite ?? (async (relativePath) => {
|
|
3103
|
-
s.stop("Paused");
|
|
3104
3102
|
const result = await p.select({
|
|
3105
3103
|
message: `${relativePath} already exists. What do you want to do?`,
|
|
3106
3104
|
options: [{
|
|
@@ -3111,20 +3109,12 @@ async function runInit(config, options = {}) {
|
|
|
3111
3109
|
label: "Skip"
|
|
3112
3110
|
}]
|
|
3113
3111
|
});
|
|
3114
|
-
s.start("Generating configuration files...");
|
|
3115
3112
|
if (p.isCancel(result)) return "skip";
|
|
3116
3113
|
return result;
|
|
3117
3114
|
}));
|
|
3118
3115
|
if (config.releaseStrategy !== "none" && !ctx.packageJson?.repository) p.log.warn(`package.json is missing a "repository" field — required for release strategy "${config.releaseStrategy}"`);
|
|
3119
3116
|
logDetectionSummary(ctx);
|
|
3120
|
-
|
|
3121
|
-
let results;
|
|
3122
|
-
try {
|
|
3123
|
-
results = await runGenerators(ctx);
|
|
3124
|
-
} catch (error) {
|
|
3125
|
-
s.stop("Generation failed!");
|
|
3126
|
-
throw error;
|
|
3127
|
-
}
|
|
3117
|
+
const results = await runGenerators(ctx);
|
|
3128
3118
|
const alreadyArchived = new Set(results.filter((r) => r.action === "archived").map((r) => r.filePath));
|
|
3129
3119
|
for (const rel of archivedFiles) if (!alreadyArchived.has(rel)) results.push({
|
|
3130
3120
|
filePath: rel,
|
|
@@ -3134,10 +3124,9 @@ async function runInit(config, options = {}) {
|
|
|
3134
3124
|
const created = results.filter((r) => r.action === "created");
|
|
3135
3125
|
const updated = results.filter((r) => r.action === "updated");
|
|
3136
3126
|
if (!(created.length > 0 || updated.length > 0 || archivedFiles.length > 0) && options.noPrompt) {
|
|
3137
|
-
|
|
3127
|
+
p.log.success("Repository is up to date.");
|
|
3138
3128
|
return results;
|
|
3139
3129
|
}
|
|
3140
|
-
s.stop("Done!");
|
|
3141
3130
|
if (results.some((r) => r.action === "archived" && r.filePath.startsWith(".husky/"))) try {
|
|
3142
3131
|
execSync("git config --unset core.hooksPath", {
|
|
3143
3132
|
cwd: config.targetDir,
|
|
@@ -3159,16 +3148,15 @@ async function runInit(config, options = {}) {
|
|
|
3159
3148
|
const bensandeeDeps = getAddedDevDepNames(config).filter((name) => name.startsWith("@bensandee/"));
|
|
3160
3149
|
const hasLockfile = ctx.exists("pnpm-lock.yaml");
|
|
3161
3150
|
if (bensandeeDeps.length > 0 && hasLockfile) {
|
|
3162
|
-
|
|
3151
|
+
p.log.info("Updating @bensandee/* packages...");
|
|
3163
3152
|
try {
|
|
3164
3153
|
execSync(`pnpm update --latest ${bensandeeDeps.join(" ")}`, {
|
|
3165
3154
|
cwd: config.targetDir,
|
|
3166
|
-
stdio: "
|
|
3155
|
+
stdio: "inherit",
|
|
3167
3156
|
timeout: 6e4
|
|
3168
3157
|
});
|
|
3169
|
-
s.stop("Updated @bensandee/* packages");
|
|
3170
3158
|
} catch (_error) {
|
|
3171
|
-
|
|
3159
|
+
p.log.warn("Could not update @bensandee/* packages — run pnpm install manually");
|
|
3172
3160
|
}
|
|
3173
3161
|
}
|
|
3174
3162
|
p.note([
|
|
@@ -4671,7 +4659,7 @@ const dockerCheckCommand = defineCommand({
|
|
|
4671
4659
|
const main = defineCommand({
|
|
4672
4660
|
meta: {
|
|
4673
4661
|
name: "tooling",
|
|
4674
|
-
version: "0.25.
|
|
4662
|
+
version: "0.25.3",
|
|
4675
4663
|
description: "Bootstrap and maintain standardized TypeScript project tooling"
|
|
4676
4664
|
},
|
|
4677
4665
|
subCommands: {
|
|
@@ -4687,7 +4675,7 @@ const main = defineCommand({
|
|
|
4687
4675
|
"docker:check": dockerCheckCommand
|
|
4688
4676
|
}
|
|
4689
4677
|
});
|
|
4690
|
-
console.log(`@bensandee/tooling v0.25.
|
|
4678
|
+
console.log(`@bensandee/tooling v0.25.3`);
|
|
4691
4679
|
async function run() {
|
|
4692
4680
|
await runMain(main);
|
|
4693
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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-
|
|
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 };
|