Skip to content

Commit 9358883

Browse files
Switch to pnpm (#1702)
* Switch to pnpm * Tweak github actions * Update package.json * Update jest.config.js * Add tests * Fix lint and tests
1 parent d6817f8 commit 9358883

File tree

13 files changed

+13593
-10930
lines changed

13 files changed

+13593
-10930
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v2
19-
- uses: volta-cli/action@v1
18+
- uses: actions/checkout@v4
19+
- uses: pnpm/action-setup@v4
2020
with:
21-
node-version: 16.x
22-
- run: yarn
23-
- run: yarn test
21+
version: 10
22+
- name: Install Node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 18
26+
cache: pnpm
27+
- run: pnpm i
28+
- run: pnpm test
2429

2530
automerge:
2631
needs: [test]

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ tests/
2020
babel.config.js
2121
cypress.json
2222
index.html
23+
pnpm-lock.yaml
2324
rollup.config.js
2425
yarn.lock
2526
yarn-error.log

.release-it.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module.exports = {
44
hooks: {
5-
'after:bump': 'yarn build'
5+
'after:bump': 'pnpm build'
66
},
77
plugins: {
88
'release-it-lerna-changelog': {

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
You will need:
44

5-
- [Yarn](https://yarnpkg.com/)
5+
- [pnpm](https://pnpm.io/)
66

77
Windows users will need additional setup to enable build capabilities in NPM.
88
From an administrative command window:
99

1010
```sh
11-
yarn global add windows-build-tools
11+
pnpm global add windows-build-tools
1212
```
1313

1414
## Getting started
1515

1616
1. Fork the project
1717
2. Clone your forked project by running `git clone [email protected]:{
1818
YOUR_USERNAME }/tether.git`
19-
3. Run `yarn` to install node modules
20-
4. Test that you can build the source by running `yarn build` and ensure the `dist` directory appears.
19+
3. Run `pnpm` to install node modules
20+
4. Test that you can build the source by running `pnpm build` and ensure the `dist` directory appears.
2121

2222
## Writing code!
2323

@@ -26,9 +26,9 @@ you can focus on writing relevant code. If there is a fix or feature you would l
2626
to contribute, we ask that you take the following steps:
2727

2828
1. Most of the _editable_ code lives in the `src` directory while built code
29-
will end up in the `dist` directory upon running `yarn build`.
29+
will end up in the `dist` directory upon running `pnpm build`.
3030

31-
2. Some examples are served out of the `examples` directory. Running `yarn start` will open the list in your browser and initiate a live-reloading session as you make changes.
31+
2. Some examples are served out of the `examples` directory. Running `pnpm start` will open the list in your browser and initiate a live-reloading session as you make changes.
3232

3333

3434
## Opening Pull Requests
@@ -46,7 +46,7 @@ All PRs, that change code functionality, are required to have accompanying tests
4646

4747
### Acceptance Tests
4848

49-
Acceptance tests are run using [`cypress`](https://github.com/cypress-io/cypress). A number of different testing configurations can be found in [`package.json`](/package.json), but you can simply run `yarn test:ci:watch` to build your latest changes and begin running the tests inside a Chrome browser instance.
49+
Acceptance tests are run using [`cypress`](https://github.com/cypress-io/cypress). A number of different testing configurations can be found in [`package.json`](/package.json), but you can simply run `pnpm test:ci:watch` to build your latest changes and begin running the tests inside a Chrome browser instance.
5050

5151
⚠️ The acceptance tests are set up to run on `localhost` port `9002`. If you'd like to change this port, make sure to change the `baseUrl` option inside of [`cypress.json`](/cypress.json), and change any references to port `9002` in [`package.json`](/package.json) accordingly.
5252

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Once the prep work is completed, the actual release is straight forward:
3131
* First, ensure that you have installed your projects dependencies:
3232

3333
```sh
34-
yarn install
34+
pnpm install
3535
```
3636

3737
* Second, ensure that you have obtained a

jest.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,10 @@ module.exports = {
2828
// A map from regular expressions to paths to transformers
2929
transform: {
3030
'^.+\\.js$': 'babel-jest'
31-
}
31+
},
32+
33+
// Transform sinon ESM module (handle pnpm structure)
34+
transformIgnorePatterns: [
35+
'node_modules/(?!(.pnpm|sinon))'
36+
]
3237
};

package.json

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,65 +18,69 @@
1818
"main": "dist/js/tether.js",
1919
"module": "dist/js/tether.esm.js",
2020
"scripts": {
21-
"build": "yarn clean && rollup -c",
21+
"build": "pnpm clean && rollup -c",
2222
"changelog": "github_changelog_generator -u shipshapecode -p tether --since-tag v1.4.7",
2323
"clean": "rimraf dist",
2424
"cy:open": "./node_modules/.bin/cypress open",
2525
"cy:run": "./node_modules/.bin/cypress run",
2626
"lint:js": "eslint . --ext js",
27-
"start": "yarn watch",
27+
"start": "pnpm watch",
2828
"start-test-server": "http-server -p 9002",
29-
"test": "yarn lint:js && yarn test:ci",
30-
"test:ci": "yarn test:unit:ci && yarn test:cy:ci",
31-
"test:cy:ci": "yarn build && start-server-and-test start-test-server http://localhost:9002 cy:run",
32-
"test:cy:watch": "yarn build && start-server-and-test start-test-server http://localhost:9002 cy:open",
29+
"test": "pnpm lint:js && pnpm test:ci",
30+
"test:ci": "pnpm test:unit:ci && pnpm test:cy:ci",
31+
"test:cy:ci": "pnpm build && start-server-and-test start-test-server http://127.0.0.1:9002 cy:run",
32+
"test:cy:watch": "pnpm build && start-server-and-test start-test-server http://127.0.0.1:9002 cy:open",
3333
"test:unit:ci": "jest --coverage",
3434
"test:unit:watch": "jest --watch",
35-
"watch": "yarn clean && rollup -c --environment DEVELOPMENT --watch"
35+
"watch": "pnpm clean && rollup -c --environment DEVELOPMENT --watch"
3636
},
3737
"devDependencies": {
38-
"@babel/core": "^7.27.4",
39-
"@babel/preset-env": "^7.27.2",
38+
"@babel/core": "^7.28.5",
39+
"@babel/preset-env": "^7.28.5",
4040
"@testing-library/jest-dom": "^5.17.0",
41-
"autoprefixer": "^10.4.21",
41+
"autoprefixer": "^10.4.22",
4242
"babel-jest": "^29.7.0",
4343
"babel-plugin-rewire": "^1.2.0",
4444
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
45-
"chai": "^5.2.0",
45+
"chai": "^5.3.3",
4646
"cssnano": "^6.1.2",
4747
"cypress": "13.17.0",
4848
"eslint": "^8.57.1",
49-
"eslint-plugin-jest": "^28.3.0",
49+
"eslint-plugin-jest": "^28.14.0",
5050
"http-server": "^14.1.1",
5151
"jest": "^29.7.0",
5252
"jest-environment-jsdom": "^29.7.0",
5353
"jest-expect-message": "^1.1.3",
5454
"jsdom": "^22.1.0",
5555
"mutationobserver-shim": "^0.3.7",
56-
"postcss": "^8.5.5",
56+
"postcss": "^8.5.6",
5757
"release-it": "^15.11.0",
5858
"release-it-lerna-changelog": "^5.0.0",
59-
"rimraf": "^5.0.7",
59+
"rimraf": "^5.0.10",
6060
"rollup": "^2.79.2",
6161
"rollup-plugin-babel": "^4.4.0",
6262
"rollup-plugin-browsersync": "^1.3.3",
6363
"rollup-plugin-eslint": "^7.0.0",
6464
"rollup-plugin-filesize": "^10.0.0",
6565
"rollup-plugin-license": "^3.6.0",
66-
"rollup-plugin-sass": "^1.15.2",
66+
"rollup-plugin-sass": "^1.15.3",
6767
"rollup-plugin-terser": "^7.0.2",
68-
"rollup-plugin-visualizer": "^5.12.0",
69-
"sinon": "^15.1.2",
70-
"start-server-and-test": "^2.0.12"
68+
"rollup-plugin-visualizer": "^5.14.0",
69+
"sinon": "^15.2.0",
70+
"start-server-and-test": "^2.1.3"
7171
},
7272
"publishConfig": {
7373
"registry": "https://registry.npmjs.org"
7474
},
7575
"engines": {
76-
"node": ">= 16"
76+
"node": ">= 18",
77+
"pnpm": ">= 10"
7778
},
78-
"volta": {
79-
"node": "16.0.0",
80-
"yarn": "1.22.10"
79+
"pnpm": {
80+
"onlyBuiltDependencies": [
81+
"@parcel/watcher",
82+
"core-js",
83+
"cypress"
84+
]
8185
}
8286
}

0 commit comments

Comments
 (0)