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

View File

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

1
.gitignore vendored
View File

@ -6,7 +6,6 @@ javascript/examples/**/dist
.vscode/ .vscode/
*.iml *.iml
dist dist
package-lock.json
*.tgz *.tgz
# dependencies # 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": { "bugs": {
"url": "https://github.com/maxGraph/maxGraph/issues" "url": "https://github.com/maxGraph/maxGraph/issues"
}, },
"workspaces": [
"./packages/*"
],
"scripts": { "scripts": {
"dev": "node ./scripts/dev", "dev": "node ./scripts/dev",
"bootstrap": "lerna bootstrap --no-ci",
"postinstall": "lerna bootstrap --no-ci",
"lint": "eslint packages/**/**.ts", "lint": "eslint packages/**/**.ts",
"lint:fix": "eslint --fix packages/**/**.ts", "lint:fix": "eslint --fix packages/**/**.ts",
"prettier": "prettier --write packages/*/src/**/*.ts" "prettier": "prettier --write packages/*/src/**/*.ts"
}, },
"devDependencies": { "devDependencies": {
"@lerna/filter-options": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^5.39.0", "@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0", "@typescript-eslint/parser": "^5.39.0",
"eslint": "^8.26.0", "eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.26.0",
"lerna": "^4.0.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"typescript": "^4.9.5" "typescript": "^4.9.5"
}, },

View File

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

View File

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

View File

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