@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.
@@ -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 _process_frontend_resource(res, manifest, full_res_path, resource_path, resource_name, should_enable):
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=False,
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
  ''',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tdk-landscape/tdk-cli-core",
3
- "version": "1.3.145",
3
+ "version": "1.3.146",
4
4
  "description": "TDK CLI — start services on your machine.",
5
5
  "homepage": "https://tdk-landscape.github.io/tdk-website",
6
6
  "repository": {