Skip to content

Commit b1bb752

Browse files
authored
build: migrate to yarn v4 (#509)
1 parent 8a50056 commit b1bb752

File tree

19 files changed

+17232
-12413
lines changed

19 files changed

+17232
-12413
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,22 @@ jobs:
2121
- name: Checkout Repo
2222
uses: actions/checkout@v4
2323

24+
- name: Enable Corepack
25+
run: corepack enable
26+
2427
- name: Setup Node.js ${{ matrix.node }}
2528
uses: actions/setup-node@v4
2629
with:
2730
node-version: ${{ matrix.node }}
2831
cache: yarn
32+
env:
33+
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
34+
SKIP_YARN_COREPACK_CHECK: 1
2935

3036
- name: Install Dependencies
31-
run: yarn --frozen-lockfile
37+
run: yarn --immutable
38+
env:
39+
SKIP_YARN_COREPACK_CHECK: 1
3240

3341
- name: Build, Lint and Test
3442
run: |
@@ -37,6 +45,7 @@ jobs:
3745
env:
3846
EFF_NO_LINK_RULES: true
3947
PARSER_NO_WATCH: true
48+
SKIP_YARN_COREPACK_CHECK: 1
4049

4150
- name: Codecov
4251
uses: codecov/codecov-action@v3

.github/workflows/codeql.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
name: 'CodeQL'
1+
name: CodeQL
22

33
on:
44
push:
5-
branches: ['master']
65
pull_request:
7-
branches: ['master']
86
schedule:
97
- cron: '41 19 * * 6'
108

@@ -20,22 +18,23 @@ jobs:
2018
strategy:
2119
fail-fast: false
2220
matrix:
23-
language: [javascript]
21+
language:
22+
- javascript
2423

2524
steps:
2625
- name: Checkout
2726
uses: actions/checkout@v4
2827

2928
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@v2
29+
uses: github/codeql-action/init@v3
3130
with:
3231
languages: ${{ matrix.language }}
3332
queries: +security-and-quality
3433

3534
- name: Autobuild
36-
uses: github/codeql-action/autobuild@v2
35+
uses: github/codeql-action/autobuild@v3
3736

3837
- name: Perform CodeQL Analysis
39-
uses: github/codeql-action/analyze@v2
38+
uses: github/codeql-action/analyze@v3
4039
with:
4140
category: '/language:${{ matrix.language }}'

.github/workflows/pkg-size.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ jobs:
1414
- name: Checkout
1515
uses: actions/checkout@v4
1616

17+
- name: Enable Corepack
18+
run: corepack enable
19+
1720
- name: Setup Node.js LTS
1821
uses: actions/setup-node@v4
1922
with:
2023
node-version: lts/*
2124
cache: yarn
25+
env:
26+
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
27+
SKIP_YARN_COREPACK_CHECK: 1
2228

2329
- name: Package Size Report
2430
uses: pkg-size/action@v1

.github/workflows/release.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,38 @@ jobs:
1616
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1717
fetch-depth: 0
1818

19+
- name: Enable Corepack
20+
run: corepack enable
21+
1922
- name: Setup Node.js LTS
2023
uses: actions/setup-node@v4
2124
with:
2225
node-version: lts/*
2326
cache: yarn
27+
env:
28+
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
29+
SKIP_YARN_COREPACK_CHECK: 1
2430

2531
- name: Install Dependencies
26-
run: yarn --frozen-lockfile
32+
run: yarn --immutable
33+
env:
34+
SKIP_YARN_COREPACK_CHECK: 1
2735

2836
# required for linting before commit
2937
- name: Build
3038
run: yarn build
39+
env:
40+
SKIP_YARN_COREPACK_CHECK: 1
3141

3242
- name: Create Release Pull Request or Publish to npm
3343
id: changesets
3444
uses: changesets/action@v1
3545
with:
36-
# This expects you to have a script called release which does a build for your packages and calls changeset publish
37-
publish: yarn release:only
3846
commit: 'chore: release package(s)'
3947
title: 'chore: release package(s)'
48+
publish: yarn release:only
49+
version: yarn run version
4050
env:
4151
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4252
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
53+
SKIP_YARN_COREPACK_CHECK: 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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")}}})};

.yarnrc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
nodeLinker: node-modules
2+
3+
plugins:
4+
- checksum: 37b2361b1502b2054e6779788c0e9bdd6a90ce49852a8cad2feda79b0614ec94f06fb6e78951f5f95429c610d7934dd077caa47413a0227378a102c55161616d
5+
path: .yarn/plugins/plugin-prepare-lifecycle.cjs
6+
spec: "https://github.com/un-es/yarn-plugin-prepare-lifecycle/releases/download/v0.0.1/index.js"

package.json

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,60 @@
99
"workspaces": [
1010
"packages/*"
1111
],
12-
"packageManager": "yarn@1.22.21",
12+
"packageManager": "yarn@4.0.2",
1313
"scripts": {
14-
"build": "run-p build:*",
14+
"build": "run-p 'build:*'",
1515
"build:r": "r -f es2015",
1616
"build:ts": "tsc -b",
17-
"clean": "rimraf packages/*/{lib,*.tsbuildinfo}",
18-
"lint": "run-p lint:*",
17+
"clean": "rimraf --glob 'packages/*/{lib,*.tsbuildinfo}'",
18+
"lint": "yarn build && run-p 'lint:*'",
1919
"lint:es": "eslint . --cache -f friendly",
2020
"lint:tsc": "tsc --noEmit",
21-
"prelint": "yarn build",
22-
"prepare": "patch-package && simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
23-
"prerelease": "yarn build",
24-
"release": "yarn release:only",
21+
"prepare": "patch-package && simple-git-hooks",
22+
"release": "run-s build release:only",
2523
"release:only": "changeset publish",
26-
"test": "jest",
24+
"version": "changeset version && yarn --no-immutable",
25+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
2726
"typecov": "type-coverage"
2827
},
2928
"devDependencies": {
30-
"@1stg/lib-config": "^12.0.1",
29+
"@1stg/common-config": "^10.0.0",
3130
"@changesets/changelog-github": "^0.5.0",
3231
"@changesets/cli": "^2.27.1",
33-
"@types/eslint": "^8.44.8",
32+
"@commitlint/cli": "^18.4.3",
33+
"@pkgr/rollup": "^5.0.0",
34+
"@types/acorn": "^6.0.0",
35+
"@types/eslint": "^8.56.0",
3436
"@types/eslint-plugin-markdown": "^2.0.2",
35-
"@types/jest": "^29.5.10",
36-
"@types/node": "^20.10.3",
37-
"@types/react": "^18.2.42",
37+
"@types/jest": "^29.5.11",
38+
"@types/node": "^20.10.6",
39+
"@types/react": "^18.2.46",
3840
"@types/unist": "^3.0.2",
39-
"jest": "^29.7.0",
41+
"cross-env": "^7.0.3",
42+
"eslint": "^8.56.0",
43+
"jest": "^30.0.0-alpha.2",
44+
"lint-staged": "^15.2.0",
45+
"npm-run-all2": "^6.1.1",
4046
"patch-package": "^8.0.0",
47+
"prettier": "^3.1.1",
4148
"react": "^18.2.0",
49+
"rimraf": "^5.0.5",
50+
"simple-git-hooks": "^2.9.0",
4251
"ts-jest": "^29.1.1",
43-
"ts-node": "^10.9.1",
44-
"type-coverage": "^2.27.0",
45-
"typescript": "^5.3.2",
46-
"yarn-deduplicate": "^6.0.2"
52+
"ts-node": "^10.9.2",
53+
"type-coverage": "^2.27.1",
54+
"typescript": "^5.3.3"
4755
},
4856
"resolutions": {
4957
"@types/acorn": "^6.0.0",
5058
"@types/mdast": "^4.0.3",
51-
"acorn": "^8.11.2",
59+
"acorn": "^8.11.3",
5260
"cliui": "npm:@isaacs/cliui@^8.0.2",
5361
"eslint-mdx": "link:packages/eslint-mdx",
5462
"eslint-plugin-markdown": "JounQin/eslint-plugin-markdown#feat/bump",
5563
"eslint-plugin-mdx": "link:packages/eslint-plugin-mdx",
5664
"mdast-util-frontmatter": "^2.0.1",
5765
"mdast-util-gfm": "^3.0.0",
58-
"prettier": "^2.8.8",
5966
"unified": "^11.0.4",
6067
"unified-engine": "^11.2.0",
6168
"unist-util-visit": "^5.0.0"

packages/eslint-mdx/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
"eslint": ">=8.0.0"
3131
},
3232
"dependencies": {
33-
"acorn": "^8.11.2",
33+
"acorn": "^8.11.3",
3434
"acorn-jsx": "^5.3.2",
3535
"espree": "^9.6.1",
3636
"estree-util-visit": "^2.0.0",
3737
"remark-mdx": "^3.0.0",
3838
"remark-parse": "^11.0.0",
3939
"remark-stringify": "^11.0.0",
40-
"synckit": "^0.8.6",
40+
"synckit": "^0.8.8",
4141
"tslib": "^2.6.2",
4242
"unified": "^11.0.4",
4343
"unified-engine": "^11.2.0",

packages/eslint-mdx/src/meta.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- no idea
2-
// @ts-ignore
31
import { name, version } from '../package.json'
42

53
export const meta = { name, version }

packages/eslint-mdx/src/worker.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ let tokTypes: typeof _tokTypes
6262
let jsxTokTypes: Record<string, TokenType>
6363
let tt: Record<string, TokenType> & typeof _tokTypes
6464

65-
let TokenTranslator: typeof import('espree/lib/token-translator')['default']
65+
let TokenTranslator: (typeof import('espree/lib/token-translator'))['default']
6666

6767
export const processorCache = new Map<
6868
string,
@@ -71,9 +71,8 @@ export const processorCache = new Map<
7171

7272
const getRemarkConfig = async (searchFrom: string) => {
7373
if (!config) {
74-
const { Configuration } = await loadEsmModule<
75-
typeof import('unified-engine')
76-
>('unified-engine')
74+
const { Configuration } =
75+
await loadEsmModule<typeof import('unified-engine')>('unified-engine')
7776
config = new Configuration({
7877
cwd: process.cwd(),
7978
packageField: 'remarkConfig',
@@ -251,13 +250,12 @@ runAsWorker(
251250
}
252251

253252
if (!jsxTokTypes) {
254-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
255-
jsxTokTypes = acornJsx.default(
256-
{
257-
allowNamespacedObjects: true,
258-
},
259-
// @ts-expect-error
260-
)(acorn.Parser).acornJsx.tokTypes
253+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
254+
jsxTokTypes = acornJsx.default({
255+
allowNamespacedObjects: true,
256+
// @ts-expect-error -- no type
257+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
258+
})(acorn.Parser).acornJsx.tokTypes
261259
}
262260

263261
if (!TokenTranslator) {
@@ -289,9 +287,8 @@ runAsWorker(
289287
const comments: Comment[] = []
290288
const tokens: AST.Token[] = []
291289

292-
const { visit } = await loadEsmModule<typeof import('unist-util-visit')>(
293-
'unist-util-visit',
294-
)
290+
const { visit } =
291+
await loadEsmModule<typeof import('unist-util-visit')>('unist-util-visit')
295292

296293
const processed = new WeakSet<Node>()
297294

@@ -727,9 +724,10 @@ runAsWorker(
727724
})
728725
}
729726

730-
const { visit: visitEstree } = await loadEsmModule<
731-
typeof import('estree-util-visit')
732-
>('estree-util-visit')
727+
const { visit: visitEstree } =
728+
await loadEsmModule<typeof import('estree-util-visit')>(
729+
'estree-util-visit',
730+
)
733731

734732
visitEstree(
735733
{

packages/eslint-plugin-mdx/src/configs/recommended.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const addPrettierRules = () => {
6565
return
6666
}
6767

68+
/* istanbul ignore next */
6869
overrides.push(
6970
{
7071
files: '*.md',
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- no idea
2-
// @ts-ignore
31
import { name, version } from '../package.json'
42

53
export const meta = { name, version }
File renamed without changes.

patches/string-length+4.0.2.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)