From 68235ec3fc78b9973d886e782e03048427b6f93e Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Thu, 16 Nov 2023 20:31:52 -0800 Subject: [PATCH] feat(deploy-script-support): Write out bundle file names in machine readable file --- .../src/writeCoreProposal.js | 23 +++++++++++++++++-- packages/internal/src/node/createBundles.js | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/deploy-script-support/src/writeCoreProposal.js b/packages/deploy-script-support/src/writeCoreProposal.js index 144ef6bebff..8a489f47384 100644 --- a/packages/deploy-script-support/src/writeCoreProposal.js +++ b/packages/deploy-script-support/src/writeCoreProposal.js @@ -91,6 +91,8 @@ export const makeWriteCoreProposal = ( return ns.default; }; + const bundles = []; + /** * Install an entrypoint. * @@ -103,9 +105,14 @@ export const makeWriteCoreProposal = ( const bundle = getBundle(entrypoint, bundlePath); // Serialise the installations. - mutex = E.when(mutex, () => { + mutex = E.when(mutex, async () => { // console.log('installing', { filePrefix, entrypoint, bundlePath }); - return getBundleSpec(bundle, getBundler, opts); + const spec = await getBundleSpec(bundle, getBundler, opts); + bundles.push({ + entrypoint, + ...spec, + }); + return spec; }); // @ts-expect-error xxx mutex type narrowing return mutex; @@ -162,6 +169,18 @@ const overrideManifest = ${stringify(overrideManifest, true)}; log(`creating ${proposalJsFile}`); await writeFile(proposalJsFile, trimmed); + const plan = { + name: filePrefix, + script: proposalJsFile, + permit: proposalPermitJsonFile, + bundles, + }; + + await writeFile( + `${filePrefix}-plan.json`, + `${JSON.stringify(plan, null, 2)}\n`, + ); + log(`\ You can now run a governance submission command like: agd tx gov submit-proposal swingset-core-eval ${proposalPermitJsonFile} ${proposalJsFile} \\ diff --git a/packages/internal/src/node/createBundles.js b/packages/internal/src/node/createBundles.js index d17d1bb45ea..ecc7d505b73 100644 --- a/packages/internal/src/node/createBundles.js +++ b/packages/internal/src/node/createBundles.js @@ -23,7 +23,7 @@ export const createBundlesFromAbsolute = async sourceBundles => { } const bundle = match[1]; - const args = cacheToArgs.get(cache) || ['--to', cache]; + const args = cacheToArgs.get(cache) || ['--cache-js', cache]; args.push(srcPath, bundle); cacheToArgs.set(cache, args); }