@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,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`.
@@ -67,7 +67,7 @@ function convertToPosixPath(p) {
67
67
  * single file.
68
68
  */
69
69
  class Bundler extends projen_1.Component {
70
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Bundler", version: "0.5.1" };
70
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Bundler", version: "0.5.2" };
71
71
  /**
72
72
  * Returns the `Bundler` instance associated with a project or `undefined` if
73
73
  * there is no Bundler.
@@ -221,7 +221,7 @@ exports.Bundler = Bundler;
221
221
  * });
222
222
  */
223
223
  class LambdaFunctionCodeBundle extends projen_1.Component {
224
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LambdaFunctionCodeBundle", version: "0.5.1" };
224
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LambdaFunctionCodeBundle", version: "0.5.2" };
225
225
  /**
226
226
  * Defines a pre-bundled AWS Lambda Function code asset from handler code.
227
227
  *
@@ -273,7 +273,7 @@ exports.LambdaFunctionCodeBundle = LambdaFunctionCodeBundle;
273
273
  * Creates Lambda Function code bundles from entrypoints discovered in the project's source tree.
274
274
  */
275
275
  class LambdaFunctionCodeBundler extends projen_1.cdk.AutoDiscoverBase {
276
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LambdaFunctionCodeBundler", version: "0.5.1" };
276
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LambdaFunctionCodeBundler", version: "0.5.2" };
277
277
  constructor(project, options) {
278
278
  super(project, {
279
279
  projectdir: options.srcdir,
@@ -11,7 +11,7 @@ const homebrew_1 = require("./homebrew");
11
11
  * Adds Colima support to your project with automatic installation and startup.
12
12
  */
13
13
  class Colima extends component_1.Component {
14
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Colima", version: "0.5.1" };
14
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Colima", version: "0.5.2" };
15
15
  constructor(scope) {
16
16
  super(scope);
17
17
  const project = this.project;
@@ -14,7 +14,7 @@ function tapOf(packageName) {
14
14
  return parts.length === 3 ? `${parts[0]}/${parts[1]}` : undefined;
15
15
  }
16
16
  class Homebrew extends component_1.Component {
17
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Homebrew", version: "0.5.1" };
17
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Homebrew", version: "0.5.2" };
18
18
  static of(project) {
19
19
  const isHomebrew = (c) => c instanceof Homebrew;
20
20
  return project.components.find(isHomebrew);
@@ -44,7 +44,7 @@ const utils_1 = require("../utils");
44
44
  * The bundling happens during projen execution, not during CDK synth, enabling a "build once, deploy many" pattern.
45
45
  */
46
46
  class LambdaFunctionConstructGenerator extends projen_1.Component {
47
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LambdaFunctionConstructGenerator", version: "0.5.1" };
47
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LambdaFunctionConstructGenerator", version: "0.5.2" };
48
48
  sourceDir;
49
49
  outputDir;
50
50
  filePattern;
@@ -12,7 +12,7 @@ const homebrew_1 = require("./homebrew");
12
12
  * Adds LocalStack support to your project with automatic Docker/Colima setup.
13
13
  */
14
14
  class LocalStack extends component_1.Component {
15
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LocalStack", version: "0.5.1" };
15
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LocalStack", version: "0.5.2" };
16
16
  constructor(scope, options = {}) {
17
17
  super(scope);
18
18
  const project = javascript_1.NodeProject.of(this);
@@ -7,7 +7,7 @@ const component_1 = require("projen/lib/component");
7
7
  const textfile_1 = require("projen/lib/textfile");
8
8
  const homebrew_1 = require("./homebrew");
9
9
  class Mise extends component_1.Component {
10
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Mise", version: "0.5.1" };
10
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Mise", version: "0.5.2" };
11
11
  static of(project) {
12
12
  const isMise = (c) => c instanceof Mise;
13
13
  return project.components.find(isMise);
@@ -34,7 +34,7 @@ const DEFAULT_CONFIG = {
34
34
  * TypeDoc component for projen projects
35
35
  */
36
36
  class TypeDoc extends component_1.Component {
37
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.TypeDoc", version: "0.5.1" };
37
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.TypeDoc", version: "0.5.2" };
38
38
  static of(project) {
39
39
  const isTypeDoc = (c) => c instanceof TypeDoc;
40
40
  return project.components.find(isTypeDoc);
@@ -141,7 +141,7 @@ var CoverageReporter;
141
141
  CoverageReporter["TEXT"] = "text";
142
142
  })(CoverageReporter || (exports.CoverageReporter = CoverageReporter = {}));
143
143
  class Vitest extends component_1.Component {
144
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Vitest", version: "0.5.1" };
144
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Vitest", version: "0.5.2" };
145
145
  static of(project) {
146
146
  const isVitest = (c) => c instanceof Vitest;
147
147
  return project.components.find(isVitest);
@@ -428,7 +428,7 @@ class TypeScriptClassRenderer {
428
428
  */
429
429
  class ProjectGenerator extends projen.Component {
430
430
  options;
431
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.ProjectGenerator", version: "0.5.1" };
431
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.ProjectGenerator", version: "0.5.2" };
432
432
  renderer;
433
433
  static enumGenerated = false;
434
434
  /**
@@ -15,7 +15,7 @@ const utils_1 = require("../utils");
15
15
  * Extends Projen's base class with opinionated defaults and automatic component setup.
16
16
  */
17
17
  class AwsCdkConstructLibraryProject extends projen_1.awscdk.AwsCdkConstructLibrary {
18
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.AwsCdkConstructLibraryProject", version: "0.5.1" };
18
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.AwsCdkConstructLibraryProject", version: "0.5.2" };
19
19
  /**
20
20
  * @param options - Project configuration
21
21
  */
@@ -15,7 +15,7 @@ const utils_1 = require("../utils");
15
15
  * Extends Projen's base class with opinionated defaults and automatic component setup.
16
16
  */
17
17
  class AwsCdkTypeScriptAppProject extends projen_1.awscdk.AwsCdkTypeScriptApp {
18
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.AwsCdkTypeScriptAppProject", version: "0.5.1" };
18
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.AwsCdkTypeScriptAppProject", version: "0.5.2" };
19
19
  /**
20
20
  * @param options - Project configuration
21
21
  */
@@ -16,7 +16,7 @@ const utils_1 = require("../utils");
16
16
  * Extends Projen's base class with opinionated defaults and automatic component setup.
17
17
  */
18
18
  class JsiiProject extends projen_1.cdk.JsiiProject {
19
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.JsiiProject", version: "0.5.1" };
19
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.JsiiProject", version: "0.5.2" };
20
20
  /**
21
21
  * @param options - Project configuration
22
22
  */
@@ -15,7 +15,7 @@ const utils_1 = require("../utils");
15
15
  * Extends Projen's base class with opinionated defaults and automatic component setup.
16
16
  */
17
17
  class TypeScriptProject extends projen_1.typescript.TypeScriptProject {
18
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.TypeScriptProject", version: "0.5.1" };
18
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.TypeScriptProject", version: "0.5.2" };
19
19
  /**
20
20
  * @param options - Project configuration
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nikovirtala/projen-constructs",
3
- "description": "Projen project types with standard configuration",
3
+ "description": "Opinionated projen project types that scaffold TypeScript, JSII and AWS CDK repositories with one shared config.",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/nikovirtala/projen-constructs.git"
@@ -60,7 +60,7 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "version": "0.5.1",
63
+ "version": "0.5.2",
64
64
  "types": "lib/index.d.ts",
65
65
  "jsii": {
66
66
  "outdir": "dist",
@@ -96,6 +96,7 @@
96
96
  "test:watch": "projen test:watch",
97
97
  "typedoc": "projen typedoc",
98
98
  "unbump": "projen unbump",
99
+ "update-readme": "projen update-readme",
99
100
  "update-versions": "projen update-versions",
100
101
  "upgrade": "projen upgrade",
101
102
  "watch": "projen watch",