@tdk-landscape/tdk-cli-core 1.3.68 → 1.3.70
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/CHANGELOG.md +9 -0
- package/cli/dist/commands/doctor.js +67 -7
- package/cli/dist/commands/resource.js +3 -0
- package/cli/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ Notable changes to the `tdk` CLI. Versions match [npm](https://www.npmjs.com/pac
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
- **Fix for 1.3.69:** `tdk doctor` no longer reports "Environment not ready" for the ERP example. The new check for missing `@types/*` packages flagged its 7 frontends, but they build with `vite build`, which never type-checks, so `types: ["node"]` cannot fail their build. It now only flags a service whose `build` script runs `tsc` (following `bun|npm|pnpm|yarn run` hops). Found by the new ERP CI workflow on its first run.
|
|
8
|
+
|
|
9
|
+
- New CI workflow that boots the public 100-service ERP example on a clean GitHub-hosted runner with the published CLI and waits for every backend to answer `/health` through Traefik, then writes the time to healthy and the resource use to the job summary. Manual (`full` or `one-stack`) and weekly.
|
|
10
|
+
|
|
11
|
+
## 1.3.69 (2026-09-28)
|
|
12
|
+
|
|
13
|
+
- `tdk resource --type backend` adds `@types/node` to the new service. The Docker build uses a tsconfig with `"types": ["node"]`, so without it the image failed at `bun run build` with `TS2688: Cannot find type definition file for 'node'`. This was the next blocker on a clean machine, after the base-image race and the default Prisma feature.
|
|
14
|
+
- `tdk doctor` now checks **every** entry in the Docker tsconfig's `types` list against the service's dependencies. It only looked at `"bun"`, so a missing `@types/node` passed. It names the service, the entry and the package to add, and handles subpath (`vitest/globals`) and scoped entries.
|
|
15
|
+
|
|
7
16
|
## 1.3.67 (2026-09-28)
|
|
8
17
|
|
|
9
18
|
- The clean-machine quickstart run (`tdk project`, `tdk resource`, `tdk up`, wait for `/health`) now starts by itself after every successful release and tests exactly the version just published. It also still runs nightly and on demand.
|
|
@@ -447,10 +447,52 @@ function checkStartupScripts() {
|
|
|
447
447
|
* -- and the failure only surfaces later as `tsc: TS2688: Cannot find type
|
|
448
448
|
* definition file for 'bun'` inside `bun run build`, mid Docker image build.
|
|
449
449
|
*/
|
|
450
|
+
/**
|
|
451
|
+
* Package names that can satisfy a `compilerOptions.types` entry. TypeScript
|
|
452
|
+
* resolves `"node"` from `@types/node` or from a package named `node`, and
|
|
453
|
+
* `"vitest/globals"` from `vitest`; scoped entries name their own package.
|
|
454
|
+
*/
|
|
455
|
+
function typePackageCandidates(entry) {
|
|
456
|
+
if (entry.startsWith("@")) {
|
|
457
|
+
return [entry.split("/").slice(0, 2).join("/")];
|
|
458
|
+
}
|
|
459
|
+
const base = entry.split("/")[0] ?? entry;
|
|
460
|
+
return [`@types/${base}`, base];
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* True when running the script `name` invokes `tsc`, following `bun|npm|pnpm|yarn run <other>`
|
|
464
|
+
* hops. TS2688 ("Cannot find type definition file") is raised by `tsc`; a `vite build` or
|
|
465
|
+
* `bun build` transpiles TypeScript without type-checking and never reads `"types"`.
|
|
466
|
+
*/
|
|
467
|
+
function scriptRunsTsc(scripts, name, depth = 0) {
|
|
468
|
+
const body = scripts[name];
|
|
469
|
+
if (typeof body !== "string" || depth > 3)
|
|
470
|
+
return false;
|
|
471
|
+
if (/(^|[\s;&|(])tsc(\s|$)/.test(body))
|
|
472
|
+
return true;
|
|
473
|
+
for (const hop of body.matchAll(/\b(?:bun|npm|pnpm|yarn)\s+run\s+([\w:.-]+)/g)) {
|
|
474
|
+
if (scriptRunsTsc(scripts, hop[1], depth + 1))
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
/** The package to tell the user to install for a `types` entry. */
|
|
480
|
+
function neededTypePackage(entry) {
|
|
481
|
+
const candidates = typePackageCandidates(entry);
|
|
482
|
+
// "node" -> @types/node; "vitest/globals" and scoped entries name their own package.
|
|
483
|
+
return entry.includes("/") || entry.startsWith("@")
|
|
484
|
+
? candidates[candidates.length - 1]
|
|
485
|
+
: candidates[0];
|
|
486
|
+
}
|
|
487
|
+
const KNOWN_TYPE_PACKAGE_VERSIONS = {
|
|
488
|
+
"@types/bun": "^1.4.2",
|
|
489
|
+
"@types/node": "^20.0.0",
|
|
490
|
+
};
|
|
450
491
|
export function checkTypeScriptTypeDependencies() {
|
|
451
492
|
const projectRoot = findProjectRoot() ?? process.cwd();
|
|
452
493
|
const resources = discoverResourcesFromRoot(projectRoot);
|
|
453
494
|
const problems = [];
|
|
495
|
+
const missingPackages = new Set();
|
|
454
496
|
for (const resource of resources) {
|
|
455
497
|
const packageJsonPath = join(resource.path, "package.json");
|
|
456
498
|
const dockerTsconfigPath = join(resource.path, ".autogenerated", "tsconfig.docker.autogenerated.json");
|
|
@@ -460,27 +502,45 @@ export function checkTypeScriptTypeDependencies() {
|
|
|
460
502
|
const tsconfig = readJsonFile(dockerTsconfigPath);
|
|
461
503
|
const compilerOptions = tsconfig?.compilerOptions;
|
|
462
504
|
const types = compilerOptions?.types;
|
|
463
|
-
if (!Array.isArray(types)
|
|
505
|
+
if (!Array.isArray(types)) {
|
|
464
506
|
continue;
|
|
465
507
|
}
|
|
466
508
|
const pkg = readJsonFile(packageJsonPath);
|
|
467
|
-
const
|
|
468
|
-
if (!
|
|
469
|
-
|
|
509
|
+
const scripts = pkg?.scripts ?? {};
|
|
510
|
+
if (!scriptRunsTsc(scripts, "build")) {
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
const installed = new Set([
|
|
514
|
+
...Object.keys(pkg?.devDependencies ?? {}),
|
|
515
|
+
...Object.keys(pkg?.dependencies ?? {}),
|
|
516
|
+
]);
|
|
517
|
+
const missing = types
|
|
518
|
+
.filter((entry) => typeof entry === "string")
|
|
519
|
+
.filter((entry) => !typePackageCandidates(entry).some((name) => installed.has(name)));
|
|
520
|
+
for (const entry of missing) {
|
|
521
|
+
missingPackages.add(neededTypePackage(entry));
|
|
522
|
+
}
|
|
523
|
+
if (missing.length > 0) {
|
|
524
|
+
const described = missing.map((m) => `"${m}" (needs ${neededTypePackage(m)})`).join(", ");
|
|
525
|
+
problems.push(`${resource.name}: "types" lists ${described}`);
|
|
470
526
|
}
|
|
471
527
|
}
|
|
472
528
|
if (problems.length === 0) {
|
|
473
529
|
return {
|
|
474
530
|
name: "TypeScript Type Dependencies",
|
|
475
531
|
didPass: true,
|
|
476
|
-
message:
|
|
532
|
+
message: 'Every service\'s Docker tsconfig "types" entry has its @types package installed',
|
|
477
533
|
};
|
|
478
534
|
}
|
|
535
|
+
const lines = [...missingPackages].map((name) => {
|
|
536
|
+
const version = KNOWN_TYPE_PACKAGE_VERSIONS[name];
|
|
537
|
+
return version ? `"${name}": "${version}"` : `${name} (bun add -d ${name})`;
|
|
538
|
+
});
|
|
479
539
|
return {
|
|
480
540
|
name: "TypeScript Type Dependencies",
|
|
481
541
|
didPass: false,
|
|
482
|
-
message: `
|
|
483
|
-
fix:
|
|
542
|
+
message: `Docker tsconfig "types" names packages the service does not depend on, so \`bun run build\` fails with TS2688 (Cannot find type definition file):\n ${problems.join("\n ")}`,
|
|
543
|
+
fix: `Add to each service's package.json devDependencies: ${lines.join(", ")}`,
|
|
484
544
|
};
|
|
485
545
|
}
|
|
486
546
|
function readJsonFile(path) {
|
|
@@ -84,6 +84,9 @@ export function createPackageJson(name, type) {
|
|
|
84
84
|
},
|
|
85
85
|
devDependencies: {
|
|
86
86
|
"@types/bun": "^1.4.2",
|
|
87
|
+
// The generated Docker tsconfig sets "types": ["node"]; without this the
|
|
88
|
+
// image's `bun run build` fails with TS2688. ^20 matches the services that build.
|
|
89
|
+
"@types/node": "^20.0.0",
|
|
87
90
|
typescript: "^7.0.2",
|
|
88
91
|
vitest: "^5.0.0",
|
|
89
92
|
"@biomejs/biome": "^2.5.13",
|
package/cli/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tdk-landscape/tdk-cli-core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.70",
|
|
4
4
|
"description": "Run 100 microservices on a 16 GB laptop without Kubernetes. Scaffold services and run them locally with hot reload, built on Tilt.",
|
|
5
5
|
"homepage": "https://tdk-landscape.github.io/tdk-website",
|
|
6
6
|
"repository": {
|