Here is a little POC to help our team move forward with our stack! β¨
description | url |
---|---|
π Backend app | https://rhf-mui-nx-sandbox-back.herokuapp.com |
π Frontend app | https://mui-rhf-sandbox.vercel.app |
π Storybook | https://mui-rhf-sandbox-storybook.vercel.app |
# using fnm to set node version - https://github.com/Schniz/fnm
fnm use
# Installing dependencies
pnpm i
# starting backend and frontend in parallel
pnpm dev frontend-app,backend-app
# on windows
pnpm dev "frontend-app,backend-app"
# run all tests
pnpm test-all
# launch cypress tests in watch mode
pnpm nx e2e front-e2e-app --watch
# launch storybook in dev mode
pnpm storybook
Seriously, read these please π₯²
πΆ Forms handling
πΆ Tests
πΆ Storybook
πΆ Cypress
Project | Description |
---|---|
π frontend-app app |
Our frontend app, containing a signup form |
π front-e2e-app app |
Our end to end testing code using cypress |
π front-storybook-app app |
A next app used to serve storybook |
π backend-app app |
Our backend app, relying on an in-memory dataset |
π§© front-api-lib lib |
Our api types, extracted from the backend swagger |
π§© front-components-lib lib |
Our generic components and the MUI theme shared by all our frontend apps |
π§© front-contexts-lib lib |
Shared contexts |
π§© front-logic-lib lib |
Shared logic code |
π§© front-storybook-lib lib |
Library centralizing the configuration necessary to build and run storybook. |
π§© front-tests-lib lib |
Tests related helpers and wrappers. |
π§© front-theme-lib lib |
Our applications theme (Mui). |
π§© front-translations-lib lib |
Translations locales and helpers for our UI. |
Description | Command |
---|---|
pnpm nx run <action> <project> |
|
pnpm nx run-many --target=<action> --all |
|
pnpm nx run-many --target=<action> --projects=<project1>,<project2> |
|
pnpm nx affected:<action> |
Actions are defined by project in project.json
files. Here are a few standard actions:
Action | Description |
---|---|
π οΈ build | Builds the app/lib. Use --prod flag for a production build |
π serve | Runs the app |
Run the linter against project files | |
βοΈ type-check | Uses tsc --noEmit to validate types against project files |
β test | Runs tests |
βοΈ e2e | Runs end to end tests |
π΅οΈ Sonarcloud scan | Execute sonarcloud scanner on the targetted app of lib |
flag | Description |
---|---|
β¬ --target=x |
specifies which action to run |
β¬ --skip-nx-cache |
disables nx caching; the command will be ran fully |
β¬ --verbose |
prints additional error stack trace on failure |
β¬ --projects=x,x |
run-many : specifies which projects to run the action against |
β¬ --parallel=x |
run-many : allows x tasks to be ran in parallel |
Description | Command |
---|---|
β Run tests for a project (watch) | pnpm test-changes <project> or pnpm nx test --project=<project> --watch |
β Run all tests for a project (watchAll) | pnpm test-dev <project> or pnpm nx test --project=<project> --watchAll |
β Run all tests in parallel | pnpm test-all or pnpm nx run-many --target=test --parallel --all |
Description | Command |
---|---|
ποΈ Create a new front app or lib | pnpm nx g @nrwl/react:app <appname> or pnpm nx g @nrwl/react:lib <libname> |
ποΈ Create a new backend app or lib | pnpm nx g @nrwl/nest:app <appname> or pnpm nx g @nrwl/nest:lib <libname> |
ποΈ Create a vanilla node lib | pnpm nx g @nrwl/node:lib <libname> |