@nikovirtala/projen-constructs 0.3.1 → 0.3.3

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 (35) hide show
  1. package/.jsii +343 -279
  2. package/README.md +144 -11
  3. package/docs/api/assets/search.js +1 -1
  4. package/docs/api/classes/AwsCdkConstructLibraryProject.html +1 -1
  5. package/docs/api/classes/AwsCdkTypeScriptAppProject.html +1 -1
  6. package/docs/api/classes/JsiiProject.html +1 -1
  7. package/docs/api/classes/TypeScriptProject.html +1 -1
  8. package/docs/api/index.html +152 -12
  9. package/docs/api/interfaces/AwsCdkConstructLibraryProjectOptions.html +274 -247
  10. package/docs/api/interfaces/AwsCdkTypeScriptAppProjectOptions.html +263 -236
  11. package/docs/api/interfaces/JsiiProjectOptions.html +262 -235
  12. package/docs/api/interfaces/TypeScriptProjectOptions.html +241 -214
  13. package/lib/components/bundle-lambda-function-code.js +3 -3
  14. package/lib/components/colima.js +1 -1
  15. package/lib/components/homebrew.js +1 -1
  16. package/lib/components/lambda-function-construct-generator.js +1 -1
  17. package/lib/components/localstack.js +1 -1
  18. package/lib/components/mise.js +1 -1
  19. package/lib/components/typedoc.js +1 -1
  20. package/lib/components/vitest.js +1 -1
  21. package/lib/project-generator.d.ts +17 -1
  22. package/lib/project-generator.js +47 -4
  23. package/lib/projects/awscdk-construct-library-options.generated.d.ts +21 -2
  24. package/lib/projects/awscdk-construct-library-options.generated.js +1 -1
  25. package/lib/projects/awscdk-construct-library.generated.js +1 -1
  26. package/lib/projects/awscdk-typescript-app-options.generated.d.ts +21 -2
  27. package/lib/projects/awscdk-typescript-app-options.generated.js +1 -1
  28. package/lib/projects/awscdk-typescript-app.generated.js +1 -1
  29. package/lib/projects/jsii-options.generated.d.ts +21 -2
  30. package/lib/projects/jsii-options.generated.js +1 -1
  31. package/lib/projects/jsii.generated.js +1 -1
  32. package/lib/projects/typescript-options.generated.d.ts +21 -2
  33. package/lib/projects/typescript-options.generated.js +1 -1
  34. package/lib/projects/typescript.generated.js +1 -1
  35. package/package.json +5 -5
@@ -14,11 +14,17 @@
14
14
  <pre><code class="bash"><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">add</span><span class="hl-1"> </span><span class="hl-3">-D</span><span class="hl-1"> </span><span class="hl-2">@nikovirtala/projen-constructs</span><span class="hl-1"> </span><span class="hl-2">projen</span><span class="hl-1"> </span><span class="hl-2">constructs</span>
15
15
  </code><button type="button">Copy</button></pre>
16
16
 
17
+ <p>Requires pnpm 11 and <code>projen</code> &gt;= 0.101.27. <code>@mrgrain/cdk-esbuild</code> and <code>constructs</code> are peer
18
+ dependencies as well.</p>
19
+ <p>To create a project from scratch:</p>
20
+ <pre><code class="bash"><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">dlx</span><span class="hl-1"> </span><span class="hl-2">projen</span><span class="hl-1"> </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-3">--from</span><span class="hl-1"> </span><span class="hl-2">@nikovirtala/projen-constructs</span><span class="hl-1"> </span><span class="hl-2">aws_cdk_construct_library</span>
21
+ </code><button type="button">Copy</button></pre>
22
+
17
23
  <h2 id="features" class="tsd-anchor-link">Features<a href="#features" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
18
24
  <ul>
19
25
  <li><strong>Standard Configuration</strong>: Opinionated defaults for author, release branch, package manager, Node.js, TypeScript, and tooling</li>
