Skip to content

Commit

Permalink
Update to use PNPM
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjwest committed Feb 26, 2023
1 parent c287f99 commit c45241f
Show file tree
Hide file tree
Showing 4 changed files with 4,032 additions and 3,429 deletions.
70 changes: 36 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ orbs:
coveralls: coveralls/coveralls@1.0.6

references:
yarn-cache-key-latest: &yarn-cache-key-latest
v1-dependency-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}-latest
yarn-cache-key: &yarn-cache-key
v1-dependency-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
yarn-backup-cache-key: &yarn-backup-cache-key
v1-dependency-yarn-{{ .Branch }}-
yarn-backup-cache-key-no-branch: &yarn-backup-cache-key-no-branch
v1-dependency-yarn-
pnpm-cache-key-latest: &pnpm-cache-key-latest
v1-dependency-pnpm-{{ .Branch }}-{{ checksum "pnpm-lock.yaml" }}-latest
pnpm-cache-key: &pnpm-cache-key
v1-dependency-pnpm-{{ .Branch }}-{{ checksum "pnpm-lock.yaml" }}
pnpm-backup-cache-key: &pnpm-backup-cache-key
v1-dependency-pnpm-{{ .Branch }}-
pnpm-backup-cache-key-no-branch: &pnpm-backup-cache-key-no-branch
v1-dependency-pnpm-

node-14: &node-14
cimg/node:14.21.1
Expand All @@ -31,68 +31,70 @@ commands:
install-dependencies:
steps:
- run:
name: Yarn version
command: yarn --version
name: PNPM version
command: pnpm --version
- restore_cache:
name: Restore pnpm cache
keys:
- *yarn-cache-key
- *yarn-backup-cache-key
- *yarn-backup-cache-key-no-branch
- *pnpm-cache-key
- *pnpm-backup-cache-key
- *pnpm-backup-cache-key-no-branch
- run:
name: Install dependencies
command: yarn install --frozen-lockfile
command: pnpm install
- save_cache:
name: Save yarn package cache
key: *yarn-cache-key
name: Save pnpm cache
key: *pnpm-cache-key
paths:
- ~/.cache/yarn
- node_modules

install-dependencies-latest:
steps:
- run:
name: Yarn version
command: yarn --version
name: PNPM version
command: pnpm --version
- restore_cache:
name: Restore pnpm cache
keys:
- *yarn-cache-key-latest
- *yarn-cache-key
- *yarn-backup-cache-key
- *yarn-backup-cache-key-no-branch
- *pnpm-cache-key-latest
- *pnpm-cache-key
- *pnpm-backup-cache-key
- *pnpm-backup-cache-key-no-branch
- run:
name: Upgrade dependencies lockfile and install
command: yarn upgrade
command: pnpm update
- run:
name: Output dependencies diff
command: git --no-pager diff
- save_cache:
name: Save yarn package cache
key: *yarn-cache-key-latest
name: Save pnpm cache
key: *pnpm-cache-key-latest
paths:
- ~/.cache/yarn
- node_modules

checks:
steps:
- run:
name: Lint Typescript/Javascript code
command: yarn lint
command: pnpm lint
- run:
name: Audit production dependencies
command: yarn audit-dependencies
command: pnpm audit --prod

build:
steps:
- run:
name: Build project
command: yarn build
command: pnpm build

tests:
steps:
- run:
name: Unit tests
command: yarn test:coverage
command: pnpm test:coverage
- run:
name: Test documentation snippets
command: yarn test:snippets
command: pnpm test:snippets
- store_artifacts:
path: coverage
- store_test_results:
Expand All @@ -102,13 +104,13 @@ commands:
steps:
- run:
name: ES5 Unit tests
command: yarn test:unit:es5
command: pnpm test:unit:es5

tests-es6:
steps:
- run:
name: ES6 Unit tests
command: yarn test:unit:es6
command: pnpm test:unit:es6

jobs:
checks:
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
],
"homepage": "https://github.com/peterjwest/react-bem-classes#readme",
"scripts": {
"audit-dependencies": "yarn audit; [[ $? -ge 4 ]] && exit 1 || exit 0",
"build": "rm -rf build/code && tsup src/index.ts --format cjs,esm --dts --out-dir build/code",
"lint": "eslint .",
"test:coverage": "rm -rf coverage && c8 mocha --node-option experimental-specifier-resolution=node --node-option loader=ts-node/esm 'tests/*.ts'",
"test:unit": "mocha --node-option experimental-specifier-resolution=node --node-option loader=ts-node/esm 'tests/*.ts'",
"test:unit:es5": "mocha 'tests/*.cjs'",
"test:unit:es6": "mocha 'tests/*.js'",
"test:snippets": "test-snippets"
"test:snippets": "test-snippets",
"preinstall": "npx only-allow pnpm"
},
"peerDependencies": {
"react": ">16"
Expand All @@ -50,6 +50,7 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@babel/core": "^7.21.0",
"@babel/eslint-parser": "^7.19.1",
"@babel/preset-env": "^7.14.4",
"@babel/preset-react": "^7.13.13",
Expand All @@ -66,6 +67,7 @@
"eslint": "^8.33.0",
"mocha": "^10.2.0",
"node-html-parser": "^6.1.4",
"only-allow": "^1.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"test-snippets": "^0.3.0",
Expand Down

0 comments on commit c45241f

Please sign in to comment.