Skip to content
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
99 changes: 89 additions & 10 deletions .yarn/releases/code-chronicles.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From: Miorel-Lucian Palii <[email protected]>
Date: Mon, 21 Oct 2024 19:50:25 -0700
Date: Fri, 25 Oct 2024 21:06:12 -0700
Subject: Code Chronicles Yarn patch!

---
.../sources/commands/set/version/sources.ts | 16 ++++--
.../sources/commands/foreach.ts | 17 ++++--
.../sources/commands/foreach.ts | 49 ++++++++++++-----
.../sources/commands/build/bundle.ts | 9 +++-
packages/yarnpkg-core/sources/Manifest.ts | 3 +-
packages/yarnpkg-core/sources/Report.ts | 53 ++++++++++++++-----
5 files changed, 72 insertions(+), 26 deletions(-)
5 files changed, 95 insertions(+), 35 deletions(-)

diff --git a/packages/plugin-essentials/sources/commands/set/version/sources.ts b/packages/plugin-essentials/sources/commands/set/version/sources.ts
index dc38915c1d06f9f41638c55b973fb08f2f695358..0ab5eec31a8109f165a146d4822369a3f31bb8f5 100644
Expand Down Expand Up @@ -52,10 +52,35 @@ index dc38915c1d06f9f41638c55b973fb08f2f695358..0ab5eec31a8109f165a146d4822369a3
const bundleBuffer = await xfs.readFilePromise(bundlePath);

diff --git a/packages/plugin-workspace-tools/sources/commands/foreach.ts b/packages/plugin-workspace-tools/sources/commands/foreach.ts
index 47668fc447c882119b4efb7b75453e2dac30a99e..fefe4d75e5bfd45c081171b5e1f242bceb777c01 100644
index 47668fc447c882119b4efb7b75453e2dac30a99e..8487c94a62f158fd1c26c64984d8413c9492c38d 100644
--- a/packages/plugin-workspace-tools/sources/commands/foreach.ts
+++ b/packages/plugin-workspace-tools/sources/commands/foreach.ts
@@ -260,7 +260,7 @@ export default class WorkspacesForeachCommand extends BaseCommand {
@@ -240,11 +240,23 @@ export default class WorkspacesForeachCommand extends BaseCommand {
}
}