20
- <li><strong>Automatic Project Type Discovery</strong>: Generates <code>ProjectType</code> enum from Projen's JSII manifest (18 project types)</li>
21
- <li><strong>Component System</strong>: Reusable components (Vitest, Mise, TypeDoc, LocalStack, etc.)</li>
26
+ <li><strong>Automatic Project Type Discovery</strong>: Generates the <code>ProjectType</code> enum from Projen's JSII manifest (19 project types)</li>
27
+ <li><strong>Component System</strong>: Reusable components (Vitest, TypeDoc, Mise, Homebrew, Colima, LocalStack, Lambda bundling)</li>
22
28
  <li><strong>Code Generation</strong>: <code>ProjectGenerator</code> creates project classes with standard configuration</li>
23
29
  <li><strong>ES Modules</strong>: TypeScript and CDK App projects use ES modules (JSII uses CommonJS)</li>
24
30
  <li><strong>Code Quality</strong>: Biome for formatting and linting</li>
@@ -31,17 +37,64 @@
31
37
  <ul>
32
38
  <li><strong>Author</strong>: Niko Virtala (<a href="mailto:niko.virtala@hey.com">niko.virtala@hey.com</a>)</li>
33
39
  <li><strong>Default Release Branch</strong>: main</li>
34
- <li><strong>Package Manager</strong>: pnpm 10</li>
35
- <li><strong>Node Version</strong>: 22.21.1</li>
36
- <li><strong>TypeScript</strong>: 5.9.3</li>
37
- <li><strong>CDK Version</strong>: 2.223.0 (for CDK projects)</li>
38
- <li><strong>JSII Version</strong>: ~5.9.3 (for JSII projects)</li>
40
+ <li><strong>Package Manager</strong>: pnpm 11.20.0</li>
41
+ <li><strong>Node Version</strong>: 24.19.0</li>
42
+ <li><strong>TypeScript</strong>: 6.0.3</li>
43
+ <li><strong>CDK Version</strong>: 2.263.0 (for CDK projects)</li>
44
+ <li><strong>JSII Version</strong>: ~6.0.3 (for JSII projects)</li>
45
+ </ul>
46
+ <p>The AWS CDK, Node.js and TypeScript versions live in <code>src/versions.json</code> and are refreshed by the
47
+ <code>update-versions</code> task, which the dependency upgrade workflow runs.</p>
48
+ <h3 id="pnpm" class="tsd-anchor-link">pnpm<a href="#pnpm" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
49
+ <p>pnpm reads its settings from <code>pnpm-workspace.yaml</code>, not <code>.npmrc</code>, since pnpm 11. Generated projects
50
+ get:</p>
51
+ <table>
52
+ <thead>
53
+ <tr>
54
+ <th>Setting</th>
55
+ <th>Value</th>
56
+ <th>Reason</th>
57
+ </tr>
58
+ </thead>
59
+ <tbody>
60
+ <tr>
61
+ <td><code>nodeLinker</code></td>
62
+ <td><code>hoisted</code></td>
63
+ <td>jsii tooling resolves dependencies from a flat <code>node_modules</code></td>
64
+ </tr>
65
+ <tr>
66
+ <td><code>allowBuilds</code></td>
67
+ <td><code>esbuild: true</code></td>
68
+ <td>esbuild links its platform binary in a postinstall script, and pnpm 11 fails an install with ignored builds</td>
69
+ </tr>
70
+ <tr>
71
+ <td><code>verifyDepsBeforeRun</code></td>
72
+ <td><code>false</code></td>
73
+ <td>projen resolves the task <code>PATH</code> with <code>$(pnpm -c exec ...)</code>, which otherwise re-enters <code>pnpm install</code> and deadlocks</td>
74
+ </tr>
75
+ <tr>
76
+ <td><code>minimumReleaseAge</code></td>
77
+ <td><code>0</code></td>
78
+ <td>the pnpm 11 default of 1440 minutes makes pnpm write <code>minimumReleaseAgeExclude</code> entries into this generated file</td>
79
+ </tr>
80
+ </tbody>
81
+ </table>
82
+ <h3 id="typescript-configuration" class="tsd-anchor-link">TypeScript configuration<a href="#typescript-configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
83
+ <p>Projen renders three configs, and none of them should be edited directly:</p>
84
+ <ul>
85
+ <li><code>tsconfig.json</code> compiles <code>src</code> to <code>lib</code>. For JSII projects, jsii validates it against its <code>strict</code>
86
+ rule set, so it only carries compiler options jsii accepts.</li>
87
+ <li><code>test/tsconfig.json</code> extends it and is type-check only. This is the config Vitest type checking and
88
+ the editor use, and the one <code>tsconfigDev</code> points at.</li>
89
+ <li><code>projenrc/tsconfig.json</code> covers <code>.projenrc.ts</code>.</li>
39
90
  </ul>
