@nikovirtala/projen-constructs 0.5.1 → 0.5.2

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 (40) hide show
  1. package/.jsii +4 -4
  2. package/.kiro/steering/product.md +7 -5
  3. package/.kiro/steering/tech.md +7 -5
  4. package/README.md +94 -478
  5. package/docs/api/assets/highlight.css +8 -8
  6. package/docs/api/functions/renderBundleName.html +1 -1
  7. package/docs/api/index.html +96 -415
  8. package/docs/api/interfaces/AwsCdkConstructLibraryProjectOptions.html +3 -3
  9. package/docs/api/interfaces/AwsCdkTypeScriptAppProjectOptions.html +3 -3
  10. package/docs/api/interfaces/JsiiProjectOptions.html +3 -3
  11. package/docs/api/interfaces/LocalStackOptions.html +2 -2
  12. package/docs/api/interfaces/ProjectGeneratorOptions.html +1 -1
  13. package/docs/api/interfaces/TypeScriptProjectOptions.html +3 -3
  14. package/docs/api/interfaces/VitestConfigOptions.html +3 -3
  15. package/docs/api/interfaces/VitestOptions.html +2 -2
  16. package/docs/api/media/LICENSE +202 -0
  17. package/docs/api/media/components.md +191 -0
  18. package/docs/api/media/configuration.md +108 -0
  19. package/docs/api/media/development.md +93 -0
  20. package/docs/api/media/index.html +169 -0
  21. package/docs/api/media/migration.md +106 -0
  22. package/docs/api/modules.html +2 -2
  23. package/docs/components.md +191 -0
  24. package/docs/configuration.md +108 -0
  25. package/docs/development.md +93 -0
  26. package/docs/migration.md +106 -0
  27. package/lib/components/bundle-lambda-function-code.js +3 -3
  28. package/lib/components/colima.js +1 -1
  29. package/lib/components/homebrew.js +1 -1
  30. package/lib/components/lambda-function-construct-generator.js +1 -1
  31. package/lib/components/localstack.js +1 -1
  32. package/lib/components/mise.js +1 -1
  33. package/lib/components/typedoc.js +1 -1
  34. package/lib/components/vitest.js +1 -1
  35. package/lib/project-generator.js +1 -1
  36. package/lib/projects/awscdk-construct-library.generated.js +1 -1
  37. package/lib/projects/awscdk-typescript-app.generated.js +1 -1
  38. package/lib/projects/jsii.generated.js +1 -1
  39. package/lib/projects/typescript.generated.js +1 -1
  40. package/package.json +3 -2
