Skip to content

Commit

Permalink
build: migrate to yarn v4 (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin authored Dec 11, 2023
1 parent 3d85966 commit b0e4c61
Show file tree
Hide file tree
Showing 14 changed files with 21,879 additions and 17,594 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,33 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Enable Corepack
run: corepack enable

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm
cache: yarn
env:
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
SKIP_YARN_COREPACK_CHECK: 1
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
YARN_IGNORE_NODE: 1

- name: Install Dependencies
run: pnpm i
run: yarn --immutable
env:
SKIP_YARN_COREPACK_CHECK: 1
YARN_IGNORE_NODE: 1

- name: Build, Lint and Test
run: pnpm run-s build lint test
run: yarn run-s test-build lint
env:
EFF_NO_LINK_RULES: true
PARSER_NO_WATCH: true
SKIP_YARN_COREPACK_CHECK: 1
YARN_IGNORE_NODE: 1

- name: Codecov
uses: codecov/codecov-action@v3
14 changes: 8 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ jobs:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Enable Corepack
run: corepack enable

- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
cache: yarn

- name: Install Dependencies
run: pnpm i
run: yarn --immutable

- name: Build
run: pnpm build
run: yarn build

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand All @@ -38,7 +38,9 @@ jobs:
commit: 'chore: release package(s)'
title: 'chore: release package(s)'
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
publish: yarn release
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
version: update-versions
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 6 additions & 5 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,21 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Enable Corepack
run: corepack enable

- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
cache: yarn

- name: Install Dependencies
run: pnpm i
run: yarn --immutable

- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
skip_step: install
script: pnpm size-limit --json
build_script: test-build
script: yarn size-limit --json
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
*.log
*.tsbuildinfo
.*cache
.changelog
.type-coverage
.vercel
.yarn/*
!.yarn/patches
!.yarn/plugins
coverage
dist
lib
node_modules
packages/*/src/languages.ts
yarn.lock
/auto-imports.d.ts
19 changes: 0 additions & 19 deletions .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.yarn
coverage
dist
**/test/fixtures
/pnpm-lock.yaml
13 changes: 13 additions & 0 deletions .yarn/patches/vite-npm-5.0.7-583fea8b6f.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/dist/node/chunks/dep-wTaJK0Jt.js b/dist/node/chunks/dep-wTaJK0Jt.js
index 101079c6bd9419729c11174dd792c82757793f9c..b9b36d66af89733a77ed92896a1f25bbb73a7ac8 100644
--- a/dist/node/chunks/dep-wTaJK0Jt.js
+++ b/dist/node/chunks/dep-wTaJK0Jt.js
@@ -63867,6 +63867,8 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
contents,
};
});
+
+ setupExternalize(/.*/, () => true);
},
};
}
1 change: 1 addition & 0 deletions .yarn/plugins/plugin-prepare-lifecycle.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports={name:"plugin-prepare-lifecycle",factory:e=>({hooks:{afterAllInstalled(r){if(!r.topLevelWorkspace.manifest.scripts.get("prepare"))return;e("@yarnpkg/shell").execute("yarn prepare")}}})};
10 changes: 10 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
compressionLevel: mixed

enableHardenedMode: false

nodeLinker: node-modules

plugins:
- checksum: 37b2361b1502b2054e6779788c0e9bdd6a90ce49852a8cad2feda79b0614ec94f06fb6e78951f5f95429c610d7934dd077caa47413a0227378a102c55161616d
path: .yarn/plugins/plugin-prepare-lifecycle.cjs
spec: "https://github.com/un-es/yarn-plugin-prepare-lifecycle/releases/download/v0.0.1/index.js"
21 changes: 0 additions & 21 deletions auto-imports.d.ts

This file was deleted.