40
91
  <h2 id="customization" class="tsd-anchor-link">Customization<a href="#customization" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
41
92
  <p>Override any option by passing it to the constructor:</p>
42
- <pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">project</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">JsiiProject</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">name:</span><span class="hl-1"> </span><span class="hl-2">&quot;my-project&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">repositoryUrl:</span><span class="hl-1"> </span><span class="hl-2">&quot;https://github.com/nikovirtala/my-project.git&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">minNodeVersion:</span><span class="hl-1"> </span><span class="hl-2">&quot;20.0.0&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">author:</span><span class="hl-1"> </span><span class="hl-2">&quot;Custom Author&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">authorAddress:</span><span class="hl-1"> </span><span class="hl-2">&quot;custom@example.com&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">mise:</span><span class="hl-1"> </span><span class="hl-3">false</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">vitest:</span><span class="hl-1"> </span><span class="hl-3">false</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">tsconfig:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">compilerOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">noUnusedLocals:</span><span class="hl-1"> </span><span class="hl-3">false</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-5">biomeOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">biomeConfig:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">formatter:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">lineWidth:</span><span class="hl-1"> </span><span class="hl-6">100</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
93
+ <pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">project</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">JsiiProject</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">name:</span><span class="hl-1"> </span><span class="hl-2">&quot;my-project&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">repositoryUrl:</span><span class="hl-1"> </span><span class="hl-2">&quot;https://github.com/nikovirtala/my-project.git&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">minNodeVersion:</span><span class="hl-1"> </span><span class="hl-2">&quot;24.0.0&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">author:</span><span class="hl-1"> </span><span class="hl-2">&quot;Custom Author&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">authorAddress:</span><span class="hl-1"> </span><span class="hl-2">&quot;custom@example.com&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">mise:</span><span class="hl-1"> </span><span class="hl-3">false</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">vitest:</span><span class="hl-1"> </span><span class="hl-3">false</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">tsconfig:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">compilerOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">noUnusedLocals:</span><span class="hl-1"> </span><span class="hl-3">false</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-5">biomeOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">biomeConfig:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">formatter:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">lineWidth:</span><span class="hl-1"> </span><span class="hl-6">100</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
43
94
  </code><button type="button">Copy</button></pre>
44
95
 
96
+ <p>Every component is exposed as an enable flag (<code>mise</code>, <code>vitest</code>, ...) plus an options property
97
+ (<code>miseOptions</code>, <code>vitestOptions</code>, ...).</p>
45
98
  <h2 id="usage" class="tsd-anchor-link">Usage<a href="#usage" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
46
99
  <h3 id="projects" class="tsd-anchor-link">Projects<a href="#projects" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
47
100
  <h4 id="aws-cdk-construct-library-project" class="tsd-anchor-link">AWS CDK Construct Library Project<a href="#aws-cdk-construct-library-project" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4>
@@ -67,6 +120,8 @@
67
120
  <pre><code class="typescript"><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">Vitest</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@nikovirtala/projen-constructs&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Vitest</span><span class="hl-1">(</span><span class="hl-5">project</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">vitestVersion:</span><span class="hl-1"> </span><span class="hl-2">&quot;^4&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">config:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">coverageProvider:</span><span class="hl-1"> </span><span class="hl-5">CoverageProvider</span><span class="hl-1">.</span><span class="hl-4">V8</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">coverageReporters:</span><span class="hl-1"> [</span><span class="hl-5">CoverageReporter</span><span class="hl-1">.</span><span class="hl-4">TEXT</span><span class="hl-1">, </span><span class="hl-5">CoverageReporter</span><span class="hl-1">.</span><span class="hl-4">LCOV</span><span class="hl-1">],</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
68
121
  </code><button type="button">Copy</button></pre>
69
122
 
123
+ <p>Type checking runs against the project's development tsconfig (<code>test/tsconfig.json</code>) unless
124
+ <code>config.typecheckTsconfig</code> says otherwise.</p>
70
125
  <h4 id="typedoc" class="tsd-anchor-link">TypeDoc<a href="#typedoc" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4>
