Skip to content

Commit

Permalink
chore: use pnpm (#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbt1 authored Oct 18, 2024
1 parent 4274d4d commit 1161e06
Show file tree
Hide file tree
Showing 16 changed files with 13,174 additions and 13,433 deletions.
43 changes: 23 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ version: 2.1
orbs:
browser-tools: circleci/[email protected]

aliases:
- &restore_yarn_cache
keys:
- v1-yarn-deps-{{ checksum "yarn.lock" }}
- &save_yarn_cache
paths:
- ~/.cache/yarn
key: v1-yarn-deps-{{ checksum "yarn.lock" }}
- &filter_master
branches:
only: master

defaults: &defaults
working_directory: ~/picassojs
# Available images https://hub.docker.com/r/circleci/node/tags/
Expand All @@ -25,9 +13,24 @@ jobs:
<<: *defaults
steps:
- checkout
- restore_cache: *restore_yarn_cache
- run: yarn install --frozen-lockfile
- save_cache: *save_yarn_cache
- restore_cache:
name: Restore pnpm cache
keys:
- pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Enable pnpm
command: |
corepack enable pnpm --install-directory ~/bin
pnpm config set store-dir .pnpm-store
- run:
name: Install dependencies
command: |
pnpm install --frozen-lockfile
- save_cache:
name: Save pnpm cache
key: pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
paths:
- .pnpm-store
- store_artifacts:
path: package.json
- persist_to_workspace:
Expand All @@ -40,7 +43,7 @@ jobs:
steps:
- attach_workspace:
at: ~/picassojs
- run: yarn run build
- run: pnpm run build
- store_artifacts:
path: packages/picasso.js/dist
- store_artifacts:
Expand All @@ -61,14 +64,14 @@ jobs:
steps:
- attach_workspace:
at: ~/picassojs
- run: yarn run lint
- run: pnpm run lint

types:
<<: *defaults
steps:
- attach_workspace:
at: ~/picassojs
- run: yarn run types:check
- run: pnpm run types:check

api-governance:
<<: *defaults
Expand Down Expand Up @@ -113,7 +116,7 @@ jobs:
steps:
- attach_workspace:
at: ~/picassojs
- run: yarn run test:component
- run: pnpm run test:component

test-integration:
<<: *defaults
Expand All @@ -122,7 +125,7 @@ jobs:
at: ~/picassojs
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- run: yarn run test:integration:ci
- run: pnpm run test:integration:ci

workflows:
version: 2
Expand Down
12 changes: 6 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Submit your feature by creating a Pull Request, following the [GIT guidelines](#

### Prerequisites

- [Node.js](https://nodejs.org/) 10+ and [yarn](https://yarnpkg.com) 1.9.4 installed
- [Node.js](https://nodejs.org/) 18+ and [pnpm](https://pnpm.io)

### Project structure

Expand All @@ -48,8 +48,8 @@ This is a multi-package repository which uses [lerna](https://github.com/lerna/l
To install and build all packages run:

```sh
$ yarn
$ yarn run build
$ pnpm
$ pnpm build
```

This will generate UMD packages for:
Expand All @@ -59,9 +59,9 @@ This will generate UMD packages for:

### Development workflow

- `yarn run build` generates UMD bundles for all packages
- `yarn run lint` checks code style
- `yarn run test` runs all tests
- `pnpm build` generates UMD bundles for all packages
- `pnpm lint` checks code style
- `pnpm test` runs all tests

## <a name="git"></a> Git Guidelines

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Install dependencies
shell: bash
run: yarn install --immutable --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Run unit tests
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: ${{github.workspace}}/reports/lcov.info:lcov
coverageCommand: yarn test:unit --ci --coverage --reporters="github-actions" --reporters="summary"
coverageCommand: pnpm test:unit --ci --coverage --reporters="github-actions" --reporters="summary"
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
pnpm commitlint --edit $1
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn pretty-quick --staged
pnpm pretty-quick --staged
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
docs/scriptappy.json
packages/picasso.js/types/index.d.ts
pnpm-lock.yaml
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"version": "2.3.0",
"description": "Documentation source",
"scripts": {
"build": "yarn run spec && yarn run ts",
"build": "pnpm run spec && pnpm run ts",
"spec": "jsdoc -r ../packages/picasso.js/src -p ../packages/picasso.js/package.json -X | scriptappy-from-jsdoc -c ./scriptappy.config.js",
"ts": "sy to-dts --export default -o ../packages/picasso.js/types/index.d.ts",
"version": "yarn run spec && yarn run ts && git add scriptappy.json ../packages/picasso.js/types/index.d.ts"
"version": "pnpm run spec && pnpm run ts && git add scriptappy.json ../packages/picasso.js/types/index.d.ts"
},
"devDependencies": {
"@scriptappy/cli": "0.10.0",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
}
},
"version": "2.3.0",
"npmClient": "yarn"
"npmClient": "pnpm"
}
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
"test:integration:server": "rollup -c ./test/integration/rollup.config.js",
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"prepare": "husky install",
"prepare": "husky",
"types:check": "tsc --noEmit"
},
"engines": {
"node": ">=8",
"yarn": "~1.9.2 || > 1.9.10"
"node": ">=18"
},
"devDependencies": {
"@babel/cli": "7.25.6",
Expand Down Expand Up @@ -66,11 +65,8 @@
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-serve": "1.1.1",
"sinon": "19.0.2",
"sinon-chai": "4.0.0"
"sinon-chai": "4.0.0",
"typescript": "5.6.3"
},
"workspaces": [
"docs",
"packages/*",
"plugins/*"
]
"packageManager": "[email protected]+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4"
}
4 changes: 2 additions & 2 deletions packages/picasso.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"types": "types/index.d.ts",
"scripts": {
"build": "rollup --config ../../rollup.config.js",
"build:watch": "yarn run build -w",
"build:watch": "pnpm run build -w",
"lint": "eslint src test",
"lint:fix": "npm run lint -- --fix",
"fixture:server": "aw serve -c aw.webserver.config.js",
Expand All @@ -50,7 +50,7 @@
"node-event-emitter": "0.0.1",
"path2d": "0.2.1",
"preact": "10.13.2",
"test-utils": "^2.3.0"
"test-utils": "workspace:*"
},
"gitHead": "b6ca9d1ed11709ec18f227b7b7077ce34d61857b"
}
4 changes: 2 additions & 2 deletions plugins/hammer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"module": "dist/picasso-hammer.esm.js",
"scripts": {
"build": "rollup --config ../../rollup.config.js",
"build:watch": "yarn run build -w",
"build:watch": "pnpm run build -w",
"lint": "eslint src",
"prepublishOnly": "rm -rf dist && npm run build"
},
"devDependencies": {
"test-utils": "^2.3.0"
"test-utils": "workspace:*"
},
"gitHead": "b6ca9d1ed11709ec18f227b7b7077ce34d61857b"
}
2 changes: 1 addition & 1 deletion plugins/q/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"module": "dist/picasso-q.esm.js",
"scripts": {
"build": "rollup --config ../../rollup.config.js",
"build:watch": "yarn run build -w",
"build:watch": "pnpm run build -w",
"lint": "eslint src",
"prepublishOnly": "rm -rf dist && npm run build"
},
Expand Down
Loading

0 comments on commit 1161e06

Please sign in to comment.