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

upgrade Yarn to v4 #9945

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
strategy:
fail-fast: false
matrix:
cli: [link-cli/yarn, registry/yarn, registry/npm, registry/npx]
cli: [link-cli/yarn, registry/npm, registry/npx]
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://yarnpkg.com/configuration/yarnrc#compressionLevel
compressionLevel: 0

nodeLinker: node-modules
2 changes: 1 addition & 1 deletion a3p-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"@agoric/synthetic-chain": "patch:@agoric/synthetic-chain@npm%3A0.1.0#~/.yarn/patches/@agoric-synthetic-chain-npm-0.1.0-148de716a6.patch",
"@types/better-sqlite3": "^7.6.9"
},
"packageManager": "yarn@4.2.2",
"packageManager": "yarn@4.4.0",
"license": "Apache-2.0"
}
4 changes: 2 additions & 2 deletions a3p-integration/proposals/a:vaults-auctions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"scripts": {
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops"
"agops": "yarn --cwd /usr/src/agoric-sdk/ agops"
},
"packageManager": "yarn@4.2.2"
"packageManager": "yarn@4.4.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
"!submission"
]
},
"packageManager": "yarn@4.2.2"
"packageManager": "yarn@4.4.0"
}
2 changes: 1 addition & 1 deletion a3p-integration/proposals/c:stake-bld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
"ava": {
"concurrency": 1
},
"packageManager": "yarn@4.2.2"
"packageManager": "yarn@4.4.0"
}
4 changes: 2 additions & 2 deletions a3p-integration/proposals/e:upgrade-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
]
},
"scripts": {
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops"
"agops": "yarn --cwd /usr/src/agoric-sdk/ agops"
},
"packageManager": "yarn@4.2.2"
"packageManager": "yarn@4.4.0"
}
4 changes: 2 additions & 2 deletions a3p-integration/proposals/z:acceptance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
]
},
"scripts": {
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops"
"agops": "yarn --cwd /usr/src/agoric-sdk/ agops"
},
"packageManager": "yarn@4.2.2",
"packageManager": "yarn@4.4.0",
"devDependencies": {
"typescript": "^5.5.4"
}
Expand Down
4 changes: 3 additions & 1 deletion golang/cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"engines": {
"node": "^18.12 || ^20.9"
},
"packageManager": "yarn@1.22.22",
"scripts": {
"test": "exit 0",
"build:all": "make",
Expand All @@ -27,6 +26,9 @@
"napi-thread-safe-callback": "0.0.6",
"node-addon-api": "^1.7.1"
},
"devDependencies": {
"node-gyp": "^10.2.0"
},
"author": "Agoric",
"license": "Apache-2.0",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion multichain-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"starship:stop": "make stop",
"postinstall": "patch-package"
},
"packageManager": "yarn@4.1.1",
"packageManager": "yarn@4.4.0",
"devDependencies": {
"@agoric/cosmic-proto": "0.4.1-dev-08f8549.0",
"@cosmjs/crypto": "^0.32.2",
Expand Down
16 changes: 6 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
"packages/wallet/api"
],
"type": "module",
"packageManager": "yarn@1.22.22",
"packageManager": "yarn@4.4.0",
"devDependencies": {
"@endo/eslint-plugin": "^2.2.1",
"@jessie.js/eslint-plugin": "^0.4.1",
"@types/express": "^4.17.17",
"@types/node": "^18.19.24",
"agoric": "^0.21.1",
"ava": "^5.3.0",
"c8": "^9.1.0",
"conventional-changelog-conventionalcommits": "^4.6.0",
Expand All @@ -37,17 +38,11 @@
"typescript": "^5.5.3",
"typescript-eslint": "^7.15.0"
},
"resolutions": {
"**/protobufjs": "^7.2.6",
"**/@types/estree": "^1.0.0",
"**/@typescript-eslint/typescript-estree": "^7.15.0"
},
"engines": {
"node": "^18.12 || ^20.9"
},
"scripts": {
"clean": "yarn lerna run --no-bail clean",
"check-dependencies": "node ./scripts/check-mismatched-dependencies.cjs",
"docs": "run-s docs:build docs:update-functions-path",
"docs:build": "typedoc --tsconfig tsconfig.build.json",
"docs:markdown-for-agoric-documentation-repo": "run-s docs:markdown-build 'docs:update-functions-path md'",
Expand All @@ -59,12 +54,13 @@
"format": "yarn prettier --write .github golang packages scripts a3p-integration multichain-testing",
"lint:format": "yarn prettier --check .github golang packages scripts a3p-integration multichain-testing",
"lint-fix": "yarn lerna run --no-bail lint-fix",
"lint": "run-s --continue-on-error lint:*",
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
"lint:packages": "yarn lerna run --no-bail lint",
"lint:scripts": "yarn eslint scripts/*js",
"test": "yarn lerna run --no-bail test",
"test:c8-all": "rm -rf coverage/tmp && C8_OPTIONS=\"--clean=false --temp-directory=$PWD/coverage/tmp\" lerna run test:c8",
"test:xs": "yarn workspaces run test:xs",
"build": "yarn workspaces run build && scripts/agd-builder.sh stamp yarn-built",
"test:xs": "yarn workspaces foreach --all run test:xs",
"build": "yarn workspaces foreach --all run build && scripts/agd-builder.sh stamp yarn-built",
"postinstall": "patch-package && scripts/agd-builder.sh stamp yarn-installed",
"build-ts": "tsc --build tsconfig.build.json",
"build-xs-worker": "cd packages/xs-vat-worker && yarn build:xs-lin"
Expand Down
9 changes: 5 additions & 4 deletions packages/ERTP/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"test:xs-unit": "ava-xs",
"test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2 test/swingsetTests",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:eslint": "eslint .",
"lint:types": "tsc"
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL:

-T,--top-level Check the root workspace for scripts and/or binaries instead of the current one

"lint:eslint": "yarn run -T eslint .",
"lint:types": "yarn run -T tsc"
},
"repository": {
"type": "git",
Expand All @@ -39,11 +39,11 @@
},
"homepage": "/~https://github.com/Agoric/agoric-sdk#readme",
"dependencies": {
"@endo/errors": "^1.2.5",
"@agoric/notifier": "^0.6.2",
"@agoric/store": "^0.9.2",
"@agoric/vat-data": "^0.5.2",
"@agoric/zone": "^0.2.2",
"@endo/errors": "^1.2.5",
"@endo/eventual-send": "^1.2.5",
"@endo/far": "^1.1.5",
"@endo/marshal": "^1.5.3",
Expand All @@ -53,6 +53,7 @@
},
"devDependencies": {
"@agoric/swingset-vat": "^0.32.2",
"@agoric/xsnap": "^0.14.2",
"@endo/bundle-source": "^3.4.0",
"@fast-check/ava": "^1.1.5",
"ava": "^5.3.0",
Expand Down
11 changes: 6 additions & 5 deletions packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"test:xs": "SWINGSET_WORKER_TYPE=xs-worker ava",
"test:xs-worker": "ava test/workers -m 'xsnap vat manager'",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:types": "tsc",
"lint:eslint": "eslint ."
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
"lint:types": "yarn run -T tsc",
"lint:eslint": "yarn run -T eslint ."
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.9",
"@types/microtime": "^2.1.0",
"@types/tmp": "^0.2.0",
"@types/yargs-parser": "^21.0.0"
"@types/yargs-parser": "^21.0.0",
"ava": "^5.3.0"
},
"dependencies": {
"@endo/errors": "^1.2.5",
"@agoric/internal": "^0.3.2",
"@agoric/kmarshal": "^0.1.0",
"@agoric/store": "^0.9.2",
Expand All @@ -43,6 +43,7 @@
"@endo/captp": "^4.3.0",
"@endo/check-bundle": "^1.0.9",
"@endo/compartment-mapper": "^1.2.2",
"@endo/errors": "^1.2.5",
"@endo/eventual-send": "^1.2.5",
"@endo/far": "^1.1.5",
"@endo/import-bundle": "^1.2.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/access-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:xs": "exit 0",
"lint": "run-s --continue-on-error lint:*",
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
"lint-fix": "yarn lint:eslint --fix",
"lint:eslint": "eslint .",
"lint:types": "tsc"
"lint:eslint": "yarn run -T eslint .",
"lint:types": "yarn run -T tsc"
},
"dependencies": {
"n-readlines": "^1.0.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "module",
"main": "src/main.js",
"bin": {
"agoric": "src/entrypoint.js",
"agops": "src/bin-agops.js"
"agops": "src/bin-agops.js",
"agoric": "src/entrypoint.js"
},
"exports": {
"./src/entrypoint.js": "./src/entrypoint.js",
Expand All @@ -24,9 +24,9 @@
"test:xs": "exit 0",
"integration-test": "ava --config .ava-integration-test.config.js",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:types": "tsc",
"lint:eslint": "eslint ."
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
"lint:types": "yarn run -T tsc",
"lint:eslint": "yarn run -T eslint ."
},
"devDependencies": {
"@agoric/cosmic-swingset": "^0.41.3",
Expand All @@ -37,7 +37,6 @@
},
"dependencies": {
"@agoric/access-token": "^0.4.21",
"@endo/errors": "^1.2.5",
"@agoric/cache": "^0.3.2",
"@agoric/casting": "^0.4.2",
"@agoric/cosmic-proto": "^0.4.0",
Expand All @@ -62,6 +61,7 @@
"@endo/captp": "^4.3.0",
"@endo/compartment-mapper": "^1.2.2",
"@endo/env-options": "^1.1.6",
"@endo/errors": "^1.2.5",
"@endo/far": "^1.1.5",
"@endo/init": "^1.1.4",
"@endo/marshal": "^1.5.3",
Expand Down
37 changes: 11 additions & 26 deletions packages/agoric-cli/scripts/get-sdk-package-names.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
#! /usr/bin/env node
/* global process, Buffer */
import { spawn } from 'child_process';
// @ts-check
/* eslint-env node */
import { execFileSync } from 'child_process';
import { basename } from 'path';
import { listWorkspaces } from '../src/lib/yarn.js';

const ps = spawn('yarn', ['workspaces', '--silent', 'info'], {
stdio: ['ignore', 'pipe', 'inherit'],
shell: true,
});
const workspaces = listWorkspaces({ execFileSync });

// Get Buffers of output.
const chunks = [];
ps.stdout.on('data', data => chunks.push(data));
const packageNames = workspaces.map(w => w.name);

// Wait for the process to exit.
ps.on('close', code => {
if (code !== 0) {
throw Error(`yarn info exited with code ${code}`);
}

// Get the output.
const json = Buffer.concat(chunks).toString('utf8');
// process.stderr.write(json);

// Write the module.
const workspaces = Object.keys(JSON.parse(json)).sort();
process.stdout.write(`\
// Write the module.
process.stdout.write(`\
// DO NOT EDIT - automatically generated by ${basename(
new URL(import.meta.url).pathname,
)}
new URL(import.meta.url).pathname,
)}
// prettier-ignore
export default ${JSON.stringify(workspaces, null, 2)};
export default ${JSON.stringify(packageNames.sort(), null, 2)};
`);
});
16 changes: 4 additions & 12 deletions packages/agoric-cli/src/install.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* global process Buffer */
/* eslint-env node */
import path from 'path';
import chalk from 'chalk';
import { execFileSync } from 'child_process';
import { makePspawn } from './helpers.js';
import DEFAULT_SDK_PACKAGE_NAMES from './sdk-package-names.js';
import { listWorkspaces } from './lib/yarn.js';

const REQUIRED_AGORIC_START_PACKAGES = [
'@agoric/solo',
Expand Down Expand Up @@ -30,17 +32,7 @@ export default async function installMain(progname, rawArgs, powers, opts) {
const rimraf = file => pspawn('rm', ['-rf', file]);

async function getWorktreePackagePaths(cwd = '.', map = new Map()) {
// run `yarn workspaces info` to get the list of directories to
// use, instead of a hard-coded list
const p = pspawn('yarn', ['workspaces', '--silent', 'info'], {
cwd,
stdio: ['inherit', 'pipe', 'inherit'],
});
const stdout = [];
p.childProcess.stdout.on('data', out => stdout.push(out));
await p;
const d = JSON.parse(Buffer.concat(stdout).toString('utf-8'));
for (const [name, { location }] of Object.entries(d)) {
for (const { name, location } of listWorkspaces({ execFileSync })) {
map.set(name, path.resolve(cwd, location));
}
return map;
Expand Down
22 changes: 22 additions & 0 deletions packages/agoric-cli/src/lib/yarn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// @ts-check

/**
* @import { execFileSync } from 'child_process';
*/

/**
* Omits the root
*
* @param {{ execFileSync: execFileSync }} io
* @returns {Array<{ location: string, name: string }>}
*/
export const listWorkspaces = ({ execFileSync }) => {
const out = execFileSync('npm', ['query', '.workspace'], {
stdio: ['ignore', 'pipe', 'inherit'],
shell: true,
encoding: 'utf-8',
});
/** @type {Array<{ location: string, name: string, description: string }>} */
const result = JSON.parse(out);
return result.filter(({ location }) => location !== '.');
};
18 changes: 18 additions & 0 deletions packages/agoric-cli/test/helpers.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** @file the `helpers` module is exported to test its API */

import '@endo/init/debug.js';

import test from 'ava';

import { getSDKBinaries } from '../src/helpers.js';

test('getSDKBinaries', t => {
const binaries = getSDKBinaries();
t.log(binaries);
t.is(typeof binaries.agSolo, 'string');
t.is(typeof binaries.agSoloBuild, 'object');
t.is(typeof binaries.cosmosChain, 'string');
t.is(typeof binaries.cosmosChainBuild, 'object');
t.is(typeof binaries.cosmosClientBuild, 'object');
t.is(typeof binaries.cosmosHelper, 'string');
});
6 changes: 3 additions & 3 deletions packages/base-zone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:types": "tsc",
"lint:eslint": "eslint ."
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
"lint:types": "yarn run -T tsc",
"lint:eslint": "yarn run -T eslint ."
},
"exports": {
".": "./src/index.js",
Expand Down
Loading
Loading