46 changes: 27 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"workspaces": [
"packages/*"
],
"packageManager": "pnpm@8.12.0",
"packageManager": "yarn@4.0.2",
"scripts": {
"build": "run-p build:*",
"build": "run-p 'build:*'",
"build:r": "r -f cjs",
"build:ts": "tsc -b",
"clean": "rimraf dist coverage 'packages/*/{lib,*.tsbuildinfo}'",
Expand All @@ -21,23 +21,26 @@
"docs:dev": "vite dev",
"format": "tsx scripts/format",
"languages": "tsx scripts/languages",
"lint": "run-p lint:*",
"lint": "run-p 'lint:*'",
"lint:es": "eslint . --cache -f friendly",
"lint:tsc": "tsc --noEmit",
"postversion": "pnpm i --no-frozen-lockfile",
"prepare": "simple-git-hooks && pnpm languages || exit 0",
"prepare": "simple-git-hooks && yarn languages || exit 0",
"release": "changeset publish",
"serve": "sirv dist",
"test": "vitest run --coverage",
"test-build": "run-s test build",
"typecov": "type-coverage",
"vercel-build": "pnpm docs:build"
"update-versions": "changeset version && yarn --no-immutable",
"vercel-build": "yarn docs:build"
},
"devDependencies": {
"@1stg/app-config": "^9.0.1",
"@1stg/lib-config": "^12.0.1",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^18.4.3",
"@mdx-js/rollup": "^3.0.0",
"@pkgr/rollup": "^4.1.3",
"@types/lodash": "^4.14.202",
"@types/mvdan-sh": "^0.10.9",
"@types/node": "^20.10.4",
Expand All @@ -46,20 +49,20 @@
"@types/web": "^0.0.127",
"@vitejs/plugin-react-swc": "^3.5.0",
"@vitest/coverage-istanbul": "^1.0.4",
"github-markdown-css": "^5.4.0",
"eslint": "^8.55.0",
"github-markdown-css": "^5.5.0",
"linguist-languages": "^7.27.0",
"lint-staged": "^15.2.0",
"lodash": "^4.17.21",
"npm-run-all2": "^6.1.1",
"prettier": "^3.1.1",
"prettier-plugin-autocorrect": "workspace:*",
"prettier-plugin-pkg": "workspace:*",
"prettier-plugin-sh": "workspace:*",
"prettier-plugin-sql": "workspace:*",
"prettier-plugin-toml": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.20.1",
"remark-gfm": "^4.0.0",
"rimraf": "^5.0.5",
"sass": "^1.69.5",
"simple-git-hooks": "^2.9.0",
"sirv-cli": "^2.0.2",
"size-limit": "^11.0.1",
"size-limit-preset-node-lib": "^0.3.0",
Expand All @@ -71,14 +74,19 @@
"vitest": "^1.0.4"
},
"resolutions": {
"@commitlint/cli": "^18.4.3",
"eslint-plugin-prettier": "^5.0.1",
"lint-staged": "^15.2.0",
"npm-run-all": "npm:npm-run-all2@^6.1.1",
"prettier": "^3.1.1",
"prettier-plugin-autocorrect": "workspace:*",
"prettier-plugin-pkg": "workspace:*",
"prettier-plugin-sh": "workspace:*",
"prettier-plugin-sql": "workspace:*",
"prettier-plugin-toml": "workspace:*",
"rollup": "^4.8.0"
"prettier-plugin-autocorrect": "link:packages/autocorrect",
"prettier-plugin-pkg": "link:packages/pkg",
"prettier-plugin-sh": "link:packages/sh",
"prettier-plugin-sql": "link:packages/sql",
"prettier-plugin-toml": "link:packages/toml",
"rimraf": "^5.0.5",
"rollup": "^4.8.0",
"vite": "patch:vite@npm%3A5.0.7#~/.yarn/patches/vite-npm-5.0.7-583fea8b6f.patch"
},
"browserslist": [
"extends @1stg/browserslist-config/modern"
Expand All @@ -89,14 +97,14 @@
]
},
"eslintIgnore": [
".yarn",
"coverage",
"dist",
"packages/**/fixtures",
"packages/**/lib",
"packages/**/CHANGELOG.md",
"packages/*/src/languages.ts",
"/auto-imports.d.ts",
"/pnpm-lock.yaml",
"!/.github",
"!/.*.js"
],
Expand Down
Loading

0 comments on commit b0e4c61

Please sign in to comment.