chore: use npm workspaces (#273)

`maxGraph` was using `lerna` v4 to build and only used its "build
workspaces" support, not the "publishing" support as we only published a
single package and it is done manually, without using `lerna`.
The support for packages in `lerna` was removed in version 7. See
https://github.com/lerna/lerna/releases/tag/7.0.0 and
https://lerna.js.org/docs/legacy-package-management.
So, start using npm workspaces as we don't need to manage the publishing
of several packages for now.

This will allow to do more reproducible builds by locking dependencies
with a `package-lock.json` file. This didn't work well with `lerna` v4
and had been disabled.
development
Thomas Bouffard 2023-12-04 03:25:41 +01:00 committed by GitHub
parent 068a50f35c
commit d9b85945f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 25438 additions and 46 deletions

14
.github/actions/build-setup/action.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: 'Build Setup'
description: 'Setup node and install dependencies'
runs:
using: 'composite'
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
uses: bahmutov/npm-install@v1
with:
install-command: npm ci --prefer-offline --audit false --ignore-scripts --no-fund

View File

@ -37,27 +37,18 @@ jobs:
os: ['ubuntu-22.04', 'macos-13', 'windows-2022']
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm install
- name: Build Setup
uses: ./.github/actions/build-setup
- name: Build @maxgraph/core - esm
working-directory: packages/core
run: npm run build
run: npm run build -w packages/core
- name: Test @maxgraph/core
working-directory: packages/core
run: npm test
run: npm test -w packages/core
- name: Test TypeScript support
working-directory: packages/ts-support
run: npm test
run: npm test -w packages/ts-support
- name: Build ts-example
working-directory: packages/ts-example
run: npm run build
run: npm run build -w packages/ts-example
- name: Build Storybook mini-site
working-directory: packages/html
run: npm run build
run: npm run build -w packages/html
- name: Upload all examples as artifact
uses: actions/upload-artifact@v3
with:

View File

@ -17,18 +17,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm install
- name: Build Setup
uses: ./.github/actions/build-setup
- name: Build @maxgraph/core API docs
working-directory: packages/core
run: npm run docs:api
run: npm run docs:api -w packages/core
- name: Build website
working-directory: packages/website
run: npm run build
run: npm run build -w packages/website
- name: Upload website artifact
uses: actions/upload-artifact@v3
with:

1
.gitignore vendored
View File

@ -6,7 +6,6 @@ javascript/examples/**/dist
.vscode/
*.iml
dist
package-lock.json
*.tgz
# dependencies

View File

@ -1,6 +0,0 @@
{
"packages": [
"packages/*"
],
"version": "0.0.0"
}

25410
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -11,22 +11,21 @@
"bugs": {
"url": "https://github.com/maxGraph/maxGraph/issues"
},
"workspaces": [
"./packages/*"
],
"scripts": {
"dev": "node ./scripts/dev",
"bootstrap": "lerna bootstrap --no-ci",
"postinstall": "lerna bootstrap --no-ci",
"lint": "eslint packages/**/**.ts",
"lint:fix": "eslint --fix packages/**/**.ts",
"prettier": "prettier --write packages/*/src/**/*.ts"
},
"devDependencies": {
"@lerna/filter-options": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"lerna": "^4.0.0",
"prettier": "^2.7.1",
"typescript": "^4.9.5"
},

View File

@ -9,9 +9,6 @@
"build": "tsc && storybook build --output-dir dist",
"preview": "vite preview"
},
"dependencies": {
"@maxgraph/core": "*"
},
"devDependencies": {
"@storybook/addon-essentials": "^7.4.6",
"@storybook/addon-links": "^7.4.6",

View File

@ -7,9 +7,6 @@
"build": "tsc --version && tsc && vite build --base ./",
"preview": "vite preview"
},
"dependencies": {
"@maxgraph/core": "*"
},
"devDependencies": {
"vite": "~4.4.2"
}

View File

@ -4,9 +4,6 @@
"scripts": {
"test": "tsc --version && tsc"
},
"dependencies": {
"@maxgraph/core": "*"
},
"devDependencies": {
"typescript": "3.8.2"
}