✨ This workspace has been generated by Nx, a Smart, fast and extensible build system. ✨
To start the development server run nx serve demo
. Open your browser and navigate to http://localhost:4200/. Happy coding!
If you happen to use Nx plugins, you can leverage code generators that might come with it.
Run nx list
to get a list of available plugins and whether they have generators. Then run nx list <plugin-name>
to see what generators are available.
Learn more about Nx generators on the docs.
For nx caching, set up environment variable in .env. See bitwarden "VERCEL REMOTE CACHE NX TOKEN" entry.
NX_VERCEL_REMOTE_CACHE_TOKEN=
NX_VERCEL_REMOTE_CACHE_TEAM=
To execute tasks with Nx use the following syntax:
nx <target> <project> <...options>
You can also run multiple targets:
nx run-many -t <target1> <target2>
..or add -p
to filter specific projects
nx run-many -t <target1> <target2> -p <proj1> <proj2>
Targets can be defined in the package.json
or projects.json
. Learn more in the docs.
Have a look at the Nx Console extensions. It provides autocomplete support, a UI for exploring and running tasks & generators, and more! Available for VSCode, IntelliJ and comes with a LSP for Vim users.
Just run nx build demoapp
to build the application. The build artifacts will be stored in the dist/
directory, ready to be deployed.
Nx comes with local caching already built-in (check your nx.json
). On CI you might want to go a step further.
Before any publish, releasing is mandatory if you want it to take any effect.
- Release
You will need to be connected to github (GITHUB_TOKEN, GH_TOKEN) or with cli login.
-
Install
gh
Linux
sudo apt install gh
MacOS
brew install gh
-
Connect to github
gh auth login # GitHub.com # SSH # upload ssh public key? skip # how ? login with a web browser # press enter, login.
Run npm run dry-release
to see the changes that will be made are all good.
Run npm run release
to release every project independantly at once.
If you want to release only one package specifically you can use the nx command available in each project called project-release
and project-dry-release
Check that the project name is inside nx.json, release.projects array.
# first time
npx nx run PROJECTNAME:project-dry-release --first-release
# next time
npx nx run PROJECTNAME:project-dry-release
# when you are ready
# first time
npx nx run PROJECTNAME:project-release --first-release
npx nx run PROJECTNAME:project-release
- Publish
Check that projects were released before and that the tag "publishable" is inside project.json of each project.
/some/project/project.json
{
"tags": [
"publishable"
],
}
Check that the project is public in package.json and repository is set to stack. { "publishConfig": { "access": "public" }, "repository": { "url": "https://github.com/OKAMca/stack.git" } }
Run the Publish
workflow on main with github actions.
After adding a library with nx, don't forget to add the path naming in tsconfig for import.
In tsconfig.base.json, compilerOptions.path, add:
"@okam/package-name": ["libs/section/library/src/index.ts"],
In the local source code:
import { something } from '@okam/package-name'
Restart your editor to make sure typescript is recompiled.
First define NEXT_PUBLIC_GRAPHQL_URL in your .env file
NEXT_PUBLIC_GRAPHQL_URL=https://website.com/graphql/
Then run codegen
npm run codegen