mirror of
https://github.com/galacean/engine.git
synced 2026-06-08 16:52:58 +08:00
Use pnpm workspace instead of lerna (#1032)
* build: Use pnpm workspace instead of lerna
This commit is contained in:
29
.github/workflows/nodejs.yml
vendored
29
.github/workflows/nodejs.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [15.x]
|
||||
node-version: [16.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -17,9 +17,32 @@ jobs:
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm install
|
||||
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
name: Install pnpm
|
||||
id: pnpm-install
|
||||
with:
|
||||
version: 7
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
id: pnpm-cache
|
||||
run: |
|
||||
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- run: npm run ci
|
||||
- run: npm install codecov
|
||||
- run: pnpm install codecov -w
|
||||
- name: Upload coverage to Codecov
|
||||
run: ./node_modules/.bin/codecov
|
||||
- run: curl -s https://codecov.io/bash
|
||||
5
.npmrc
5
.npmrc
@@ -1,3 +1,4 @@
|
||||
registry=https://registry.npm.taobao.org
|
||||
chromedriver_cdnurl=https://npmmirror.com/mirrors/chromedriver/
|
||||
electron_mirror=http://npm.taobao.org/mirrors/electron/
|
||||
electron_mirror=http://npm.taobao.org/mirrors/electron/
|
||||
hoist=true
|
||||
auto-install-peers=true
|
||||
@@ -77,10 +77,13 @@ Make sure to read the [Contributing Guide](.github/HOW_TO_CONTRIBUTE.md) / [贡
|
||||
|
||||
## Build
|
||||
|
||||
If you don't already have [Node.js v15.0.0+](https://nodejs.org/en/) and NPM, go install them. Then, in the folder where you have cloned the repository, install the build dependencies using npm:
|
||||
prerequisites:
|
||||
- [Node.js v15.0.0+](https://nodejs.org/en/) and NPM (Install Node.js By official website)
|
||||
- [PNPM](https://pnpm.io/) (Install Pnpm globally by `npm install -g pnpm`)
|
||||
|
||||
First, you need to install the dependencies:
|
||||
```sh
|
||||
npm run bootstrap
|
||||
pnpm install
|
||||
```
|
||||
|
||||
Then, to build the source, using npm:
|
||||
|
||||
12
lerna.json
12
lerna.json
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"npmClient": "npm",
|
||||
"version": "0.9.0-alpha.4",
|
||||
"bootstrap": {
|
||||
"hoist": true
|
||||
},
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"tests/**"
|
||||
],
|
||||
"loglevel": "verbose"
|
||||
}
|
||||
14
package.json
14
package.json
@@ -2,24 +2,21 @@
|
||||
"name": "oasis-engine-root",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"bootstrap": "npm i && lerna bootstrap",
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"test": "cross-env TS_NODE_PROJECT=tsconfig.tests.json floss --path tests -r ts-node/register",
|
||||
"test-debug": "cross-env TS_NODE_PROJECT=tsconfig.tests.json floss --path tests -r ts-node/register --debug",
|
||||
"test-cov": "cross-env TS_NODE_PROJECT=tsconfig.tests.json nyc --reporter=lcov floss --path tests -r ts-node/register",
|
||||
"ci": "lerna bootstrap && npm run b:module && npm run b:types && npm run test-cov",
|
||||
"ci": "pnpm install && npm run b:module && npm run b:types && npm run test-cov",
|
||||
"lint": "eslint packages/*/src --ext .ts",
|
||||
"watch": "cross-env NODE_ENV=development BUILD_TYPE=MODULE rollup -cw -m inline",
|
||||
"watch:umd": "cross-env NODE_ENV=development BUILD_TYPE=UMD rollup -cw -m inline",
|
||||
"b:types": "lerna run b:types",
|
||||
"b:types": "pnpm -r --filter='./packages/*' run b:types",
|
||||
"b:module": "cross-env BUILD_TYPE=MODULE rollup -c",
|
||||
"b:umd": "cross-env BUILD_TYPE=UMD rollup -c",
|
||||
"b:miniprogram": "cross-env BUILD_TYPE=MINI rollup -c",
|
||||
"b:all": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c",
|
||||
"clean": "lerna exec -- rm -rf dist && lerna clean"
|
||||
"clean": "pnpm -r exec rm -rf dist && pnpm -r exec rm -rf types"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.10",
|
||||
@@ -39,10 +36,10 @@
|
||||
"@rollup/plugin-replace": "^2.3.4",
|
||||
"@types/chai": "^4.3.1",
|
||||
"@types/mocha": "^8.0.0",
|
||||
"@types/node": "^18.7.16",
|
||||
"@types/offscreencanvas": "^2019.6.4",
|
||||
"@typescript-eslint/eslint-plugin": "^4.12.0",
|
||||
"@typescript-eslint/parser": "^4.12.0",
|
||||
"babel-loader": "^8.2.2",
|
||||
"chai": "^4.3.6",
|
||||
"cross-env": "^5.2.0",
|
||||
"electron": "^13",
|
||||
@@ -51,7 +48,6 @@
|
||||
"eslint-plugin-prettier": "^3.1.1",
|
||||
"floss": "^5.0.1",
|
||||
"husky": "^4.3.7",
|
||||
"lerna": "^3.22.1",
|
||||
"lint-staged": "^10.5.3",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "^2.2.1",
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
"types/**/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@oasis-engine/math": "0.9.0-alpha.4"
|
||||
"@oasis-engine/math": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@oasis-engine/design": "0.9.0-alpha.4"
|
||||
"@oasis-engine/design": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
2
packages/design/package.json
Executable file → Normal file
2
packages/design/package.json
Executable file → Normal file
@@ -17,6 +17,6 @@
|
||||
],
|
||||
"types": "types/index.d.ts",
|
||||
"dependencies": {
|
||||
"@oasis-engine/math": "0.9.0-alpha.4"
|
||||
"@oasis-engine/math": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
"types/**/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@oasis-engine/core": "0.9.0-alpha.4"
|
||||
"@oasis-engine/core": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
"types/**/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@oasis-engine/core": "0.9.0-alpha.4",
|
||||
"@oasis-engine/draco": "0.9.0-alpha.4",
|
||||
"@oasis-engine/math": "0.9.0-alpha.4",
|
||||
"@oasis-engine/rhi-webgl": "0.9.0-alpha.4"
|
||||
"@oasis-engine/core": "workspace:*",
|
||||
"@oasis-engine/draco": "workspace:*",
|
||||
"@oasis-engine/math": "workspace:*",
|
||||
"@oasis-engine/rhi-webgl": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
0
packages/math/package.json
Executable file → Normal file
0
packages/math/package.json
Executable file → Normal file
@@ -18,9 +18,9 @@
|
||||
"types/**/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@oasis-engine/core": "0.9.0-alpha.4",
|
||||
"@oasis-engine/loader": "0.9.0-alpha.4",
|
||||
"@oasis-engine/math": "0.9.0-alpha.4",
|
||||
"@oasis-engine/rhi-webgl": "0.9.0-alpha.4"
|
||||
"@oasis-engine/core": "workspace:*",
|
||||
"@oasis-engine/loader": "workspace:*",
|
||||
"@oasis-engine/math": "workspace:*",
|
||||
"@oasis-engine/rhi-webgl": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,10 @@
|
||||
"types/**/*"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@oasis-engine/design": "0.9.0-alpha.4"
|
||||
"@oasis-engine/design": "workspace:*",
|
||||
"oasis-engine": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"oasis-engine": "0.9.0-alpha.4"
|
||||
"oasis-engine": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
"types/**/*"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@oasis-engine/design": "0.9.0-alpha.4"
|
||||
"@oasis-engine/design": "workspace:*",
|
||||
"oasis-engine": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"oasis-engine": "0.9.0-alpha.4"
|
||||
"oasis-engine": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
"types/**/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@oasis-engine/core": "0.9.0-alpha.4",
|
||||
"@oasis-engine/math": "0.9.0-alpha.4"
|
||||
"@oasis-engine/core": "workspace:*",
|
||||
"@oasis-engine/math": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@oasis-engine/design": "0.9.0-alpha.4"
|
||||
"@oasis-engine/design": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
5
pnpm-workspace.yaml
Normal file
5
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
packages:
|
||||
# all packages in direct subdirs of packages/
|
||||
- 'packages/*'
|
||||
# all packages in subdirs of components/
|
||||
- 'tests'
|
||||
@@ -15,9 +15,10 @@
|
||||
"types/**/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@oasis-engine/core": "0.9.0-alpha.4",
|
||||
"@oasis-engine/design": "0.9.0-alpha.4",
|
||||
"@oasis-engine/math": "0.9.0-alpha.4",
|
||||
"@oasis-engine/rhi-webgl": "0.9.0-alpha.4"
|
||||
"@oasis-engine/core": "workspace:*",
|
||||
"@oasis-engine/design": "workspace:*",
|
||||
"@oasis-engine/math": "workspace:*",
|
||||
"@oasis-engine/rhi-webgl": "workspace:*",
|
||||
"@oasis-engine/physics-lite": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user