@nikovirtala/projen-constructs 0.3.80 → 0.3.82
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.
- package/.jsii +55 -42
- package/README.md +104 -0
- package/docs/api/assets/search.js +1 -1
- package/docs/api/classes/AwsCdkConstructLibraryProject.html +1 -1
- package/docs/api/classes/AwsCdkTypeScriptAppProject.html +1 -1
- package/docs/api/classes/JsiiProject.html +1 -1
- package/docs/api/classes/ProjectGenerator.html +1 -1
- package/docs/api/classes/TypeScriptProject.html +1 -1
- package/docs/api/classes/Vitest.html +9 -7
- package/docs/api/index.html +129 -0
- package/docs/api/interfaces/ProjectGeneratorOptions.html +1 -1
- package/lib/components/bundle-lambda-function-code.js +3 -3
- package/lib/components/colima.js +1 -1
- package/lib/components/homebrew.js +1 -1
- package/lib/components/lambda-function-construct-generator.js +1 -1
- package/lib/components/localstack.js +1 -1
- package/lib/components/mise.js +1 -1
- package/lib/components/typedoc.js +1 -1
- package/lib/components/vitest.d.ts +16 -0
- package/lib/components/vitest.js +39 -2
- package/lib/project-generator.js +1 -1
- package/lib/projects/awscdk-construct-library.generated.js +1 -1
- package/lib/projects/awscdk-typescript-app.generated.js +1 -1
- package/lib/projects/jsii.generated.js +1 -1
- package/lib/projects/typescript.generated.js +1 -1
- package/package.json +1 -1
package/.jsii
CHANGED
|
@@ -4196,7 +4196,7 @@
|
|
|
4196
4196
|
},
|
|
4197
4197
|
"name": "@nikovirtala/projen-constructs",
|
|
4198
4198
|
"readme": {
|
|
4199
|
-
"markdown": "# @nikovirtala/projen-constructs\n\nProjen project types with standard configuration for consistent project setup across all repositories.\n\n## Installation\n\n```bash\npnpm add -D @nikovirtala/projen-constructs projen constructs\n```\n\nRequires pnpm 11 and `projen` >= 0.101.27. `@mrgrain/cdk-esbuild` and `constructs` are peer\ndependencies as well.\n\nTo create a project from scratch:\n\n```bash\npnpm dlx projen new --from @nikovirtala/projen-constructs aws_cdk_construct_library\n```\n\n## Features\n\n- **Standard Configuration**: Opinionated defaults for author, release branch, package manager, Node.js, TypeScript, and tooling\n- **Automatic Project Type Discovery**: Generates the `ProjectType` enum from Projen's JSII manifest (19 project types)\n- **Component System**: Reusable components (Vitest, TypeDoc, Mise, Homebrew, Colima, LocalStack, Lambda bundling)\n- **Code Generation**: `ProjectGenerator` creates project classes with standard configuration\n- **ES Modules**: TypeScript and CDK App projects use ES modules (JSII uses CommonJS)\n- **Code Quality**: Biome for formatting and linting\n- **Testing**: Vitest with coverage\n- **Auto-merge**: Enabled with auto-approve\n- **VSCode**: Recommended extensions and settings\n- **mise**: Node version management\n\n## Standard Configuration\n\n- **Author**: Niko Virtala (niko.virtala@hey.com)\n- **Default Release Branch**: main\n- **Package Manager**: pnpm 11.20.0\n- **Node Version**: 24.19.0\n- **TypeScript**: 6.0.3\n- **CDK Version**: 2.263.0 (for CDK projects)\n- **JSII Version**: ~6.0.3 (for JSII projects)\n\nThe AWS CDK, Node.js and TypeScript versions live in `src/versions.json` and are refreshed by the\n`update-versions` task, which the dependency upgrade workflow runs.\n\n### pnpm\n\npnpm reads its settings from `pnpm-workspace.yaml`, not `.npmrc`, since pnpm 11. Generated projects\nget:\n\n| Setting | Value | Reason |\n| ---------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------ |\n| `nodeLinker` | `hoisted` | jsii tooling resolves dependencies from a flat `node_modules` |\n| `allowBuilds` | `esbuild: true` | esbuild links its platform binary in a postinstall script, and pnpm 11 fails an install with ignored builds |\n| `verifyDepsBeforeRun` | `false` | projen resolves the task `PATH` with `$(pnpm -c exec ...)`, which otherwise re-enters `pnpm install` and deadlocks |\n| `minimumReleaseAge` | `0` | the pnpm 11 default of 1440 minutes makes pnpm write `minimumReleaseAgeExclude` entries into this generated file |\n\n### TypeScript configuration\n\nProjen renders three configs, and none of them should be edited directly:\n\n- `tsconfig.json` compiles `src` to `lib`. For JSII projects, jsii validates it against its `strict`\n rule set, so it only carries compiler options jsii accepts.\n- `test/tsconfig.json` extends it and is type-check only. This is the config Vitest type checking and\n the editor use, and the one `tsconfigDev` points at.\n- `projenrc/tsconfig.json` covers `.projenrc.ts`.\n\n## Customization\n\nOverride any option by passing it to the constructor:\n\n```typescript\nconst project = new JsiiProject({\n name: \"my-project\",\n repositoryUrl: \"https://github.com/nikovirtala/my-project.git\",\n minNodeVersion: \"24.0.0\",\n author: \"Custom Author\",\n authorAddress: \"custom@example.com\",\n mise: false,\n vitest: false,\n tsconfig: {\n compilerOptions: {\n noUnusedLocals: false,\n },\n },\n biomeOptions: {\n biomeConfig: {\n formatter: {\n lineWidth: 100,\n },\n },\n },\n});\n```\n\nEvery component is exposed as an enable flag (`mise`, `vitest`, ...) plus an options property\n(`miseOptions`, `vitestOptions`, ...).\n\n## Usage\n\n### Projects\n\n#### AWS CDK Construct Library Project\n\n```typescript\nimport { AwsCdkConstructLibraryProject } from \"@nikovirtala/projen-constructs\";\n\nconst project = new AwsCdkConstructLibraryProject({\n name: \"my-cdk-construct\",\n repositoryUrl: \"https://github.com/nikovirtala/my-cdk-construct.git\",\n});\n\nproject.synth();\n```\n\n#### AWS CDK TypeScript App Project\n\n```typescript\nimport { AwsCdkTypeScriptAppProject } from \"@nikovirtala/projen-constructs\";\n\nconst project = new AwsCdkTypeScriptAppProject({\n name: \"my-cdk-app\",\n repositoryUrl: \"https://github.com/nikovirtala/my-cdk-app.git\",\n});\n\nproject.synth();\n```\n\n#### JSII Project\n\n```typescript\nimport { JsiiProject } from \"@nikovirtala/projen-constructs\";\n\nconst project = new JsiiProject({\n name: \"my-jsii-project\",\n repositoryUrl: \"https://github.com/nikovirtala/my-jsii-project.git\",\n});\n\nproject.synth();\n```\n\n#### TypeScript Project\n\n```typescript\nimport { TypeScriptProject } from \"@nikovirtala/projen-constructs\";\n\nconst project = new TypeScriptProject({\n name: \"my-typescript-project\",\n repositoryUrl: \"https://github.com/nikovirtala/my-typescript-project.git\",\n});\n\nproject.synth();\n```\n\n### Components\n\nThe package includes reusable components for common development tasks:\n\n#### Vitest\n\n[Vitest](https://vitest.dev) testing framework component.\n\n```typescript\nimport { Vitest } from \"@nikovirtala/projen-constructs\";\n\nnew Vitest(project, {\n vitestVersion: \"^4\",\n config: {\n coverageProvider: CoverageProvider.V8,\n coverageReporters: [CoverageReporter.TEXT, CoverageReporter.LCOV],\n },\n});\n```\n\nType checking runs against the project's development tsconfig (`test/tsconfig.json`) unless\n`config.typecheckTsconfig` says otherwise.\n\nFor Vitest settings that `config` doesn't cover, use `extraTestConfig` (merged into `test`) and\n`extraConfig` (top-level options next to `test`):\n\n```typescript\nnew Vitest(project, {\n extraTestConfig: {\n setupFiles: [\"test/setup.ts\"],\n },\n extraConfig: {\n resolve: { alias: { \"@\": \"/src\" } },\n },\n});\n```\n\n`extraTestConfig` is deep-merged over the generated `test` options: objects merge, and other values\n(including arrays) replace the generated value. Both options are rendered as JSON, so their values\ncan't contain functions or regular expressions, which rules out plugins.\n\n#### TypeDoc\n\n[TypeDoc](https://typedoc.org) documentation generation component.\n\n```typescript\nimport { TypeDoc, EntryPointStrategy } from \"@nikovirtala/projen-constructs\";\n\nnew TypeDoc(project, {\n version: \"^0.28\",\n typeDocConfig: {\n entryPointStrategy: EntryPointStrategy.EXPAND,\n out: \"docs/api\",\n exclude: [\"**/*.test.ts\"],\n },\n});\n```\n\n#### Mise\n\n[Mise](https://mise.jdx.dev) dev tools/runtimes management component.\n\n```typescript\nimport { Mise } from \"@nikovirtala/projen-constructs\";\n\nnew Mise(project, {\n nodeVersion: \"24.19.0\",\n});\n```\n\n#### Homebrew\n\n[Homebrew](https://brew.sh) package management component. Writes a `Brewfile` and adds an\n`install:homebrew` task that bootstraps Homebrew and runs `brew bundle`.\n\n```typescript\nimport { Homebrew } from \"@nikovirtala/projen-constructs\";\n\nconst homebrew = new Homebrew(project, {\n packages: [\"jq\", \"yq\"],\n});\n\nhomebrew.addPackage(\"gh\");\n```\n\n#### Colima\n\n[Colima](https://github.com/abiosoft/colima) container runtime component. Alternative for Docker.\n\n```typescript\nimport { Colima } from \"@nikovirtala/projen-constructs\";\n\nnew Colima(project);\n```\n\n#### LocalStack\n\n[LocalStack](https://www.localstack.cloud) AWS emulation component.\n\n```typescript\nimport { LocalStack } from \"@nikovirtala/projen-constructs\";\n\nnew LocalStack(project, {\n services: [\"s3\", \"lambda\", \"dynamodb\"],\n port: 4566,\n debug: true,\n});\n```\n\n#### LambdaFunctionConstructGenerator\n\nGenerates AWS CDK Lambda Function constructs and bundles their code.\n\n```typescript\nimport { LambdaFunctionConstructGenerator } from \"@nikovirtala/projen-constructs\";\n\nnew LambdaFunctionConstructGenerator(project, {\n sourceDir: \"src/handlers\",\n outputDir: \"src/constructs/lambda\",\n filePattern: \"*.lambda.ts\",\n esbuildOptions: {\n minify: true,\n sourcemap: true,\n },\n});\n```\n\n#### Bundler\n\nLow-level bundling utilities for Lambda functions.\n\n```typescript\nimport {\n Bundler,\n LambdaFunctionCodeBundle,\n} from \"@nikovirtala/projen-constructs\";\n\nconst bundler = new Bundler(project, {\n assetsDir: \"assets\",\n esbuildVersion: \"^0.25\",\n});\n\nnew LambdaFunctionCodeBundle(project, {\n entrypoint: \"src/my-function.lambda.ts\",\n extension: \".lambda.ts\",\n});\n```\n\n#### ProjectGenerator\n\nGenerates TypeScript project classes with standard configuration.\n\n```typescript\nimport { ProjectGenerator, ProjectType } from \"@nikovirtala/projen-constructs\";\n\nnew ProjectGenerator(project, {\n name: \"TypeScriptProject\",\n projectType: ProjectType.TYPE_SCRIPT_PROJECT,\n filePath: \"./src/projects/typescript.generated.ts\",\n components: [\n { componentClass: Mise },\n { componentClass: Vitest }, // Auto-detects VitestOptions from JSII manifest\n ],\n});\n```\n\nFeatures:\n\n- Automatically generates the `ProjectType` enum from Projen's JSII manifest\n- Auto-detects component options types from JSII manifests\n- Strips Projen's `@pjnew` annotation from `packageManager`, which `projen new` would otherwise\n render into a generated `.projenrc.ts` as the package manager that ran the command\n- Validates paths to prevent directory traversal attacks\n- Structured error handling with custom error classes\n\n## Development\n\nThis project is managed by Projen and generates itself: `.projenrc.ts` defines the project using the\n`JsiiProject` type from `src/`. Configuration changes belong in `.projenrc.ts`, never in the\ngenerated files.\n\n```bash\npnpm projen # synthesize project files\npnpm build # synthesize, compile, test and package\npnpm test # biome, vitest, typedoc\npnpm test:watch # vitest in watch mode\npnpm test:update # update snapshots\npnpm biome # format and lint\npnpm docgen # regenerate API.md from the .jsii manifest\npnpm update-versions # refresh src/versions.json\npnpm upgrade # upgrade dependencies\n```\n\n### Build process\n\n```mermaid\nflowchart TD\n projenrc[\".projenrc.ts\"]\n\n subgraph synthesize[\"default (synthesize)\"]\n direction TB\n synth[\"tsx .projenrc.ts\"]\n generator[\"ProjectGenerator\"]\n generated[\"src/project-type.ts<br/>src/projects/*.generated.ts<br/>src/projects/*-options.generated.ts\"]\n projenfiles[\"package.json, tsconfig.json,<br/>pnpm-workspace.yaml, workflows, ...\"]\n brew[\"install:homebrew<br/>brew bundle\"]\n definecfg[\"bundle-vitest-define-config<br/>esbuild → lib/vitest-define-config.js\"]\n\n synth --> generator --> generated\n synth --> projenfiles\n synth --> brew\n synth --> definecfg\n end\n\n subgraph compile[\"compile\"]\n direction TB\n jsii[\"jsii<br/>validates tsconfig.json against the strict rule set\"]\n lib[\"lib/**\"]\n manifest[\".jsii manifest\"]\n\n jsii --> lib\n jsii --> manifest\n end\n\n subgraph test[\"test\"]\n direction TB\n biome[\"biome check --write\"]\n vitest[\"vitest run<br/>+ type checking\"]\n typedoc[\"typedoc → docs/api\"]\n\n biome --> vitest --> typedoc\n end\n\n subgraph package[\"package\"]\n direction TB\n pacmak[\"jsii-pacmak<br/>--pack-command 'pnpm pack'\"]\n dist[\"dist/js/*.tgz\"]\n\n pacmak --> dist\n end\n\n projenrc --> synthesize\n synthesize --> compile\n compile --> test\n test --> package\n\n manifest -. \"component options FQNs<br/>read on the next synthesis\" .-> generator\n docgen[\"docgen<br/>jsii-docgen → API.md\"]\n manifest --> docgen\n\n classDef artifact fill:#eef,stroke:#88a\n class generated,projenfiles,lib,manifest,dist artifact\n```\n\nThe dashed edge is the part worth knowing about: `ProjectGenerator` reads the committed `.jsii`\nmanifest to resolve component options types, so the manifest produced by `compile` feeds the *next*\nsynthesis. This is why `.jsii` is committed rather than ignored. A component options type that is\nmissing from the manifest is reported as a warning and its options property is left out of the\ngenerated interface, which is expected only while a new component is being introduced: compile once,\nthen synthesize again.\n\n`package` runs `package:js` on CI and `package-all` locally; both end up in `jsii-pacmak`.\n`docgen` is not part of `build` and has to be run explicitly after the manifest changes.\n"
|
|
4199
|
+
"markdown": "# @nikovirtala/projen-constructs\n\nProjen project types with standard configuration for consistent project setup across all repositories.\n\n## Installation\n\n```bash\npnpm add -D @nikovirtala/projen-constructs projen constructs\n```\n\nRequires pnpm 11 and `projen` >= 0.101.27. `@mrgrain/cdk-esbuild` and `constructs` are peer\ndependencies as well.\n\nTo create a project from scratch:\n\n```bash\npnpm dlx projen new --from @nikovirtala/projen-constructs aws_cdk_construct_library\n```\n\n## Features\n\n- **Standard Configuration**: Opinionated defaults for author, release branch, package manager, Node.js, TypeScript, and tooling\n- **Automatic Project Type Discovery**: Generates the `ProjectType` enum from Projen's JSII manifest (19 project types)\n- **Component System**: Reusable components (Vitest, TypeDoc, Mise, Homebrew, Colima, LocalStack, Lambda bundling)\n- **Code Generation**: `ProjectGenerator` creates project classes with standard configuration\n- **ES Modules**: TypeScript and CDK App projects use ES modules (JSII uses CommonJS)\n- **Code Quality**: Biome for formatting and linting\n- **Testing**: Vitest with coverage\n- **Auto-merge**: Enabled with auto-approve\n- **VSCode**: Recommended extensions and settings\n- **mise**: Node version management\n\n## Standard Configuration\n\n- **Author**: Niko Virtala (niko.virtala@hey.com)\n- **Default Release Branch**: main\n- **Package Manager**: pnpm 11.20.0\n- **Node Version**: 24.19.0\n- **TypeScript**: 6.0.3\n- **CDK Version**: 2.263.0 (for CDK projects)\n- **JSII Version**: ~6.0.3 (for JSII projects)\n\nThe AWS CDK, Node.js and TypeScript versions live in `src/versions.json` and are refreshed by the\n`update-versions` task, which the dependency upgrade workflow runs.\n\n### pnpm\n\npnpm reads its settings from `pnpm-workspace.yaml`, not `.npmrc`, since pnpm 11. Generated projects\nget:\n\n| Setting | Value | Reason |\n| ---------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------ |\n| `nodeLinker` | `hoisted` | jsii tooling resolves dependencies from a flat `node_modules` |\n| `allowBuilds` | `esbuild: true` | esbuild links its platform binary in a postinstall script, and pnpm 11 fails an install with ignored builds |\n| `verifyDepsBeforeRun` | `false` | projen resolves the task `PATH` with `$(pnpm -c exec ...)`, which otherwise re-enters `pnpm install` and deadlocks |\n| `minimumReleaseAge` | `0` | the pnpm 11 default of 1440 minutes makes pnpm write `minimumReleaseAgeExclude` entries into this generated file |\n\n### TypeScript configuration\n\nProjen renders three configs, and none of them should be edited directly:\n\n- `tsconfig.json` compiles `src` to `lib`. For JSII projects, jsii validates it against its `strict`\n rule set, so it only carries compiler options jsii accepts.\n- `test/tsconfig.json` extends it and is type-check only. This is the config Vitest type checking and\n the editor use, and the one `tsconfigDev` points at.\n- `projenrc/tsconfig.json` covers `.projenrc.ts`.\n\n## Customization\n\nOverride any option by passing it to the constructor:\n\n```typescript\nconst project = new JsiiProject({\n name: \"my-project\",\n repositoryUrl: \"https://github.com/nikovirtala/my-project.git\",\n minNodeVersion: \"24.0.0\",\n author: \"Custom Author\",\n authorAddress: \"custom@example.com\",\n mise: false,\n vitest: false,\n tsconfig: {\n compilerOptions: {\n noUnusedLocals: false,\n },\n },\n biomeOptions: {\n biomeConfig: {\n formatter: {\n lineWidth: 100,\n },\n },\n },\n});\n```\n\nEvery component is exposed as an enable flag (`mise`, `vitest`, ...) plus an options property\n(`miseOptions`, `vitestOptions`, ...).\n\n## Usage\n\n### Projects\n\n#### AWS CDK Construct Library Project\n\n```typescript\nimport { AwsCdkConstructLibraryProject } from \"@nikovirtala/projen-constructs\";\n\nconst project = new AwsCdkConstructLibraryProject({\n name: \"my-cdk-construct\",\n repositoryUrl: \"https://github.com/nikovirtala/my-cdk-construct.git\",\n});\n\nproject.synth();\n```\n\n#### AWS CDK TypeScript App Project\n\n```typescript\nimport { AwsCdkTypeScriptAppProject } from \"@nikovirtala/projen-constructs\";\n\nconst project = new AwsCdkTypeScriptAppProject({\n name: \"my-cdk-app\",\n repositoryUrl: \"https://github.com/nikovirtala/my-cdk-app.git\",\n});\n\nproject.synth();\n```\n\n#### JSII Project\n\n```typescript\nimport { JsiiProject } from \"@nikovirtala/projen-constructs\";\n\nconst project = new JsiiProject({\n name: \"my-jsii-project\",\n repositoryUrl: \"https://github.com/nikovirtala/my-jsii-project.git\",\n});\n\nproject.synth();\n```\n\n#### TypeScript Project\n\n```typescript\nimport { TypeScriptProject } from \"@nikovirtala/projen-constructs\";\n\nconst project = new TypeScriptProject({\n name: \"my-typescript-project\",\n repositoryUrl: \"https://github.com/nikovirtala/my-typescript-project.git\",\n});\n\nproject.synth();\n```\n\n### Components\n\nThe package includes reusable components for common development tasks:\n\n#### Vitest\n\n[Vitest](https://vitest.dev) testing framework component.\n\n```typescript\nimport { Vitest } from \"@nikovirtala/projen-constructs\";\n\nnew Vitest(project, {\n vitestVersion: \"^4\",\n config: {\n coverageProvider: CoverageProvider.V8,\n coverageReporters: [CoverageReporter.TEXT, CoverageReporter.LCOV],\n },\n});\n```\n\nType checking runs against the project's development tsconfig (`test/tsconfig.json`) unless\n`config.typecheckTsconfig` says otherwise.\n\nFor Vitest settings that `config` doesn't cover, use `extraTestConfig` (merged into `test`) and\n`extraConfig` (top-level options next to `test`):\n\n```typescript\nnew Vitest(project, {\n extraTestConfig: {\n setupFiles: [\"test/setup.ts\"],\n },\n extraConfig: {\n resolve: { alias: { \"@\": \"/src\" } },\n },\n});\n```\n\n`extraTestConfig` is deep-merged over the generated `test` options: objects merge, and other values\n(including arrays) replace the generated value. Both options are rendered as JSON, so their values\ncan't contain functions or regular expressions, which rules out plugins.\n\n#### TypeDoc\n\n[TypeDoc](https://typedoc.org) documentation generation component.\n\n```typescript\nimport { TypeDoc, EntryPointStrategy } from \"@nikovirtala/projen-constructs\";\n\nnew TypeDoc(project, {\n version: \"^0.28\",\n typeDocConfig: {\n entryPointStrategy: EntryPointStrategy.EXPAND,\n out: \"docs/api\",\n exclude: [\"**/*.test.ts\"],\n },\n});\n```\n\n#### Mise\n\n[Mise](https://mise.jdx.dev) dev tools/runtimes management component.\n\n```typescript\nimport { Mise } from \"@nikovirtala/projen-constructs\";\n\nnew Mise(project, {\n nodeVersion: \"24.19.0\",\n});\n```\n\n#### Homebrew\n\n[Homebrew](https://brew.sh) package management component. Writes a `Brewfile` and adds an\n`install:homebrew` task that bootstraps Homebrew and runs `brew bundle`.\n\n```typescript\nimport { Homebrew } from \"@nikovirtala/projen-constructs\";\n\nconst homebrew = new Homebrew(project, {\n packages: [\"jq\", \"yq\"],\n});\n\nhomebrew.addPackage(\"gh\");\n```\n\n#### Colima\n\n[Colima](https://github.com/abiosoft/colima) container runtime component. Alternative for Docker.\n\n```typescript\nimport { Colima } from \"@nikovirtala/projen-constructs\";\n\nnew Colima(project);\n```\n\n#### LocalStack\n\n[LocalStack](https://www.localstack.cloud) AWS emulation component.\n\n```typescript\nimport { LocalStack } from \"@nikovirtala/projen-constructs\";\n\nnew LocalStack(project, {\n services: [\"s3\", \"lambda\", \"dynamodb\"],\n port: 4566,\n debug: true,\n});\n```\n\n#### LambdaFunctionConstructGenerator\n\nGenerates AWS CDK Lambda Function constructs and bundles their code.\n\n```typescript\nimport { LambdaFunctionConstructGenerator } from \"@nikovirtala/projen-constructs\";\n\nnew LambdaFunctionConstructGenerator(project, {\n sourceDir: \"src/handlers\",\n outputDir: \"src/constructs/lambda\",\n filePattern: \"*.lambda.ts\",\n esbuildOptions: {\n minify: true,\n sourcemap: true,\n },\n});\n```\n\n#### Bundler\n\nLow-level bundling utilities for Lambda functions.\n\n```typescript\nimport {\n Bundler,\n LambdaFunctionCodeBundle,\n} from \"@nikovirtala/projen-constructs\";\n\nconst bundler = new Bundler(project, {\n assetsDir: \"assets\",\n esbuildVersion: \"^0.25\",\n});\n\nnew LambdaFunctionCodeBundle(project, {\n entrypoint: \"src/my-function.lambda.ts\",\n extension: \".lambda.ts\",\n});\n```\n\n#### ProjectGenerator\n\nGenerates TypeScript project classes with standard configuration.\n\n```typescript\nimport { ProjectGenerator, ProjectType } from \"@nikovirtala/projen-constructs\";\n\nnew ProjectGenerator(project, {\n name: \"TypeScriptProject\",\n projectType: ProjectType.TYPE_SCRIPT_PROJECT,\n filePath: \"./src/projects/typescript.generated.ts\",\n components: [\n { componentClass: Mise },\n { componentClass: Vitest }, // Auto-detects VitestOptions from JSII manifest\n ],\n});\n```\n\nFeatures:\n\n- Automatically generates the `ProjectType` enum from Projen's JSII manifest\n- Auto-detects component options types from JSII manifests\n- Strips Projen's `@pjnew` annotation from `packageManager`, which `projen new` would otherwise\n render into a generated `.projenrc.ts` as the package manager that ran the command\n- Validates paths to prevent directory traversal attacks\n- Structured error handling with custom error classes\n\n## Migrating from the standalone packages\n\nThe components used to be published as separate packages. Those packages are deprecated and won't\nget new features or fixes. Every class, interface, enum and function they exported is exported from\n`@nikovirtala/projen-constructs` under the same name, except `AwsCdkApp` (see below).\n\n| Deprecated package | Replacement in `@nikovirtala/projen-constructs` |\n| --- | --- |\n| `@nikovirtala/projen-vitest` | `Vitest`, `VitestOptions`, `VitestConfigOptions`, `Environment`, `Pool`, `CoverageProvider`, `CoverageReporter` |\n| `@nikovirtala/projen-typedoc` | `TypeDoc`, `TypeDocOptions`, `TypeDocConfiguration` and its enums |\n| `@nikovirtala/projen-homebrew` | `Homebrew`, `HomebrewOptions` |\n| `@nikovirtala/projen-colima` | `Colima` |\n| `@nikovirtala/projen-localstack` | `LocalStack`, `LocalStackOptions` |\n| `@nikovirtala/projen-bundle-lambda-function-code` | `Bundler`, `LambdaFunctionCodeBundle`, `LambdaFunctionCodeBundler` and their options |\n| `@nikovirtala/projen-lambda-function-construct-generator` | `LambdaFunctionConstructGenerator`, `LambdaFunctionConstructGeneratorOptions` |\n| `@nikovirtala/projen-aws-cdk-app` | `AwsCdkTypeScriptAppProject`, `AwsCdkTypeScriptAppProjectOptions` |\n\n### Steps\n\n1. In `.projenrc.ts`, replace the old package in `devDeps` with `@nikovirtala/projen-constructs`, and\n change the imports:\n\n ```typescript\n // before\n import { Vitest } from \"@nikovirtala/projen-vitest\";\n // after\n import { Vitest } from \"@nikovirtala/projen-constructs\";\n ```\n\n2. Check the peer dependencies. `@nikovirtala/projen-constructs` needs `projen` ^0.104, `constructs`\n ^10 and `@mrgrain/cdk-esbuild` ^5. The standalone packages accepted older projen versions, so you\n may have to upgrade projen in the same change.\n3. Install the new package, run `npx projen` and review the changes to the generated files.\n\n### Changes to expect\n\nThese are the differences in behaviour or generated files between the standalone packages and this\nlibrary.\n\n**Vitest**\n\n- `vitest.config.ts` imports `defineConfig` from\n `@nikovirtala/projen-constructs/lib/vitest-define-config` instead of\n `@nikovirtala/projen-vitest/lib/bundled-define-config`. Projen rewrites the file, so there's\n nothing to change by hand.\n- The config is rendered as JSON, so its keys are quoted. The settings are the same.\n- `config.typecheckTsconfig` defaults to the project's development tsconfig (`test/tsconfig.json`\n in current projen) instead of `tsconfig.dev.json`.\n- JSII and construct library projects exclude `vitest.config.ts` from the published package.\n- New: `extraTestConfig` and `extraConfig` for Vitest settings that `config` doesn't cover.\n\n**Homebrew and Colima**\n\n- Packages from a tap (`owner/tap/formula`) also add a `tap` line to the `Brewfile`, and the\n `Brewfile` is sorted.\n- The `install:homebrew`, `homebrew:bundle` and `colima` tasks run in bash. `homebrew:bundle` also\n finds a freshly installed `brew` that isn't on the `PATH` yet.\n\n**LocalStack**\n\n- `imageTag` is applied: LocalStack starts with `localstack/localstack:<imageTag>`. It used to be\n ignored.\n\n**Bundler / LambdaFunctionCodeBundler**\n\n- `LambdaFunctionCodeBundler.bundleOptions` applies to every discovered entrypoint. Its `entrypoint`\n used to replace them all.\n\n**LambdaFunctionConstructGenerator**\n\n- The bundle task runs `tsx` with the project's development tsconfig instead of `tsconfig.dev.json`.\n\n**TypeDoc**: no changes.\n\n### From `AwsCdkApp` to `AwsCdkTypeScriptAppProject`\n\n```typescript\n// before\nimport { AwsCdkApp } from \"@nikovirtala/projen-aws-cdk-app\";\nconst project = new AwsCdkApp({ name: \"my-app\", cdkVersion: \"2.221.0\" });\n\n// after\nimport { AwsCdkTypeScriptAppProject } from \"@nikovirtala/projen-constructs\";\nconst project = new AwsCdkTypeScriptAppProject({ name: \"my-app\", cdkVersion: \"2.221.0\" });\n```\n\nBoth are ES module apps run with `tsx`, using pnpm, Biome, Vitest and mise. The differences:\n\n- **`nvm` is removed.** Use mise (on by default), which pins the Node.js version in `mise.toml`.\n- **Homebrew is on by default.** The project gets a `Brewfile`, and `npx projen` runs\n `install:homebrew` (installs Homebrew if `brew` is missing) and `homebrew:bundle`. Set\n `homebrew: false` to turn it off.\n- **cdk.json `app`** is `npx tsx src/main.ts` instead of `tsx --tsconfig tsconfig.json src/main.ts`.\n- **Defaults** come from this library: Node.js, TypeScript, CDK and pnpm versions (pnpm 11 instead\n of 10), Dependabot off, auto-merge on, `auto-approve` and `auto-merge` labels on dependency\n upgrade PRs, and auto-approval of PRs by `nikovirtala`. Any option you set explicitly still wins,\n so set `autoApproveOptions` if you aren't `nikovirtala`.\n- **tsconfig**: `noImplicitOverride` and `allowSyntheticDefaultImports` move from `tsconfig.json`\n to the development tsconfig (`test/tsconfig.json`).\n- **Options removed from the interface**: `eslint`, `jest`, `prettier` (and their options),\n `sampleCode` and `tsJestOptions`.\n- `vitestOptions` takes the `VitestOptions` of this library, and now also `homebrewOptions` and\n `miseOptions`.\n\n## Development\n\nThis project is managed by Projen and generates itself: `.projenrc.ts` defines the project using the\n`JsiiProject` type from `src/`. Configuration changes belong in `.projenrc.ts`, never in the\ngenerated files.\n\n```bash\npnpm projen # synthesize project files\npnpm build # synthesize, compile, test and package\npnpm test # biome, vitest, typedoc\npnpm test:watch # vitest in watch mode\npnpm test:update # update snapshots\npnpm biome # format and lint\npnpm docgen # regenerate API.md from the .jsii manifest\npnpm update-versions # refresh src/versions.json\npnpm upgrade # upgrade dependencies\n```\n\n### Build process\n\n```mermaid\nflowchart TD\n projenrc[\".projenrc.ts\"]\n\n subgraph synthesize[\"default (synthesize)\"]\n direction TB\n synth[\"tsx .projenrc.ts\"]\n generator[\"ProjectGenerator\"]\n generated[\"src/project-type.ts<br/>src/projects/*.generated.ts<br/>src/projects/*-options.generated.ts\"]\n projenfiles[\"package.json, tsconfig.json,<br/>pnpm-workspace.yaml, workflows, ...\"]\n brew[\"install:homebrew<br/>brew bundle\"]\n definecfg[\"bundle-vitest-define-config<br/>esbuild → lib/vitest-define-config.js\"]\n\n synth --> generator --> generated\n synth --> projenfiles\n synth --> brew\n synth --> definecfg\n end\n\n subgraph compile[\"compile\"]\n direction TB\n jsii[\"jsii<br/>validates tsconfig.json against the strict rule set\"]\n lib[\"lib/**\"]\n manifest[\".jsii manifest\"]\n\n jsii --> lib\n jsii --> manifest\n end\n\n subgraph test[\"test\"]\n direction TB\n biome[\"biome check --write\"]\n vitest[\"vitest run<br/>+ type checking\"]\n typedoc[\"typedoc → docs/api\"]\n\n biome --> vitest --> typedoc\n end\n\n subgraph package[\"package\"]\n direction TB\n pacmak[\"jsii-pacmak<br/>--pack-command 'pnpm pack'\"]\n dist[\"dist/js/*.tgz\"]\n\n pacmak --> dist\n end\n\n projenrc --> synthesize\n synthesize --> compile\n compile --> test\n test --> package\n\n manifest -. \"component options FQNs<br/>read on the next synthesis\" .-> generator\n docgen[\"docgen<br/>jsii-docgen → API.md\"]\n manifest --> docgen\n\n classDef artifact fill:#eef,stroke:#88a\n class generated,projenfiles,lib,manifest,dist artifact\n```\n\nThe dashed edge is the part worth knowing about: `ProjectGenerator` reads the committed `.jsii`\nmanifest to resolve component options types, so the manifest produced by `compile` feeds the *next*\nsynthesis. This is why `.jsii` is committed rather than ignored. A component options type that is\nmissing from the manifest is reported as a warning and its options property is left out of the\ngenerated interface, which is expected only while a new component is being introduced: compile once,\nthen synthesize again.\n\n`package` runs `package:js` on CI and `package-all` locally; both end up in `jsii-pacmak`.\n`docgen` is not part of `build` and has to be run explicitly after the manifest changes.\n"
|
|
4200
4200
|
},
|
|
4201
4201
|
"repository": {
|
|
4202
4202
|
"type": "git",
|
|
@@ -11781,7 +11781,7 @@
|
|
|
11781
11781
|
"kind": "enum",
|
|
11782
11782
|
"locationInModule": {
|
|
11783
11783
|
"filename": "src/components/vitest.ts",
|
|
11784
|
-
"line":
|
|
11784
|
+
"line": 75
|
|
11785
11785
|
},
|
|
11786
11786
|
"members": [
|
|
11787
11787
|
{
|
|
@@ -11813,7 +11813,7 @@
|
|
|
11813
11813
|
"kind": "enum",
|
|
11814
11814
|
"locationInModule": {
|
|
11815
11815
|
"filename": "src/components/vitest.ts",
|
|
11816
|
-
"line":
|
|
11816
|
+
"line": 91
|
|
11817
11817
|
},
|
|
11818
11818
|
"members": [
|
|
11819
11819
|
{
|
|
@@ -11910,7 +11910,7 @@
|
|
|
11910
11910
|
"kind": "enum",
|
|
11911
11911
|
"locationInModule": {
|
|
11912
11912
|
"filename": "src/components/vitest.ts",
|
|
11913
|
-
"line":
|
|
11913
|
+
"line": 10
|
|
11914
11914
|
},
|
|
11915
11915
|
"members": [
|
|
11916
11916
|
{
|
|
@@ -16201,7 +16201,7 @@
|
|
|
16201
16201
|
"kind": "enum",
|
|
16202
16202
|
"locationInModule": {
|
|
16203
16203
|
"filename": "src/components/vitest.ts",
|
|
16204
|
-
"line":
|
|
16204
|
+
"line": 38
|
|
16205
16205
|
},
|
|
16206
16206
|
"members": [
|
|
16207
16207
|
{
|
|
@@ -20708,7 +20708,7 @@
|
|
|
20708
20708
|
},
|
|
20709
20709
|
"locationInModule": {
|
|
20710
20710
|
"filename": "src/components/vitest.ts",
|
|
20711
|
-
"line":
|
|
20711
|
+
"line": 345
|
|
20712
20712
|
},
|
|
20713
20713
|
"parameters": [
|
|
20714
20714
|
{
|
|
@@ -20729,7 +20729,7 @@
|
|
|
20729
20729
|
"kind": "class",
|
|
20730
20730
|
"locationInModule": {
|
|
20731
20731
|
"filename": "src/components/vitest.ts",
|
|
20732
|
-
"line":
|
|
20732
|
+
"line": 316
|
|
20733
20733
|
},
|
|
20734
20734
|
"methods": [
|
|
20735
20735
|
{
|
|
@@ -20738,7 +20738,7 @@
|
|
|
20738
20738
|
},
|
|
20739
20739
|
"locationInModule": {
|
|
20740
20740
|
"filename": "src/components/vitest.ts",
|
|
20741
|
-
"line":
|
|
20741
|
+
"line": 317
|
|
20742
20742
|
},
|
|
20743
20743
|
"name": "of",
|
|
20744
20744
|
"parameters": [
|
|
@@ -20763,7 +20763,7 @@
|
|
|
20763
20763
|
},
|
|
20764
20764
|
"locationInModule": {
|
|
20765
20765
|
"filename": "src/components/vitest.ts",
|
|
20766
|
-
"line":
|
|
20766
|
+
"line": 466
|
|
20767
20767
|
},
|
|
20768
20768
|
"name": "addExclude",
|
|
20769
20769
|
"parameters": [
|
|
@@ -20781,7 +20781,7 @@
|
|
|
20781
20781
|
},
|
|
20782
20782
|
"locationInModule": {
|
|
20783
20783
|
"filename": "src/components/vitest.ts",
|
|
20784
|
-
"line":
|
|
20784
|
+
"line": 461
|
|
20785
20785
|
},
|
|
20786
20786
|
"name": "addInclude",
|
|
20787
20787
|
"parameters": [
|
|
@@ -20799,7 +20799,7 @@
|
|
|
20799
20799
|
},
|
|
20800
20800
|
"locationInModule": {
|
|
20801
20801
|
"filename": "src/components/vitest.ts",
|
|
20802
|
-
"line":
|
|
20802
|
+
"line": 476
|
|
20803
20803
|
},
|
|
20804
20804
|
"name": "configureCoverageProvider",
|
|
20805
20805
|
"parameters": [
|
|
@@ -20817,7 +20817,7 @@
|
|
|
20817
20817
|
},
|
|
20818
20818
|
"locationInModule": {
|
|
20819
20819
|
"filename": "src/components/vitest.ts",
|
|
20820
|
-
"line":
|
|
20820
|
+
"line": 495
|
|
20821
20821
|
},
|
|
20822
20822
|
"name": "configureCoverageReporters",
|
|
20823
20823
|
"parameters": [
|
|
@@ -20840,7 +20840,7 @@
|
|
|
20840
20840
|
},
|
|
20841
20841
|
"locationInModule": {
|
|
20842
20842
|
"filename": "src/components/vitest.ts",
|
|
20843
|
-
"line":
|
|
20843
|
+
"line": 471
|
|
20844
20844
|
},
|
|
20845
20845
|
"name": "configureEnvironment",
|
|
20846
20846
|
"parameters": [
|
|
@@ -20858,7 +20858,7 @@
|
|
|
20858
20858
|
},
|
|
20859
20859
|
"locationInModule": {
|
|
20860
20860
|
"filename": "src/components/vitest.ts",
|
|
20861
|
-
"line":
|
|
20861
|
+
"line": 500
|
|
20862
20862
|
},
|
|
20863
20863
|
"name": "configureGlobals"
|
|
20864
20864
|
},
|
|
@@ -20869,10 +20869,23 @@
|
|
|
20869
20869
|
},
|
|
20870
20870
|
"locationInModule": {
|
|
20871
20871
|
"filename": "src/components/vitest.ts",
|
|
20872
|
-
"line":
|
|
20872
|
+
"line": 403
|
|
20873
20873
|
},
|
|
20874
20874
|
"name": "preSynthesize",
|
|
20875
20875
|
"overrides": "projen.Component"
|
|
20876
|
+
},
|
|
20877
|
+
{
|
|
20878
|
+
"docs": {
|
|
20879
|
+
"remarks": "`postSynthesize` would be too late to rely\non: projen skips it when `PROJEN_DISABLE_POST` is set.",
|
|
20880
|
+
"stability": "stable",
|
|
20881
|
+
"summary": "Runs after projen's sample code component, which is added in the project constructor before any component, so the sample test exists by now."
|
|
20882
|
+
},
|
|
20883
|
+
"locationInModule": {
|
|
20884
|
+
"filename": "src/components/vitest.ts",
|
|
20885
|
+
"line": 418
|
|
20886
|
+
},
|
|
20887
|
+
"name": "synthesize",
|
|
20888
|
+
"overrides": "projen.Component"
|
|
20876
20889
|
}
|
|
20877
20890
|
],
|
|
20878
20891
|
"name": "Vitest",
|
|
@@ -20890,7 +20903,7 @@
|
|
|
20890
20903
|
"kind": "interface",
|
|
20891
20904
|
"locationInModule": {
|
|
20892
20905
|
"filename": "src/components/vitest.ts",
|
|
20893
|
-
"line":
|
|
20906
|
+
"line": 123
|
|
20894
20907
|
},
|
|
20895
20908
|
"name": "VitestConfigOptions",
|
|
20896
20909
|
"properties": [
|
|
@@ -20905,7 +20918,7 @@
|
|
|
20905
20918
|
"immutable": true,
|
|
20906
20919
|
"locationInModule": {
|
|
20907
20920
|
"filename": "src/components/vitest.ts",
|
|
20908
|
-
"line":
|
|
20921
|
+
"line": 243
|
|
20909
20922
|
},
|
|
20910
20923
|
"name": "bail",
|
|
20911
20924
|
"optional": true,
|
|
@@ -20923,7 +20936,7 @@
|
|
|
20923
20936
|
"immutable": true,
|
|
20924
20937
|
"locationInModule": {
|
|
20925
20938
|
"filename": "src/components/vitest.ts",
|
|
20926
|
-
"line":
|
|
20939
|
+
"line": 203
|
|
20927
20940
|
},
|
|
20928
20941
|
"name": "coverageDirectory",
|
|
20929
20942
|
"optional": true,
|
|
@@ -20942,7 +20955,7 @@
|
|
|
20942
20955
|
"immutable": true,
|
|
20943
20956
|
"locationInModule": {
|
|
20944
20957
|
"filename": "src/components/vitest.ts",
|
|
20945
|
-
"line":
|
|
20958
|
+
"line": 180
|
|
20946
20959
|
},
|
|
20947
20960
|
"name": "coverageEnabled",
|
|
20948
20961
|
"optional": true,
|
|
@@ -20961,7 +20974,7 @@
|
|
|
20961
20974
|
"immutable": true,
|
|
20962
20975
|
"locationInModule": {
|
|
20963
20976
|
"filename": "src/components/vitest.ts",
|
|
20964
|
-
"line":
|
|
20977
|
+
"line": 188
|
|
20965
20978
|
},
|
|
20966
20979
|
"name": "coverageProvider",
|
|
20967
20980
|
"optional": true,
|
|
@@ -20980,7 +20993,7 @@
|
|
|
20980
20993
|
"immutable": true,
|
|
20981
20994
|
"locationInModule": {
|
|
20982
20995
|
"filename": "src/components/vitest.ts",
|
|
20983
|
-
"line":
|
|
20996
|
+
"line": 196
|
|
20984
20997
|
},
|
|
20985
20998
|
"name": "coverageReporters",
|
|
20986
20999
|
"optional": true,
|
|
@@ -21004,7 +21017,7 @@
|
|
|
21004
21017
|
"immutable": true,
|
|
21005
21018
|
"locationInModule": {
|
|
21006
21019
|
"filename": "src/components/vitest.ts",
|
|
21007
|
-
"line":
|
|
21020
|
+
"line": 146
|
|
21008
21021
|
},
|
|
21009
21022
|
"name": "environment",
|
|
21010
21023
|
"optional": true,
|
|
@@ -21023,7 +21036,7 @@
|
|
|
21023
21036
|
"immutable": true,
|
|
21024
21037
|
"locationInModule": {
|
|
21025
21038
|
"filename": "src/components/vitest.ts",
|
|
21026
|
-
"line":
|
|
21039
|
+
"line": 138
|
|
21027
21040
|
},
|
|
21028
21041
|
"name": "exclude",
|
|
21029
21042
|
"optional": true,
|
|
@@ -21048,7 +21061,7 @@
|
|
|
21048
21061
|
"immutable": true,
|
|
21049
21062
|
"locationInModule": {
|
|
21050
21063
|
"filename": "src/components/vitest.ts",
|
|
21051
|
-
"line":
|
|
21064
|
+
"line": 172
|
|
21052
21065
|
},
|
|
21053
21066
|
"name": "globals",
|
|
21054
21067
|
"optional": true,
|
|
@@ -21067,7 +21080,7 @@
|
|
|
21067
21080
|
"immutable": true,
|
|
21068
21081
|
"locationInModule": {
|
|
21069
21082
|
"filename": "src/components/vitest.ts",
|
|
21070
|
-
"line":
|
|
21083
|
+
"line": 130
|
|
21071
21084
|
},
|
|
21072
21085
|
"name": "include",
|
|
21073
21086
|
"optional": true,
|
|
@@ -21092,7 +21105,7 @@
|
|
|
21092
21105
|
"immutable": true,
|
|
21093
21106
|
"locationInModule": {
|
|
21094
21107
|
"filename": "src/components/vitest.ts",
|
|
21095
|
-
"line":
|
|
21108
|
+
"line": 156
|
|
21096
21109
|
},
|
|
21097
21110
|
"name": "isolate",
|
|
21098
21111
|
"optional": true,
|
|
@@ -21111,7 +21124,7 @@
|
|
|
21111
21124
|
"immutable": true,
|
|
21112
21125
|
"locationInModule": {
|
|
21113
21126
|
"filename": "src/components/vitest.ts",
|
|
21114
|
-
"line":
|
|
21127
|
+
"line": 235
|
|
21115
21128
|
},
|
|
21116
21129
|
"name": "passWithNoTests",
|
|
21117
21130
|
"optional": true,
|
|
@@ -21130,7 +21143,7 @@
|
|
|
21130
21143
|
"immutable": true,
|
|
21131
21144
|
"locationInModule": {
|
|
21132
21145
|
"filename": "src/components/vitest.ts",
|
|
21133
|
-
"line":
|
|
21146
|
+
"line": 164
|
|
21134
21147
|
},
|
|
21135
21148
|
"name": "pool",
|
|
21136
21149
|
"optional": true,
|
|
@@ -21149,7 +21162,7 @@
|
|
|
21149
21162
|
"immutable": true,
|
|
21150
21163
|
"locationInModule": {
|
|
21151
21164
|
"filename": "src/components/vitest.ts",
|
|
21152
|
-
"line":
|
|
21165
|
+
"line": 259
|
|
21153
21166
|
},
|
|
21154
21167
|
"name": "printConsoleTrace",
|
|
21155
21168
|
"optional": true,
|
|
@@ -21168,7 +21181,7 @@
|
|
|
21168
21181
|
"immutable": true,
|
|
21169
21182
|
"locationInModule": {
|
|
21170
21183
|
"filename": "src/components/vitest.ts",
|
|
21171
|
-
"line":
|
|
21184
|
+
"line": 267
|
|
21172
21185
|
},
|
|
21173
21186
|
"name": "slowTestThreshold",
|
|
21174
21187
|
"optional": true,
|
|
@@ -21188,7 +21201,7 @@
|
|
|
21188
21201
|
"immutable": true,
|
|
21189
21202
|
"locationInModule": {
|
|
21190
21203
|
"filename": "src/components/vitest.ts",
|
|
21191
|
-
"line":
|
|
21204
|
+
"line": 219
|
|
21192
21205
|
},
|
|
21193
21206
|
"name": "typecheckChecker",
|
|
21194
21207
|
"optional": true,
|
|
@@ -21207,7 +21220,7 @@
|
|
|
21207
21220
|
"immutable": true,
|
|
21208
21221
|
"locationInModule": {
|
|
21209
21222
|
"filename": "src/components/vitest.ts",
|
|
21210
|
-
"line":
|
|
21223
|
+
"line": 211
|
|
21211
21224
|
},
|
|
21212
21225
|
"name": "typecheckEnabled",
|
|
21213
21226
|
"optional": true,
|
|
@@ -21226,7 +21239,7 @@
|
|
|
21226
21239
|
"immutable": true,
|
|
21227
21240
|
"locationInModule": {
|
|
21228
21241
|
"filename": "src/components/vitest.ts",
|
|
21229
|
-
"line":
|
|
21242
|
+
"line": 227
|
|
21230
21243
|
},
|
|
21231
21244
|
"name": "typecheckTsconfig",
|
|
21232
21245
|
"optional": true,
|
|
@@ -21246,7 +21259,7 @@
|
|
|
21246
21259
|
"immutable": true,
|
|
21247
21260
|
"locationInModule": {
|
|
21248
21261
|
"filename": "src/components/vitest.ts",
|
|
21249
|
-
"line":
|
|
21262
|
+
"line": 251
|
|
21250
21263
|
},
|
|
21251
21264
|
"name": "updateSnapshots",
|
|
21252
21265
|
"optional": true,
|
|
@@ -21267,7 +21280,7 @@
|
|
|
21267
21280
|
"kind": "interface",
|
|
21268
21281
|
"locationInModule": {
|
|
21269
21282
|
"filename": "src/components/vitest.ts",
|
|
21270
|
-
"line":
|
|
21283
|
+
"line": 270
|
|
21271
21284
|
},
|
|
21272
21285
|
"name": "VitestOptions",
|
|
21273
21286
|
"properties": [
|
|
@@ -21280,7 +21293,7 @@
|
|
|
21280
21293
|
"immutable": true,
|
|
21281
21294
|
"locationInModule": {
|
|
21282
21295
|
"filename": "src/components/vitest.ts",
|
|
21283
|
-
"line":
|
|
21296
|
+
"line": 281
|
|
21284
21297
|
},
|
|
21285
21298
|
"name": "config",
|
|
21286
21299
|
"optional": true,
|
|
@@ -21298,7 +21311,7 @@
|
|
|
21298
21311
|
"immutable": true,
|
|
21299
21312
|
"locationInModule": {
|
|
21300
21313
|
"filename": "src/components/vitest.ts",
|
|
21301
|
-
"line":
|
|
21314
|
+
"line": 276
|
|
21302
21315
|
},
|
|
21303
21316
|
"name": "configFilePath",
|
|
21304
21317
|
"optional": true,
|
|
@@ -21319,7 +21332,7 @@
|
|
|
21319
21332
|
"immutable": true,
|
|
21320
21333
|
"locationInModule": {
|
|
21321
21334
|
"filename": "src/components/vitest.ts",
|
|
21322
|
-
"line":
|
|
21335
|
+
"line": 313
|
|
21323
21336
|
},
|
|
21324
21337
|
"name": "extraConfig",
|
|
21325
21338
|
"optional": true,
|
|
@@ -21345,7 +21358,7 @@
|
|
|
21345
21358
|
"immutable": true,
|
|
21346
21359
|
"locationInModule": {
|
|
21347
21360
|
"filename": "src/components/vitest.ts",
|
|
21348
|
-
"line":
|
|
21361
|
+
"line": 301
|
|
21349
21362
|
},
|
|
21350
21363
|
"name": "extraTestConfig",
|
|
21351
21364
|
"optional": true,
|
|
@@ -21368,7 +21381,7 @@
|
|
|
21368
21381
|
"immutable": true,
|
|
21369
21382
|
"locationInModule": {
|
|
21370
21383
|
"filename": "src/components/vitest.ts",
|
|
21371
|
-
"line":
|
|
21384
|
+
"line": 288
|
|
21372
21385
|
},
|
|
21373
21386
|
"name": "vitestVersion",
|
|
21374
21387
|
"optional": true,
|
|
@@ -21380,6 +21393,6 @@
|
|
|
21380
21393
|
"symbolId": "src/components/vitest:VitestOptions"
|
|
21381
21394
|
}
|
|
21382
21395
|
},
|
|
21383
|
-
"version": "0.3.
|
|
21384
|
-
"fingerprint": "
|
|
21396
|
+
"version": "0.3.82",
|
|
21397
|
+
"fingerprint": "ohTyXBPcXHQJxAF+S6nZLkupFB+kGYPBqv6Ox/00a3E="
|
|
21385
21398
|
}
|
package/README.md
CHANGED
|
@@ -327,6 +327,110 @@ Features:
|
|
|
327
327
|
- Validates paths to prevent directory traversal attacks
|
|
328
328
|
- Structured error handling with custom error classes
|
|
329
329
|
|
|
330
|
+
## Migrating from the standalone packages
|
|
331
|
+
|
|
332
|
+
The components used to be published as separate packages. Those packages are deprecated and won't
|
|
333
|
+
get new features or fixes. Every class, interface, enum and function they exported is exported from
|
|
334
|
+
`@nikovirtala/projen-constructs` under the same name, except `AwsCdkApp` (see below).
|
|
335
|
+
|
|
336
|
+
| Deprecated package | Replacement in `@nikovirtala/projen-constructs` |
|
|
337
|
+
| --- | --- |
|
|
338
|
+
| `@nikovirtala/projen-vitest` | `Vitest`, `VitestOptions`, `VitestConfigOptions`, `Environment`, `Pool`, `CoverageProvider`, `CoverageReporter` |
|
|
339
|
+
| `@nikovirtala/projen-typedoc` | `TypeDoc`, `TypeDocOptions`, `TypeDocConfiguration` and its enums |
|
|
340
|
+
| `@nikovirtala/projen-homebrew` | `Homebrew`, `HomebrewOptions` |
|
|
341
|
+
| `@nikovirtala/projen-colima` | `Colima` |
|
|
342
|
+
| `@nikovirtala/projen-localstack` | `LocalStack`, `LocalStackOptions` |
|
|
343
|
+
| `@nikovirtala/projen-bundle-lambda-function-code` | `Bundler`, `LambdaFunctionCodeBundle`, `LambdaFunctionCodeBundler` and their options |
|
|
344
|
+
| `@nikovirtala/projen-lambda-function-construct-generator` | `LambdaFunctionConstructGenerator`, `LambdaFunctionConstructGeneratorOptions` |
|
|
345
|
+
| `@nikovirtala/projen-aws-cdk-app` | `AwsCdkTypeScriptAppProject`, `AwsCdkTypeScriptAppProjectOptions` |
|
|
346
|
+
|
|
347
|
+
### Steps
|
|
348
|
+
|
|
349
|
+
1. In `.projenrc.ts`, replace the old package in `devDeps` with `@nikovirtala/projen-constructs`, and
|
|
350
|
+
change the imports:
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
// before
|
|
354
|
+
import { Vitest } from "@nikovirtala/projen-vitest";
|
|
355
|
+
// after
|
|
356
|
+
import { Vitest } from "@nikovirtala/projen-constructs";
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
2. Check the peer dependencies. `@nikovirtala/projen-constructs` needs `projen` ^0.104, `constructs`
|
|
360
|
+
^10 and `@mrgrain/cdk-esbuild` ^5. The standalone packages accepted older projen versions, so you
|
|
361
|
+
may have to upgrade projen in the same change.
|
|
362
|
+
3. Install the new package, run `npx projen` and review the changes to the generated files.
|
|
363
|
+
|
|
364
|
+
### Changes to expect
|
|
365
|
+
|
|
366
|
+
These are the differences in behaviour or generated files between the standalone packages and this
|
|
367
|
+
library.
|
|
368
|
+
|
|
369
|
+
**Vitest**
|
|
370
|
+
|
|
371
|
+
- `vitest.config.ts` imports `defineConfig` from
|
|
372
|
+
`@nikovirtala/projen-constructs/lib/vitest-define-config` instead of
|
|
373
|
+
`@nikovirtala/projen-vitest/lib/bundled-define-config`. Projen rewrites the file, so there's
|
|
374
|
+
nothing to change by hand.
|
|
375
|
+
- The config is rendered as JSON, so its keys are quoted. The settings are the same.
|
|
376
|
+
- `config.typecheckTsconfig` defaults to the project's development tsconfig (`test/tsconfig.json`
|
|
377
|
+
in current projen) instead of `tsconfig.dev.json`.
|
|
378
|
+
- JSII and construct library projects exclude `vitest.config.ts` from the published package.
|
|
379
|
+
- New: `extraTestConfig` and `extraConfig` for Vitest settings that `config` doesn't cover.
|
|
380
|
+
|
|
381
|
+
**Homebrew and Colima**
|
|
382
|
+
|
|
383
|
+
- Packages from a tap (`owner/tap/formula`) also add a `tap` line to the `Brewfile`, and the
|
|
384
|
+
`Brewfile` is sorted.
|
|
385
|
+
- The `install:homebrew`, `homebrew:bundle` and `colima` tasks run in bash. `homebrew:bundle` also
|
|
386
|
+
finds a freshly installed `brew` that isn't on the `PATH` yet.
|
|
387
|
+
|
|
388
|
+
**LocalStack**
|
|
389
|
+
|
|
390
|
+
- `imageTag` is applied: LocalStack starts with `localstack/localstack:<imageTag>`. It used to be
|
|
391
|
+
ignored.
|
|
392
|
+
|
|
393
|
+
**Bundler / LambdaFunctionCodeBundler**
|
|
394
|
+
|
|
395
|
+
- `LambdaFunctionCodeBundler.bundleOptions` applies to every discovered entrypoint. Its `entrypoint`
|
|
396
|
+
used to replace them all.
|
|
397
|
+
|
|
398
|
+
**LambdaFunctionConstructGenerator**
|
|
399
|
+
|
|
400
|
+
- The bundle task runs `tsx` with the project's development tsconfig instead of `tsconfig.dev.json`.
|
|
401
|
+
|
|
402
|
+
**TypeDoc**: no changes.
|
|
403
|
+
|
|
404
|
+
### From `AwsCdkApp` to `AwsCdkTypeScriptAppProject`
|
|
405
|
+
|
|
406
|
+
```typescript
|
|
407
|
+
// before
|
|
408
|
+
import { AwsCdkApp } from "@nikovirtala/projen-aws-cdk-app";
|
|
409
|
+
const project = new AwsCdkApp({ name: "my-app", cdkVersion: "2.221.0" });
|
|
410
|
+
|
|
411
|
+
// after
|
|
412
|
+
import { AwsCdkTypeScriptAppProject } from "@nikovirtala/projen-constructs";
|
|
413
|
+
const project = new AwsCdkTypeScriptAppProject({ name: "my-app", cdkVersion: "2.221.0" });
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
Both are ES module apps run with `tsx`, using pnpm, Biome, Vitest and mise. The differences:
|
|
417
|
+
|
|
418
|
+
- **`nvm` is removed.** Use mise (on by default), which pins the Node.js version in `mise.toml`.
|
|
419
|
+
- **Homebrew is on by default.** The project gets a `Brewfile`, and `npx projen` runs
|
|
420
|
+
`install:homebrew` (installs Homebrew if `brew` is missing) and `homebrew:bundle`. Set
|
|
421
|
+
`homebrew: false` to turn it off.
|
|
422
|
+
- **cdk.json `app`** is `npx tsx src/main.ts` instead of `tsx --tsconfig tsconfig.json src/main.ts`.
|
|
423
|
+
- **Defaults** come from this library: Node.js, TypeScript, CDK and pnpm versions (pnpm 11 instead
|
|
424
|
+
of 10), Dependabot off, auto-merge on, `auto-approve` and `auto-merge` labels on dependency
|
|
425
|
+
upgrade PRs, and auto-approval of PRs by `nikovirtala`. Any option you set explicitly still wins,
|
|
426
|
+
so set `autoApproveOptions` if you aren't `nikovirtala`.
|
|
427
|
+
- **tsconfig**: `noImplicitOverride` and `allowSyntheticDefaultImports` move from `tsconfig.json`
|
|
428
|
+
to the development tsconfig (`test/tsconfig.json`).
|
|
429
|
+
- **Options removed from the interface**: `eslint`, `jest`, `prettier` (and their options),
|
|
430
|
+
`sampleCode` and `tsJestOptions`.
|
|
431
|
+
- `vitestOptions` takes the `VitestOptions` of this library, and now also `homebrewOptions` and
|
|
432
|
+
`miseOptions`.
|
|
433
|
+
|
|
330
434
|
## Development
|
|
331
435
|
|
|
332
436
|
This project is managed by Projen and generates itself: `.projenrc.ts` defines the project using the
|