Skip to content

chore(projen): migrate to projen's native ConstructLibraryCdktn project type - #127

Open
so0k (so0k) wants to merge 1 commit into
Azure:mainfrom
so0k:chore/projen-cdktn-project-type
Open

so0k (so0k) wants to merge 1 commit into
Azure:mainfrom
so0k:chore/projen-cdktn-project-type

Conversation

@so0k

Copy link
Copy Markdown

Summary

projen 0.104 ships a native cdktn.ConstructLibraryCdktn project type. This PR adopts it so .projenrc.ts no longer has to emulate cdktn via cdktf.ConstructLibraryCdktf with a removeDependency("cdktf") hack and a keywords override.

Part of the CDKTF→CDKTN cleanup series (see #124, #125, #126). Still targets cdktn 0.22.0; the cdktn 0.24 bump and pre-built AZAPI provider adoption are a separate draft PR stacked on this one.

Changes

Project type and dependencies

  • cdktn.ConstructLibraryCdktn({ cdktnVersion: "0.22.0", ... }). cdktn and constructs become peer + dev dependencies, the jsii convention. cdktn is removed from runtime dependencies, where the previous projenrc had added it explicitly on top of the peer dependency. Consumers already had to install cdktn themselves because of the peer dependency, so this should be a no-op for them, but worth a reviewer's eye.
  • projen ^0.81.15 → ^0.104.4.
  • constructs minimum 10.4.2 → 10.5.0. projen 0.104 peer-depends on constructs@^10.5.0; 10.5.0 is still inside cdktn@0.22.0's ^10.4.2 range. Side effect: API.md gains the inherited with(mixins) method that constructs 10.5 added to every construct (~3.8k generated lines, no hand edits).
  • minNodeVersion 20.16.0 → 22.19.0. cdktn@0.22.0 already declares engines.node >= 22.19.0, and the cdktn v0.23 upgrade guide announces Node 22 as the upcoming minimum. CI workflows now use Node 22.19.0.
  • packageManager: YARN_CLASSIC set explicitly (projen deprecation warning otherwise).
  • Stale comments about cdktn not publishing to Maven/NuGet updated; publishing stays disabled.

Pinned to preserve current behaviour

  • tsconfigDevFile: "tsconfig.dev.json": newer projen defaults the dev tsconfig to <testdir>/tsconfig.json, which with this repo's testdir: "" produced a broken /tsconfig.json.
  • tsconfig.compilerOptions.module: "commonjs": projen's new jsii default is node16, which rejects the four extension-less dynamic import() calls in azapi-resource.ts. jsii's strict tsconfig ruleset accepts commonjs, which is what jsii generated before projen owned tsconfig.json.
  • The empty eslint lint pattern produced by testdir: "" is dropped; eslint 9 errors on it. This touches projen's private _lintPatterns set, flagged in a comment.

Generated-file churn from the projen upgrade (all under ~~ Generated by projen headers)

  • eslint 8 → 9 (legacy config mode via ESLINT_USE_FLAT_CONFIG=false), typescript-eslint 6 → 8, standard-version → commit-and-tag-version, jest-junit 15 → 17.
  • GitHub Actions pinned to commit SHAs; package-js/package-python jobs now check out the repo and extract the build tarball instead of mv dist .repo; release workflow gains a dry_run input.
  • package-lock.json removed (yarn classic is the package manager; it was already stale).
  • eslint's new curly rule added braces around four single-line throw statements in src/testing/index.ts via --fix.

The existing index-based include-hidden-files overrides in .projenrc.ts were re-checked against the regenerated workflows and still land on the upload/download-artifact steps.

Test plan

Verified locally with npx projen build:

  • jsii compile ✅
  • 59 test suites / 1978 tests ✅
  • eslint ✅ (2 pre-existing import/order warnings)
  • jsii-docgen ✅
  • jsii-pacmak js + python ✅

CI should run the same build.yml; please watch for self-mutation diffs, since that is the main risk of a projen version jump.

🤖 Generated with Claude Code

…ct type

projen 0.104 ships `cdktn.ConstructLibraryCdktn`, so the repo no longer needs
to emulate it with `cdktf.ConstructLibraryCdktf` plus a manual
`removeDependency("cdktf")` and a `keywords` override.

Project type and dependencies
- `.projenrc.ts` now uses `cdktn.ConstructLibraryCdktn({ cdktnVersion: "0.22.0" })`.
  cdktn and constructs become peer + dev dependencies (jsii convention);
  `cdktn` is removed from runtime `dependencies`, where the old projenrc had
  added it explicitly.
- projen ^0.81 -> ^0.104.4.
- constructs minimum 10.4.2 -> 10.5.0 (projen 0.104 peer-depends on
  ^10.5.0; still within cdktn@0.22.0's ^10.4.2 peer range). API.md gains the
  inherited `with(mixins)` method that constructs 10.5 added to every construct.
- minNodeVersion 20.16.0 -> 22.19.0: cdktn@0.22.0 already declares
  `engines.node >= 22.19.0`, and cdktn's v0.23 upgrade guide announces Node 22
  as the upcoming minimum. Workflows now set up Node 22.19.0.

Pinned to preserve current behaviour
- `tsconfigDevFile: "tsconfig.dev.json"`: newer projen defaults the dev
  tsconfig to `<testdir>/tsconfig.json`, which is invalid with `testdir: ""`.
- `tsconfig.compilerOptions.module: "commonjs"`: projen's new jsii default is
  `node16`, which rejects the extension-less dynamic `import()` calls in
  azapi-resource.ts. jsii's strict ruleset accepts commonjs.
- Drop the empty eslint lint pattern that `testdir: ""` produces; eslint 9
  errors on it.

Generated-file churn from the projen upgrade
- eslint 8 -> 9 (legacy config mode), typescript-eslint 6 -> 8,
  standard-version -> commit-and-tag-version, jest-junit 15 -> 17.
- GitHub Actions pinned to commit SHAs, package jobs rebuilt from the
  build artifact, release workflow gains a dry-run input.
- `package-lock.json` removed (yarn classic is the package manager).
- eslint's new `curly` rule added braces around four single-line throws in
  src/testing/index.ts.

Verified locally with `npx projen build`: compile, 59 test suites /
1978 tests, eslint, docgen and jsii-pacmak (js + python) all pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch is waiting to be deployed

1 waiting deployment
Build — 48e29873 Waiting Oct 12, 2026 by so0k via build #196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant