Howto design, develop, test, document, deploy
src/@module-group/module/
bin
common
lib
site
web
bin
- compiled into./commonjs/bin
folder ascommonjs
modules suitable for nodejs applications and lambdascommon
- compiled into the./commonjs/common/
folder as commonjs modules, and also./web/common/
as es2015 moduleslib
- compiled into./web/lib/
site
- html, nunjucks templates, and other web content compiled into./site
Angular style commit messages.
Gitflow branch management. A short-lived branches should rebase (rather than merge) to sync up with the long-lived parent it branches off of.
The build process is setup so that commonjs and web modules are layed out for easy import into other npm packages. The web content is setup to load code via relative paths when possible, but otherwise assumes javascript modules are deployed under a /modules/
root.
See the buildspec.yml codebuild configuration.
npm run build
npm test
npm run lint
npm audit
The npm test
command runs a jasmine test suites for web modules (using karmajs) and commonjs modules (with jasmine's nodejs runner).
The lint
script integrates with eslint and typescript-eslint.
- https://www.npmjs.com/package/eslint-config-airbnb-typescript
- https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md
- https://github.com/typescript-eslint/typescript-eslint
The buildspec.yml file defines a codebuild pipeline that builds and tests code committed to the github repository.
Before publishing a new version - be sure to update both the package version and the release notes.
The codebuild integration (more details here) publishes the npm module with a cicd
tag. The CICD integration requires that the git tag matches the module version in package.json
. Furthermore, we require that all git tags be applied to the master
branch - which is our release
branch in our simplified gitflow
branching strategy.
(
version="$(jq -r .version < package.json)"
git tag -a "$version" -m "release details in Notes/reference/releaseNotes.md#$version"
git push origin $version
)
After a module version has been published with the cicd
tag, we must manually apply the latest
tag to make the new version the new default for consumers:
(
version="$(jq -r .version < package.json)"
packname="$(jq -r .name < package.json)"
npm dist-tag add "${packname}@$version" latest
)