- Prerequisites
- Getting Started
- Project structure
- Code style
- Testing
- Git commits
- Package versioning
- Deployment
- Documentation
- How to fix an old release
The following dependencies must be available to be begin project development.
- Unix-like operating system — Windows Subsystem for Linux also works
- Git
- Node
^9.7.1
- Yarn
>=1.5.1
- Python
^2.7
— Some dependencies requirenode-gyp
which uses Python
To get set up, run the following commands:
git clone https://github.com/Autodesk/hig
cd hig
yarn
yarn build
This project is structured as a monorepo, with each package residing within its own directory.
The monorepo uses Yarn workspaces and Lerna to manage the interdependencies between packages.
Private packages are used to organize development tools and dependencies. For example, the @hig/scripts
package contains the build script that's used to build every component package.
We use ESLint and Prettier to ensure consistency throughout the source code. Please view our ESLint configuration for details on style rules.
Jest along with Enzyme is used to run our unit testing suite. While we aim for the highest possible code coverage, every component should be covered with a snapshot test at the very least.
Unit tests reside within module specifications (moduleName.test.js
), which are placed next to their respective modules. Jest runs all of the project's unit tests together, and evaluates code coverage on the project as a whole.
yarn test
yarn test -u
To ensure that changes do not break the visual presentation of components, we run a suite of visual regression tests via Gemini.
The tests are run upon a Storybook developed specifically for automated testing. Screenshots of each test are stored within the repository similar to unit test snapshots.
cd packages/storybook
yarn gemini-update # Update snapshots
yarn gemini # Check components against committed snapshots
Commit messages should adhere to the Angular Git Commit Guidelines.
Package versioning is automated via Semantic Release and determined by commit messages. Commit messages should adhere to Angular Git Commit Guidelines.
Using the example package documentation as a reference, create a new package with the version 1.0.0-alpha
.
Per Semantic Versioning 2.0.0, the "-alpha"
portion of the version labels the package as pre-release. Packages labeled as pre-release are ignored during deployment.
Packages that have already been published can have pre-releases as well.
For example, @hig/[email protected]
can have a pre-release package by changing the version to @hig/[email protected]
.
Subsequent pre-releases can be made by further changing the package version, e.g. @hig/[email protected]
.
Storybook is deployed when changes are merged into the master
branch. Storybook Staging is deployed when changes are merged into the development
branch.
Packages are published via Semantic Release.
New packages should be labeled as pre-release and are ignored during deployment.
For the deployment workflow to recognize them, the pre-release version must be changed to a stable version. For example, 1.0.0-alpha
should be changed to 1.0.0
.
Packages labeled as pre-release are ignored during deployment, and must be published manually via the appropriate CLI tools.
- Create a pull request (PR) to merge
development
intomaster
.- Begin the PR title with
Release:
for consistency. - Add the
release
issue label for discovery.
- Begin the PR title with
- Wait for the PR to receive approval and all automation to finish.
- Merge the PR with a merge commit
- Merging with a merge commit ensures there's no loss of commit information.
Semantic Release will then:
- Create new Git tags
- Create/update changelogs
- Publish new package versions to NPM
- Update the
master
branch - Create GitHub releases
- Merge all changes into the
development
branch
A package must have the following properties defined in its package.json
file in order to be published by Semantic Release
"devDependencies": {
"@hig/scripts": "^x.x.x",
"@hig/semantic-release-config": "^x.x.x",
},
"release": {
"extends": "@hig/semantic-release-config"
},
"scripts": {
"release": "hig-scripts-release"
},
Every table of contents is generated using doctoc
.
To update each document's table of contents run:
yarn docs
Scenario: a consumer reports a critical bug for @hig/[email protected]
, but the current package version is @hig/[email protected]
. Additionally, upgrading to @hig/[email protected]
isn't an option for the consumer.
We need to patch @hig/[email protected]
, by releasing @hig/[email protected]
with the fix.
- Checkout a new branch based on the tag for the respective version
git checkout @hig/[email protected]
git checkout -b fix/button
- Update the working directory
yarn install
yarn run build
- Make the necessary changes for the fix
- Commit changes following the Git commit guidelines
- Bump the package version
packages/button/package.json
{
"name": "@hig/button",
- "version": "0.1.0",
+ "version": "0.1.1"
}
- Update the
CHANGELOG.md
- Adhere to the existing format
- Commit changes
git add packages/button/package.json
git add packages/button/CHANGELOG.md
git commit -m "chore(release): bump version to `@hig/[email protected]`"
- Merge development branch and resolve conflicts
git merge development --no-ff
- Follow standard pull request procedure
- Wait for CI to successfully complete
- Wait for pull request approval
- Merge PR with merge commit
- Publish package
cd ./packages/button
npm publish
- Create a Git tag and release entry via GitHub
- The tag should point to the commit with the
chore(release)
message
- The tag should point to the commit with the