@nikovirtala/projen-constructs 0.3.80 → 0.3.81
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 +3 -3
- package/README.md +104 -0
- package/docs/api/index.html +129 -0
- 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.js +1 -1
- 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",
|
|
@@ -21380,6 +21380,6 @@
|
|
|
21380
21380
|
"symbolId": "src/components/vitest:VitestOptions"
|
|
21381
21381
|
}
|
|
21382
21382
|
},
|
|
21383
|
-
"version": "0.3.
|
|
21384
|
-
"fingerprint": "
|
|
21383
|
+
"version": "0.3.81",
|
|
21384
|
+
"fingerprint": "P+E0Ff9WXKCy+afdNyUGYyPBk332hDPrftkUe2SEc5M="
|
|
21385
21385
|
}
|
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
|
package/docs/api/index.html
CHANGED
|
@@ -180,6 +180,129 @@ render into a generated <code>.projenrc.ts</code> as the package manager that ra
|
|
|
180
180
|
<li>Validates paths to prevent directory traversal attacks</li>
|
|
181
181
|
<li>Structured error handling with custom error classes</li>
|
|
182
182
|
</ul>
|
|
183
|
+
<h2 id="migrating-from-the-standalone-packages" class="tsd-anchor-link">Migrating from the standalone packages<a href="#migrating-from-the-standalone-packages" 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>
|
|
184
|
+
<p>The components used to be published as separate packages. Those packages are deprecated and won't
|
|
185
|
+
get new features or fixes. Every class, interface, enum and function they exported is exported from
|
|
186
|
+
<code>@nikovirtala/projen-constructs</code> under the same name, except <code>AwsCdkApp</code> (see below).</p>
|
|
187
|
+
<table>
|
|
188
|
+
<thead>
|
|
189
|
+
<tr>
|
|
190
|
+
<th>Deprecated package</th>
|
|
191
|
+
<th>Replacement in <code>@nikovirtala/projen-constructs</code></th>
|
|
192
|
+
</tr>
|
|
193
|
+
</thead>
|
|
194
|
+
<tbody>
|
|
195
|
+
<tr>
|
|
196
|
+
<td><code>@nikovirtala/projen-vitest</code></td>
|
|
197
|
+
<td><code>Vitest</code>, <code>VitestOptions</code>, <code>VitestConfigOptions</code>, <code>Environment</code>, <code>Pool</code>, <code>CoverageProvider</code>, <code>CoverageReporter</code></td>
|
|
198
|
+
</tr>
|
|
199
|
+
<tr>
|
|
200
|
+
<td><code>@nikovirtala/projen-typedoc</code></td>
|
|
201
|
+
<td><code>TypeDoc</code>, <code>TypeDocOptions</code>, <code>TypeDocConfiguration</code> and its enums</td>
|
|
202
|
+
</tr>
|
|
203
|
+
<tr>
|
|
204
|
+
<td><code>@nikovirtala/projen-homebrew</code></td>
|
|
205
|
+
<td><code>Homebrew</code>, <code>HomebrewOptions</code></td>
|
|
206
|
+
</tr>
|
|
207
|
+
<tr>
|
|
208
|
+
<td><code>@nikovirtala/projen-colima</code></td>
|
|
209
|
+
<td><code>Colima</code></td>
|
|
210
|
+
</tr>
|
|
211
|
+
<tr>
|
|
212
|
+
<td><code>@nikovirtala/projen-localstack</code></td>
|
|
213
|
+
<td><code>LocalStack</code>, <code>LocalStackOptions</code></td>
|
|
214
|
+
</tr>
|
|
215
|
+
<tr>
|
|
216
|
+
<td><code>@nikovirtala/projen-bundle-lambda-function-code</code></td>
|
|
217
|
+
<td><code>Bundler</code>, <code>LambdaFunctionCodeBundle</code>, <code>LambdaFunctionCodeBundler</code> and their options</td>
|
|
218
|
+
</tr>
|
|
219
|
+
<tr>
|
|
220
|
+
<td><code>@nikovirtala/projen-lambda-function-construct-generator</code></td>
|
|
221
|
+
<td><code>LambdaFunctionConstructGenerator</code>, <code>LambdaFunctionConstructGeneratorOptions</code></td>
|
|
222
|
+
</tr>
|
|
223
|
+
<tr>
|
|
224
|
+
<td><code>@nikovirtala/projen-aws-cdk-app</code></td>
|
|
225
|
+
<td><code>AwsCdkTypeScriptAppProject</code>, <code>AwsCdkTypeScriptAppProjectOptions</code></td>
|
|
226
|
+
</tr>
|
|
227
|
+
</tbody>
|
|
228
|
+
</table>
|
|
229
|
+
<h3 id="steps" class="tsd-anchor-link">Steps<a href="#steps" 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>
|
|
230
|
+
<ol>
|
|
231
|
+
<li>
|
|
232
|
+
<p>In <code>.projenrc.ts</code>, replace the old package in <code>devDeps</code> with <code>@nikovirtala/projen-constructs</code>, and
|
|
233
|
+
change the imports:</p>
|
|
234
|
+
<pre><code class="typescript"><span class="hl-8">// before</span><br/><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">Vitest</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">"@nikovirtala/projen-vitest"</span><span class="hl-1">;</span><br/><span class="hl-8">// after</span><br/><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">Vitest</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">"@nikovirtala/projen-constructs"</span><span class="hl-1">;</span>
|
|
235
|
+
</code><button type="button">Copy</button></pre>
|
|
236
|
+
|
|
237
|
+
</li>
|
|
238
|
+
<li>
|
|
239
|
+
<p>Check the peer dependencies. <code>@nikovirtala/projen-constructs</code> needs <code>projen</code> ^0.104, <code>constructs</code>
|
|
240
|
+
^10 and <code>@mrgrain/cdk-esbuild</code> ^5. The standalone packages accepted older projen versions, so you
|
|
241
|
+
may have to upgrade projen in the same change.</p>
|
|
242
|
+
</li>
|
|
243
|
+
<li>
|
|
244
|
+
<p>Install the new package, run <code>npx projen</code> and review the changes to the generated files.</p>
|
|
245
|
+
</li>
|
|
246
|
+
</ol>
|
|
247
|
+
<h3 id="changes-to-expect" class="tsd-anchor-link">Changes to expect<a href="#changes-to-expect" 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>
|
|
248
|
+
<p>These are the differences in behaviour or generated files between the standalone packages and this
|
|
249
|
+
library.</p>
|
|
250
|
+
<p><strong>Vitest</strong></p>
|
|
251
|
+
<ul>
|
|
252
|
+
<li><code>vitest.config.ts</code> imports <code>defineConfig</code> from
|
|
253
|
+
<code>@nikovirtala/projen-constructs/lib/vitest-define-config</code> instead of
|
|
254
|
+
<code>@nikovirtala/projen-vitest/lib/bundled-define-config</code>. Projen rewrites the file, so there's
|
|
255
|
+
nothing to change by hand.</li>
|
|
256
|
+
<li>The config is rendered as JSON, so its keys are quoted. The settings are the same.</li>
|
|
257
|
+
<li><code>config.typecheckTsconfig</code> defaults to the project's development tsconfig (<code>test/tsconfig.json</code>
|
|
258
|
+
in current projen) instead of <code>tsconfig.dev.json</code>.</li>
|
|
259
|
+
<li>JSII and construct library projects exclude <code>vitest.config.ts</code> from the published package.</li>
|
|
260
|
+
<li>New: <code>extraTestConfig</code> and <code>extraConfig</code> for Vitest settings that <code>config</code> doesn't cover.</li>
|
|
261
|
+
</ul>
|
|
262
|
+
<p><strong>Homebrew and Colima</strong></p>
|
|
263
|
+
<ul>
|
|
264
|
+
<li>Packages from a tap (<code>owner/tap/formula</code>) also add a <code>tap</code> line to the <code>Brewfile</code>, and the
|
|
265
|
+
<code>Brewfile</code> is sorted.</li>
|
|
266
|
+
<li>The <code>install:homebrew</code>, <code>homebrew:bundle</code> and <code>colima</code> tasks run in bash. <code>homebrew:bundle</code> also
|
|
267
|
+
finds a freshly installed <code>brew</code> that isn't on the <code>PATH</code> yet.</li>
|
|
268
|
+
</ul>
|
|
269
|
+
<p><strong>LocalStack</strong></p>
|
|
270
|
+
<ul>
|
|
271
|
+
<li><code>imageTag</code> is applied: LocalStack starts with <code>localstack/localstack:<imageTag></code>. It used to be
|
|
272
|
+
ignored.</li>
|
|
273
|
+
</ul>
|
|
274
|
+
<p><strong>Bundler / LambdaFunctionCodeBundler</strong></p>
|
|
275
|
+
<ul>
|
|
276
|
+
<li><code>LambdaFunctionCodeBundler.bundleOptions</code> applies to every discovered entrypoint. Its <code>entrypoint</code>
|
|
277
|
+
used to replace them all.</li>
|
|
278
|
+
</ul>
|
|
279
|
+
<p><strong>LambdaFunctionConstructGenerator</strong></p>
|
|
280
|
+
<ul>
|
|
281
|
+
<li>The bundle task runs <code>tsx</code> with the project's development tsconfig instead of <code>tsconfig.dev.json</code>.</li>
|
|
282
|
+
</ul>
|
|
283
|
+
<p><strong>TypeDoc</strong>: no changes.</p>
|
|
284
|
+
<h3 id="from-to" class="tsd-anchor-link">From <code>AwsCdkApp</code> to <code>AwsCdkTypeScriptAppProject</code><a href="#from-to" 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>
|
|
285
|
+
<pre><code class="typescript"><span class="hl-8">// before</span><br/><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">AwsCdkApp</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">"@nikovirtala/projen-aws-cdk-app"</span><span class="hl-1">;</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">project</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">AwsCdkApp</span><span class="hl-1">({ </span><span class="hl-5">name:</span><span class="hl-1"> </span><span class="hl-2">"my-app"</span><span class="hl-1">, </span><span class="hl-5">cdkVersion:</span><span class="hl-1"> </span><span class="hl-2">"2.221.0"</span><span class="hl-1"> });</span><br/><br/><span class="hl-8">// after</span><br/><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-5">AwsCdkTypeScriptAppProject</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">"@nikovirtala/projen-constructs"</span><span class="hl-1">;</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">project</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">AwsCdkTypeScriptAppProject</span><span class="hl-1">({ </span><span class="hl-5">name:</span><span class="hl-1"> </span><span class="hl-2">"my-app"</span><span class="hl-1">, </span><span class="hl-5">cdkVersion:</span><span class="hl-1"> </span><span class="hl-2">"2.221.0"</span><span class="hl-1"> });</span>
|
|
286
|
+
</code><button type="button">Copy</button></pre>
|
|
287
|
+
|
|
288
|
+
<p>Both are ES module apps run with <code>tsx</code>, using pnpm, Biome, Vitest and mise. The differences:</p>
|
|
289
|
+
<ul>
|
|
290
|
+
<li><strong><code>nvm</code> is removed.</strong> Use mise (on by default), which pins the Node.js version in <code>mise.toml</code>.</li>
|
|
291
|
+
<li><strong>Homebrew is on by default.</strong> The project gets a <code>Brewfile</code>, and <code>npx projen</code> runs
|
|
292
|
+
<code>install:homebrew</code> (installs Homebrew if <code>brew</code> is missing) and <code>homebrew:bundle</code>. Set
|
|
293
|
+
<code>homebrew: false</code> to turn it off.</li>
|
|
294
|
+
<li><strong>cdk.json <code>app</code></strong> is <code>npx tsx src/main.ts</code> instead of <code>tsx --tsconfig tsconfig.json src/main.ts</code>.</li>
|
|
295
|
+
<li><strong>Defaults</strong> come from this library: Node.js, TypeScript, CDK and pnpm versions (pnpm 11 instead
|
|
296
|
+
of 10), Dependabot off, auto-merge on, <code>auto-approve</code> and <code>auto-merge</code> labels on dependency
|
|
297
|
+
upgrade PRs, and auto-approval of PRs by <code>nikovirtala</code>. Any option you set explicitly still wins,
|
|
298
|
+
so set <code>autoApproveOptions</code> if you aren't <code>nikovirtala</code>.</li>
|
|
299
|
+
<li><strong>tsconfig</strong>: <code>noImplicitOverride</code> and <code>allowSyntheticDefaultImports</code> move from <code>tsconfig.json</code>
|
|
300
|
+
to the development tsconfig (<code>test/tsconfig.json</code>).</li>
|
|
301
|
+
<li><strong>Options removed from the interface</strong>: <code>eslint</code>, <code>jest</code>, <code>prettier</code> (and their options),
|
|
302
|
+
<code>sampleCode</code> and <code>tsJestOptions</code>.</li>
|
|
303
|
+
<li><code>vitestOptions</code> takes the <code>VitestOptions</code> of this library, and now also <code>homebrewOptions</code> and
|
|
304
|
+
<code>miseOptions</code>.</li>
|
|
305
|
+
</ul>
|
|
183
306
|
<h2 id="development" class="tsd-anchor-link">Development<a href="#development" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
|
|
184
307
|
<p>This project is managed by Projen and generates itself: <code>.projenrc.ts</code> defines the project using the
|
|
185
308
|
<code>JsiiProject</code> type from <code>src/</code>. Configuration changes belong in <code>.projenrc.ts</code>, never in the
|
|
@@ -301,6 +424,12 @@ then synthesize again.</p>
|
|
|
301
424
|
<li><a href="#lambdafunctionconstructgenerator"><span>Lambda<wbr/>Function<wbr/>Construct<wbr/>Generator</span></a></li>
|
|
302
425
|
<li><a href="#bundler"><span>Bundler</span></a></li>
|
|
303
426
|
<li><a href="#projectgenerator"><span>Project<wbr/>Generator</span></a></li></ul></li></ul></li>
|
|
427
|
+
<li><a href="#migrating-from-the-standalone-packages"><span>Migrating from the standalone packages</span></a></li>
|
|
428
|
+
<li>
|
|
429
|
+
<ul>
|
|
430
|
+
<li><a href="#steps"><span>Steps</span></a></li>
|
|
431
|
+
<li><a href="#changes-to-expect"><span>Changes to expect</span></a></li>
|
|
432
|
+
<li><a href="#from-to"><span>From to </span></a></li></ul></li>
|
|
304
433
|
<li><a href="#development"><span>Development</span></a></li>
|
|
305
434
|
<li>
|
|
306
435
|
<ul>
|
|
@@ -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.3.
|
|
70
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Bundler", version: "0.3.81" };
|
|
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.3.
|
|
224
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LambdaFunctionCodeBundle", version: "0.3.81" };
|
|
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.3.
|
|
276
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LambdaFunctionCodeBundler", version: "0.3.81" };
|
|
277
277
|
constructor(project, options) {
|
|
278
278
|
super(project, {
|
|
279
279
|
projectdir: options.srcdir,
|
package/lib/components/colima.js
CHANGED
|
@@ -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.3.
|
|
14
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Colima", version: "0.3.81" };
|
|
15
15
|
constructor(scope) {
|
|
16
16
|
super(scope);
|
|
17
17
|
const project = this.project;
|
|
@@ -6,7 +6,7 @@ const component_1 = require("projen/lib/component");
|
|
|
6
6
|
const task_shell_1 = require("projen/lib/task-shell");
|
|
7
7
|
const textfile_1 = require("projen/lib/textfile");
|
|
8
8
|
class Homebrew extends component_1.Component {
|
|
9
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Homebrew", version: "0.3.
|
|
9
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Homebrew", version: "0.3.81" };
|
|
10
10
|
static of(project) {
|
|
11
11
|
const isHomebrew = (c) => c instanceof Homebrew;
|
|
12
12
|
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.3.
|
|
47
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LambdaFunctionConstructGenerator", version: "0.3.81" };
|
|
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.3.
|
|
15
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.LocalStack", version: "0.3.81" };
|
|
16
16
|
constructor(scope, options = {}) {
|
|
17
17
|
super(scope);
|
|
18
18
|
const project = javascript_1.NodeProject.of(this);
|
package/lib/components/mise.js
CHANGED
|
@@ -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.3.
|
|
10
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Mise", version: "0.3.81" };
|
|
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.3.
|
|
37
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.TypeDoc", version: "0.3.81" };
|
|
38
38
|
static of(project) {
|
|
39
39
|
const isTypeDoc = (c) => c instanceof TypeDoc;
|
|
40
40
|
return project.components.find(isTypeDoc);
|
package/lib/components/vitest.js
CHANGED
|
@@ -140,7 +140,7 @@ var CoverageReporter;
|
|
|
140
140
|
CoverageReporter["TEXT"] = "text";
|
|
141
141
|
})(CoverageReporter || (exports.CoverageReporter = CoverageReporter = {}));
|
|
142
142
|
class Vitest extends component_1.Component {
|
|
143
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Vitest", version: "0.3.
|
|
143
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.Vitest", version: "0.3.81" };
|
|
144
144
|
static of(project) {
|
|
145
145
|
const isVitest = (c) => c instanceof Vitest;
|
|
146
146
|
return project.components.find(isVitest);
|
package/lib/project-generator.js
CHANGED
|
@@ -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.3.
|
|
431
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.ProjectGenerator", version: "0.3.81" };
|
|
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.3.
|
|
18
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.AwsCdkConstructLibraryProject", version: "0.3.81" };
|
|
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.3.
|
|
18
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.AwsCdkTypeScriptAppProject", version: "0.3.81" };
|
|
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.3.
|
|
19
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.JsiiProject", version: "0.3.81" };
|
|
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.3.
|
|
18
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@nikovirtala/projen-constructs.TypeScriptProject", version: "0.3.81" };
|
|
19
19
|
/**
|
|
20
20
|
* @param options - Project configuration
|
|
21
21
|
*/
|