Skip to content

Commit

Permalink
refactor(governance): Convert RESM to NESM
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Aug 11, 2021
1 parent 227975e commit 1f9802a
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 34 deletions.
8 changes: 1 addition & 7 deletions packages/governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"name": "@agoric/governance",
"version": "0.1.7",
"description": "Core governance support",
"parsers": {
"js": "mjs"
},
"type": "module",
"main": "src/paramManager.js",
"engines": {
"node": ">=14.15.0"
Expand Down Expand Up @@ -48,7 +46,6 @@
"@agoric/install-ses": "^0.5.21",
"@agoric/swingset-vat": "^0.19.0",
"ava": "^3.12.1",
"esm": "agoric-labs/esm#Agoric-built",
"ses": "^0.14.0"
},
"files": [
Expand All @@ -59,9 +56,6 @@
"files": [
"test/**/test-*.js"
],
"require": [
"esm"
],
"timeout": "10m"
},
"eslintConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/governance/src/binaryBallotCounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { makePromiseKit } from '@agoric/promise-kit';
import { Far } from '@agoric/marshal';

import { E } from '@agoric/eventual-send';
import { ChoiceMethod, buildBallot } from './ballotBuilder';
import { scheduleClose } from './closingRule';
import { ChoiceMethod, buildBallot } from './ballotBuilder.js';
import { scheduleClose } from './closingRule.js';

const makeWeightedBallot = (ballot, shares) => harden({ ballot, shares });

Expand Down
4 changes: 2 additions & 2 deletions packages/governance/src/paramManager.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @ts-check

import { assert, details as X } from '@agoric/assert';
import { assertIsRatio } from '@agoric/zoe/src/contractSupport';
import { assertIsRatio } from '@agoric/zoe/src/contractSupport/index.js';
import { AmountMath, looksLikeBrand } from '@agoric/ertp';
import { Far } from '@agoric/marshal';
import { assertKeywordName } from '@agoric/zoe/src/cleanProposal';
import { assertKeywordName } from '@agoric/zoe/src/cleanProposal.js';
import { Nat } from '@agoric/nat';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';
import buildManualTimer from '@agoric/zoe/tools/manualTimer';
import buildManualTimer from '@agoric/zoe/tools/manualTimer.js';

const makeVoterVat = async (log, vats, zoe) => {
const voterCreator = E(vats.voter).build(zoe);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global __dirname */

// @ts-check

// TODO Remove babel-standalone preinitialization
Expand All @@ -12,9 +10,13 @@ import '@agoric/install-ses';
import test from 'ava';
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@agoric/bundle-source';
import path from 'path';

const CONTRACT_FILES = ['committeeRegistrar', 'binaryBallotCounter'];

const filename = new URL(import.meta.url).pathname;
const dirname = path.dirname(filename);

test.before(async t => {
const start = Date.now();
const kernelBundles = await buildKernelBundles();
Expand All @@ -30,7 +32,7 @@ test.before(async t => {
} else {
({ bundleName, contractPath } = settings);
}
const source = `${__dirname}/../../../src/${contractPath}`;
const source = `${dirname}/../../../src/${contractPath}`;
const bundle = await bundleSource(source);
contractBundles[bundleName] = bundle;
}),
Expand All @@ -40,12 +42,12 @@ test.before(async t => {
const vats = {};
await Promise.all(
['voter', 'zoe'].map(async name => {
const source = `${__dirname}/vat-${name}.js`;
const source = `${dirname}/vat-${name}.js`;
const bundle = await bundleSource(source);
vats[name] = { bundle };
}),
);
const bootstrapSource = `${__dirname}/bootstrap.js`;
const bootstrapSource = `${dirname}/bootstrap.js`;
vats.bootstrap = {
bundle: await bundleSource(bootstrapSource),
parameters: { contractBundles }, // argv will be added to this
Expand Down
10 changes: 5 additions & 5 deletions packages/governance/test/test-param-manager.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @ts-check

import { test } from '@agoric/zoe/tools/prepare-test-env-ava';
import '@agoric/zoe/exported';
import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
import '@agoric/zoe/exported.js';
import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp';
import { makeRatio } from '@agoric/zoe/src/contractSupport';
import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js';

import { makeHandle } from '@agoric/zoe/src/makeHandle';
import { buildParamManager, ParamType } from '../src/paramManager';
import { makeHandle } from '@agoric/zoe/src/makeHandle.js';
import { buildParamManager, ParamType } from '../src/paramManager.js';

const BASIS_POINTS = 10_000;

Expand Down
8 changes: 4 additions & 4 deletions packages/governance/test/unitTests/test-ballotCount.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @ts-check

import { test } from '@agoric/zoe/tools/prepare-test-env-ava';
import '@agoric/zoe/exported';
import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
import '@agoric/zoe/exported.js';
import { E } from '@agoric/eventual-send';

import { makeHandle } from '@agoric/zoe/src/makeHandle';
import { makeBinaryBallotCounter } from '../../src/binaryBallotCounter';
import { makeHandle } from '@agoric/zoe/src/makeHandle.js';
import { makeBinaryBallotCounter } from '../../src/binaryBallotCounter.js';

const QUESTION = 'Fish or cut bait?';
const FISH = 'Fish';
Expand Down
19 changes: 11 additions & 8 deletions packages/governance/test/unitTests/test-committee.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
/* global __dirname */
// @ts-check

import { test } from '@agoric/zoe/tools/prepare-test-env-ava';
import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';

import '@agoric/zoe/exported';
import '@agoric/zoe/exported.js';

import path from 'path';
import { E } from '@agoric/eventual-send';
import { makeZoe } from '@agoric/zoe';
import fakeVatAdmin from '@agoric/zoe/tools/fakeVatAdmin';
import fakeVatAdmin from '@agoric/zoe/tools/fakeVatAdmin.js';
import bundleSource from '@agoric/bundle-source';
import buildManualTimer from '@agoric/zoe/tools/manualTimer';
import buildManualTimer from '@agoric/zoe/tools/manualTimer.js';

import { ChoiceMethod } from '../../src/ballotBuilder';
import { ChoiceMethod } from '../../src/ballotBuilder.js';

const registrarRoot = `${__dirname}/../../src/committeeRegistrar`;
const counterRoot = `${__dirname}/../../src/binaryBallotCounter`;
const filename = new URL(import.meta.url).pathname;
const dirname = path.dirname(filename);

const registrarRoot = `${dirname}/../../src/committeeRegistrar.js`;
const counterRoot = `${dirname}/../../src/binaryBallotCounter.js`;

async function setupContract() {
const zoe = makeZoe(fakeVatAdmin);
Expand Down

0 comments on commit 1f9802a

Please sign in to comment.