Skip to content

Commit d8cb6d0

Browse files
authored
[WTF-2349]: Migrate widget-tools repo to pnpm (#132)
## This PR contains - [ ] Bug fix - [ ] Feature - [x] Refactor - [ ] Documentation - [ ] Other (describe) ## What is the purpose of this PR? Pnpm is an alternative package manager that has leaves a smaller footprint when installing dependencies. It also has great workspaces support which makes it easer to depend on other projects in the same monorepo as well as synchronizing dependencies between them. Another benefit is that other teams at Mendix use it to manage monorepos, so this move unifies our way of working. ## Relevant changes - Lockfiles have been replaced - Top-level scripts have been moved to the packages level, minimizing risk of dependencies colliding due to nestedness. - Cheerio has been added to resolutions to allow enzyme tests to continue to function - CI scripts have been updated to use pnpm ## What should be covered while testing? - CI actions continue to function as expected - Widgets continue to use the pwt unhindered
2 parents 8a6f858 + 8f04293 commit d8cb6d0

127 files changed

Lines changed: 15603 additions & 58975 deletions

File tree

Some content is hidden

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

.github/workflows/CreateGWRelease.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,22 @@ jobs:
2323
with:
2424
submodules: false
2525

26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
28+
with:
29+
version: 10
30+
2631
- name: "Defining node version"
27-
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # v2
32+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2833
with:
2934
node-version-file: ".nvmrc"
35+
cache: 'pnpm'
3036

3137
- name: "Installing dependencies"
32-
run: npm install
38+
run: pnpm install
3339

3440
- name: "Creating GW release and MR"
35-
run: "npm run release:gw"
41+
run: "pnpm --dir packages/release-tools run release:gw"
3642
env:
3743
GH_USERNAME: ${{ secrets.GH_USERNAME }}
3844
GH_EMAIL: ${{ secrets.GH_EMAIL }}

.github/workflows/CreatePWTRelease.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,22 @@ jobs:
2323
with:
2424
submodules: false
2525

26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
28+
with:
29+
version: 10
30+
2631
- name: "Defining node version"
27-
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # v2
32+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2833
with:
2934
node-version-file: ".nvmrc"
35+
cache: 'pnpm'
3036

3137
- name: "Installing dependencies"
32-
run: npm install
38+
run: pnpm install
3339

3440
- name: "Creating PWT release and MR"
35-
run: "npm run release:pwt"
41+
run: "pnpm --dir packages/release-tools run release:pwt"
3642
env:
3743
GH_USERNAME: ${{ secrets.GH_USERNAME }}
3844
GH_EMAIL: ${{ secrets.GH_EMAIL }}

.github/workflows/PublishNpm.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,32 @@ jobs:
1616
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2
1717
with:
1818
submodules: false
19+
20+
- name: Setup pnpm
21+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
22+
with:
23+
version: 10
24+
1925
- name: "Defining Environment Variables"
2026
id: variables
2127
run: echo "::set-output name=tag::$(git tag --points-at HEAD)"
28+
2229
- name: "Defining node version"
23-
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # v2
30+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2431
with:
2532
node-version-file: ".nvmrc"
26-
- name: "Installing root dependencies"
27-
working-directory: ./
28-
run: npm install
29-
- name: "Installing pluggable-widgets-tools dependencies"
30-
working-directory: ./packages/pluggable-widgets-tools
31-
if: contains(steps.variables.outputs.tag, 'pluggable-widgets-tools-v')
32-
run: npm install
33+
cache: 'pnpm'
34+
3335
- name: "Installing generator-widget dependencies"
34-
working-directory: ./packages/generator-widget
35-
if: contains(steps.variables.outputs.tag, 'generator-widget-v')
36-
run: npm install
36+
run: pnpm install
37+
3738
- name: "Targeting Pluggable Widgets Tools"
3839
if: contains(steps.variables.outputs.tag, 'pluggable-widgets-tools-v')
3940
uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939 # v1
4041
with:
4142
package: "./packages/pluggable-widgets-tools/package.json"
4243
token: ${{ secrets.NPM_TOKEN }}
44+
4345
- name: "Targeting Pluggable Widgets Generator"
4446
if: contains(steps.variables.outputs.tag, 'generator-widget-v')
4547
uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939 # v1

.github/workflows/ShaCheck.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2
1616
with:
1717
submodules: false
18+
1819
- name: "Ensure SHA pinned actions"
1920
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@0b552a197e44b819629237e065d781f5ca691460 # v1.1.1
2021
with:

.github/workflows/TestPWTCommands.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ jobs:
2727
with:
2828
filters: |
2929
packages:
30-
- 'packages/**/*'
30+
- 'packages/generator-widget/*'
31+
- 'packages/pluggable-widgets-tools/*'
3132
tests:
32-
- 'tests/**/*'
33+
- 'packages/command-tests/*'
3334
env:
3435
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3536

@@ -38,24 +39,35 @@ jobs:
3839
env:
3940
cache-name: cache-node-modules
4041
with:
41-
path: ~/.npm
42+
path: ~/.pnpm-store
4243
key: ${{ runner.os }}-${{ matrix.node }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
4344

45+
- name: Setup pnpm
46+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
47+
if: matrix.node == 16
48+
with:
49+
version: 8
50+
- name: Setup pnpm
51+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
52+
if: matrix.node == 18
53+
with:
54+
version: 10
55+
4456
- name: "Defining node version"
45-
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # v2
57+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
4658
with:
4759
node-version: ${{ matrix.node == 18 && '18.15.0' || matrix.node }}
60+
cache: 'pnpm'
4861

4962
- name: "Installing dependencies"
50-
working-directory: ./
5163
if: steps.filter.outputs.packages == 'true' || steps.filter.outputs.tests == 'true'
52-
run: npm install
64+
run: pnpm install
5365

5466
- name: Increase number of watchers
5567
if: (steps.filter.outputs.packages == 'true' || steps.filter.outputs.tests == 'true') && startsWith(matrix.os, 'ubuntu')
5668
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
5769

5870
- name: "Testing PWT commands"
59-
working-directory: ./
71+
working-directory: ./packages/command-tests
6072
if: steps.filter.outputs.packages == 'true' || steps.filter.outputs.tests == 'true'
61-
run: npm run test:pwt:commands
73+
run: pnpm test

.github/workflows/UnitTests.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,29 @@ jobs:
3333
env:
3434
cache-name: cache-node-modules
3535
with:
36-
path: ~/.npm
36+
path: ~/.pnpm-store
3737
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
3838

39+
- name: Setup pnpm
40+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
41+
with:
42+
version: 10
43+
3944
- name: "Defining node version"
40-
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # v2
45+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
4146
with:
4247
node-version-file: ".nvmrc"
48+
cache: 'pnpm'
4349

4450
- name: "Installing dependencies"
45-
working-directory: ./
4651
if: steps.filter.outputs.packages == 'true'
47-
run: npm install
52+
run: pnpm install
4853

49-
- name: "Running pluggable-widgets-tools unit tests"
50-
working-directory: ./packages/pluggable-widgets-tools
51-
if: steps.filter.outputs.packages == 'true'
52-
run: npm run test
53-
54-
- name: "Running generator-widget unit tests"
55-
working-directory: ./packages/generator-widget
54+
- name: "Running unit tests"
5655
if: steps.filter.outputs.packages == 'true'
57-
run: npm run test
56+
run: pnpm -r test
5857

5958
- name: "Linting generator-widget"
6059
working-directory: ./packages/generator-widget
6160
if: steps.filter.outputs.packages == 'true'
62-
run: npm run lint
61+
run: pnpm run lint

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ node_modules
1010
mxproject
1111
coverage
1212

13-
# tests
13+
# Packed packages
14+
mendix-*.tgz

0 commit comments

Comments
 (0)