Kogen is a project that utilizes npm workspaces to manage multiple packages within a single repository.
- Project Structure
- Workspaces
- Getting Started
- Development
- Testing Production Build
- Contributing
- License
The project is organized using npm workspaces, with the following structure:
kogen/
├── package.json
├── package/
│ └── ui/
│ ├── .env.example
│ ├── package.json
│ └── ...
└── ...
This project uses npm workspaces, which is a feature that allows you to manage multiple packages within a single repository. Workspaces offer several benefits:
- Simplified dependency management: Shared dependencies are hoisted to the root, reducing duplication and saving disk space.
- Cross-package development: You can easily work on and test multiple packages simultaneously.
- Consistent versioning: Ensures all packages use the same version of shared dependencies.
In this project, we have a workspace called @kogen/kogen-ui
located in the package/ui
directory.
- Node.js (version 12.22.9 or higher)
- npm (version 8.19.3 or higher)
-
Clone the repository:
git clone https://github.com/kogen-markets/app.git cd app
-
Set up the environment for the UI package:
cp package/ui/.env.example package/ui/.env
-
Install dependencies:
npm i
To start the development server for the UI package:
npm -w @kogen/kogen-ui run dev
This command uses the -w
flag to specify the workspace package you want to run the script in.
To build and serve the production version of the UI package:
-
Build the production version:
npm run -w @kogen/kogen-ui build:prod
-
Serve the built files:
npx serve package/ui/dist