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

fewer packageManager assumptions #11012

Merged
merged 8 commits into from
Feb 18, 2025
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
2 changes: 1 addition & 1 deletion a3p-integration/scripts/build-submission.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ shift || true
sdkroot=$(git rev-parse --show-toplevel)
(
cd "$sdkroot"
yarn agoric run --verbose "packages/builders/scripts/$builderScript" "$@"
npm exec agoric run -- --verbose "packages/builders/scripts/$builderScript" "$@"
)

# Create and populate the submission directory.
Expand Down
1 change: 0 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": "[email protected]",
"scripts": {
"test": "exit 0",
"build:all": "make",
Expand Down
2 changes: 1 addition & 1 deletion multichain-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"patch-package": "^8.0.0",
"starshipjs": "2.4.1",
"ts-blank-space": "^0.4.4",
"typescript": "~5.8.0-beta"
"typescript": "~5.8.1-rc"
},
"resolutions": {
"axios": "1.6.7",
Expand Down
18 changes: 9 additions & 9 deletions multichain-testing/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4925,7 +4925,7 @@ __metadata:
patch-package: "npm:^8.0.0"
starshipjs: "npm:2.4.1"
ts-blank-space: "npm:^0.4.4"
typescript: "npm:~5.8.0-beta"
typescript: "npm:~5.8.1-rc"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -5468,13 +5468,13 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:~5.8.0-beta":
version: 5.8.0-dev.20250130
resolution: "typescript@npm:5.8.0-dev.20250130"
"typescript@npm:~5.8.1-rc":
version: 5.8.1-rc
resolution: "typescript@npm:5.8.1-rc"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/20852f1703f109576c925a6710d6d0001656ecc77d60fca4ea94ecd562290cef4aa529f919f45f6ab3c8334d3746a938ecca700ed7d2fd563d7cbc3dbf75f2bf
checksum: 10c0/7692b2584d0bddbab2b9a76457908276cb968935b9e1a89b7429939b1c02c7c47b5b23f1e989e18bf441fc545a311f02e143e7594a3914e240554637011a7d70
languageName: node
linkType: hard

Expand All @@ -5488,13 +5488,13 @@ __metadata:
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A~5.8.0-beta#optional!builtin<compat/typescript>":
version: 5.8.0-dev.20250130
resolution: "typescript@patch:typescript@npm%3A5.8.0-dev.20250130#optional!builtin<compat/typescript>::version=5.8.0-dev.20250130&hash=5786d5"
"typescript@patch:typescript@npm%3A~5.8.1-rc#optional!builtin<compat/typescript>":
version: 5.8.1-rc
resolution: "typescript@patch:typescript@npm%3A5.8.1-rc#optional!builtin<compat/typescript>::version=5.8.1-rc&hash=5786d5"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/8cc5b8c72a84ff58ca8c2e3bdd25ea50e98aed8b6c079ddfa43f14744cd20d97529edd61ca930e99deb9c9d6321650fd69030169bbbd546187c426fcff83d360
checksum: 10c0/45267f3c53240100da1d53ec8ebaa008f019055fe339c79baf596bab180aab2821751781bfc3202d5f6180fe01200aed9ebf45dec84490ef3a9d90359326c075
languageName: node
linkType: hard

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"type-coverage": "^2.27.1",
"typedoc": "^0.26.7",
"typedoc-plugin-markdown": "^4.2.1",
"typescript": "~5.8.0-beta",
"typescript": "~5.8.1-rc",
"typescript-eslint": "^8.22.0"
},
"resolutions": {
Expand All @@ -49,7 +49,6 @@
},
"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 Down
35 changes: 10 additions & 25 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
// @ts-check
/* eslint-env node */
import { spawn } from 'child_process';
import { execFileSync } from 'child_process';
import { basename } from 'path';
import { listWorkspaces } from '../src/lib/packageManager.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)};
`);
});
14 changes: 3 additions & 11 deletions packages/agoric-cli/src/install.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* 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/packageManager.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/packageManager.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');
});
10 changes: 5 additions & 5 deletions packages/boot/tools/supports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ import { icaMocks, protoMsgMockMap, protoMsgMocks } from './ibc/mocks.js';

const trace = makeTracer('BSTSupport', false);

const cliEntrypoint = new URL(
importMetaResolve('agoric/src/entrypoint.js', import.meta.url),
).pathname;

type ConsumeBootrapItem = <N extends string>(
name: N,
) => N extends keyof FastUSDCCorePowers['consume']
Expand Down Expand Up @@ -176,12 +180,8 @@ export const makeProposalExtractor = ({ childProcess, fs }: Powers) => {
cliArgs: string[] = [],
) => {
console.info('running package script:', scriptPath);
const out = childProcess.execFileSync('yarn', ['bin', 'agoric'], {
cwd: outputDir,
env,
});
return childProcess.execFileSync(
out.toString().trim(),
cliEntrypoint,
['run', scriptPath, ...cliArgs],
{
cwd: outputDir,
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
"ava": "^5.3.1",
"rimraf": "^5.0.0",
"tsd": "^0.31.1",
"typescript": "^5.8.0-beta"
"typescript": "~5.8.1-rc"
},
"dependencies": {
"@endo/base64": "^1.0.9",
Expand Down
34 changes: 0 additions & 34 deletions scripts/check-mismatched-dependencies.cjs

This file was deleted.

10 changes: 2 additions & 8 deletions scripts/check-untested-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
import fs from 'fs';
import path from 'path';
import { execFileSync } from 'child_process';
import { listWorkspaces } from '../packages/agoric-cli/src/lib/packageManager.js';

const parent = new URL('..', import.meta.url).pathname;
const yarnCmd = ['yarn', '--silent', 'workspaces', 'info'];
console.log('Getting', yarnCmd.join(' '));
const workspacesInfo = execFileSync(yarnCmd[0], yarnCmd.slice(1), {
cwd: parent,
encoding: 'utf8',
});
const workspacesInfoJson = JSON.parse(workspacesInfo);

const testYaml = path.resolve(
parent,
Expand All @@ -22,7 +16,7 @@ const testYamlContent = fs.readFileSync(testYaml, 'utf-8');

console.log('Searching for "cd <location> && yarn test"...');
let status = 0;
for (const [pkg, { location }] of Object.entries(workspacesInfoJson)) {
for (const { name: pkg, location } of listWorkspaces({ execFileSync })) {
const cmd = `cd ${location} && yarn \${{ steps.vars.outputs.test }}`;
if (!testYamlContent.includes(cmd)) {
console.error(`Cannot find ${location} (${pkg})`);
Expand Down
Empty file modified scripts/run-deployment-integration.sh
100644 → 100755
Empty file.
Empty file modified scripts/update-typedoc-functions-path.cjs
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12032,16 +12032,16 @@ typescript-eslint@^7.3.1, typescript-eslint@^8.14.0, typescript-eslint@^8.22.0:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==

typescript@^5.8.0-beta, typescript@~5.8.0-beta:
version "5.8.0-dev.20250130"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.0-dev.20250130.tgz#eede4cf5d813f9845c6ee2b508d2392d544cb76e"
integrity sha512-qeH56cqOnOE0NO4zUsuuc5kyIQlzOPurHcguomUpSTfUE2He5dABg+fBBUeYIf4MreflM6ArXyj/rIrcHQ5g0g==

typescript@~5.6.3:
version "5.6.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b"
integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==

typescript@~5.8.1-rc:
version "5.8.1-rc"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.1-rc.tgz#678b7586bf1d7fdec0dbf35708ab7bb39ce13c3d"
integrity sha512-D8IlSOUk1E08jpFdK81reYkA1a/4XtEdV6MElOGdbu/uOy1RpEDqNO/onWmqUaLkTyeHmmU/QlWvjcM9cqF85g==

uc.micro@^2.0.0, uc.micro@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee"
Expand Down
Loading