@@ -0,0 +1,108 @@
1
+ # Configuration
2
+
3
+ This page covers the configuration that `@nikovirtala/projen-constructs` applies to generated
4
+ projects: package manager settings, the TypeScript configs, native TypeScript execution, and how
5
+ you override any of it.
6
+
7
+ ## Standard configuration
8
+
9
+ Every project type ships with the same opinionated defaults:
10
+
11
+ <!-- generated:version-table-start -->
12
+ - **Author**: Niko Virtala (niko.virtala@hey.com)
13
+ - **Default release branch**: main
14
+ - **Package manager**: pnpm 12.16.1
15
+ - **Node version**: 26.13.0
16
+ - **TypeScript**: 6.0.3
17
+ - **CDK version**: 2.275.0 (for CDK projects)
18
+ - **JSII version**: ~6.0.3 (for JSII projects)
19
+ <!-- generated:version-table-end -->
20
+
21
+ The AWS CDK, Node.js and TypeScript versions live in `src/versions.json` and are refreshed by the
22
+ `update-versions` task, which the dependency upgrade workflow runs.
23
+
24
+ ## pnpm
25
+
26
+ pnpm reads its settings from `pnpm-workspace.yaml`, not `.npmrc`, since pnpm 11. Generated projects
27
+ get:
28
+
29
+ | Setting | Value | Reason |
30
+ | ---------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------ |
31
+ | `nodeLinker` | `hoisted` | jsii tooling resolves dependencies from a flat `node_modules` |
32
+ | `allowBuilds` | `esbuild: true` | esbuild links its platform binary in a postinstall script, and pnpm 11 fails an install with ignored builds |
33
+ | `verifyDepsBeforeRun` | `false` | projen resolves the task `PATH` with `$(pnpm -c exec ...)`, which otherwise re-enters `pnpm install` and deadlocks |
34
+ | `minimumReleaseAge` | `0` | the pnpm 11 default of 1440 minutes makes pnpm write `minimumReleaseAgeExclude` entries into this generated file |
35
+
36
+ ## TypeScript configuration
37
+
38
+ Projen renders three configs, and you should not edit any of them directly:
39
+
40
+ - `tsconfig.json` compiles `src` to `lib`. For JSII projects, jsii validates it against its `strict`
41
+ rule set, so it only carries compiler options jsii accepts.
42
+ - `test/tsconfig.json` extends it and is type-check only. This is the config Vitest type checking and
43
+ the editor use, and the one `tsconfigDev` points at.
44
+ - `projenrc/tsconfig.json` covers `.projenrc.ts`.
45
+
46
+ ## Native TypeScript
47
+
48
+ TypeScript and AWS CDK app projects run TypeScript with Node.js's built-in
49
+ [type stripping](https://nodejs.org/api/typescript.html#type-stripping) instead of `tsx` or
50
+ `ts-node`: the default task is `node .projenrc.ts`, and the cdk.json `app` is `node src/main.ts`.
51
+ Their `tsconfig.json` sets `erasableSyntaxOnly` and `verbatimModuleSyntax`, so `tsc` reports code
52
+ that Node.js cannot run before Node.js does.
53
+
54
+ Code in these projects must therefore:
55
+
56
+ - only use syntax that can be stripped: no `enum`s (use an `as const` object), no namespaces with
57
+ values, and no constructor parameter properties
58
+ - mark type-only imports with `type` (Biome's `useImportType` fixes these)
59
+ - import relative files with their `.ts` extension, and never import a directory
60
+ - use Node.js [subpath imports](https://nodejs.org/api/packages.html#subpath-imports)
61
+ (`#stacks` in `package.json` `imports`) instead of tsconfig `paths`, which Node.js does not read
62
+ - import packages without an `exports` map either from the package root or with an explicit file,
63
+ e.g. `projen/lib/component.js` rather than `projen/lib/component`
64
+
65
+ Lambda handlers bundled by esbuild and tests run by Vitest are not run by Node.js directly, but the
66
+ same compiler options apply to them.
67
+
68
+ JSII and AWS CDK construct library projects keep using `tsx`, because jsii compiles to CommonJS, and
69
+ their `.projenrc.ts` often imports their own `src`.
70
+
71
+ When you start a new project by hand, make sure `package.json` has `"type": "module"` before the
72
+ first `node .projenrc.ts`: `npm init` writes `"type": "commonjs"`, which makes Node.js reject the
73
+ `import` statements in `.projenrc.ts`.
74
+
75
+ ## Customization
76
+
77
+ Override any option by passing it to the constructor:
78
+
79
+ ```typescript
80
+ import { JsiiProject } from "@nikovirtala/projen-constructs";
81
+
82
+ const project = new JsiiProject({
83
+ name: "my-project",
84
+ author: "Custom Author",
85
+ authorAddress: "custom@example.com",
86
+ repositoryUrl: "https://github.com/nikovirtala/my-project.git",
87
+ minNodeVersion: "26.0.0",
88
+ mise: false,
89
+ vitest: false,
90
+ tsconfig: {
91
+ compilerOptions: {
92
+ noUnusedLocals: false,
93
+ },
94
+ },
95
+ biomeOptions: {
96
+ biomeConfig: {
97
+ formatter: {
98
+ lineWidth: 100,
99
+ },
100
+ },
101
+ },
102
+ });
103
+
104
+ project.synth();
105
+ ```
106
+
107
+ Every component is exposed as an enable flag (`mise`, `vitest`, ...) plus an options property
108
+ (`miseOptions`, `vitestOptions`, ...).
@@ -0,0 +1,93 @@
1
+ # Development
2
+
3
+ This project is managed by projen and generates itself: `.projenrc.ts` defines the project using the
4
+ `JsiiProject` type from `src/`. Configuration changes belong in `.projenrc.ts`, never in the
5
+ generated files.
6
+
7
+ ## Commands
8
+
9
+ ```bash
10
+ pnpm projen # synthesize project files
11
+ pnpm build # synthesize, compile, test and package
12
+ pnpm test # biome, vitest, typedoc
13
+ pnpm test:watch # vitest in watch mode
14
+ pnpm test:update # update snapshots
15
+ pnpm biome # format and lint
16
+ pnpm docgen # regenerate API.md from the .jsii manifest
17
+ pnpm update-versions # refresh src/versions.json
18
+ pnpm upgrade # upgrade dependencies
19
+ ```
20
+
21
+ ## Build process
22
+
23
+ The diagram below shows how synthesis, compile, test and package connect. Each node names a task or
24
+ artifact, and the arrows show the order they run in.
25
+
26
+ ```mermaid
27
+ flowchart TD
28
+ projenrc[".projenrc.ts"]
29
+
30
+ subgraph synthesize["default (synthesize)"]
31
+ direction TB
32
+ synth["tsx .projenrc.ts"]
33
+ generator["ProjectGenerator"]
34
+ generated["src/project-type.ts<br/>src/projects/*.generated.ts<br/>src/projects/*-options.generated.ts"]
35
+ projenfiles["package.json, tsconfig.json,<br/>pnpm-workspace.yaml, workflows, ..."]
36
+ brew["install:homebrew<br/>brew bundle"]
37
+ definecfg["bundle-vitest-define-config<br/>esbuild → lib/vitest-define-config.js"]
38
+
39
+ synth --> generator --> generated
40
+ synth --> projenfiles
41
+ synth --> brew
42
+ synth --> definecfg
43
+ end
44
+
45
+ subgraph compile["compile"]
46
+ direction TB
47
+ jsii["jsii<br/>validates tsconfig.json against the strict rule set"]
48
+ lib["lib/**"]
49
+ manifest[".jsii manifest"]
50
+
51
+ jsii --> lib
52
+ jsii --> manifest
53
+ end
54
+
55
+ subgraph test["test"]
56
+ direction TB
57
+ biome["biome check --write"]
58
+ vitest["vitest run<br/>+ type checking"]
59
+ typedoc["typedoc → docs/api"]
60
+
61
+ biome --> vitest --> typedoc
62
+ end
63
+
64
+ subgraph package["package"]
65
+ direction TB
66
+ pacmak["jsii-pacmak<br/>--pack-command 'pnpm pack'"]
67
+ dist["dist/js/*.tgz"]
68
+
69
+ pacmak --> dist
70
+ end
71
+
72
+ projenrc --> synthesize
73
+ synthesize --> compile
74
+ compile --> test
75
+ test --> package
76
+
77
+ manifest -. "component options FQNs<br/>read on the next synthesis" .-> generator
78
+ docgen["docgen<br/>jsii-docgen → API.md"]
79
+ manifest --> docgen
80
+
81
+ classDef artifact fill:#eef,stroke:#88a
82
+ class generated,projenfiles,lib,manifest,dist artifact
83
+ ```
84
+
85
+ The dashed edge is the part worth knowing about: `ProjectGenerator` reads the committed `.jsii`
86
+ manifest to resolve component options types, so the manifest produced by `compile` feeds the *next*
87
+ synthesis. This is why `.jsii` is committed rather than ignored. A component options type that is
88
+ missing from the manifest is reported as a warning and its options property is left out of the
89
+ generated interface, which is expected only while a new component is being introduced: compile once,
90
+ then synthesize again.
91
+
92
+ `package` runs `package:js` on CI and `package-all` locally; both end up in `jsii-pacmak`.
93
+ `docgen` is not part of `build` and has to be run explicitly after the manifest changes.
@@ -0,0 +1,169 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="./"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@nikovirtala/projen-constructs</title><meta name="description" content="Documentation for @nikovirtala/projen-constructs"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar">
2
+ <div class="tsd-toolbar-contents container"><a href="index.html" class="title">@nikovirtala/projen-constructs</a>
3
+ <div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/>
4
+ <ul role="listbox" id="tsd-search-results"></ul>
5
+ <div id="tsd-search-status" aria-live="polite" aria-atomic="true">
6
+ <div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></header>
7
+ <div class="container container-main">
8
+ <div class="col-content">
9
+ <div class="tsd-page-title">
10
+ <h1>@nikovirtala/projen-constructs</h1></div>
11
+ <div class="tsd-panel tsd-typography"><h1 id="nikovirtalaprojen-constructs" class="tsd-anchor-link">@nikovirtala/projen-constructs<a href="#nikovirtalaprojen-constructs" 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></h1>
12
+ <p>Opinionated projen project types that scaffold TypeScript, JSII and AWS CDK repositories with one shared config.</p>
13
+ <p><a href="https://www.npmjs.com/package/@nikovirtala/projen-constructs"><img src="https://img.shields.io/npm/v/@nikovirtala/projen-constructs?label=npm" alt="npm version badge, latest release on npm"></a>
14
+ <a href="https://github.com/nikovirtala/projen-constructs/actions/workflows/build.yml"><img src="https://img.shields.io/github/actions/workflow/status/nikovirtala/projen-constructs/build.yml?branch=main&amp;label=build" alt="build status badge from the GitHub Actions build workflow"></a>
15
+ <a href="./LICENSE"><img src="https://img.shields.io/npm/l/@nikovirtala/projen-constructs?label=license" alt="license badge, Apache-2.0"></a>
16
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D26.13.0-informational?label=node" alt="supported Node.js version badge, requires Node.js 26.13.0 or newer"></a>
17
+ <a href="https://projen.io"><img src="https://img.shields.io/badge/projen-%5E0.104.23-informational?label=projen" alt="projen peer dependency version badge, requires projen 0.104.23 or newer"></a></p>
18
+ <h2 id="why-this-exists" class="tsd-anchor-link">Why this exists<a href="#why-this-exists" 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>
19
+ <p>Projen gives you code-first project configuration, but wiring up a consistent setup across many
20
+ TypeScript, JSII and AWS CDK repositories still means repeating the same choices. This library
21
+ packages those choices into ready-made project types and reusable components, so every repository
22
+ you generate shares the same package manager, Node.js and TypeScript versions, testing, linting and
23
+ release tooling.</p>
24
+ <p>It is for anyone in the projen and AWS CDK community who maintains more than one repository and wants
25
+ them to behave the same way without hand-copying configuration between them.</p>
26
+ <h2 id="when-not-to-use-this" class="tsd-anchor-link">When not to use this<a href="#when-not-to-use-this" 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>
27
+ <p>Reach for plain projen instead when:</p>
28
+ <ul>
29
+ <li>you want unopinionated projen defaults and prefer to make each tooling choice yourself</li>
30
+ <li>your setup is not pnpm-based or cannot run Node.js 26</li>
31
+ <li>you build in languages beyond TypeScript, JSII and AWS CDK</li>
32
+ </ul>
33
+ <h2 id="status-and-supported-versions" class="tsd-anchor-link">Status and supported versions<a href="#status-and-supported-versions" 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>
34
+ <p>Stability: <strong>stable</strong>. This library requires <code>projen</code> ^0.104.23, pnpm 12, and Node.js &gt;= 26.13.0.
35
+ These values are maintained in <code>src/versions.json</code> and the project configuration; the numbers quoted
36
+ across this documentation track those sources.</p>
37
+ <h2 id="documentation" class="tsd-anchor-link">Documentation<a href="#documentation" 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>
38
+ <table>
39
+ <thead>
40
+ <tr>
41
+ <th>Guide</th>
42
+ <th>What it covers</th>
43
+ </tr>
44
+ </thead>
45
+ <tbody>
46
+ <tr>
47
+ <td><a href="media/configuration.md">Configuration</a></td>
48
+ <td>Standard defaults, pnpm settings, the TypeScript configs, native TypeScript, and how to customize any option</td>
49
+ </tr>
50
+ <tr>
51
+ <td><a href="media/components.md">Components</a></td>
52
+ <td>Reference for every component: Vitest, TypeDoc, Mise, Homebrew, Colima, LocalStack, LambdaFunctionConstructGenerator, Bundler, and ProjectGenerator</td>
53
+ </tr>
54
+ <tr>
55
+ <td><a href="media/migration.md">Migration</a></td>
56
+ <td>Moving from the deprecated standalone packages, including the name mapping and behaviour changes</td>
57
+ </tr>
58
+ <tr>
59
+ <td><a href="media/development.md">Development</a></td>
60
+ <td>Development commands and the build process diagram</td>
61
+ </tr>
62
+ <tr>
63
+ <td><a href="media/index.html">API reference</a></td>
64
+ <td>Generated TypeDoc API documentation</td>
65
+ </tr>
66
+ </tbody>
67
+ </table>
68
+ <p>Quick links: <a href="#quick-start">Quick start</a> · <a href="#usage">Usage</a> · <a href="#features">Features</a>.</p>
69
+ <h2 id="quick-start" class="tsd-anchor-link">Quick start<a href="#quick-start" 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>
70
+ <p>Install the library alongside its <code>projen</code> and <code>constructs</code> peers:</p>
71
+ <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>
72
+ </code><button type="button">Copy</button></pre>
73
+
74
+ <p>Create a <code>.projenrc.ts</code> that defines an AWS CDK construct library and synthesizes it:</p>
75
+ <pre><code class="typescript"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">AwsCdkConstructLibraryProject</span><span class="hl-1"> } </span><span class="hl-4">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-6">project</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">AwsCdkConstructLibraryProject</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-cdk-construct&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;Your Name&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;you@example.com&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/your-org/my-cdk-construct.git&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">cdkVersion:</span><span class="hl-1"> </span><span class="hl-2">&quot;2.275.0&quot;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-5">project</span><span class="hl-1">.</span><span class="hl-0">synth</span><span class="hl-1">();</span>
76
+ </code><button type="button">Copy</button></pre>
77
+
78
+ <p>Then run synthesis:</p>
79
+ <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>
80
+ </code><button type="button">Copy</button></pre>
81
+
82
+ <p><strong>Expected output</strong>: projen reads <code>.projenrc.ts</code> and writes the generated project files into the
83
+ working directory: <code>package.json</code>, <code>tsconfig.json</code>, <code>pnpm-workspace.yaml</code>, the GitHub Actions
84
+ workflows, the Vitest and Biome configuration, <code>mise.toml</code>, and the source and test scaffolding for
85
+ your construct library. Re-running the command after you edit <code>.projenrc.ts</code> updates those files in
86
+ place.</p>
87
+ <p>To start a project from scratch without writing <code>.projenrc.ts</code> yourself:</p>
88
+ <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>
89
+ </code><button type="button">Copy</button></pre>
90
+
91
+ <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>
92
+ <ul>
93
+ <li><strong>Standard configuration</strong>: opinionated defaults for author, release branch, package manager,
94
+ Node.js, TypeScript, and tooling</li>
95
+ <li><strong>Automatic project type discovery</strong>: generates the <code>ProjectType</code> enum from projen's JSII manifest
96
+ (<!-- generated:project-type-count-start -->21<!-- generated:project-type-count-end --> project types)</li>
97
+ <li><strong>Component system</strong>: reusable components (Vitest, TypeDoc, Mise, Homebrew, Colima, LocalStack,
98
+ Lambda bundling)</li>
99
+ <li><strong>Code generation</strong>: <code>ProjectGenerator</code> creates project classes with standard configuration</li>
100
+ <li><strong>ES modules</strong>: TypeScript and CDK app projects use ES modules (JSII uses CommonJS)</li>
101
+ <li><strong>Code quality</strong>: Biome for formatting and linting</li>
102
+ <li><strong>Testing</strong>: Vitest with coverage</li>
103
+ <li><strong>Auto-merge</strong>: enabled with auto-approve</li>
104
+ <li><strong>VSCode</strong>: recommended extensions and settings</li>
105
+ <li><strong>mise</strong>: Node version management</li>
106
+ </ul>
107
+ <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>
108
+ <p>Each project type applies the standard configuration and the shared components. See
109
+ <a href="media/configuration.md">Configuration</a> for the defaults and how to override them, and
110
+ <a href="media/components.md">Components</a> for the component reference.</p>
111
+ <h3 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></h3>
112
+ <pre><code class="typescript"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">AwsCdkConstructLibraryProject</span><span class="hl-1"> } </span><span class="hl-4">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-6">project</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">AwsCdkConstructLibraryProject</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-cdk-construct&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;Your Name&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;you@example.com&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-cdk-construct.git&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">cdkVersion:</span><span class="hl-1"> </span><span class="hl-2">&quot;2.275.0&quot;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-5">project</span><span class="hl-1">.</span><span class="hl-0">synth</span><span class="hl-1">();</span>
113
+ </code><button type="button">Copy</button></pre>
114
+
115
+ <h3 id="aws-cdk-typescript-app-project" class="tsd-anchor-link">AWS CDK TypeScript app project<a href="#aws-cdk-typescript-app-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></h3>
116
+ <pre><code class="typescript"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">AwsCdkTypeScriptAppProject</span><span class="hl-1"> } </span><span class="hl-4">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-6">project</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">AwsCdkTypeScriptAppProject</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-cdk-app&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">repository:</span><span class="hl-1"> </span><span class="hl-2">&quot;https://github.com/nikovirtala/my-cdk-app.git&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">cdkVersion:</span><span class="hl-1"> </span><span class="hl-2">&quot;2.275.0&quot;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-5">project</span><span class="hl-1">.</span><span class="hl-0">synth</span><span class="hl-1">();</span>
117
+ </code><button type="button">Copy</button></pre>
118
+
119
+ <h3 id="jsii-project" class="tsd-anchor-link">JSII project<a href="#jsii-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></h3>
120
+ <pre><code class="typescript"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">JsiiProject</span><span class="hl-1"> } </span><span class="hl-4">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-6">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-jsii-project&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;Your Name&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;you@example.com&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-jsii-project.git&quot;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-5">project</span><span class="hl-1">.</span><span class="hl-0">synth</span><span class="hl-1">();</span>
121
+ </code><button type="button">Copy</button></pre>
122
+
123
+ <h3 id="typescript-project" class="tsd-anchor-link">TypeScript project<a href="#typescript-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></h3>
124
+ <pre><code class="typescript"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">TypeScriptProject</span><span class="hl-1"> } </span><span class="hl-4">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-6">project</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">TypeScriptProject</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-typescript-project&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">repository:</span><span class="hl-1"> </span><span class="hl-2">&quot;https://github.com/nikovirtala/my-typescript-project.git&quot;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-5">project</span><span class="hl-1">.</span><span class="hl-0">synth</span><span class="hl-1">();</span>
125
+ </code><button type="button">Copy</button></pre>
126
+
127
+ <h2 id="contributing" class="tsd-anchor-link">Contributing<a href="#contributing" 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>
128
+ <p>See <a href="media/development.md">Development</a> for the commands and the build process. Configuration
129
+ changes belong in <code>.projenrc.ts</code>, never in the generated files.</p>
130
+ <h2 id="license" class="tsd-anchor-link">License<a href="#license" 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>
131
+ <p>Apache-2.0. See <a href="media/LICENSE">LICENSE</a>.</p>
132
+ </div></div>
133
+ <div class="col-sidebar">
134
+ <div class="page-menu">
135
+ <div class="tsd-navigation settings">
136
+ <details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>
137
+ <h3>Settings</h3></summary>
138
+ <div class="tsd-accordion-details">
139
+ <div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span>
140
+ <ul id="tsd-filter-options">
141
+ <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li>
142
+ <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li>
143
+ <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div>
144
+ <div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
145
+ <details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>
146
+ <h3>On This Page</h3></summary>
147
+ <div class="tsd-accordion-details"><a href="#nikovirtalaprojen-constructs"><span>@nikovirtala/projen-<wbr/>constructs</span></a>
148
+ <ul>
149
+ <li><a href="#why-this-exists"><span>Why this exists</span></a></li>
150
+ <li><a href="#when-not-to-use-this"><span>When not to use this</span></a></li>
151
+ <li><a href="#status-and-supported-versions"><span>Status and supported versions</span></a></li>
152
+ <li><a href="#documentation"><span>Documentation</span></a></li>
153
+ <li><a href="#quick-start"><span>Quick start</span></a></li>
154
+ <li><a href="#features"><span>Features</span></a></li>
155
+ <li><a href="#usage"><span>Usage</span></a></li>
156
+ <li>
157
+ <ul>
158
+ <li><a href="#aws-cdk-construct-library-project"><span>AWS <wbr/>CDK construct library project</span></a></li>
159
+ <li><a href="#aws-cdk-typescript-app-project"><span>AWS <wbr/>CDK <wbr/>Type<wbr/>Script app project</span></a></li>
160
+ <li><a href="#jsii-project"><span>JSII project</span></a></li>
161
+ <li><a href="#typescript-project"><span>Type<wbr/>Script project</span></a></li></ul></li>
162
+ <li><a href="#contributing"><span>Contributing</span></a></li>
163
+ <li><a href="#license"><span>License</span></a></li></ul></div></details></div>
164
+ <div class="site-menu">
165
+ <nav class="tsd-navigation"><a href="modules.html">@nikovirtala/projen-constructs</a>
166
+ <ul class="tsd-small-nested-navigation" id="tsd-nav-container">
167
+ <li>Loading...</li></ul></nav></div></div></div><footer>
168
+ <p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer>
169
+ <div class="overlay"></div></body></html>
@@ -0,0 +1,106 @@
1
+ # Migrating from the standalone packages
2
+
3
+ The components used to be published as separate packages. Those packages are deprecated and will not
4
+ get new features or fixes. Every class, interface, enum and function they exported is exported from
5
+ `@nikovirtala/projen-constructs` under the same name, except `AwsCdkApp` (see below).
6
+
7
+ | Deprecated package | Replacement in `@nikovirtala/projen-constructs` |
8
+ | --- | --- |
9
+ | `@nikovirtala/projen-vitest` | `Vitest`, `VitestOptions`, `VitestConfigOptions`, `Environment`, `Pool`, `CoverageProvider`, `CoverageReporter` |
10
+ | `@nikovirtala/projen-typedoc` | `TypeDoc`, `TypeDocOptions`, `TypeDocConfiguration` and its enums |
11
+ | `@nikovirtala/projen-homebrew` | `Homebrew`, `HomebrewOptions` |
12
+ | `@nikovirtala/projen-colima` | `Colima` |
13
+ | `@nikovirtala/projen-localstack` | `LocalStack`, `LocalStackOptions` |
14
+ | `@nikovirtala/projen-bundle-lambda-function-code` | `Bundler`, `LambdaFunctionCodeBundle`, `LambdaFunctionCodeBundler` and their options |
15
+ | `@nikovirtala/projen-lambda-function-construct-generator` | `LambdaFunctionConstructGenerator`, `LambdaFunctionConstructGeneratorOptions` |
16
+ | `@nikovirtala/projen-aws-cdk-app` | `AwsCdkTypeScriptAppProject`, `AwsCdkTypeScriptAppProjectOptions` |
17
+
18
+ ## Steps
19
+
20
+ 1. In `.projenrc.ts`, replace the old package in `devDeps` with `@nikovirtala/projen-constructs`, and
21
+ change the imports:
22
+
23
+ ```typescript
24
+ // before
25
+ import { Vitest } from "@nikovirtala/projen-vitest";
26
+ // after
27
+ import { Vitest } from "@nikovirtala/projen-constructs";
28
+ ```
29
+
30
+ 2. Check the peer dependencies. `@nikovirtala/projen-constructs` needs `projen` ^0.104.23, `constructs`
31
+ ^10 and `@mrgrain/cdk-esbuild` ^5. The standalone packages accepted older projen versions, so you
32
+ may have to upgrade projen in the same change.
33
+ 3. Install the new package, run `npx projen` and review the changes to the generated files.
34
+
35
+ ## Changes to expect
36
+
37
+ These are the differences in behaviour or generated files between the standalone packages and this
38
+ library.
39
+
40
+ **Vitest**
41
+
42
+ - `vitest.config.ts` imports `defineConfig` from
43
+ `@nikovirtala/projen-constructs/lib/vitest-define-config` instead of
44
+ `@nikovirtala/projen-vitest/lib/bundled-define-config`. Projen rewrites the file, so there is
45
+ nothing to change by hand.
46
+ - The config is rendered as JSON, so its keys are quoted. The settings are the same.
47
+ - `config.typecheckTsconfig` defaults to the project's development tsconfig (`test/tsconfig.json`
48
+ in current projen) instead of `tsconfig.dev.json`.
49
+ - JSII and construct library projects exclude `vitest.config.ts` from the published package.
50
+ - New: `extraTestConfig` and `extraConfig` for Vitest settings that `config` does not cover.
51
+
52
+ **Homebrew and Colima**
53
+
54
+ - Packages from a tap (`owner/tap/formula`) also add a `tap` line to the `Brewfile`, and the
55
+ `Brewfile` is sorted.
56
+ - The `install:homebrew`, `homebrew:bundle` and `colima` tasks run in bash. `homebrew:bundle` also
57
+ finds a freshly installed `brew` that is not on the `PATH` yet.
58
+
59
+ **LocalStack**
60
+
61
+ - `imageTag` is applied: LocalStack starts with `localstack/localstack:<imageTag>`. It used to be
62
+ ignored.
63
+
64
+ **Bundler / LambdaFunctionCodeBundler**
65
+
66
+ - `LambdaFunctionCodeBundler.bundleOptions` applies to every discovered entrypoint. Its `entrypoint`
67
+ used to replace them all.
68
+
69
+ **LambdaFunctionConstructGenerator**
70
+
71
+ - The bundle task runs `tsx` with the project's development tsconfig instead of `tsconfig.dev.json`.
72
+
73
+ **TypeDoc**: no changes.
74
+
75
+ ## From `AwsCdkApp` to `AwsCdkTypeScriptAppProject`
76
+
77
+ ```typescript
78
+ // before
79
+ import { AwsCdkApp } from "@nikovirtala/projen-aws-cdk-app";
80
+ const project = new AwsCdkApp({ name: "my-app", cdkVersion: "2.221.0" });
81
+
82
+ // after
83
+ import { AwsCdkTypeScriptAppProject } from "@nikovirtala/projen-constructs";
84
+ const project = new AwsCdkTypeScriptAppProject({ name: "my-app", cdkVersion: "2.221.0" });
85
+ ```
86
+
87
+ Both are ES module apps using pnpm, Biome, Vitest and mise. The differences:
88
+
89
+ - **Native TypeScript**: `.projenrc.ts` and the app run with `node` instead of `tsx`, and the
90
+ tsconfig sets `erasableSyntaxOnly` and `verbatimModuleSyntax` (see
91
+ [Native TypeScript](./configuration.md#native-typescript)).
92
+ - **`nvm` is removed.** Use mise (on by default), which pins the Node.js version in `mise.toml`.
93
+ - **Homebrew is on by default.** The project gets a `Brewfile`, and `npx projen` runs
94
+ `install:homebrew` (installs Homebrew if `brew` is missing) and `homebrew:bundle`. Set
95
+ `homebrew: false` to turn it off.
96
+ - **cdk.json `app`** is `node src/main.ts` instead of `tsx --tsconfig tsconfig.json src/main.ts`.
97
+ - **Defaults** come from this library: Node.js, TypeScript, CDK and pnpm versions (pnpm 12 instead
98
+ of 10), Dependabot off, auto-merge on, `auto-approve` and `auto-merge` labels on dependency
99
+ upgrade PRs, and auto-approval of PRs by `nikovirtala`. Any option you set explicitly still wins,
100
+ so set `autoApproveOptions` if you are not `nikovirtala`.
101
+ - **tsconfig**: `noImplicitOverride` and `allowSyntheticDefaultImports` move from `tsconfig.json`
102
+ to the development tsconfig (`test/tsconfig.json`).
103
+ - **Options removed from the interface**: `eslint`, `jest`, `prettier` (and their options),
104
+ `sampleCode` and `tsJestOptions`.
105
+ - `vitestOptions` takes the `VitestOptions` of this library, and now also `homebrewOptions` and
106
+ `miseOptions`.