Scaffold a Projen CDK construct project with npm registry on AWS CodeArtifact
npm install projen-cdk-initScaffold a Projen-based AWS CDK construct library, pre-wired to use an npm registry hosted in AWS CodeArtifact.
- Node.js >= 18
- npm or yarn
- Git (recommended)
- Access to an AWS account if you plan to publish to CodeArtifact
No installation required. Use npx, which runs the CLI directly from npm:
```
npx projen-cdk-init with-registry-aws-codeartifact --package-name my-construct
An alternate CLI name is also available:
``
npx cdk-construct-init with-registry-aws-codeartifact --package-name my-construct
`
cdk-construct-init with-registry-aws-codeartifact --package-name
Options:
--package-name Package name (required)
--description Package description
--author-name Author name (default:
--author-email Author email (default:
--repository-url Repository URL
`
When you run the command, it will:
- Create a new folder named after your package.
- Run projen new awscdk-construct to scaffold a TypeScript library..projenrc.ts
- Configure npm publishing to an AWS CodeArtifact registry and add GitHub OIDC authentication snippets to .npx projen
- Synthesize the project (), then run install/build/tests.
The generator patches the new project’s .projenrc.ts to include a CodeArtifact role similar to:
``
arn:aws:iam::
and sets the npm registry URL using a value you provide via defaults (see Configuration) or that you later edit in the generated project.
This CLI ships with placeholders so it can be adapted to your environment:
-
-
-
-
- )
You can customize these defaults in this repository’s src/construct.ts before publishing your own copy of the CLI. Alternatively, after your project is generated, open the new project’s .projenrc.ts and adjust the CodeArtifact options, repository metadata, and role to match your setup.
Generate a construct library with description and repo URL:
``
npx projen-cdk-init with-registry-aws-codeartifact \
--package-name monitoring-constructs \
--description "Reusable pipeline constructs" \
--repository-url https://github.com/
- Install deps and build:
- npx projen buildnpx ./bin/cdk-construct-init with-registry-aws-codeartifact --package-name demo-lib
- Run locally (after build):
- npm test`
- Tests:
-
Apache-2.0