Install pnpm globally:
npm i -g pnpm
pnpm i
pnpm setup
After setting up pnpm
, close and reopen VSCode before continuing to the next step.
Install Nx globally:
pnpm add -g nx
(If you choose not to install Nx globally, you will have to prefix pnpm
to all nx [...]
commands in this README. For example, nx test lang-font-picker
becomes pnpm nx test lang-font-picker
.)
Project-specific tasks are generally executed with Nx using
nx <target> <project> <...options>
where <target>
is one of
build
lint
preview
serve
static-serve
test
and <project>
is one of
headless-lfp
lang-font-picker
unstyled-lfp
For a specific <project>
(e.g., lang-font-picker
):
nx build <project>
To run on all projects:
pnpm build
The build artifacts are stored in the output directory dist/
.
To check formatting on all projects:
pnpm format:check
To fix formatting on all projects:
pnpm format:write
To lint a specific <project>
(e.g., lang-font-picker
):
nx lint <project>
To lint all projects:
pnpm lint
For a specific <project>
(e.g., lang-font-picker
):
nx test <project>
To run on all projects:
pnpm test
nx graph
To see the targets available for a specific <project>
(e.g., lang-font-picker
):
nx show project <project> --web
For a new project with a library (e.g. an internal utility or reusable component) named <library>
:
nx g @nx/react:library --bundler=vite --component=false --directory=libs/<library> --unitTestRunner=vitest <library>
In the new project's folder, in package.json
:
- change the
version
line to match the version of the other projects;
and in project.json
:
- change the
sourceRoot
line to"sourceRoot": "{projectRoot}/src",
; - delete the
// targets
line.
You can use Nx generators to jump-start a new application, component, hook, etc., such as with https://nx.dev/nx-api/react/generators/component. When first executing a nx generate ...
or nx g ...
command, use the --dry-run
flag to see what files will be created or modified.
See https://nx.dev/features/manage-releases for how to use nx release
to:
- Update version number across all projects;
- Auto-update the CHANGELOG;
- Release the new version of all projects.
For now, development next-steps and goals can be added to and updated in the Development To-Do List. After the first release, move dev steps to issues which can be closed with targeted pull requests. For broader goals, consider coordinating work with a GitHub project.