+ // Default to maximum verbosity in terminal environments.
+ const verbosity = this.verbose ?? ((this.context.stdout as WriteStream).isTTY ? Infinity : 0);
+ const label = verbosity > 0;
+ const timing = verbosity > 1;
+ let commandCount = 0;
+
for (const workspace of selection) {
if (scriptName && !workspace.manifest.scripts.has(scriptName) && !isGlobalScript) {
const accessibleBinaries = await scriptUtils.getWorkspaceAccessibleBinaries(workspace);
if (!accessibleBinaries.has(scriptName)) {
- log(`Excluding ${workspace.relativeCwd} because it doesn't have a "${scriptName}" script`);
+ // [Code Chronicles] Report what we skipped for explicitness.
+ if (label && !this.dryRun) {
+ const prefix = getPrefix(workspace, {configuration, label, commandIndex: commandCount++});
+ this.context.stdout.write(`${prefix} Skipping because there's no "${scriptName}" script\n`);
+ } else {
+ log(`Excluding ${workspace.relativeCwd} because it doesn't have a "${scriptName}" script\n`);
+ }
continue;
}
}
@@ -260,7 +272,7 @@ export default class WorkspacesForeachCommand extends BaseCommand {
}

if (this.exclude.length > 0 && (micromatch.isMatch(structUtils.stringifyIdent(workspace.anchoredLocator), this.exclude) || micromatch.isMatch(workspace.relativeCwd, this.exclude))) {
Expand All @@ -64,7 +89,54 @@ index 47668fc447c882119b4efb7b75453e2dac30a99e..fefe4d75e5bfd45c081171b5e1f242bc
continue;
}

@@ -448,7 +448,7 @@ export default class WorkspacesForeachCommand extends BaseCommand {
@@ -275,11 +287,6 @@ export default class WorkspacesForeachCommand extends BaseCommand {
if (this.dryRun)
return 0;

- // Default to maximum verbosity in terminal environments.
- const verbosity = this.verbose ?? ((this.context.stdout as WriteStream).isTTY ? Infinity : 0);
- const label = verbosity > 0;
- const timing = verbosity > 1;
-
const concurrency = this.parallel ?
(this.jobs === `unlimited`
? Infinity
@@ -296,7 +303,6 @@ export default class WorkspacesForeachCommand extends BaseCommand {
const needsProcessing = new Map<LocatorHash, Workspace>();
const processing = new Set<DescriptorHash>();

- let commandCount = 0;
let finalExitCode: number | null = null;

let abortNextCommands = false;
@@ -324,11 +330,16 @@ export default class WorkspacesForeachCommand extends BaseCommand {

const start = Date.now();

+ // [Code Chronicles] Update the environment to indicate that it's a
+ // `yarn workspaces foreach`.
+ const oldEnv = process.env;
+ process.env = {...oldEnv, CODE_CHRONICLES_RUNNING_VIA_YARN_WORKSPACES_FOREACH: `1`};
const exitCode = (await this.cli.run([this.commandName, ...this.args], {
cwd: workspace.cwd,
stdout,
stderr,
})) || 0;
+ process.env = oldEnv;

stdout.end();
stderr.end();
@@ -399,7 +410,8 @@ export default class WorkspacesForeachCommand extends BaseCommand {

commandPromises.push(limit(async () => {
const exitCode = await runCommand(workspace, {
- commandIndex: ++commandCount,
+ // [Code Chronicles] Start the `commandIndex` at 0.
+ commandIndex: commandCount++,
});

needsProcessing.delete(identHash);
@@ -448,7 +460,7 @@ export default class WorkspacesForeachCommand extends BaseCommand {


function createStream(report: Report, {prefix, interlaced}: {prefix: string | null, interlaced: boolean}): [Writable, Promise<boolean>] {
Expand All @@ -73,7 +145,15 @@ index 47668fc447c882119b4efb7b75453e2dac30a99e..fefe4d75e5bfd45c081171b5e1f242bc

const defaultStream = new miscUtils.DefaultStream();
defaultStream.pipe(streamReporter, {end: false});
@@ -484,12 +484,19 @@ function getPrefix(workspace: Workspace, {configuration, commandIndex, label}: G
@@ -480,16 +492,25 @@ type GetPrefixOptions = {
label: boolean;
};

+
+// [Code Chronicles] Add a few more colors.
+const WORKSPACE_COLORS = [`#00A6ED`, `#2E86AB`, `#A23B72`, `#F18F01`, `#C73E1D`, `#CCE2A3`, `#FF69B4`, `#3D9970`];
+
function getPrefix(workspace: Workspace, {configuration, commandIndex, label}: GetPrefixOptions) {
if (!label)
return null;

Expand All @@ -85,9 +165,8 @@ index 47668fc447c882119b4efb7b75453e2dac30a99e..fefe4d75e5bfd45c081171b5e1f242bc
+ const prefix = `[${name}]`;

- const colors = [`#2E86AB`, `#A23B72`, `#F18F01`, `#C73E1D`, `#CCE2A3`];
+ // [Code Chronicles] Add a few more colors.
+ const colors = [`#00A6ED`, `#2E86AB`, `#A23B72`, `#F18F01`, `#C73E1D`, `#CCE2A3`, `#FF69B4`, `#3D9970`];
const colorName = colors[commandIndex % colors.length];
- const colorName = colors[commandIndex % colors.length];
+ const colorName = WORKSPACE_COLORS[commandIndex % WORKSPACE_COLORS.length];

return formatUtils.pretty(configuration, prefix, colorName);
}
Expand Down

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ enableInlineBuilds: true
enableTelemetry: false
nodeLinker: node-modules
tsEnableAutoTypes: true
yarnPath: .yarn/releases/yarn-4.5.1-git.20241018.hash-031b5da-code-chronicles-patch.cjs
yarnPath: .yarn/releases/yarn-4.5.1-git.20241025.hash-f59bbf9-code-chronicles-patch.cjs
# TODO: patch Yarn to not add extra newlines to this file
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"type": "module",
"scripts": {
"format": "yarn workspace @code-chronicles/repository-scripts start format",
"lint": "yarn workspace @code-chronicles/repository-scripts start lint",
"lint": "code-chronicles-lint",
"prepare": "husky",
"test": "yarn workspace @code-chronicles/repository-scripts start test",
"typecheck": "tsx -e 'require(\"@code-chronicles/repository-scripts/typecheck\").run()'"
"typecheck": "code-chronicles-typecheck"
},
"devDependencies": {
"@code-chronicles/eslint-config": "workspace:*",
"@code-chronicles/repository-scripts": "workspace:*",
"@yarnpkg/types": "4.0.0",
"eslint": "9.12.0",
"eslint": "9.13.0",
"husky": "9.1.6",
"lint-staged": "15.2.10",
"prettier": "3.3.3",
Expand Down
14 changes: 7 additions & 7 deletions workspaces/adventure-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,34 @@
"build-chrome-extension": "tsx src/scripts/build/buildChromeExtension.ts",
"package-goodies:test": "tsx ./jest.config.ts --testPathIgnorePatterns=\"<rootDir>/goodies/\"",
"format": "yarn goodies:java:format && yarn goodies:kotlin:format && yarn goodies:python3:format && yarn goodies:typescript:format && prettier --color --write .",
"lint": "eslint --color --max-warnings=0 .",
"lint": "code-chronicles-lint",
"postinstall": "yarn goodies:java:install && yarn goodies:kotlin:install && yarn goodies:python3:install",
"test": "yarn goodies:java:test && yarn goodies:kotlin:test && yarn goodies:python3:test && yarn goodies:typescript:test && yarn package-goodies:test",
"typecheck": "tsx -e 'require(\"@code-chronicles/repository-scripts/typecheck\").run()'"
"typecheck": "code-chronicles-typecheck"
},
"dependencies": {
"immutability-helper": "patch:immutability-helper@npm%3A3.1.1#~/.yarn/patches/immutability-helper-npm-3.1.1-482f1f8f58.patch",
"invariant": "2.2.4",
"nullthrows": "patch:nullthrows@npm%3A1.1.1#~/.yarn/patches/nullthrows-npm-1.1.1-3d1f817134.patch",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-syntax-highlighter": "15.5.0"
"react-syntax-highlighter": "15.6.1"
},
"devDependencies": {
"@code-chronicles/eslint-config": "workspace:*",
"@code-chronicles/repository-scripts": "workspace:*",
"@code-chronicles/util": "workspace:*",
"@jest/globals": "29.7.0",
"@types/node": "22.7.6",
"@types/react": "18.3.11",
"@types/node": "22.8.1",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/react-syntax-highlighter": "15.5.13",
"cross-env": "7.0.3",
"eslint": "9.12.0",
"eslint": "9.13.0",
"fork-ts-checker-webpack-plugin": "9.0.2",
"jest": "29.7.0",
"prettier": "3.3.3",
"prettier-plugin-java": "2.6.4",
"prettier-plugin-java": "2.6.5",
"ts-jest": "29.2.5",
"ts-loader": "9.5.1",
"ts-morph": "24.0.0",
Expand Down
8 changes: 4 additions & 4 deletions workspaces/download-leetcode-submissions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"scripts": {
"build": "cross-env NODE_OPTIONS=\"--import tsx\" webpack",
"format": "prettier --color --write .",
"lint": "eslint --color --max-warnings=0 .",
"lint": "code-chronicles-lint",
"start": "tsx src/main.ts",
"typecheck": "tsx -e 'require(\"@code-chronicles/repository-scripts/typecheck\").run()'"
"typecheck": "code-chronicles-typecheck"
},
"dependencies": {
"@code-chronicles/leetcode-api": "workspace:*",
Expand All @@ -31,9 +31,9 @@
"@code-chronicles/eslint-config": "workspace:*",
"@code-chronicles/repository-scripts": "workspace:*",
"@code-chronicles/webpack-make-output-executable-plugin": "workspace:*",
"@types/node": "22.7.6",
"@types/node": "22.8.1",
"cross-env": "7.0.3",
"eslint": "9.12.0",
"eslint": "9.13.0",
"fork-ts-checker-webpack-plugin": "9.0.2",
"prettier": "3.3.3",
"ts-loader": "9.5.1",
Expand Down
8 changes: 4 additions & 4 deletions workspaces/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
},
"scripts": {
"format": "prettier --color --write .",
"lint": "eslint --color --max-warnings=0 ."
"lint": "code-chronicles-lint"
},
"dependencies": {
"@stylistic/eslint-plugin-js": "2.9.0",
"@stylistic/eslint-plugin-ts": "2.9.0",
"@typescript-eslint/eslint-plugin": "8.10.0",
"@typescript-eslint/parser": "8.10.0",
"@typescript-eslint/eslint-plugin": "8.11.0",
"@typescript-eslint/parser": "8.11.0",
"eslint-import-resolver-typescript": "3.6.3",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-import-x": "4.3.1",
Expand All @@ -34,7 +34,7 @@
},
"devDependencies": {
"@code-chronicles/repository-scripts": "workspace:*",
"eslint": "9.12.0",
"eslint": "9.13.0",
"prettier": "3.3.3",
"tsx": "4.19.1"
}
Expand Down
8 changes: 4 additions & 4 deletions workspaces/fetch-leetcode-problem-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"scripts": {
"build": "cross-env NODE_OPTIONS=\"--import tsx\" webpack",
"format": "prettier --color --write .",
"lint": "eslint --color --max-warnings=0 .",
"lint": "code-chronicles-lint",
"start": "tsx src/main.ts",
"typecheck": "tsx -e 'require(\"@code-chronicles/repository-scripts/typecheck\").run()'"
"typecheck": "code-chronicles-typecheck"
},
"dependencies": {
"@code-chronicles/leetcode-api": "workspace:*",
Expand All @@ -29,9 +29,9 @@
"@code-chronicles/eslint-config": "workspace:*",
"@code-chronicles/repository-scripts": "workspace:*",
"@code-chronicles/webpack-make-output-executable-plugin": "workspace:*",
"@types/node": "22.7.6",
"@types/node": "22.8.1",
"cross-env": "7.0.3",
"eslint": "9.12.0",
"eslint": "9.13.0",
"fork-ts-checker-webpack-plugin": "9.0.2",
"prettier": "3.3.3",
"ts-loader": "9.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"scripts": {
"build": "cross-env NODE_OPTIONS=\"--import tsx\" webpack",
"format": "prettier --color --write .",
"lint": "eslint --color --max-warnings=0 .",
"lint": "code-chronicles-lint",
"start": "tsx src/main.ts",
"typecheck": "tsx -e 'require(\"@code-chronicles/repository-scripts/typecheck\").run()'"
"typecheck": "code-chronicles-typecheck"
},
"dependencies": {
"@code-chronicles/leetcode-api": "workspace:*",
Expand All @@ -29,9 +29,9 @@
"@code-chronicles/eslint-config": "workspace:*",
"@code-chronicles/repository-scripts": "workspace:*",
"@code-chronicles/webpack-make-output-executable-plugin": "workspace:*",
"@types/node": "22.7.6",
"@types/node": "22.8.1",
"cross-env": "7.0.3",
"eslint": "9.12.0",
"eslint": "9.13.0",
"fork-ts-checker-webpack-plugin": "9.0.2",
"prettier": "3.3.3",
"ts-loader": "9.5.1",
Expand Down
8 changes: 4 additions & 4 deletions workspaces/generate-health-report/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"type": "module",
"scripts": {
"format": "prettier --color --write .",
"lint": "eslint --color --max-warnings=0 .",
"lint": "code-chronicles-lint",
"start": "tsx src/main.ts",
"typecheck": "tsc --pretty --project ."
"typecheck": "code-chronicles-typecheck"
},
"dependencies": {
"@code-chronicles/util": "workspace:*",
Expand All @@ -26,8 +26,8 @@
},
"devDependencies": {
"@code-chronicles/eslint-config": "workspace:*",
"@types/node": "22.7.6",
"eslint": "9.12.0",
"@types/node": "22.8.1",
"eslint": "9.13.0",
"prettier": "3.3.3",
"typescript": "5.6.3"
}
Expand Down
8 changes: 4 additions & 4 deletions workspaces/javascript-leetcode-month/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"type": "module",
"scripts": {
"format": "prettier --color --write .",
"lint": "eslint --color --max-warnings=0 .",
"lint": "code-chronicles-lint",
"prep-write-up-for-leetcode": "tsx scripts/prep-write-up-for-leetcode.ts",
"typecheck": "tsx -e 'require(\"@code-chronicles/repository-scripts/typecheck\").run()'"
"typecheck": "code-chronicles-typecheck"
},
"devDependencies": {
"@code-chronicles/eslint-config": "workspace:*",
"@code-chronicles/repository-scripts": "workspace:*",
"@code-chronicles/util": "workspace:*",
"@types/mdast": "4.0.4",
"@types/node": "22.7.6",
"eslint": "9.12.0",
"@types/node": "22.8.1",
"eslint": "9.13.0",
"mdast": "3.0.0",
"prettier": "3.3.3",
"remark": "15.0.1",
Expand Down
8 changes: 4 additions & 4 deletions workspaces/leetcode-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"scripts": {
"codegen": "cross-env NODE_OPTIONS=\"--import tsx\" graphql-codegen-esm --config graphql-codegen.config.ts",
"format": "prettier --color --write .",
"lint": "eslint --color --max-warnings=0 .",
"lint": "code-chronicles-lint",
"patch-graphql-schema": "tsx src/scripts/patch-graphql-schema/main.ts",
"scrape-graphql-schema": "tsx src/scripts/scrape-graphql-schema/main.ts",
"test": "tsx ./jest.config.ts",
"typecheck": "tsx -e 'require(\"@code-chronicles/repository-scripts/typecheck\").run()'"
"typecheck": "code-chronicles-typecheck"
},
"dependencies": {
"@code-chronicles/util": "workspace:*",
Expand All @@ -40,10 +40,10 @@
"@graphql-codegen/add": "5.0.3",
"@graphql-codegen/cli": "5.0.3",
"@graphql-codegen/near-operation-file-preset": "3.0.0",
"@types/node": "22.7.6",
"@types/node": "22.8.1",
"cross-env": "7.0.3",
"dedent": "1.5.3",
"eslint": "9.12.0",
"eslint": "9.13.0",
"graphql-query-compress": "1.2.4",
"immutability-helper": "patch:immutability-helper@npm%3A3.1.1#~/.yarn/patches/immutability-helper-npm-3.1.1-482f1f8f58.patch",
"jest": "29.7.0",
Expand Down
Loading
Loading