Skip to content

JSII construct library template for AWS CDK

Notifications You must be signed in to change notification settings

bcgalvin/awscdk-jsii-template

 
 

Repository files navigation

awscdk-jsii-template

Welcome to awscdk-jsii-template

This repository template helps you generate JSII construct library for AWS CDK and aims to simplify the process to develop, build, test and eventually publish your AWS CDK construct lib to npmjs and pipy.

Directories in this template

  • src - all the typescript source code under this directory
  • test - unit tests and integ tests
  • lib - will be auto-generated from the src when you run yarn build

Confiuguration

  1. customize your .projenrc.js
  2. run npx projen to project generate assets including the LICENSE, version.json, package.json and .github/workflows from .projenrc.js. At this moment, your initial version should be 0.0.0.
  3. yarn install to install all required npm packages

You can run the commands above like this:

$ npx projen && yarn install

From now on, we will refer to this command as pj. Every time you modify .projenrc.js, just run pj.

Put this in your shell profile: alias pj='npx projen && yarn install'

Integration tests

  1. run yarn watch in a seperate terminal
  2. edit test/integ.api.ts
  3. Run cdk diff and cdk deploy to ensure it deploys with no error in your real aws environment.
cdk --app 'test/integ.api.js' diff
cdk --app 'test/integ.api.js' deploy
  1. validate the stack

Unit tests

  1. edit test/*.test.ts
  2. run yarn test

run yarn build to generate the lib directory

If yarn test is doing great with no error. Run yarn build to generate the lib and other assets.

commit your changes to local repository

$ git commit -am "chore(release): initial commit for the first release" 

bump the version and push to your repository

To bump a specific release version number, i.e. v0.1.0

$ yarn bump --release-as v0.1.0

or simply bump the minor version from version.json, in which case the version will bump from 0.0.0 to 0.0.1

$ yarn bump

and git push with the tags

$ git push --follow-tags origin master

Or just:

# this equals to `arn bump && git push --follow-tags origin master`, see package.json
$ yarn release

If you push successfully, go to your the Actions in your github repository, make sure the build and release workflows run successfully.

Projen

This template leverages the eladb/projen by Elad Ben-Israel. Check it out for more detials and usages for the projen command.

Projects using this Template

About

JSII construct library template for AWS CDK

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 59.4%
  • JavaScript 40.6%