Skip to content

Commit

Permalink
Merge pull request #8778 from Agoric/ta/restore-builders-typecheck
Browse files Browse the repository at this point in the history
restore 'builders' typecheck
  • Loading branch information
mergify[bot] authored Jan 19, 2024
2 parents 853cca5 + 755a2f7 commit 1cea34c
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export default async (homeP, endowments) => {

await writeCoreProposal('gov-add-collateral', defaultProposalBuilder);
await writeCoreProposal('gov-start-psm', opts =>
// @ts-expect-error XXX makeInstallCache types
psmProposalBuilder({ ...opts, wrapInstall: tool.wrapInstall }),
);
};
2 changes: 2 additions & 0 deletions packages/builders/scripts/inter-protocol/init-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,11 @@ export default async (homeP, endowments) => {
});
await Promise.all([
writeCoreProposal('gov-econ-committee', opts =>
// @ts-expect-error XXX makeInstallCache types
committeeProposalBuilder({ ...opts, wrapInstall: tool.wrapInstall }),
),
writeCoreProposal('gov-amm-vaults-etc', opts =>
// @ts-expect-error XXX makeInstallCache types
mainProposalBuilder({ ...opts, wrapInstall: tool.wrapInstall }),
),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const game1ProposalBuilder = async ({ publishRef, install }) => {
});
};

/** @type {DeployScriptFunction} */
export default async (homeP, endowments) => {
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
await writeCoreProposal('start-game1', game1ProposalBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) =>
'getManifestForUpgradeWallet',
{
walletRef: publishRef(
// @ts-expect-error eslint is confused. The call is correct.
install('@agoric/smart-wallet/src/walletFactory.js'),
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
});
};

/** @type {DeployScriptFunction} */
export default async (homeP, endowments) => {
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
await writeCoreProposal('upgrade-walletFactory', defaultProposalBuilder);
Expand Down
2 changes: 1 addition & 1 deletion packages/builders/scripts/vats/set-core-proposal-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (!spec) {
}

const vatConfigFile = require.resolve(spec);
const configJson = fs.readFileSync(vatConfigFile);
const configJson = fs.readFileSync(vatConfigFile, 'utf-8');
const config = JSON.parse(configJson);

const envs = new Map();
Expand Down
4 changes: 3 additions & 1 deletion packages/builders/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"checkJs": false,
"allowSyntheticDefaultImports": true,
"checkJs": true,
"maxNodeModuleJsDepth": 2,
},
"include": [
"*.js",
Expand Down
3 changes: 3 additions & 0 deletions packages/deploy-script-support/src/endo-pieces-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export const start = () => {
});
};

/**
* @param {{ zoe: ERef<ZoeService> }} opts
*/
const makeBundler = ({ zoe }) => {
/** @type { Map<string, [string, Uint8Array]>} */
const nameToContent = new Map();
Expand Down
12 changes: 6 additions & 6 deletions packages/deploy-script-support/src/externalTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export {};
*/

/**
* @typedef {{ bundleName: string } | { bundleID: string} } ManifestBundleRef
* @typedef {{fileName?: string} & ({ bundleName: string } | { bundleID: string}) } ManifestBundleRef
*/

/**
Expand All @@ -26,19 +26,19 @@ export {};
*/

/**
* @callback InstallBundle
* @callback InstallEntrypoint
* @param {string} srcSpec
* @param {string} bundlePath
* @param {any} [opts]
* @param {string} [bundlePath]
* @param {unknown} [opts]
* @returns {Promise<ManifestBundleRef>}
*/

/**
* @callback ProposalBuilder
* @param {{
* publishRef: PublishBundleRef,
* install: InstallBundle,
* wrapInstall?: <T>(f: T) => T }
* install: InstallEntrypoint,
* wrapInstall?: <T extends InstallEntrypoint>(f: T) => T }
* } powers
* @param {...any} args
* @returns {Promise<ProposalResult>}
Expand Down
1 change: 1 addition & 0 deletions packages/deploy-script-support/src/getBundlerMaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { E } from '@endo/far';
import url from 'url';

/** @typedef {ReturnType<import('./endo-pieces-contract.js')['start']>['publicFacet']} BundleMaker */
/** @typedef {ReturnType<BundleMaker['makeBundler']>} Bundler */

export const makeGetBundlerMaker =
(homeP, { lookup, bundleSource }) =>
Expand Down
2 changes: 2 additions & 0 deletions packages/deploy-script-support/src/writeCoreProposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const makeWriteCoreProposal = (
const { bundleSource, pathResolve } = endowments;

let bundlerCache;
/** @returns {import('./getBundlerMaker.js').Bundler} */
const getBundler = () => {
if (!bundlerCache) {
bundlerCache = E(getBundlerMaker()).makeBundler({
Expand Down Expand Up @@ -120,6 +121,7 @@ export const makeWriteCoreProposal = (

// Await a reference then publish to the board.
const cmds = [];
/** @param {Promise<import('./externalTypes.js').ManifestBundleRef>} refP */
const publishRef = async refP => {
const { fileName, ...ref } = await refP;
if (fileName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ test('installInPieces', async t => {
},
};

// @ts-expect-error fake Zoe
const bundler = E(publicFacet).makeBundler({ zoe });

const installation = await installInPieces(endoPieces, bundler, {
Expand Down

0 comments on commit 1cea34c

Please sign in to comment.