itw-python-builder 0.1.32__tar.gz → 0.1.34__tar.gz

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.
Files changed (20) hide show
  1. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/PKG-INFO +1 -1
  2. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder/ssr_tasks.py +49 -16
  3. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder/tasks.py +3 -3
  4. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder.egg-info/PKG-INFO +1 -1
  5. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/pyproject.toml +1 -1
  6. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/LICENSE +0 -0
  7. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/README.md +0 -0
  8. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder/.pylintrc +0 -0
  9. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder/__init__.py +0 -0
  10. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder/cli.py +0 -0
  11. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder/templates/server.sitemap.snippet.ts +0 -0
  12. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder/templates/sitemap.routes.ts +0 -0
  13. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder/utils.py +0 -0
  14. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder/version.py +0 -0
  15. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder.egg-info/SOURCES.txt +0 -0
  16. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder.egg-info/dependency_links.txt +0 -0
  17. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder.egg-info/entry_points.txt +0 -0
  18. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder.egg-info/requires.txt +0 -0
  19. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/itw_python_builder.egg-info/top_level.txt +0 -0
  20. {itw_python_builder-0.1.32 → itw_python_builder-0.1.34}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: itw_python_builder
3
- Version: 0.1.32
3
+ Version: 0.1.34
4
4
  Summary: Standardized Django deployment pipeline with Docker, testing, and SonarQube integration
5
5
  Author-email: IT-Works <contact@it-works.io>
6
6
  License: MIT
@@ -139,33 +139,48 @@ def _maybe_add_ssr_scripts(ctx: Context) -> None:
139
139
  data = json.load(fp)
140
140
  scripts = data.setdefault('scripts', {})
141
141
 
142
- added, preserved, skipped = [], [], []
142
+ # The "ng add" schematic writes `build:ssr` as the implicit form
143
+ # `ng build && ng run <name>:server` (relies on Angular defaults). It works
144
+ # but it's not explicit. We normalize JUST that exact stub to the explicit
145
+ # form; any other existing value (custom prebuild steps, etc.) is preserved.
146
+ ng_add_stub = f'ng build && ng run {project_name}:server'
147
+
148
+ added, normalized, preserved, skipped = [], [], [], []
143
149
  for config_name, script_name in script_map.items():
144
150
  if config_name not in usable_configs:
145
151
  skipped.append((script_name, config_name))
146
152
  continue
147
- if script_name in scripts:
153
+ existing = scripts.get(script_name)
154
+ is_stub = (
155
+ script_name == 'build:ssr'
156
+ and existing is not None
157
+ and ' '.join(existing.split()) == ng_add_stub
158
+ )
159
+ if existing is not None and not is_stub:
148
160
  preserved.append(script_name)
149
161
  continue
150
- scripts[script_name] = cmd_for(config_name)
151
- added.append((script_name, scripts[script_name]))
152
-
153
- if added:
162
+ new_cmd = cmd_for(config_name)
163
+ scripts[script_name] = new_cmd
164
+ if is_stub:
165
+ normalized.append((script_name, new_cmd))
166
+ else:
167
+ added.append((script_name, new_cmd))
168
+
169
+ if added or normalized:
154
170
  with open(pkg_path, 'w', encoding='utf-8') as fp:
155
171
  json.dump(data, fp, indent=2)
156
172
  fp.write('\n')
157
173
 
158
174
  print('[itw] SSR npm scripts:')
159
- if added:
160
- for name, cmd in added:
161
- print(f' + added: {name} → {cmd}')
162
- if preserved:
163
- for name in preserved:
164
- print(f' = preserved: {name} (already in package.json, not overwritten)')
165
- if skipped:
166
- for name, cfg in skipped:
167
- print(f" - skipped: {name} (no '{cfg}' config in angular.json)")
168
- if not (added or preserved):
175
+ for name, cmd in added:
176
+ print(f' + added: {name} → {cmd}')
177
+ for name, cmd in normalized:
178
+ print(f' ~ normalized: {name} → {cmd} (was ng-add\'s implicit form)')
179
+ for name in preserved:
180
+ print(f' = preserved: {name} (already in package.json, not overwritten)')
181
+ for name, cfg in skipped:
182
+ print(f" - skipped: {name} (no '{cfg}' config in angular.json)")
183
+ if not (added or normalized or preserved):
169
184
  print(' (nothing added)')
170
185
 
171
186
 
@@ -244,6 +259,24 @@ def _run_ng_add_ssr(ctx: Context) -> None:
244
259
  print(f'[itw] Running `ng add {package_spec}` (Angular {major}, this may take a minute)...')
245
260
  ctx.run(f'npx ng add {package_spec} {flags}')
246
261
 
262
+ # `ng add` typically rewrites package.json with a caret prefix (e.g. "^18.2.14"),
263
+ # and its internal `npm install` then resolves that range to the LATEST patch
264
+ # (often newer than the installed @angular/core), reintroducing the strict-peer
265
+ # conflict and pulling in @angular/ssr versions that reference symbols not in
266
+ # the installed @angular/platform-browser. Force-pin again post-ng-add and
267
+ # reinstall with --save-exact to lock the exact versions across package.json,
268
+ # package-lock.json, and node_modules.
269
+ if installed_core:
270
+ re_pinned = _pin_ssr_deps_in_package_json(installed_core)
271
+ if re_pinned:
272
+ print(f'[itw] Re-pinned {", ".join(re_pinned)} → {installed_core} (ng add introduced a caret range).')
273
+ print(f'[itw] Locking installed versions to {installed_core} with --save-exact...')
274
+ ctx.run(
275
+ f'npm install --save-exact '
276
+ f'@angular/ssr@{installed_core} '
277
+ f'@angular/platform-server@{installed_core}'
278
+ )
279
+
247
280
 
248
281
  def _install_ngx_seo_helper(ctx: Context) -> None:
249
282
  print('[itw] Installing ngx-seo-helper...')
@@ -52,11 +52,11 @@ def build_frontend(ctx: Context, branch: str, ssr: bool = False) -> None:
52
52
  'Passed --ssr but project is not SSR-scaffolded '
53
53
  '(missing server.ts / tsconfig.server.json). Run `itw ssr-init` first.'
54
54
  )
55
- script = 'build:ssr' if branch == 'master' else 'build:ssr:staging'
55
+ script = 'build-ssr-master' if branch == 'master' else 'build-ssr-staging'
56
56
  ctx.run(f'npm run {script}')
57
57
  return
58
- config = 'production' if branch == 'master' else 'staging'
59
- ctx.run(f'npx ng build --configuration={config}')
58
+ script = 'build-master' if branch == 'master' else 'build-staging'
59
+ ctx.run(f'npm run {script}')
60
60
 
61
61
 
62
62
  def package_dist(ctx: Context) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: itw_python_builder
3
- Version: 0.1.32
3
+ Version: 0.1.34
4
4
  Summary: Standardized Django deployment pipeline with Docker, testing, and SonarQube integration
5
5
  Author-email: IT-Works <contact@it-works.io>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "itw_python_builder"
7
- version = "0.1.32"
7
+ version = "0.1.34"
8
8
  description = "Standardized Django deployment pipeline with Docker, testing, and SonarQube integration"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"