Skip to content

Commit e16d01e

Browse files
wenytang-mstecton1yefuwang1
authored
build: upgrade to node.js 18 and pnpm (#9649)
* ci: pnpm * build: update deps for pnpm run build * build: add server to pnpm * build: build workaround * build: update cli deps * build: merge dev * fix: sdk browser ut * test: update test case * test: remove useless code * test: remove useless test case * test: update devdeps * test: fix office addin ut for node 18 * Revert "test: remove useless test case" This reverts commit 73fc05c07ca0452e59dcfa10df13928dda8519ce. * Revert "test: remove useless code" This reverts commit dd15b56bb595efc27d282a2066ff87ef701c20af. * test: stop nock test case * ci: restore ut coverage * ci: enable format checker * style: format * test: update * test: update --------- Co-authored-by: Ning Tang <[email protected]> Co-authored-by: Wang Yefu <[email protected]>
1 parent 95caea3 commit e16d01e

Some content is hidden

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

51 files changed

+26547
-96377
lines changed

.github/workflows/e2e-test.yml

+17-41
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,16 @@ jobs:
4949
- name: Setup node
5050
uses: actions/setup-node@v3
5151
with:
52-
node-version: 16
52+
node-version: 18
5353

54-
- name: Setup legacy-peer-deps
54+
- name: install pnpm
5555
run: |
56-
npm config set legacy-peer-deps true
57-
58-
- name: manage pkgs to setup
59-
run: bash .github/scripts/lerna.sh tests
56+
npm install -g pnpm
6057
6158
- name: Setup project
62-
uses: nick-fields/retry@v2
63-
with:
64-
timeout_minutes: 10
65-
max_attempts: 5
66-
command: |
67-
npm run setup
59+
run: |
60+
pnpm install
61+
npm run build
6862
6963
- name: List cases for schedule
7064
id: schedule-cases
@@ -154,7 +148,7 @@ jobs:
154148
- name: Setup node
155149
uses: actions/setup-node@v3
156150
with:
157-
node-version: 16
151+
node-version: 18
158152

159153
- name: Setup Azure Functions Core Tools For Linux
160154
run: |
@@ -166,30 +160,21 @@ jobs:
166160
which func
167161
func --version
168162
169-
- name: manage pkgs to setup
170-
run: bash .github/scripts/lerna.sh tests
171-
172-
- name: Setup legacy-peer-deps
173-
run: |
174-
npm config set legacy-peer-deps true
175-
176163
- name: Setup .net
177164
uses: actions/setup-dotnet@v2
178165
with:
179166
dotnet-version: 6.0.x
180167

181168
- name: Setup project
182-
uses: nick-fields/retry@v2
183-
with:
184-
timeout_minutes: 10
185-
max_attempts: 5
186-
command: |
187-
npm run setup
169+
run: |
170+
npm install pnpm -g
171+
pnpm install
172+
npm run build
188173
189174
- name: Link CLI
190175
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
191176
run: |
192-
npm link --force
177+
pnpm link --global
193178
194179
- name: Update CLI and legacy-peer-deps for PR cases
195180
if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name == 'teamsfx-bot/TeamsFx' }}
@@ -298,22 +283,13 @@ jobs:
298283
- name: Setup node
299284
uses: actions/setup-node@v3
300285
with:
301-
node-version: 16
302-
303-
- name: manage pkgs to setup
304-
run: bash .github/scripts/lerna.sh tests
305-
306-
- name: Setup legacy-peer-deps
307-
run: |
308-
npm config set legacy-peer-deps true
286+
node-version: 18
309287

310288
- name: Setup project
311-
uses: nick-fields/retry@v2
312-
with:
313-
timeout_minutes: 10
314-
max_attempts: 5
315-
command: |
316-
npm run setup
289+
run: |
290+
npm install -g pnpm
291+
pnpm install
292+
npm run build
317293
318294
- name: E2E Test clean
319295
working-directory: packages/tests

.github/workflows/lint-pr.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
}
4040
4141
npm-audit:
42-
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' }}
42+
if: ${{ github.event_name != 'pull_request' }}
4343
runs-on: ubuntu-latest
4444
steps:
4545
- uses: actions/checkout@v3
@@ -76,10 +76,11 @@ jobs:
7676
- name: Setup node
7777
uses: actions/setup-node@v3
7878
with:
79-
node-version: 14
79+
node-version: 18
8080

8181
- name: Setup Project
8282
run: |
83+
npm i -g pnpm
8384
npm run setup
8485
8586
- name: prettier check files in PR on Fork
@@ -88,13 +89,13 @@ jobs:
8889
git remote add upstream https://github.com/OfficeDev/TeamsFx.git
8990
git fetch upstream ${{ github.event.pull_request.base.ref }}
9091
VAR=$(realpath .github/scripts/lint-pr.sh)
91-
npx lerna exec -- bash $VAR upstream/${{ github.event.pull_request.base.ref }}
92+
pnpm -r exec -- bash $VAR upstream/${{ github.event.pull_request.base.ref }}
9293
9394
- name: prettier check files in PR on local
9495
if: ${{ github.event.pull_request.head.repo.full_name == 'OfficeDev/TeamsFx' }}
9596
run: |
9697
VAR=$(realpath .github/scripts/lint-pr.sh)
97-
npx lerna exec -- bash $VAR origin/${{ github.event.pull_request.base.ref }}
98+
pnpm -r exec -- bash $VAR origin/${{ github.event.pull_request.base.ref }}
9899
99100
- name: Check if there are changes
100101
id: changes
@@ -108,7 +109,7 @@ jobs:
108109
echo 'There may be some unformatted files in your PR, please run these commands on Git Bash terminal: '
109110
echo '1. npm run setup'
110111
echo '2. VAR=$(realpath .github/scripts/lint-pr.sh) '
111-
echo '3. npx lerna exec -- bash $VAR ${your-PR-target-branch}'
112+
echo '3. pnpm -r exec -- bash $VAR ${your-PR-target-branch}'
112113
echo 'please replace the ${your-PR-target-branch} as the target branch of your PR, such as origin/dev or upstream/dev'
113114
exit 1
114115
fi
@@ -202,7 +203,7 @@ jobs:
202203
python .github/detect/sensitive-detect.py repo
203204
204205
attension-on-version:
205-
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' && github.event.action != 'edited' }}
206+
if: ${{ github.event_name != 'pull_request' }}
206207
runs-on: ubuntu-latest
207208
steps:
208209
- name: checkout branch

