Instructions, tools, and tips for those wishing to contribute.
- Overview
- Prerequisites
- Installing Dependencies
- Commit Messages
- PR Preview Labels
- Bootstrapping Projen Templates
- Releasing NPM Packages
- Cleaning Git History
nvmnode 22installed withnvmcorepackenabled sopnpmis availablenpm i -g aws-cdk
Install dependencies from the repo root with:
corepack enable pnpm
pnpm installHistorically, this repo used Yarn because npm workspace installs had a circular bin linking problem with the local CLI packages. pnpm handles the workspace layout cleanly while still giving us a committed lockfile and reproducible installs.
The repo now enforces package boundaries in two layers:
pnpm installat the repo root uses the default isolated workspace layout, so undeclared dependencies are less likely to leak across the tree through a flatnode_modules.pnpm lintrunsimport/no-extraneous-dependencies, including type-only imports, so package source files must declare the workspace and external packages they import.
When adding a new import:
- Add runtime and type-only package imports to the importing package's
dependencieswhen shipped source or declarations rely on them. - Add external test-only helpers to the specific package's
devDependencies. The shared DynamoDB fixture intests/dynamodbis provided by the root test harness. - Treat
packages/microapps-cdkas the exception path for package-manager behavior; if it ever needs special handling, keep that handling local to the package rather than reintroducing repo-wide hoisting.
Use Conventional Commits in this repository.
Preferred shapes:
type: summarytype(scope): summary
Guidelines:
- Keep the summary imperative and concise.
- Use a scope when it makes the affected package or area clearer, such as
feat(router): ...orfix(release): .... - Prefer these types unless there is a good reason not to:
feat,fix,docs,refactor,test,ci,build,perf,chore. - Keep each commit focused on one main idea when practical so review and rollback stay easy.
Examples:
feat(release): publish prereleases to npm beta dist-tagdocs(contributing): document conventional commit formatfix(router): preserve query string when forwarding assets
PR preview deploys now default to off. A PR only deploys preview environments when the corresponding deploy labels are present.
DEPLOY-COREruns the mainmicroapps-corepreview deploy.DEPLOY-BASICruns themicroapps-basicpreview deploy.DEPLOY-BASIC-PREFIXruns themicroapps-basic-prefixpreview deploy.
The PR Scope Labeler workflow adds these labels conservatively based on changed files. It is additive-only and does not remove labels that a maintainer already applied.
Maintainer notes:
- Add labels manually when you want to force a preview deploy for an open PR.
- The required
deploy-microapps-corecheck always reports a result on PRs. WithoutDEPLOY-CORE, it succeeds through an explicit no-op path; withDEPLOY-CORE, it only succeeds if the real core preview deploy succeeds. - Removing a deploy label prevents future preview deploy runs for that environment, but does not tear down an already-created preview. Cleanup still happens when the PR closes.
- Check the
PR Scope Labelerjob summary first when you want to understand why a PR did or did not get preview deploy labels.
Note: prefer pnpm for repo development. The command below is historical context for the original construct bootstrap and is not the current workspace package manager recommendation.
npm i -g projen
npx projen new awscdk-construct --no-git --name @pwrdrvr/microapps-cdk --author "Harold Hunt" --package-manager npm --license MIT --npm-access public --copyright-owner "PwrDrvr LLC" --copyright-period 2020 --projenrc-ts --no-jest
Challenge: projen does not support monorepos well, so it can build, tag, version, and release the CDK Construct library in packages/microapps-cdk but it cannot be invoked to release packages/pwrdrvr and, because it doesn't support monorepos well, it cannot build and publish both in one invocation.
Below are tips, tricks, and commands used to build and release pwrdrvr to NPM after microapps-cdk is done being published by projen.
Note: this has to be run in the root of the project on a clean tree (no changed files).
Note: this has to be done with npm 7.18.1 in node 16 as a fix from April, 2021 is required in some cases: npm/libnpmversion#12
npm version from-git --allow-same-version --no-git-tag-version
Example output: v0.9.3
Note: this can accept the v-prefixed version (e.g. v0.9.3) retrieved from npm version from-git --allow-same-version --no-git-tag-version
npm version v0.9.3 --no-git-tag-version --workspaces
literal:something_to_replace