Skip to content

Commit

Permalink
Yarn 4 (microsoft#778)
Browse files Browse the repository at this point in the history
* yarn 4

* husky reinit

* bumping lint-staged

* fixing up the yarn 4 dlx jest

* fix script for prettier

* use auto line ending

* point to exact yarn path

* escape yarn path as well

* filter out the line that says "Done ..."
  • Loading branch information
kenotron authored Sep 11, 2024
1 parent 46dba03 commit 3fb589f
Show file tree
Hide file tree
Showing 22 changed files with 9,743 additions and 5,808 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ lib
coverage
.idea/
**/.docusaurus/
profile*.json
profile*.json
.yarn/*
!.yarn/releases/
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npx lint-staged
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SECURITY.md
yarn.lock
# this is a test fixture
yarn.js
.yarn/**

# These lines from .gitignore can be removed after prettier 3 update
node_modules
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"files": "*.json5",
"options": { "parser": "json" }
}
]
],
"endOfLine": "auto"
}
925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.4.1.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarnPath: .yarn/releases/yarn-4.4.1.cjs
nodeLinker: node-modules
67 changes: 67 additions & 0 deletions change/change-51e9d75f-76d5-499b-9a20-b5593d7c907a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"changes": [
{
"type": "patch",
"comment": "yarn 4",
"packageName": "@lage-run/cache-github-actions",
"email": "[email protected]",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "yarn 4",
"packageName": "@lage-run/cache",
"email": "[email protected]",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "yarn 4",
"packageName": "@lage-run/format-hrtime",
"email": "[email protected]",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "yarn 4",
"packageName": "@lage-run/globby",
"email": "[email protected]",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "yarn 4",
"packageName": "@lage-run/hasher",
"email": "[email protected]",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "yarn 4",
"packageName": "lage",
"email": "[email protected]",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "yarn 4",
"packageName": "@lage-run/logger",
"email": "[email protected]",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "yarn 4",
"packageName": "@lage-run/reporters",
"email": "[email protected]",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "yarn 4",
"packageName": "@lage-run/scheduler",
"email": "[email protected]",
"dependentChangeType": "patch"
}
]
}
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"docs:build": "yarn --cwd docs build",
"docs:test": "yarn --cwd docs build",
"gh-pages": "gh-pages",
"format": "prettier --write .",
"format": "prettier --write . --",
"format:check": "prettier --check .",
"prepare": "husky install",
"prepare": "husky",
"postinstall": "patch-package"
},
"devDependencies": {
Expand All @@ -37,22 +37,24 @@
"beachball": "^2.37.0",
"fast-glob": "3.3.1",
"gh-pages": "^5.0.0",
"husky": "^8.0.3",
"husky": "^9.1.5",
"lage-npm": "npm:[email protected]",
"lint-staged": "^13.2.0",
"lint-staged": "^15.2.10",
"patch-package": "^6.5.1",
"prettier": "^2.8.6",
"syncpack": "^9.0.0",
"ts-node": "^10.9.1",
"typescript": "~5.0.3"
},
"lint-staged": {
"*": "prettier --write"
"*.{ts,js}": "eslint --fix",
"*.{ts,json,md}": "prettier --write"
},
"syncpack": {
"dependencyTypes": [
"dev",
"prod"
]
}
},
"packageManager": "[email protected]"
}
4 changes: 2 additions & 2 deletions packages/cache-github-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"lint": "monorepo-scripts lint"
},
"dependencies": {
"@actions/cache": "3.2.4",
"backfill-config": "6.4.2",
"backfill-logger": "5.2.1",
"workspace-tools": "0.36.4",
"@actions/cache": "3.2.4"
"workspace-tools": "0.36.4"
},
"devDependencies": {
"@lage-run/monorepo-scripts": "*"
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
},
"dependencies": {
"@azure/identity": "^4.0.1",
"@lage-run/target-graph": "^0.8.9",
"@lage-run/logger": "^1.3.0",
"@lage-run/target-graph": "^0.8.9",
"backfill-cache": "5.8.0",
"backfill-config": "6.4.2",
"backfill-logger": "5.2.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"scripts": {
"build": "tsc",
"start": "tsc -w --preserveWatchOutput",
"test": "jest",
"test": "monorepo-scripts jest",
"lint": "monorepo-scripts lint"
},
"dependencies": {
"@lage-run/cli": "^0.19.1",
"@lage-run/monorepo-scripts": "*",
"@lage-run/target-graph": "^0.8.9",
"@lage-run/scheduler-types": "^0.3.14",
"@lage-run/target-graph": "^0.8.9",
"execa": "5.1.1",
"glob-hasher": "^1.4.2"
}
Expand Down
5 changes: 3 additions & 2 deletions packages/e2e-tests/src/mock/monorepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Monorepo {
}

fs.cpSync(path.resolve(__dirname, "..", "..", "yarn"), path.dirname(this.yarnPath), { recursive: true });
execa.sync("yarn", ["install"], { cwd: this.root });
execa.sync(`"${process.execPath}"`, [`"${this.yarnPath}"`, "install"], { cwd: this.root, shell: true });
}

generateRepoFiles() {
Expand All @@ -65,6 +65,7 @@ export class Monorepo {
devDependencies: {
lage: path.resolve(__dirname, "..", "..", "..", "lage"),
},
packageManager: "[email protected]",
},
"lage.config.js": `module.exports = {
pipeline: {
Expand Down Expand Up @@ -147,7 +148,7 @@ export class Monorepo {
}

run(command: string, args?: string[], silent?: boolean) {
return execa.sync("yarn", [...(silent === true ? ["--silent"] : []), command, ...(args || [])], {
return execa.sync(`"${process.execPath}"`, [`"${this.yarnPath}"`, ...(silent === true ? ["--silent"] : []), command, ...(args || [])], {
cwd: this.root,
shell: true,
});
Expand Down
18 changes: 10 additions & 8 deletions packages/e2e-tests/src/parseNdJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import type { TargetStatus } from "@lage-run/scheduler-types";

export function parseNdJson(ndjson: string) {
const entries = ndjson.substr(ndjson.indexOf("{"));

return entries.split("\n").map((line) => {
try {
return JSON.parse(line);
} catch (e) {
return {};
}
});
return entries
.split("\n")
.map((line) => {
try {
return JSON.parse(line);
} catch (e) {
return {};
}
})
.filter((entry) => Object.keys(entry).length > 0);
}

export function filterEntry(data: any, pkg: string, task: string, status: TargetStatus) {
Expand Down
1 change: 0 additions & 1 deletion packages/format-hrtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"test": "jest",
"lint": "monorepo-scripts lint"
},
"devDependencies": {},
"publishConfig": {
"access": "public"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/globby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"license": "MIT",
"devDependencies": {
"globby": "14.0.1",
"esbuild": "^0.21.5"
"esbuild": "^0.21.5",
"globby": "14.0.1"
},
"exports": {
".": {
Expand Down
6 changes: 3 additions & 3 deletions packages/hasher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"lint": "monorepo-scripts lint"
},
"dependencies": {
"@lage-run/target-graph": "^0.8.9",
"@lage-run/logger": "^1.3.0",
"@lage-run/target-graph": "^0.8.9",
"execa": "5.1.1",
"workspace-tools": "0.36.4",
"fast-glob": "3.3.1",
"glob-hasher": "^1.4.2",
"graceful-fs": "4.2.11",
"micromatch": "4.0.5"
"micromatch": "4.0.5",
"workspace-tools": "0.36.4"
},
"devDependencies": {
"@lage-run/monorepo-fixture": "*",
Expand Down
11 changes: 4 additions & 7 deletions packages/lage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
"homepage": "https://microsoft.github.io/lage/",
"main": "dist/main.js",
"types": "dist/index.d.ts",
"bin": {
"lage": "dist/lage.js"
},
"bin": "dist/lage.js",
"scripts": {
"prebundle": "node scripts/prebuild.js",
"bundle": "yarn dts-bundle && node scripts/bundle.mjs",
"bundle": "node scripts/prebuild.js && yarn dts-bundle && node scripts/bundle.mjs",
"dts-bundle": "dts-bundle-generator --config ./dts-bundle.config.js && node ./scripts/update-dts-bundle.js"
},
"dependencies": {
Expand All @@ -27,8 +24,8 @@
"@lage-run/runners": "^1.0.1",
"backfill-config": "6.4.2",
"dts-bundle-generator": "^9.5.1",
"workspace-tools": "0.36.4",
"esbuild": "^0.21.5"
"esbuild": "^0.21.5",
"workspace-tools": "0.36.4"
},
"files": [
"dist/*.d.ts",
Expand Down
1 change: 0 additions & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"test": "jest",
"lint": "monorepo-scripts lint"
},
"devDependencies": {},
"publishConfig": {
"access": "public"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/reporters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"lint": "monorepo-scripts lint"
},
"dependencies": {
"@lage-run/format-hrtime": "^0.1.5",
"@lage-run/logger": "^1.3.0",
"@lage-run/scheduler-types": "^0.3.14",
"@lage-run/target-graph": "^0.8.9",
"@lage-run/format-hrtime": "^0.1.5",
"@ms-cloudpack/task-reporter": "0.5.3",
"chalk": "4.1.2",
"ansi-regex": "5.0.1",
"chalk": "4.1.2",
"gradient-string": "2.0.2"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/scheduler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
"lint": "monorepo-scripts lint"
},
"dependencies": {
"@lage-run/target-graph": "^0.8.9",
"@lage-run/logger": "^1.3.0",
"@lage-run/cache": "^1.3.1",
"@lage-run/config": "^0.4.0",
"@lage-run/hasher": "^1.3.1",
"@lage-run/logger": "^1.3.0",
"@lage-run/runners": "^1.0.1",
"@lage-run/target-graph": "^0.8.9",
"@lage-run/worker-threads-pool": "^0.8.0"
},
"devDependencies": {
"@lage-run/scheduler-types": "^0.3.14",
"@lage-run/monorepo-scripts": "*"
"@lage-run/monorepo-scripts": "*",
"@lage-run/scheduler-types": "^0.3.14"
},
"publishConfig": {
"access": "public"
Expand Down
12 changes: 5 additions & 7 deletions scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
"name": "@lage-run/monorepo-scripts",
"version": "1.0.0",
"private": true,
"bin": {
"monorepo-scripts": "bin/monorepo-scripts.js"
},
"bin": "bin/monorepo-scripts.js",
"dependencies": {
"@swc/core": "^1.3.14",
"@swc/jest": "^0.2.36",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"depcheck": "^1.4.7",
"jest": "^29.0.0",
"eslint": "^8.20.0",
"eslint-plugin-file-extension-in-import-ts": "^1.0.1",
"workspace-tools": "0.36.4",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7"
"jest": "^29.0.0",
"workspace-tools": "0.36.4"
}
}
Loading

0 comments on commit 3fb589f

Please sign in to comment.