Skip to content

Commit c7c7547

Browse files
trentmpichlermarc
andauthored
chore: use npm workspaces and a package-lock.json (#1771)
Co-authored-by: Marc Pichler <[email protected]>
1 parent 4c8b374 commit c7c7547

File tree

89 files changed

+66897
-255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+66897
-255
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,19 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12-
container:
13-
image: node:14
14-
1512
steps:
1613
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 18
17+
cache: 'npm'
1718

1819
- name: Lint markdown files
1920
uses: avto-dev/markdown-lint@v1
2021
with:
2122
ignore: "./**/CHANGELOG.md"
2223
args: "./**/*.md"
2324

24-
- name: restore lerna
25-
uses: actions/cache@master # must use unreleased master to cache multiple paths
26-
id: cache
27-
with:
28-
path: |
29-
./node_modules
30-
./package-lock.json
31-
node_modules
32-
detectors/node/*/node_modules
33-
metapackages/*/node_modules
34-
packages/*/node_modules
35-
plugins/node/*/node_modules
36-
plugins/web/*/node_modules
37-
propagators/*/node_modules
38-
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
39-
40-
- name: Bootstrap
41-
if: steps.cache.outputs.cache-hit != 'true'
42-
run: |
43-
npm install --only=dev --ignore-scripts
44-
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --nohoist='gts' --ignore-scripts -- --only=dev
25+
- run: npm ci
4526
- name: Lint
4627
run: npm run lint

.github/workflows/peer-api.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
peer-api-check:
1111
runs-on: ubuntu-latest
1212
container:
13-
image: node:14
13+
image: node:18
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717

1818
- name: Install script dependencies
19-
run: npm install
19+
run: npm ci
2020

2121
- name: Check API dependency semantics
2222
run: npx lerna exec "node \$LERNA_ROOT_PATH/scripts/peer-api-check.js"

.github/workflows/release-please-validate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/checkout@v4
1717

1818
- name: Install lerna
19-
run: npm install -g lerna@5.5.2
19+
run: npm install -g lerna@6.6.2
2020

2121
- name: Ensure Release Please Config and Manifest are in sync with the repository
2222
run: node scripts/check-release-please.mjs

.github/workflows/release-please.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,13 @@ jobs:
1717
- name: Setup Node
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: 14
20+
node-version: 18
2121
registry-url: 'https://registry.npmjs.org'
2222

23-
- name: Cache Dependencies
24-
uses: actions/cache@v3
25-
with:
26-
path: |
27-
node_modules
28-
package-lock.json
29-
detectors/node/*/node_modules
30-
metapackages/*/node_modules
31-
packages/*/node_modules
32-
plugins/node/*/node_modules
33-
plugins/web/*/node_modules
34-
propagators/*/node_modules
35-
key: release-${{ runner.os }}-${{ matrix.container }}-${{ hashFiles('**/package.json') }}
36-
3723
- name: Build Packages
3824
run: |
39-
npm install
40-
npx lerna bootstrap --no-ci
25+
npm ci
26+
npm run compile
4127
4228
- uses: google-github-actions/release-please-action@v3
4329
id: release

.github/workflows/test-all-versions.pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: actions/checkout@v4
2323
# Need lerna to list all packages
2424
- name: Install lerna
25-
run: npm install -g lerna@5.5.2
25+
run: npm install -g lerna@6.6.2
2626
- name: Parse labels into lerna scope arguments
2727
id: lerna-args
2828
run: |

.github/workflows/test-all-versions.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -115,31 +115,15 @@ jobs:
115115
node-version: ${{ matrix.node }}
116116
- name: Set MySQL variables
117117
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
118-
- name: Cache Dependencies
119-
uses: actions/cache@v3
120-
with:
121-
path: |
122-
node_modules
123-
package-lock.json
124-
detectors/node/*/node_modules
125-
detectors/node/*/package-lock.json
126-
metapackages/*/node_modules
127-
metapackages/*/package-lock.json
128-
packages/*/node_modules
129-
packages/*/package-lock.json
130-
plugins/node/*/node_modules
131-
plugins/node/*/package-lock.json
132-
plugins/web/*/node_modules
133-
plugins/web/*/package-lock.json
134-
propagators/*/node_modules
135-
propagators/*/package-lock.json
136-
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') }}
137118
- name: Legacy Peer Dependencies for npm 7
138119
if: matrix.node == '16'
139120
run: npm config set legacy-peer-deps=true
140-
- name: Install Root Dependencies
141-
run: npm install --ignore-scripts
142-
- name: Bootstrap Dependencies
143-
run: npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --nohoist='mocha' --nohoist='ts-mocha'
121+
- name: Update npm to a version that supports workspaces (v7 or later)
122+
if: ${{ matrix.node < 16 }}
123+
run: npm install -g npm@9 # npm@9 supports node >=14.17.0
124+
- name: Install
125+
run: npm ci
126+
- name: Build
127+
run: npm run compile
144128
- name: Run test-all-versions
145129
run: npx lerna run test-all-versions ${{ inputs.lerna-args }} ${{ matrix.lerna-extra-args }} --stream --concurrency 1

.github/workflows/unit-test.yml

Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -123,32 +123,16 @@ jobs:
123123
node-version: ${{ matrix.node }}
124124
- name: Set MySQL variables
125125
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
126-
- name: Cache Dependencies
127-
uses: actions/cache@v3
128-
with:
129-
path: |
130-
node_modules
131-
package-lock.json
132-
detectors/node/*/node_modules
133-
detectors/node/*/package-lock.json
134-
metapackages/*/node_modules
135-
metapackages/*/package-lock.json
136-
packages/*/node_modules
137-
packages/*/package-lock.json
138-
plugins/node/*/node_modules
139-
plugins/node/*/package-lock.json
140-
plugins/web/*/node_modules
141-
plugins/web/*/package-lock.json
142-
propagators/*/node_modules
143-
propagators/*/package-lock.json
144-
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') }}
145126
- name: Legacy Peer Dependencies for npm 7
146127
if: matrix.node == '16'
147128
run: npm config set legacy-peer-deps=true
148-
- name: Install Root Dependencies
149-
run: npm install --ignore-scripts
150-
- name: Bootstrap Dependencies
151-
run: npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --nohoist='mocha' --nohoist='ts-mocha'
129+
- name: Update npm to a version that supports workspaces (v7 or later)
130+
if: ${{ matrix.node < 16 }}
131+
run: npm install -g npm@9 # npm@9 supports node >=14.17.0
132+
- name: Install
133+
run: npm ci
134+
- name: Build
135+
run: npm run compile
152136
- name: Unit tests (Full)
153137
if: matrix.code-coverage
154138
run: npm run test -- ${{ matrix.lerna-extra-args }}
@@ -180,29 +164,13 @@ jobs:
180164
- uses: actions/setup-node@v4
181165
with:
182166
node-version: ${{ matrix.node }}
183-
- name: Cache Dependencies
184-
uses: actions/cache@v3
185-
with:
186-
path: |
187-
node_modules
188-
package-lock.json
189-
detectors/node/*/node_modules
190-
detectors/node/*/package-lock.json
191-
metapackages/*/node_modules
192-
metapackages/*/package-lock.json
193-
packages/*/node_modules
194-
packages/*/package-lock.json
195-
plugins/node/*/node_modules
196-
plugins/node/*/package-lock.json
197-
plugins/web/*/node_modules
198-
plugins/web/*/package-lock.json
199-
propagators/*/node_modules
200-
propagators/*/package-lock.json
201-
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') }}
202-
- name: Install Root Dependencies
203-
run: npm install --ignore-scripts
204-
- name: Bootstrap Dependencies
205-
run: npx lerna bootstrap --no-ci
167+
- name: Update npm to a version that supports workspaces (v7 or later)
168+
if: ${{ matrix.node < 16 }}
169+
run: npm install -g npm@9 # npm@9 supports node >=14.17.0
170+
- name: Install
171+
run: npm ci
172+
- name: Build
173+
run: npm run compile
206174
- name: Unit tests
207175
run: npm run test:browser
208176
- name: Report Coverage

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ typings/
6060

6161
# lock files
6262
yarn.lock
63-
package-lock.json
6463
packages/**/yarn.lock
65-
packages/**/package-lock.json
6664

6765
# docs files
6866
docs

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lockfile-version=2

detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"lint:fix": "eslint . --ext .ts --fix",
1313
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-alibaba-cloud --include-dependencies",
1414
"prewatch": "npm run precompile",
15-
"prepare": "npm run compile",
15+
"prepublishOnly": "npm run compile",
1616
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
1717
"tdd": "npm run test -- --watch-extensions ts --watch",
1818
"watch": "tsc -w"

0 commit comments

Comments
 (0)