awscdk-jsii-template
awscdk-jsii-template copied to clipboard
JSII construct library template for AWS CDK
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 runyarn build
Confiuguration
- customize your
.projenrc.js
- run
npx projen
to project generate assets including theLICENSE
,version.json
,package.json
and.github/workflows
from.projenrc.js
. At this moment, your initialversion
should be0.0.0
. -
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
- run
yarn watch
in a seperate terminal - edit
test/integ.api.ts
- Run
cdk diff
andcdk 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
- validate the stack
Unit tests
- edit
test/*.test.ts
- 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.