Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: migrate to yarn v4 #509

Merged
merged 3 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

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

- name: Install Dependencies
run: yarn --frozen-lockfile
run: yarn --immutable
env:
SKIP_YARN_COREPACK_CHECK: 1

- name: Build, Lint and Test
run: |
Expand All @@ -37,6 +45,7 @@ jobs:
env:
EFF_NO_LINK_RULES: true
PARSER_NO_WATCH: true
SKIP_YARN_COREPACK_CHECK: 1

- name: Codecov
uses: codecov/codecov-action@v3
13 changes: 6 additions & 7 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: 'CodeQL'
name: CodeQL

on:
push:
branches: ['master']
pull_request:
branches: ['master']
schedule:
- cron: '41 19 * * 6'

Expand All @@ -20,22 +18,23 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [javascript]
language:
- javascript

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: '/language:${{ matrix.language }}'
6 changes: 6 additions & 0 deletions .github/workflows/pkg-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
env:
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
SKIP_YARN_COREPACK_CHECK: 1

- name: Package Size Report
uses: pkg-size/action@v1
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,38 @@ jobs:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
env:
# https://github.com/actions/setup-node/issues/531#issuecomment-1819151412
SKIP_YARN_COREPACK_CHECK: 1

- name: Install Dependencies
run: yarn --frozen-lockfile
run: yarn --immutable
env:
SKIP_YARN_COREPACK_CHECK: 1

