Skip to content

Commit

Permalink
build: use yarn berry
Browse files Browse the repository at this point in the history
  • Loading branch information
ambar committed Apr 12, 2024
1 parent bbc67fd commit d91af16
Show file tree
Hide file tree
Showing 13 changed files with 9,796 additions and 6,430 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: test
- name: setup
run: |
corepack enable
yarn
yarn build
- name: test
run: |
yarn test
# yarn test --coverage
# - name: report
# uses: coverallsapp/github-action@v1.0.1
# uses: coverallsapp/github-action@v2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# path-to-lcov: ./coverage/lcov.info
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@ build
# yalc
.yalc
yalc.lock

# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
22 changes: 22 additions & 0 deletions .yarn/plugins/plugin-dedupe-on-install.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
name: `plugin-dedupe-on-install`,
factory: (require) => {
const {execute} = require('@yarnpkg/shell')
return {
hooks: {
// yarn / yarn install / yarn add / yarn dedupe -> afterAllInstalled
async afterAllInstalled() {
// use env var to prevent infinite loops
if (!process.env.DEDUPED && !process.argv.includes('dedupe')) {
process.env.DEDUPED = 'yes'
// fast check for duplicates
if (await execute('yarn dedupe --check')) {
// run actual dedupe/link step
await execute('yarn dedupe')
}
}
},
},
}
},
}
6 changes: 6 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nodeLinker: node-modules

plugins:
- checksum: 7930a64ba6239d4502df0204edda913788df1a9614a9056d23b53345d844f6f13526dae71c2be5282071502c3c077db7b1e97bcf019037db3ca35c737cd25b0c
path: .yarn/plugins/plugin-dedupe-on-install.cjs
spec: "https://raw.githubusercontent.com/ambar/yarn-plugin-dedupe-on-install/main/index.js"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Convert SVG icons to React components.
- Provide dev tool for generating static icon site.
- Generate unique IDs for SVG elements if needed.
- Format codes with [Prettier](https://github.com/prettier/prettier)
- Transpile by [esbuild](https://github.com/evanw/esbuild)
- Support webpack (via [reiconify-loader](./packages/reiconify-loader)), Vite (via [vite-plugin-reiconify](./packages/vite-plugin-reiconify))

## Install

Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
],
"scripts": {
"release": "yarn test && yarn build && lerna publish",
"build": "yarn workspaces run build",
"test": "yarn workspaces run test"
"build": "yarn workspaces foreach -Ap run build",
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
},
"jest": {
"preset": "es-jest"
},
"devDependencies": {
"@types/jest": "^29.2.0",
"es-jest": "^2.0.0",
"jest": "^29.2.2",
"react": ">=16.14.0",
"react-test-renderer": ">=16.14.0"
}
},
"packageManager": "[email protected]"
}
3 changes: 3 additions & 0 deletions packages/base-icon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
},
"peerDependencies": {
"react": ">=16.14.0"
},
"devDependencies": {
"esbuild": "^0.18.20"
}
}
1 change: 1 addition & 0 deletions packages/reiconify-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
}
},
"devDependencies": {
"esbuild": "^0.18.20",
"identity-obj-proxy": "^3.0.0",
"memfs": "^3.4.7",
"webpack": "^5.74.0"
Expand Down
6 changes: 2 additions & 4 deletions packages/reiconify-serve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"engines": {
"node": ">=8"
},
"bin": {
"reiconify-serve": "./bin/reiconify-serve.js"
},
"bin": "./bin/reiconify-serve.js",
"files": [
"bin",
".playland",
Expand All @@ -26,7 +24,7 @@
"classnames": "^2.2.5",
"execa": "^1.0.0",
"fuse.js": "^6.6.2",
"playland": "^4.1.1",
"playland": "^4.7.1",
"react": ">=16.14.0",
"react-dom": ">=16.14.0",
"yargs": "^17.6.0"
Expand Down
4 changes: 1 addition & 3 deletions packages/reiconify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"engines": {
"node": ">=10"
},
"bin": {
"reiconify": "./bin/reiconify.js"
},
"bin": "./bin/reiconify.js",
"files": [
"lib",
"index.js",
Expand Down
1 change: 1 addition & 0 deletions packages/reiconify/test/transformFiles.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe('transform', () => {
}

beforeAll(async () => {
process.chdir(path.resolve(__dirname, '..'))
await cleanup()
})

Expand Down
5 changes: 4 additions & 1 deletion packages/vite-plugin-reiconify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
"base-icon": "^2.3.1",
"reiconify": "^2.10.0"
},
"devDependencies": {
"esbuild": "^0.18.20"
},
"peerDependencies": {
"react": ">=16.14.0",
"vite": "^3.1.8"
"vite": "^3 || ^4 || ^5"
}
}
Loading

0 comments on commit d91af16

Please sign in to comment.