.github/workflows/sdk-e2e-test.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@ jobs:
2323
- name: Setup node
2424
uses: actions/setup-node@v3
2525
with:
26-
node-version: 14
26+
node-version: 18
2727

2828
- name: Setup project
29-
uses: nick-invision/retry@v2
30-
with:
31-
timeout_minutes: 10
32-
max_attempts: 10
33-
retry_on: error
34-
command: |
35-
npm run setup
29+
run: |
30+
npm install -g pnpm
31+
pnpm install
32+
npm run build
3633
3734
- name: setup python
3835
uses: actions/setup-python@v3

.github/workflows/templates-ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ jobs:
2929
- name: Setup node
3030
uses: actions/setup-node@v3
3131
with:
32-
node-version: 16
32+
node-version: 18
3333

3434
- name: Setup project
3535
run: |
36-
npm install
37-
working-directory: ./templates
36+
npm install -g pnpm
37+
pnpm --filter=templates install
3838
3939
- name: Verify
4040
run: |

.github/workflows/ui-test.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,14 @@ jobs:
9393
- name: Setup node
9494
uses: actions/setup-node@v3
9595
with:
96-
node-version: 16
96+
node-version: 18
9797

9898
- name: create pvt file (random platform/node)
9999
if: ${{ github.event.schedule == '0 18 * * *' }} || ${{ github.event.inputs.test-case }} == ''
100100
working-directory: ./packages/tests
101101
run: |
102-
npm install
102+
npm install -g pnpm
103+
pnpm --filter=@microsoft/teamsfx-test install
103104
npx ts-node ./scripts/createRandomPVT.ts
104105
105106
- name: setup matrix

.github/workflows/unit-test.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,16 @@ jobs:
4545
- name: Setup node
4646
uses: actions/setup-node@v3
4747
with:
48-
node-version: 14
49-
50-
- name: Setup .NET Core
51-
uses: actions/setup-dotnet@v1
52-
with:
53-
dotnet-version: 3.1.x
48+
node-version: 18
5449

5550
- name: Setup project
5651
run: |
52+
npm install pnpm -g
5753
npm run setup
5854
5955
- name: Unit Test
6056
run: |
61-
xvfb-run -a npx lerna run test:unit --stream
57+
xvfb-run -a pnpm run -r --stream test:unit
6258
6359
- name: CodeCov report attempt 1
6460
id: codecov1

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enable-pre-post-scripts=true

package.json

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
{
22
"name": "teamsfx",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
36
"scripts": {
4-
"setup": "npm install && npm run build",
5-
"setup-failpoint": "npm run setup && npx lerna run build-failpoint",
6-
"bootstrap": "lerna bootstrap",
7-
"lint:staged": "lerna run lint:staged --stream",
8-
"lint": "lerna run lint --stream",
9-
"manual-version:rc": "lerna version --preid=rc --no-push --no-changelog",
10-
"prepare": "husky install",
7+
"setup": "pnpm install && npm run build",
8+
"watch": "pnpm --parallel -r run watch",
9+
"build": "pnpm -r run --filter=!@microsoft/teamsfx-react build && pnpm run --filter=@microsoft/teamsfx-react build",
10+
"changeset": "changeset",
11+
"version": "changeset version",
12+
"release": "changeset publish",
1113
"precommit": "lint-staged",
12-
"postinstall": "npm run bootstrap --hoist",
13-
"build": "lerna run build",
14-
"clean": "lerna clean"
14+
"clean": "pnpm -r exec rimraf node_modules"
1515
},
1616
"devDependencies": {
17-
"@commitlint/cli": "^12.0.1",
17+
"@changesets/cli": "^2.25.2",
18+
"@commitlint/cli": "^17.7.1",
1819
"@commitlint/config-conventional": "^12.0.1",
19-
"@types/fs-extra": "^9.0.12",
20-
"@types/node": "^16.7.10",
21-
"@types/semver": "^7.3.8",
22-
"axios": "^0.21.3",
2320
"codecov": "^3.8.3",
2421
"codeowners": "^5.1.1",
2522
"cz-conventional-changelog": "^3.3.0",
2623
"dotenv": "^10.0.0",
2724
"husky": "^6.0.0",
2825
"lerna": "^4.0.0",
29-
"ts-node": "^10.2.1",
30-
"typescript": "^4.4.2"
26+
"rimraf": "^5.0.1",
27+
"ts-node": "^10.2.1"
3128
},
32-
"bin": {
33-
"teamsfx": "./packages/cli/cli.js"
29+
"keywords": [],
30+
"engines": {
31+
"node": ">=18",
32+
"pnpm": ">=8"
3433
},
34+
"packageManager": "[email protected]",
3535
"config": {
3636
"commitizen": {
3737
"path": "./node_modules/cz-conventional-changelog"

0 commit comments

Comments
 (0)