Files
xo-stack/README.md
2025-10-23 04:39:15 +00:00

119 lines
2.6 KiB
Markdown

# XO Stack
This is a monorepo project containing multiple packages managed with NPM workspaces.
## Project Structure
```
xo/
├── packages/
│ ├── primitives/
│ ├── wallet/
│ └── vue/
├── package.json
└── README.md
```
## Prerequisites
- Node.js (version 20.0.0 or later)
- NPM (version 7 or later, which includes workspaces support)
## Installation
To install all dependencies for all packages in the monorepo, run the following command from the root directory:
```bash
npm ci
```
This command will install dependencies for the root project and all packages in the `packages/` directory.
## Building Packages
To build all packages, run the following command from the root directory:
```bash
npm run build
```
This will execute the build script for each package in the monorepo.
To build a specific package, you can use the following command:
```bash
npm run build --workspace=@my-monorepo/<package-name>
```
Replace `<package-name>` with the name of the package you want to build (e.g., primitives, network-wallet, or vue).
## Running Tests
To run tests for all packages:
```bash
npm test
```
To run tests for a specific package:
```bash
npm test --workspace=@my-monorepo/<package-name>
```
## Development
During development, you can use the following command to watch for changes and rebuild packages automatically:
```bash
npm run dev
```
## Useful NPM Workspace Commands
- List all packages in the workspace:
```bash
npm ls -w
```
- Run a command in a specific package:
```bash
npm run <command> --workspace=@my-monorepo/<package-name>
```
- Add a dependency to a specific package:
```bash
npm install <dependency> --workspace=@my-monorepo/<package-name>
```
## Refactor details
We will want to use inheritance in place of IWallet, etc. A neat structure to refactor to is:
- /theThing/
- base-thing.ts
- types.ts
- utils.ts
- ...
- Rename IndexedCollection to ExtMap.
- Rename from method to fromArray.
- Have the from method accept an object.
## Troubleshooting npm audit fix issues
Currently we overrides `vite` dependency for `vitepress` and `vitepress-plugin-mermaid` for not being using a safe version free of vulnerabilities.
The `overrides` clause can be found in the package.json file.
Running `npm audit fix` doesn't look at `overrides` clause and will install the original ones.
Instead of use `npm audit fix` to try to solve vulnerabilities, try updating the version of the vulnerable package. In case npm return errors trying to perform this is recommented to:
1. Delete the `node_modules` folder
- rm -Rf node_modules/
2. Delete the package-lock.json
- rm package-lock.json