@tdk-landscape/tdk-cli-core 1.3.68 → 1.3.69
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 +3 -0
- package/cli/dist/commands/doctor.js +46 -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,9 @@ Notable changes to the `tdk` CLI. Versions match [npm](https://www.npmjs.com/pac
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
- `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.
|
|
8
|
+
- `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.
|
|
9
|
+
|
|
7
10
|
## 1.3.67 (2026-09-28)
|
|
8
11
|
|
|
9
12
|
- 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,35 @@ 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
|
+
/** The package to tell the user to install for a `types` entry. */
|
|
463
|
+
function neededTypePackage(entry) {
|
|
464
|
+
const candidates = typePackageCandidates(entry);
|
|
465
|
+
// "node" -> @types/node; "vitest/globals" and scoped entries name their own package.
|
|
466
|
+
return entry.includes("/") || entry.startsWith("@")
|
|
467
|
+
? candidates[candidates.length - 1]
|
|
468
|
+
: candidates[0];
|
|
469
|
+
}
|
|
470
|
+
const KNOWN_TYPE_PACKAGE_VERSIONS = {
|
|
471
|
+
"@types/bun": "^1.4.2",
|
|
472
|
+
"@types/node": "^20.0.0",
|
|
473
|
+
};
|
|
450
474
|
export function checkTypeScriptTypeDependencies() {
|
|
451
475
|
const projectRoot = findProjectRoot() ?? process.cwd();
|
|
452
476
|
const resources = discoverResourcesFromRoot(projectRoot);
|
|
453
477
|
const problems = [];
|
|
478
|
+
const missingPackages = new Set();
|
|
454
479
|
for (const resource of resources) {
|
|
455
480
|
const packageJsonPath = join(resource.path, "package.json");
|
|
456
481
|
const dockerTsconfigPath = join(resource.path, ".autogenerated", "tsconfig.docker.autogenerated.json");
|
|
@@ -460,27 +485,41 @@ export function checkTypeScriptTypeDependencies() {
|
|
|
460
485
|
const tsconfig = readJsonFile(dockerTsconfigPath);
|
|
461
486
|
const compilerOptions = tsconfig?.compilerOptions;
|
|
462
487
|
const types = compilerOptions?.types;
|
|
463
|
-
if (!Array.isArray(types)
|
|
488
|
+
if (!Array.isArray(types)) {
|
|
464
489
|
continue;
|
|
465
490
|
}
|
|
466
491
|
const pkg = readJsonFile(packageJsonPath);
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
|
|
492
|
+
const installed = new Set([
|
|
493
|
+
...Object.keys(pkg?.devDependencies ?? {}),
|
|
494
|
+
...Object.keys(pkg?.dependencies ?? {}),
|
|
495
|
+
]);
|
|
496
|
+
const missing = types
|
|
497
|
+
.filter((entry) => typeof entry === "string")
|
|
498
|
+
.filter((entry) => !typePackageCandidates(entry).some((name) => installed.has(name)));
|
|
499
|
+
for (const entry of missing) {
|
|
500
|
+
missingPackages.add(neededTypePackage(entry));
|
|
501
|
+
}
|
|
502
|
+
if (missing.length > 0) {
|
|
503
|
+
const described = missing.map((m) => `"${m}" (needs ${neededTypePackage(m)})`).join(", ");
|
|
504
|
+
problems.push(`${resource.name}: "types" lists ${described}`);
|
|
470
505
|
}
|
|
471
506
|
}
|
|
472
507
|
if (problems.length === 0) {
|
|
473
508
|
return {
|
|
474
509
|
name: "TypeScript Type Dependencies",
|
|
475
510
|
didPass: true,
|
|
476
|
-
message:
|
|
511
|
+
message: 'Every service\'s Docker tsconfig "types" entry has its @types package installed',
|
|
477
512
|
};
|
|
478
513
|
}
|
|
514
|
+
const lines = [...missingPackages].map((name) => {
|
|
515
|
+
const version = KNOWN_TYPE_PACKAGE_VERSIONS[name];
|
|
516
|
+
return version ? `"${name}": "${version}"` : `${name} (bun add -d ${name})`;
|
|
517
|
+
});
|
|
479
518
|
return {
|
|
480
519
|
name: "TypeScript Type Dependencies",
|
|
481
520
|
didPass: false,
|
|
482
|
-
message: `
|
|
483
|
-
fix:
|
|
521
|
+
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 ")}`,
|
|
522
|
+
fix: `Add to each service's package.json devDependencies: ${lines.join(", ")}`,
|
|
484
523
|
};
|
|
485
524
|
}
|
|
486
525
|
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.69",
|
|
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": {
|