71
126
  <p><a href="https://typedoc.org">TypeDoc</a> documentation generation component.</p>
72
127
  <pre><code class="typescript"><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">TypeDoc</span><span class="hl-1">, </span><span class="hl-5">EntryPointStrategy</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@nikovirtala/projen-constructs&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">TypeDoc</span><span class="hl-1">(</span><span class="hl-5">project</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">version:</span><span class="hl-1"> </span><span class="hl-2">&quot;^0.28&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">typeDocConfig:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">entryPointStrategy:</span><span class="hl-1"> </span><span class="hl-5">EntryPointStrategy</span><span class="hl-1">.</span><span class="hl-4">EXPAND</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">out:</span><span class="hl-1"> </span><span class="hl-2">&quot;docs/api&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">exclude:</span><span class="hl-1"> [</span><span class="hl-2">&quot;**/*.test.ts&quot;</span><span class="hl-1">],</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
@@ -74,11 +129,12 @@
74
129
 
75
130
  <h4 id="mise" class="tsd-anchor-link">Mise<a href="#mise" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4>
76
131
  <p><a href="https://mise.jdx.dev">Mise</a> dev tools/runtimes management component.</p>
77
- <pre><code class="typescript"><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">Mise</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@nikovirtala/projen-constructs&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Mise</span><span class="hl-1">(</span><span class="hl-5">project</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">nodeVersion:</span><span class="hl-1"> </span><span class="hl-2">&quot;22.21.1&quot;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
132
+ <pre><code class="typescript"><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">Mise</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@nikovirtala/projen-constructs&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Mise</span><span class="hl-1">(</span><span class="hl-5">project</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">nodeVersion:</span><span class="hl-1"> </span><span class="hl-2">&quot;24.19.0&quot;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
78
133
  </code><button type="button">Copy</button></pre>
79
134
 
80
135
  <h4 id="homebrew" class="tsd-anchor-link">Homebrew<a href="#homebrew" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4>
81
- <p><a href="https://brew.sh">Homebrew</a> package management component.</p>
136
+ <p><a href="https://brew.sh">Homebrew</a> package management component. Writes a <code>Brewfile</code> and adds an
137
+ <code>install:homebrew</code> task that bootstraps Homebrew and runs <code>brew bundle</code>.</p>
82
138
  <pre><code class="typescript"><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">Homebrew</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@nikovirtala/projen-constructs&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">homebrew</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Homebrew</span><span class="hl-1">(</span><span class="hl-5">project</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">packages:</span><span class="hl-1"> [</span><span class="hl-2">&quot;jq&quot;</span><span class="hl-1">, </span><span class="hl-2">&quot;yq&quot;</span><span class="hl-1">],</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-5">homebrew</span><span class="hl-1">.</span><span class="hl-0">addPackage</span><span class="hl-1">(</span><span class="hl-2">&quot;gh&quot;</span><span class="hl-1">);</span>
83
139
  </code><button type="button">Copy</button></pre>
84
140
 
@@ -104,16 +160,92 @@
104
160
 
105
161
  <h4 id="projectgenerator" class="tsd-anchor-link">ProjectGenerator<a href="#projectgenerator" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4>
106
162
  <p>Generates TypeScript project classes with standard configuration.</p>
107
- <pre><code class="typescript"><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">ProjectGenerator</span><span class="hl-1">, </span><span class="hl-5">ProjectType</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@nikovirtala/projen-constructs&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">ProjectGenerator</span><span class="hl-1">(</span><span class="hl-5">project</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">name:</span><span class="hl-1"> </span><span class="hl-2">&quot;TypeScriptProject&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">projectType:</span><span class="hl-1"> </span><span class="hl-5">ProjectType</span><span class="hl-1">.</span><span class="hl-4">TYPESCRIPT</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">filePath:</span><span class="hl-1"> </span><span class="hl-2">&quot;./src/projects/typescript.generated.ts&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">components:</span><span class="hl-1"> [</span><br/><span class="hl-1"> { </span><span class="hl-5">componentClass:</span><span class="hl-1"> </span><span class="hl-5">Mise</span><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-5">componentClass:</span><span class="hl-1"> </span><span class="hl-5">Vitest</span><span class="hl-1"> }, </span><span class="hl-8">// Auto-detects VitestOptions from JSII manifest</span><br/><span class="hl-1"> ],</span><br/><span class="hl-1">});</span>
163
+ <pre><code class="typescript"><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">ProjectGenerator</span><span class="hl-1">, </span><span class="hl-5">ProjectType</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@nikovirtala/projen-constructs&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">ProjectGenerator</span><span class="hl-1">(</span><span class="hl-5">project</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">name:</span><span class="hl-1"> </span><span class="hl-2">&quot;TypeScriptProject&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">projectType:</span><span class="hl-1"> </span><span class="hl-5">ProjectType</span><span class="hl-1">.</span><span class="hl-4">TYPE_SCRIPT_PROJECT</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">filePath:</span><span class="hl-1"> </span><span class="hl-2">&quot;./src/projects/typescript.generated.ts&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">components:</span><span class="hl-1"> [</span><br/><span class="hl-1"> { </span><span class="hl-5">componentClass:</span><span class="hl-1"> </span><span class="hl-5">Mise</span><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-5">componentClass:</span><span class="hl-1"> </span><span class="hl-5">Vitest</span><span class="hl-1"> }, </span><span class="hl-8">// Auto-detects VitestOptions from JSII manifest</span><br/><span class="hl-1"> ],</span><br/><span class="hl-1">});</span>
108
164
  </code><button type="button">Copy</button></pre>
109
165
 
110
166
  <p>Features:</p>
111
167
  <ul>
112
168
  <li>Automatically generates the <code>ProjectType</code> enum from Projen's JSII manifest</li>
113
169
  <li>Auto-detects component options types from JSII manifests</li>
170
+ <li>Strips Projen's <code>@pjnew</code> annotation from <code>packageManager</code>, which <code>projen new</code> would otherwise
171
+ render into a generated <code>.projenrc.ts</code> as the package manager that ran the command</li>
114
172
  <li>Validates paths to prevent directory traversal attacks</li>
115
173
  <li>Structured error handling with custom error classes</li>
116
174
  </ul>
175
+ <h2 id="development" class="tsd-anchor-link">Development<a href="#development" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
176
+ <p>This project is managed by Projen and generates itself: <code>.projenrc.ts</code> defines the project using the
177
+ <code>JsiiProject</code> type from <code>src/</code>. Configuration changes belong in <code>.projenrc.ts</code>, never in the
178
+ generated files.</p>
179
+ <pre><code class="bash"><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">projen</span><span class="hl-1"> </span><span class="hl-8"># synthesize project files</span><br/><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">build</span><span class="hl-1"> </span><span class="hl-8"># synthesize, compile, test and package</span><br/><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">test</span><span class="hl-1"> </span><span class="hl-8"># biome, vitest, typedoc</span><br/><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">test:watch</span><span class="hl-1"> </span><span class="hl-8"># vitest in watch mode</span><br/><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">test:update</span><span class="hl-1"> </span><span class="hl-8"># update snapshots</span><br/><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">biome</span><span class="hl-1"> </span><span class="hl-8"># format and lint</span><br/><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">docgen</span><span class="hl-1"> </span><span class="hl-8"># regenerate API.md from the .jsii manifest</span><br/><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">update-versions</span><span class="hl-1"> </span><span class="hl-8"># refresh src/versions.json</span><br/><span class="hl-0">pnpm</span><span class="hl-1"> </span><span class="hl-2">upgrade</span><span class="hl-1"> </span><span class="hl-8"># upgrade dependencies</span>
180
+ </code><button type="button">Copy</button></pre>
181
+
182
+ <h3 id="build-process" class="tsd-anchor-link">Build process<a href="#build-process" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
183
+ <pre><code class="mermaid">flowchart TD
184
+ projenrc[".projenrc.ts"]
185
+
186
+ subgraph synthesize["default (synthesize)"]
187
+ direction TB
188
+ synth["tsx .projenrc.ts"]
189
+ generator["ProjectGenerator"]
190
+ generated["src/project-type.ts<br/>src/projects/*.generated.ts<br/>src/projects/*-options.generated.ts"]
191
+ projenfiles["package.json, tsconfig.json,<br/>pnpm-workspace.yaml, workflows, ..."]
192
+ brew["install:homebrew<br/>brew bundle"]
193
+ definecfg["bundle-vitest-define-config<br/>esbuild → lib/vitest-define-config.js"]
194
+
195
+ synth --> generator --> generated
196
+ synth --> projenfiles
197
+ synth --> brew
198
+ synth --> definecfg
199
+ end
200
+
201
+ subgraph compile["compile"]
202
+ direction TB
203
+ jsii["jsii<br/>validates tsconfig.json against the strict rule set"]
204
+ lib["lib/**"]
205
+ manifest[".jsii manifest"]
206
+
207
+ jsii --> lib
208
+ jsii --> manifest
209
+ end
210
+
211
+ subgraph test["test"]
212
+ direction TB
213
+ biome["biome check --write"]
214
+ vitest["vitest run<br/>+ type checking"]
215
+ typedoc["typedoc → docs/api"]
216
+
217
+ biome --> vitest --> typedoc
218
+ end
219
+
220
+ subgraph package["package"]
221
+ direction TB
222
+ pacmak["jsii-pacmak<br/>--pack-command 'pnpm pack'"]
223
+ dist["dist/js/*.tgz"]
224
+
225
+ pacmak --> dist
226
+ end
227
+
228
+ projenrc --> synthesize
229
+ synthesize --> compile
230
+ compile --> test
231
+ test --> package
232
+
233
+ manifest -. "component options FQNs<br/>read on the next synthesis" .-> generator
234
+ docgen["docgen<br/>jsii-docgen → API.md"]
235
+ manifest --> docgen
236
+
237
+ classDef artifact fill:#eef,stroke:#88a
238
+ class generated,projenfiles,lib,manifest,dist artifact
239
+ </code><button type="button">Copy</button></pre>
240
+
241
+ <p>The dashed edge is the part worth knowing about: <code>ProjectGenerator</code> reads the committed <code>.jsii</code>
242
+ manifest to resolve component options types, so the manifest produced by <code>compile</code> feeds the <em>next</em>
243
+ synthesis. This is why <code>.jsii</code> is committed rather than ignored. A component options type that is
244
+ missing from the manifest is reported as a warning and its options property is left out of the
245
+ generated interface, which is expected only while a new component is being introduced: compile once,
246
+ then synthesize again.</p>
247
+ <p><code>package</code> runs <code>package:js</code> on CI and <code>package-all</code> locally; both end up in <code>jsii-pacmak</code>.
248
+ <code>docgen</code> is not part of <code>build</code> and has to be run explicitly after the manifest changes.</p>
117
249
  </div></div>
118
250
  <div class="col-sidebar">
119
251
  <div class="page-menu">
@@ -134,6 +266,10 @@
134
266
  <li><a href="#installation"><span>Installation</span></a></li>
135
267
  <li><a href="#features"><span>Features</span></a></li>
136
268
  <li><a href="#standard-configuration"><span>Standard <wbr/>Configuration</span></a></li>
269
+ <li>
270
+ <ul>
271
+ <li><a href="#pnpm"><span>pnpm</span></a></li>
272
+ <li><a href="#typescript-configuration"><span>Type<wbr/>Script configuration</span></a></li></ul></li>
137
273
  <li><a href="#customization"><span>Customization</span></a></li>
138
274
  <li><a href="#usage"><span>Usage</span></a></li>
139
275
  <li>
@@ -156,7 +292,11 @@
156
292
  <li><a href="#localstack"><span>Local<wbr/>Stack</span></a></li>
157
293
  <li><a href="#lambdafunctionconstructgenerator"><span>Lambda<wbr/>Function<wbr/>Construct<wbr/>Generator</span></a></li>
158
294
  <li><a href="#bundler"><span>Bundler</span></a></li>
159
- <li><a href="#projectgenerator"><span>Project<wbr/>Generator</span></a></li></ul></li></ul></li></ul></div></details></div>
295
+ <li><a href="#projectgenerator"><span>Project<wbr/>Generator</span></a></li></ul></li></ul></li>
296
+ <li><a href="#development"><span>Development</span></a></li>
297
+ <li>
298
+ <ul>
299
+ <li><a href="#build-process"><span>Build process</span></a></li></ul></li></ul></div></details></div>
160
300
  <div class="site-menu">
161
301
  <nav class="tsd-navigation"><a href="modules.html">@nikovirtala/projen-constructs</a>
162
302
  <ul class="tsd-small-nested-navigation" id="tsd-nav-container">