-
Notifications
You must be signed in to change notification settings - Fork 2
Contribution Guide
This project is a Lerna Monorepo. It contains multiple packages which are versioned and published to NPM separately.
The goal is to hopefully make it a seamless process to create, develop, and publish a new package from this repo.
- Node 11.3
Install this project's dependencies and all leaf package dependencies from the project root:
npm i && npm run bootstrapThe following workflow should be followed:
- Generate and Develop a New Component
- Add Dependencies
- Generate Docz File
- Lint and Test
- Bump Changed Package Versions
- Commit Files and Submit Pull Request
- Publish Changed Packages
Run the generator script, which will prompt you for a component name:
npm run createThe generator will scaffold your package files based on the name you give it.
For example, a component named MySweetButton will be created at packages/@t7/my-sweet-button ready for development.
Install a dependency to your new package from the project root:
# Installs module-name to `dependencies` of @t7/my-sweet-button package.
npm run add -- module-name --scope=@t7/my-sweet-button
# Installs module-name to `devDependencies` of @t7/my-sweet-button package.
npm run add -- module-name --scope=@t7/my-sweet-button --dev
# Installs `@t7/accordion` to `dependencies` of `@t7/my-sweet-button` and symlinks from the local repo.
npm run add -- @t7/accordion --scope=@t7/my-sweet-buttonNote: Lerna will automatically symlink dependencies that match any packages within this repo. 🎉
Fill out the generated index.mdx file and test it from the project root:
npm run doczRun eslint, stylelint, and jest from the package root:
npm run lint && npm run testIf you run into any errors, try reinstalling dependencies.
Bump changed package versions from the project root:
npm run bumpLerna determines changed packages and will prompt you for all. Be sure to follow semver guidelines.
Changes should go through a pull request process:
git checkout -b feature/my-sweet-button
git add --all
git commit -m "Adds new MySweetButton component."
git push -u origin feature/my-sweet-buttonSubmit a pull request and merge to master.
Publish changed packages once all component changes and version numbers have been successfully committed, reviewed, and merged:
npm run publish
# If using 2FA on NPM, use key from your MFA device.
NPM_CONFIG_OTP=123456 npm run publish