@tdk-landscape/tdk-cli-core 1.3.145 → 1.3.146
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 +1 -0
- package/README.md +2 -2
- package/Tiltfile +2 -0
- package/cli/dist/commands/doctor.js +49 -2
- package/cli/dist/utils/doctor-runtime.js +60 -0
- package/cli/dist/utils/host-port-config.js +11 -2
- package/cli/dist/utils/host-port-plan.js +25 -3
- package/cli/dist/utils/service-urls.js +16 -2
- package/cli/dist/utils/smoke.js +28 -0
- package/cli/dist-bundle/chunk-SWAGCVPQ.js +321 -0
- package/cli/dist-bundle/cli.js +3 -3
- package/cli/dist-bundle/{cold-preflight-F2FM46HK.js → cold-preflight-2ZV2PDU2.js} +1 -1
- package/cli/package.json +1 -1
- package/cli/templates/Tiltfile.hbs +12 -0
- package/engine/Tiltfile +2 -0
- package/engine/assets/scripts/cleanup-tilt-images.sh +2 -2
- package/engine/topologies/platform/docker/build/frontend_build_plan.star +65 -0
- package/engine/topologies/platform/docker/build/golden_image_build.star +104 -48
- package/engine/topologies/platform/docker/layers/l3_builder_layers.star +3 -1
- package/engine/topologies/tilt/resources/build_concurrency.star +56 -0
- package/engine/topologies/tilt/resources/infra-loader.star +4 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +24 -2
- package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +5 -1
- package/engine/topologies/tilt/resources/watchers.star +7 -4
- package/package.json +1 -1
- package/cli/dist-bundle/chunk-47CDYJ5E.js +0 -316
package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star
CHANGED
|
@@ -11,6 +11,7 @@ OUTPUT = struct(AUTOGENERATED_FOLDER = ".autogenerated")
|
|
|
11
11
|
|
|
12
12
|
load("../../common/utils_debug.star", "debug_log")
|
|
13
13
|
load('../../../platform/docker/index.star', 'Docker')
|
|
14
|
+
load('../../../platform/docker/build/frontend_build_plan.star', 'frontend_build_plan')
|
|
14
15
|
load('../../../platform/docker/constants.star', 'PlatformDockerConstants')
|
|
15
16
|
load('../../../tilt/manifest/constants.star', 'BASE_PORT_FRONTEND', 'BASE_PORT_BACKEND')
|
|
16
17
|
load('../../../platform/docker/networking/traefik_static_routes.star', 'generate_static_wake_route', 'normalize_abs_path')
|
|
@@ -575,11 +576,29 @@ def _should_skip_frontend(res, should_enable):
|
|
|
575
576
|
return res.get('frontend', False) and should_enable('backends-only')
|
|
576
577
|
|
|
577
578
|
|
|
578
|
-
def
|
|
579
|
+
def _register_frontend_typecheck(res, service_dir, typecheck_cmd):
|
|
580
|
+
"""Non-blocking `<service>-typecheck` resource: runs the planned tsc command so type errors show in Tilt without gating the image.
|
|
581
|
+
|
|
582
|
+
The command runs on the host, so TypeScript must resolve from the service directory (`bun install`, at the
|
|
583
|
+
service or workspace root). Without it the resource fails with that instruction instead of a bare module error.
|
|
584
|
+
"""
|
|
585
|
+
local_resource(
|
|
586
|
+
name=res['name'] + '-typecheck',
|
|
587
|
+
cmd="cd '" + service_dir + "' && { bunx tsc --version >/dev/null 2>&1 || { echo 'typecheck needs host dependencies: run bun install in " + service_dir + "'; exit 1; }; } && " + typecheck_cmd,
|
|
588
|
+
deps=[service_dir + '/src', service_dir + '/tsconfig.json'],
|
|
589
|
+
labels=['app.' + res['name'], 'typecheck'],
|
|
590
|
+
# tsc --noEmit writes no files, so it can run alongside the image builds.
|
|
591
|
+
allow_parallel=True,
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
def _process_frontend_resource(res, manifest, full_res_path, resource_path, resource_name, should_enable, project_root=''):
|
|
579
596
|
"""Process a frontend resource and return compose entry."""
|
|
580
597
|
target_path = res.get('target_path', manifest.get('target_path', '/usr/share/nginx/html'))
|
|
581
598
|
use_nginx = 'nginx' in target_path or target_path == '/usr/share/nginx/html'
|
|
582
599
|
port = res.get('port', manifest.get('port', BASE_PORT_FRONTEND))
|
|
600
|
+
service_dir = (project_root.rstrip('/') + '/' if project_root else '') + full_res_path
|
|
601
|
+
plan = frontend_build_plan(service_dir + '/package.json')
|
|
583
602
|
Docker.frontend(
|
|
584
603
|
res_path=full_res_path,
|
|
585
604
|
resource_name=res['name'],
|
|
@@ -587,7 +606,10 @@ def _process_frontend_resource(res, manifest, full_res_path, resource_path, reso
|
|
|
587
606
|
target_path=target_path,
|
|
588
607
|
use_nginx=use_nginx,
|
|
589
608
|
use_golden=should_enable('golden-image'),
|
|
609
|
+
build_cmd=plan['build_cmd'],
|
|
590
610
|
)
|
|
611
|
+
if plan['typecheck']:
|
|
612
|
+
_register_frontend_typecheck(res, service_dir, plan['typecheck_cmd'])
|
|
591
613
|
return Docker.frontend_compose(resource_path=resource_path, resource_name=resource_name, res=res, manifest=manifest)
|
|
592
614
|
|
|
593
615
|
|
|
@@ -735,7 +757,7 @@ def register_compose_resources(resource_config, ctx, runtime_flags, manifest_sta
|
|
|
735
757
|
continue
|
|
736
758
|
|
|
737
759
|
if res.get('frontend', False):
|
|
738
|
-
entry = _process_frontend_resource(res, manifest, full_res_path, resource_path, resource_name, should_enable)
|
|
760
|
+
entry = _process_frontend_resource(res, manifest, full_res_path, resource_path, resource_name, should_enable, ctx.get('project_root', ''))
|
|
739
761
|
else:
|
|
740
762
|
entry = _process_backend_resource(res, manifest, full_res_path, resource_path, resource_name, should_enable)
|
|
741
763
|
# A deferStart resource has no container Traefik can discover via
|
|
@@ -32,6 +32,7 @@ load('../../../generators/nginx_conf.star', 'Nginx')
|
|
|
32
32
|
load('../../../generators/api_gateway.star', 'ApiGateway')
|
|
33
33
|
load('../../../generators/tsconfig.star', 'TSConfig')
|
|
34
34
|
load('../../../../platform/docker/index.star', 'Docker')
|
|
35
|
+
load('../../../../platform/docker/build/frontend_build_plan.star', 'frontend_build_plan')
|
|
35
36
|
load('../../../generators/npmrc.star', 'PackageConfig')
|
|
36
37
|
load('../../libs.star', 'Libs')
|
|
37
38
|
load('./env.star', 'EnvGenerators')
|
|
@@ -371,13 +372,16 @@ def _generate_all_configs_for_resource(
|
|
|
371
372
|
target_path = resource_config.get('target_path', '/usr/share/nginx/html')
|
|
372
373
|
use_nginx = 'nginx' in target_path or target_path == '/usr/share/nginx/html'
|
|
373
374
|
port = resource_config.get('port', manifest.get('port', BASE_PORT_FRONTEND))
|
|
375
|
+
root = ctx.get('project_root', '')
|
|
376
|
+
plan = frontend_build_plan((root.rstrip('/') + '/' if root else '') + resource_path + '/package.json')
|
|
374
377
|
dockerfile_content = Docker.frontend(
|
|
375
378
|
res_path=resource_path,
|
|
376
379
|
resource_name=resource_config['name'],
|
|
377
380
|
port=port,
|
|
378
381
|
target_path=target_path,
|
|
379
382
|
use_nginx=use_nginx,
|
|
380
|
-
use_golden=should_enable('golden-image')
|
|
383
|
+
use_golden=should_enable('golden-image'),
|
|
384
|
+
build_cmd=plan['build_cmd'],
|
|
381
385
|
)
|
|
382
386
|
elif provider_owned:
|
|
383
387
|
dockerfile_content = Docker.backend_language(
|
|
@@ -89,14 +89,14 @@ def setup_utility_resources():
|
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
local_resource('prune-images',
|
|
92
|
-
cmd='./.tdk/.tdk-out/ext/assets/scripts/cleanup-tilt-images.sh --keep 0 --force && docker image prune -f',
|
|
92
|
+
cmd='./.tdk/.tdk-out/tdk-cli-ext/engine/assets/scripts/cleanup-tilt-images.sh --keep 0 --force && docker image prune -f',
|
|
93
93
|
resource_deps=[],
|
|
94
94
|
labels=['dev.maintenance'],
|
|
95
95
|
auto_init=False
|
|
96
96
|
)
|
|
97
97
|
|
|
98
98
|
local_resource('memory-optimizer',
|
|
99
|
-
cmd='./.tdk/.tdk-out/ext/assets/scripts/mac-m1-resource-monitor.sh && ./.tdk/.tdk-out/ext/assets/scripts/cleanup-tilt-images.sh --keep 0 --force && docker image prune -f && docker builder prune -af --filter "until=24h"',
|
|
99
|
+
cmd='./.tdk/.tdk-out/tdk-cli-ext/engine/assets/scripts/mac-m1-resource-monitor.sh && ./.tdk/.tdk-out/tdk-cli-ext/engine/assets/scripts/cleanup-tilt-images.sh --keep 0 --force && docker image prune -f && docker builder prune -af --filter "until=24h"',
|
|
100
100
|
resource_deps=[],
|
|
101
101
|
labels=['dev.maintenance', 'mac-m1'],
|
|
102
102
|
auto_init=False
|
|
@@ -121,12 +121,15 @@ def setup_utility_resources():
|
|
|
121
121
|
else
|
|
122
122
|
echo "$(date +%H:%M:%S) ✓ $count dangling images (threshold: 5)"
|
|
123
123
|
fi
|
|
124
|
+
# Tilt tags every build as tilt-<hash>, so superseded builds stay tagged
|
|
125
|
+
# and are never dangling. Keep the newest 2 per service; running images are skipped.
|
|
126
|
+
./.tdk/.tdk-out/tdk-cli-ext/engine/assets/scripts/cleanup-tilt-images.sh --keep 2 --force >/dev/null 2>&1 || true
|
|
124
127
|
sleep 300
|
|
125
128
|
done
|
|
126
129
|
''',
|
|
127
130
|
resource_deps=[],
|
|
128
131
|
labels=['dev.maintenance', 'mac-m1'],
|
|
129
|
-
auto_init=
|
|
132
|
+
auto_init=True,
|
|
130
133
|
)
|
|
131
134
|
|
|
132
135
|
# Continuously reclaim heavyweight migrator images once migration succeeds.
|
|
@@ -134,7 +137,7 @@ def setup_utility_resources():
|
|
|
134
137
|
serve_cmd='''
|
|
135
138
|
echo "🧹 Migrator image cleanup started (every 45s)"
|
|
136
139
|
while true; do
|
|
137
|
-
./.tdk/.tdk-out/ext/assets/scripts/cleanup-completed-migrator-images.sh || true
|
|
140
|
+
./.tdk/.tdk-out/tdk-cli-ext/engine/assets/scripts/cleanup-completed-migrator-images.sh || true
|
|
138
141
|
sleep 45
|
|
139
142
|
done
|
|
140
143
|
''',
|