From dd22da944592983dee61ee8346f0ae95b1da12a7 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Wed, 24 Nov 2021 00:10:29 -0600 Subject: [PATCH 1/4] fix(agoric-cli): use CXXFLAGS for Node 16 Also, pivot to `latest` NPM dist-tag. --- .yarn/releases/yarn-1.22.15.cjs | 5 ++++- docs/env.md | 11 +++++++++++ packages/agoric-cli/src/install.js | 25 ++++++++++++++++++++++--- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.yarn/releases/yarn-1.22.15.cjs b/.yarn/releases/yarn-1.22.15.cjs index e520b2dc986..9d72e21141b 100755 --- a/.yarn/releases/yarn-1.22.15.cjs +++ b/.yarn/releases/yarn-1.22.15.cjs @@ -1,4 +1,7 @@ #!/usr/bin/env node +if (process.env.CXXFLAGS === undefined) { + process.env.CXXFLAGS = '-std=c++14'; +} module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache @@ -147519,4 +147522,4 @@ module.exports = require("dns"); module.exports = require("domain"); /***/ }) -/******/ ]); \ No newline at end of file +/******/ ]); diff --git a/docs/env.md b/docs/env.md index 621b39bb49e..6f4f4350218 100644 --- a/docs/env.md +++ b/docs/env.md @@ -34,6 +34,17 @@ declarations. Lifetime: until all sources (including dapps) conform to using `Far` declarations for all remote objects +## CXXFLAGS + +Affects: yarn, agoric install + +Purpose: add compilation flags to Node.js C++ addons + +Description: defaults to `-std=c++14` if not set (empty string doesn't default) + +Lifetime: probably forever (until all supported Node versions work with +`CXXFLAGS=''`) + ## DEBUG Affects: agoric (CLI), ag-chain-cosmos, ag-solo diff --git a/packages/agoric-cli/src/install.js b/packages/agoric-cli/src/install.js index aa25ead7872..0a6e4f0116f 100644 --- a/packages/agoric-cli/src/install.js +++ b/packages/agoric-cli/src/install.js @@ -13,6 +13,11 @@ export default async function installMain(progname, rawArgs, powers, opts) { // Notify the preinstall guard that we are running. process.env.AGORIC_INSTALL = 'true'; + // Node 16 requires this to be set for C++ addons to compile. + if (process.env.CXXFLAGS === undefined) { + process.env.CXXFLAGS = '-std=c++14'; + } + const pspawn = makePspawn({ log, spawn, chalk }); const rimraf = file => pspawn('rm', ['-rf', file]); @@ -33,13 +38,15 @@ export default async function installMain(progname, rawArgs, powers, opts) { } let subdirs; + let sdkWorktree; const dappPackageJSON = await fs .readFile(`package.json`, 'utf-8') .then(data => JSON.parse(data)) .catch(err => log('error reading', `package.json`, err)); if (dappPackageJSON.useWorkspaces) { - subdirs = await workspaceDirectories(); - subdirs.unshift('.'); + const workdirs = await workspaceDirectories(); + sdkWorktree = workdirs.find(subd => subd === 'agoric-sdk'); + subdirs = ['.', ...workdirs.filter(subd => subd !== 'agoric-sdk')]; } else { const existingSubdirs = await Promise.all( ['.', '_agstate/agoric-servers', 'contract', 'api', 'ui'] @@ -91,6 +98,14 @@ export default async function installMain(progname, rawArgs, powers, opts) { }), ); + const sdkVersion = sdkWorktree ? 'workspace:^' : 'latest'; + + // Link the SDK. + if (sdkWorktree) { + await fs.unlink(sdkWorktree).catch(_ => {}); + await fs.symlink(sdkRoot, sdkWorktree); + } + await Promise.all( subdirs.map(async subdir => { const nm = `${subdir}/node_modules`; @@ -120,7 +135,7 @@ export default async function installMain(progname, rawArgs, powers, opts) { if (deps) { for (const pkg of Object.keys(deps)) { if (versions.has(pkg)) { - deps[pkg] = `*`; + deps[pkg] = sdkVersion; } } } @@ -151,6 +166,10 @@ export default async function installMain(progname, rawArgs, powers, opts) { return 1; } + if (sdkWorktree) { + return 0; + } + if (opts.sdk) { await Promise.all( dirPackages.map(async ([dir, pjName]) => { From 75c2d90b311b1d66c43cd1f457069a3aa9933578 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Wed, 24 Nov 2021 01:01:10 -0600 Subject: [PATCH 2/4] feat(agoric-cli): use `agoric install beta` to select that SDK --- packages/agoric-cli/src/install.js | 13 +++++++++---- packages/agoric-cli/src/main.js | 6 +++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/agoric-cli/src/install.js b/packages/agoric-cli/src/install.js index 0a6e4f0116f..610540f87aa 100644 --- a/packages/agoric-cli/src/install.js +++ b/packages/agoric-cli/src/install.js @@ -10,6 +10,8 @@ export default async function installMain(progname, rawArgs, powers, opts) { const { anylogger, fs, spawn } = powers; const log = anylogger('agoric:install'); + const forceSdkVersion = rawArgs[1]; + // Notify the preinstall guard that we are running. process.env.AGORIC_INSTALL = 'true'; @@ -98,8 +100,6 @@ export default async function installMain(progname, rawArgs, powers, opts) { }), ); - const sdkVersion = sdkWorktree ? 'workspace:^' : 'latest'; - // Link the SDK. if (sdkWorktree) { await fs.unlink(sdkWorktree).catch(_ => {}); @@ -121,7 +121,12 @@ export default async function installMain(progname, rawArgs, powers, opts) { ), ); - // Mark all the SDK package dependencies as wildcards. + if (forceSdkVersion === undefined) { + // No need to change package.json. + return; + } + + // Modify all the SDK package versions. const pjson = `${subdir}/package.json`; const packageJSON = await fs .readFile(pjson, 'utf-8') @@ -135,7 +140,7 @@ export default async function installMain(progname, rawArgs, powers, opts) { if (deps) { for (const pkg of Object.keys(deps)) { if (versions.has(pkg)) { - deps[pkg] = sdkVersion; + deps[pkg] = forceSdkVersion; } } } diff --git a/packages/agoric-cli/src/main.js b/packages/agoric-cli/src/main.js index 2b7b975a940..df92019ff58 100644 --- a/packages/agoric-cli/src/main.js +++ b/packages/agoric-cli/src/main.js @@ -156,12 +156,12 @@ const main = async (progname, rawArgs, powers) => { }); program - .command('install') + .command('install [force-sdk-version]') .description('install Dapp dependencies') - .action(async cmd => { + .action(async (forceSdkVersion, cmd) => { await isNotBasedir(); const opts = { ...program.opts(), ...cmd.opts() }; - return subMain(installMain, ['install'], opts); + return subMain(installMain, ['install', forceSdkVersion], opts); }); program From c13ec750b0801cce04c1bac320e6759d528998aa Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Wed, 24 Nov 2021 00:20:28 -0600 Subject: [PATCH 3/4] docs(MAINTAINERS): instructions for prereleases --- MAINTAINERS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 5d71fd8196f..a27bc954161 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -30,7 +30,8 @@ Once tests pass, you can publish to NPM with the following: ```sh # Publish to NPM. NOTE: You may have to repeat this several times if there are failures. -yarn lerna publish from-package +# Specify the --dist-tag if you're publishing a new beta release. +yarn lerna publish from-package # --dist-tag=beta ``` Merge the release PR into master. DO NOT REBASE OR SQUASH OR YOU WILL LOSE From 6ee4e6e0f7109c6c78d36d79f754f36ea5af641c Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Wed, 24 Nov 2021 00:31:00 -0600 Subject: [PATCH 4/4] chore(wallet-backend): update package.json --- packages/dapp-svelte-wallet/api/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/dapp-svelte-wallet/api/package.json b/packages/dapp-svelte-wallet/api/package.json index 6f1ac879148..af60ea9e0c3 100644 --- a/packages/dapp-svelte-wallet/api/package.json +++ b/packages/dapp-svelte-wallet/api/package.json @@ -57,5 +57,8 @@ "test/**/test-*.js" ], "timeout": "2m" + }, + "publishConfig": { + "access": "public" } }