Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update lerna to v7 and migrate to npm workspace #1636

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- feat-lerna-bootstrap-deprecate
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove this later

pull_request:

jobs:
Expand All @@ -21,26 +22,21 @@ jobs:
ignore: "./**/CHANGELOG.md"
args: "./**/*.md"

- name: restore lerna
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache
- uses: actions/setup-node@v3
with:
path: |
./node_modules
./package-lock.json
node_modules
detectors/node/*/node_modules
metapackages/*/node_modules
packages/*/node_modules
plugins/node/*/node_modules
plugins/web/*/node_modules
propagators/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
node-version: ${{ matrix.node }}
cache: 'npm'
cache-dependency-path: |
package.json
detectors/node/*/package.json
metapackages/*/package.json
packages/*/package.json
plugins/node/*/package.json
plugins/web/*/package.json
propagators/*/package.json

- name: Bootstrap
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install --only=dev --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --nohoist='gts' --ignore-scripts -- --only=dev
- name: Lint
run: npm run lint
1 change: 0 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
- name: Build Packages
run: |
npm install
npx lerna bootstrap --no-ci

- uses: google-github-actions/release-please-action@v3
id: release
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-all-versions.push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- "main"
- "release/**"
- "release-please/**"
- feat-lerna-bootstrap-deprecate
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove this later


jobs:
tav:
Expand Down
41 changes: 17 additions & 24 deletions .github/workflows/test-all-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
fail-fast: false
matrix:
node: ["14", "16", "18"]
include:
- node: 14
npm: 7
runs-on: ubuntu-latest
services:
mongo:
Expand Down Expand Up @@ -113,33 +116,23 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache-dependency-path: |
package.json
detectors/node/*/package.json
metapackages/*/package.json
packages/*/package.json
plugins/node/*/package.json
plugins/web/*/package.json
propagators/*/package.json
- name: Install minimum npm 7
if: matrix.npm
run: npm install -g npm@${{matrix.npm}}
- name: Set MySQL variables
run: mysql --user=root --password=${MYSQL_ROOT_PASSWORD} --host=${MYSQL_HOST} --port=${MYSQL_PORT} -e "SET GLOBAL log_output='TABLE'; SET GLOBAL general_log = 1;" mysql
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
detectors/node/*/node_modules
detectors/node/*/package-lock.json
metapackages/*/node_modules
metapackages/*/package-lock.json
packages/*/node_modules
packages/*/package-lock.json
plugins/node/*/node_modules
plugins/node/*/package-lock.json
plugins/web/*/node_modules
plugins/web/*/package-lock.json
propagators/*/node_modules
propagators/*/package-lock.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }}
- name: Legacy Peer Dependencies for npm 7
if: matrix.node == '16'
run: npm config set legacy-peer-deps=true
- name: Install Root Dependencies
run: npm install --ignore-scripts
- name: Bootstrap Dependencies
run: npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --nohoist='mocha' --nohoist='ts-mocha'
run: npm install
- name: Run test-all-versions
run: npx lerna run test-all-versions ${{ inputs.lerna-args }} ${{ matrix.lerna-extra-args }} --stream --concurrency 1
run: npx lerna run --no-bail test-all-versions ${{ inputs.lerna-args }} ${{ matrix.lerna-extra-args }} --stream --concurrency 1
90 changes: 40 additions & 50 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Unit Tests
on:
push:
branches: [main]
branches:
- feat-lerna-bootstrap-deprecate
pull_request:

jobs:
Expand All @@ -13,6 +14,7 @@ jobs:
include:
- node: 14
code-coverage: true
npm: 7
runs-on: ubuntu-latest
services:
memcached:
Expand Down Expand Up @@ -121,40 +123,32 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache-dependency-path: |
package.json
detectors/node/*/package.json
metapackages/*/package.json
packages/*/package.json
plugins/node/*/package.json
plugins/node/*/examples/package.json
plugins/web/*/package.json
plugins/web/*/examples/package.json
propagators/*/package.json
- name: Install minimum npm 7
if: matrix.npm
run: npm install -g npm@${{matrix.npm}}
- name: Set MySQL variables
run: mysql --user=root --password=${MYSQL_ROOT_PASSWORD} --host=${MYSQL_HOST} --port=${MYSQL_PORT} -e "SET GLOBAL log_output='TABLE'; SET GLOBAL general_log = 1;" mysql
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
detectors/node/*/node_modules
detectors/node/*/package-lock.json
metapackages/*/node_modules
metapackages/*/package-lock.json
packages/*/node_modules
packages/*/package-lock.json
plugins/node/*/node_modules
plugins/node/*/package-lock.json
plugins/web/*/node_modules
plugins/web/*/package-lock.json
propagators/*/node_modules
propagators/*/package-lock.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }}
- name: Legacy Peer Dependencies for npm 7
if: matrix.node == '16'
run: npm config set legacy-peer-deps=true
- name: Install Root Dependencies
run: npm install --ignore-scripts
- name: Bootstrap Dependencies
run: npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --nohoist='mocha' --nohoist='ts-mocha'
- name: Install Dependencies
run: npm install
- name: Unit tests (Full)
if: matrix.code-coverage
run: npm run test -- ${{ matrix.lerna-extra-args }}
run: npx lerna run test ${{ matrix.lerna-extra-args }}
- name: Unit tests (Delta)
if: ${{ !matrix.code-coverage }}
run: npm run test:ci:changed -- ${{ matrix.lerna-extra-args }}
run: npx lerna run test ${{ matrix.lerna-extra-args }} --since origin/main
- name: Build examples
run: npm run compile:examples
- name: Report Coverage
Expand All @@ -168,6 +162,9 @@ jobs:
fail-fast: false
matrix:
node: ["14"]
include:
- node: 14
npm: 7
runs-on: ubuntu-latest
env:
NPM_CONFIG_UNSAFE_PERM: true
Expand All @@ -180,31 +177,24 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
detectors/node/*/node_modules
detectors/node/*/package-lock.json
metapackages/*/node_modules
metapackages/*/package-lock.json
packages/*/node_modules
packages/*/package-lock.json
plugins/node/*/node_modules
plugins/node/*/package-lock.json
plugins/web/*/node_modules
plugins/web/*/package-lock.json
propagators/*/node_modules
propagators/*/package-lock.json
key: ${{ runner.os }}${{ matrix.node }}-browser-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }}
cache: 'npm'
cache-dependency-path: |
package.json
detectors/node/*/package.json
metapackages/*/package.json
packages/*/package.json
plugins/node/*/package.json
plugins/web/*/package.json
propagators/*/package.json
- name: Install minimum npm@${{matrix.npm}}
if: matrix.npm
run: npm install -g npm@${{matrix.npm}}
- name: Legacy Peer Dependencies for npm>7
run: npm config set legacy-peer-deps=true
- name: Install Root Dependencies
run: npm install --ignore-scripts
- name: Bootstrap Dependencies
run: npx lerna bootstrap --no-ci
run: npm install --legacy-bundling
- name: Unit tests
run: npm run test:browser
run: npx lerna run --no-bail test:browser
- name: Report Coverage
uses: codecov/codecov-action@v3
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@types/mocha": "8.2.3",
"@types/react": "17.0.16",
"@types/react-dom": "18.0.2",
"@types/sinon": "10.0.2",
"@types/sinon": "10.0.15",
"@types/sinon-chrome": "2.2.11",
"@typescript-eslint/eslint-plugin": "5.8.1",
"@typescript-eslint/parser": "5.8.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-alibaba-cloud --include-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"watch": "tsc -w"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-aws --include-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"watch": "tsc -w"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version --scope @opentelemetry/resource-detector-container --include-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"version:update": "node ../../../scripts/version-update.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-gcp --include-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"watch": "tsc -w"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-github --include-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"watch": "tsc -w"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-instana --include-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"watch": "tsc -w"
Expand Down
1 change: 0 additions & 1 deletion metapackages/auto-instrumentations-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/auto-instrumentations-node --include-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"tdd": "yarn test -- --watch-extensions ts --watch",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts'",
"watch": "tsc -w"
Expand Down
1 change: 0 additions & 1 deletion metapackages/auto-instrumentations-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/auto-instrumentations-web --include-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test:browser": "nyc karma start --single-run",
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json"
},
Expand Down
19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"types": "build/src/index.d.ts",
"scripts": {
"clean": "lerna run clean",
"postinstall": "npm run bootstrap",
"postinstall": "lerna run compile",
"prepare": "husky install",
"precompile": "tsc --version && npm run version:update",
"version:update": "lerna run version:update",
Expand All @@ -23,15 +23,12 @@
"test": "lerna run test",
"test:ci:changed": "lerna run test --since origin/main",
"test:browser": "lerna run test:browser --concurrency 1",
"bootstrap": "lerna bootstrap --no-ci",
"bump": "lerna publish",
"changelog": "lerna-changelog",
"lerna:link": "lerna link",
"lint": "lerna run lint",
"lint:fix": "lerna run lint:fix",
"lint:examples": "eslint ./examples/**/*.js",
"lint:examples:fix": "eslint ./examples/**/*.js --fix",
"lerna:scope": "lerna bootstrap --include-dependents --include-dependencies --scope"
"lint:examples:fix": "eslint ./examples/**/*.js --fix"
},
"keywords": [
"opentelemetry",
Expand All @@ -56,11 +53,21 @@
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "4.2.1",
"husky": "7.0.4",
"lerna": "5.5.2",
"lerna": "7.1.1",
"lerna-changelog": "2.2.0",
"prettier": "2.8.8",
"typescript": "4.4.4"
},
"workspaces": [
"packages/*",
"metapackages/*",
"plugins/node/*",
"plugins/node/*/examples",
"plugins/web/*",
"plugins/web/*/examples",
"propagators/*",
"detectors/node/*"
],
"changelog": {
"labels": {
"breaking": ":boom: Breaking Change",
Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-host-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/host-metrics --include-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"tdd": "npm run test -- --watch-extensions ts --watch",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"version:update": "node ../../scripts/version-update.js",
Expand Down
3 changes: 1 addition & 2 deletions packages/opentelemetry-id-generator-aws-xray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"test:browser": "nyc karma start --single-run",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json",
"prepare": "npm run compile"
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json"
},
"keywords": [
"opentelemetry",
Expand Down
Loading