This is a multi-workspace repo that requires npm v8. The minimum node version is set to v16 only from an LTS perspective.
Node can be downloaded from the official Node.js site. You may also consider using a Node version manager.
Your version of Node may not ship with npm v8. To install it, run:
npm install npm@8
From the root of the project, install dependencies by running:
npm install
Installing from the root of the repository is required to avoid multiple installations of React in the workspaces. When this happens, React will fail to render.
Dependencies can also be installed from the root of the repository. To install a dependency for a specific workspace, you can run:
npm install --save my-package --workspace=packages/core
Since this is a TypeScript project, installing the community type definitions may also be required:
npm install --save-dev @types/my-package --workspace=packages/core
Run the prototype in dev mode with auto-rebuilding:
npm run dev
By default, this will start a dev server listening to http://localhost:3000
Note: Recompiling the type definitions for core needs to be done manually:
npm run compile --w=packages/core
Run ESLint for all of the workspaces:
npm run lint
Run prettier for all of the workspaces:
npm run format
This project uses jest
for testing.
Test Type | Filename |
---|---|
Unit | *.unit.test.ts |
Integration | *.int.test.ts |
Tests should live in the same directory as if a single module is under test. Since unit tests should only test a single module, they should also live in the directory. For example,
+ /src
| - monarch.ts
| - monarch.unit.ts
| - monarch.int.ts
npm run test
will run unit tests.
npm run test:int
will run integration tests.
npm run test:all
will run both unit and integration tests.
docker build -t frontend .
will build a container with all available packages built
docker run -p 3000:3000 -it frontend
will run the container from above.
The container can be viewed at localhost:3000{BASE_PATH | /}
Note that the base path is configurable with the BASE_PATH
environment variable. It is left empty by default when running locally