# required for linting before commit
- name: Build
run: yarn build
env:
SKIP_YARN_COREPACK_CHECK: 1

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release:only
commit: 'chore: release package(s)'
title: 'chore: release package(s)'
publish: yarn release:only
version: yarn run version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SKIP_YARN_COREPACK_CHECK: 1
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")}}})};
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: 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"
49 changes: 28 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,60 @@
"workspaces": [
"packages/*"
],
"packageManager": "yarn@1.22.21",
"packageManager": "yarn@4.0.2",
"scripts": {
"build": "run-p build:*",
"build": "run-p 'build:*'",
"build:r": "r -f es2015",
"build:ts": "tsc -b",
"clean": "rimraf packages/*/{lib,*.tsbuildinfo}",
"lint": "run-p lint:*",
"clean": "rimraf --glob 'packages/*/{lib,*.tsbuildinfo}'",
"lint": "yarn build && run-p 'lint:*'",
"lint:es": "eslint . --cache -f friendly",
"lint:tsc": "tsc --noEmit",
"prelint": "yarn build",
"prepare": "patch-package && simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"prerelease": "yarn build",
"release": "yarn release:only",
"prepare": "patch-package && simple-git-hooks",
"release": "run-s build release:only",
"release:only": "changeset publish",
"test": "jest",
"version": "changeset version && yarn --no-immutable",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
"typecov": "type-coverage"
},
"devDependencies": {
"@1stg/lib-config": "^12.0.1",
"@1stg/common-config": "^10.0.0",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@types/eslint": "^8.44.8",
"@commitlint/cli": "^18.4.3",
"@pkgr/rollup": "^5.0.0",
"@types/acorn": "^6.0.0",
"@types/eslint": "^8.56.0",
"@types/eslint-plugin-markdown": "^2.0.2",
"@types/jest": "^29.5.10",
"@types/node": "^20.10.3",
"@types/react": "^18.2.42",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.6",
"@types/react": "^18.2.46",
"@types/unist": "^3.0.2",
"jest": "^29.7.0",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"jest": "^30.0.0-alpha.2",
"lint-staged": "^15.2.0",
"npm-run-all2": "^6.1.1",
"patch-package": "^8.0.0",
"prettier": "^3.1.1",
"react": "^18.2.0",
"rimraf": "^5.0.5",
"simple-git-hooks": "^2.9.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"type-coverage": "^2.27.0",
"typescript": "^5.3.2",
"yarn-deduplicate": "^6.0.2"
"ts-node": "^10.9.2",
"type-coverage": "^2.27.1",
"typescript": "^5.3.3"
},
"resolutions": {
"@types/acorn": "^6.0.0",
"@types/mdast": "^4.0.3",
"acorn": "^8.11.2",
"acorn": "^8.11.3",
"cliui": "npm:@isaacs/cliui@^8.0.2",
"eslint-mdx": "link:packages/eslint-mdx",
"eslint-plugin-markdown": "JounQin/eslint-plugin-markdown#feat/bump",
"eslint-plugin-mdx": "link:packages/eslint-plugin-mdx",
"mdast-util-frontmatter": "^2.0.1",
"mdast-util-gfm": "^3.0.0",
"prettier": "^2.8.8",
"unified": "^11.0.4",
"unified-engine": "^11.2.0",
"unist-util-visit": "^5.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
"eslint": ">=8.0.0"
},
"dependencies": {
"acorn": "^8.11.2",
"acorn": "^8.11.3",
"acorn-jsx": "^5.3.2",
"espree": "^9.6.1",
"estree-util-visit": "^2.0.0",
"remark-mdx": "^3.0.0",
"remark-parse": "^11.0.0",
"remark-stringify": "^11.0.0",
"synckit": "^0.8.6",
"synckit": "^0.8.8",
"tslib": "^2.6.2",
"unified": "^11.0.4",
"unified-engine": "^11.2.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/eslint-mdx/src/meta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- no idea
// @ts-ignore
import { name, version } from '../package.json'

export const meta = { name, version }
32 changes: 15 additions & 17 deletions packages/eslint-mdx/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ let tokTypes: typeof _tokTypes
let jsxTokTypes: Record<string, TokenType>
let tt: Record<string, TokenType> & typeof _tokTypes

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

export const processorCache = new Map<
string,
Expand All @@ -71,9 +71,8 @@ export const processorCache = new Map<

const getRemarkConfig = async (searchFrom: string) => {
if (!config) {
const { Configuration } = await loadEsmModule<
typeof import('unified-engine')
>('unified-engine')
const { Configuration } =
await loadEsmModule<typeof import('unified-engine')>('unified-engine')
config = new Configuration({
cwd: process.cwd(),
packageField: 'remarkConfig',
Expand Down Expand Up @@ -251,13 +250,12 @@ runAsWorker(
}

if (!jsxTokTypes) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
jsxTokTypes = acornJsx.default(
{
allowNamespacedObjects: true,
},
// @ts-expect-error
)(acorn.Parser).acornJsx.tokTypes
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
jsxTokTypes = acornJsx.default({
allowNamespacedObjects: true,
// @ts-expect-error -- no type
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
})(acorn.Parser).acornJsx.tokTypes
}

if (!TokenTranslator) {
Expand Down Expand Up @@ -289,9 +287,8 @@ runAsWorker(
const comments: Comment[] = []
const tokens: AST.Token[] = []

const { visit } = await loadEsmModule<typeof import('unist-util-visit')>(
'unist-util-visit',
)
const { visit } =
await loadEsmModule<typeof import('unist-util-visit')>('unist-util-visit')

const processed = new WeakSet<Node>()

Expand Down Expand Up @@ -727,9 +724,10 @@ runAsWorker(
})
}

const { visit: visitEstree } = await loadEsmModule<
typeof import('estree-util-visit')
>('estree-util-visit')
const { visit: visitEstree } =
await loadEsmModule<typeof import('estree-util-visit')>(
'estree-util-visit',
)

visitEstree(
{
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-mdx/src/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const addPrettierRules = () => {
return
}

/* istanbul ignore next */
overrides.push(
{
files: '*.md',
Expand Down
2 changes: 0 additions & 2 deletions packages/eslint-plugin-mdx/src/meta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- no idea
// @ts-ignore
import { name, version } from '../package.json'

export const meta = { name, version }
File renamed without changes.
11 changes: 0 additions & 11 deletions patches/string-length+4.0.2.patch

This file was deleted.

Loading
Loading