@clipboard-health/nx-plugin
Clipboard Health's Nx plugin contains generators to manage libraries within an Nx workspace.
Table of Contents
Install
npm install @clipboard-health/nx-plugin
Usage
Adding new libraries
Libraries version and publish separately. We use Nx Local Generators to generate library stubs that successfully build, lint, and test. The --publishable
flag sets up semantic versioning from commit messages, GitHub Release creation, and NPM publishing on merges to main
(but only if the code within your library package changed, thanks to Nx's dependency graph).
npx nx generate @clipboard-health/nx-plugin:node-lib [PROJECT_NAME]
npx nx generate @nx/workspace:remove --projectName [PROJECT_NAME]
npx nx generate @nx/workspace:move --projectName [PROJECT_NAME] --destination [NEW_PROJECT_NAME]
Porting existing libraries
Follow Adding new libraries to generate a new package and copy the code from the existing library into it.
To keep the same project name while avoiding publishing version conflicts, create a git tag
from the last commit on main
with the project name and version:
git checkout main
git tag --annotate [PROJECT_NAME]@[VERSION] --message "Port from [OLD_LOCATION]"
git push origin [PROJECT_NAME]@[VERSION]