Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
refactor: Convert RESM to NESM
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Aug 14, 2021
1 parent 2db2a54 commit 301c337
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 43 deletions.
4 changes: 2 additions & 2 deletions api/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import fs from 'fs';
import { E } from '@agoric/eventual-send';
import '@agoric/zoe/exported';
import '@agoric/zoe/exported.js';

import installationConstants from '../ui/public/conf/installationConstants';
import installationConstants from '../ui/public/conf/installationConstants.js';

// deploy.js runs in an ephemeral Node.js outside of swingset. The
// spawner runs within ag-solo, so is persistent. Once the deploy.js
Expand Down
7 changes: 2 additions & 5 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"private": true,
"version": "0.1.0",
"description": "Agoric Dapp web server handler",
"parsers": {
"js": "mjs"
},
"type": "module",
"scripts": {
"build": "exit 0",
"test": "exit 0",
Expand All @@ -28,8 +26,7 @@
},
"dependencies": {
"@agoric/zoe": "*",
"@agoric/eventual-send": "*",
"esm": "^3.2.5"
"@agoric/eventual-send": "*"
},
"eslintConfig": {
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion api/src/handler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { E } from '@agoric/eventual-send';
import { makeWebSocketHandler } from './lib-http';
import { makeWebSocketHandler } from './lib-http.js';

const spawnHandler = (
{ creatorFacet, board, http, invitationIssuer },
Expand Down
2 changes: 1 addition & 1 deletion contract/deploy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

import fs from 'fs';
import '@agoric/zoe/exported';
import '@agoric/zoe/exported.js';
import { E } from '@agoric/eventual-send';

// This script takes our contract code, installs it on Zoe, and makes
Expand Down
10 changes: 2 additions & 8 deletions contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"version": "0.1.0",
"private": true,
"description": "Contract for the Agoric Dapp",
"parsers": {
"js": "mjs"
},
"type": "module",
"scripts": {
"build": "exit 0",
"test": "ava --verbose",
Expand Down Expand Up @@ -34,16 +32,12 @@
"@agoric/install-ses": "*",
"@agoric/notifier": "*",
"@agoric/store": "*",
"@agoric/zoe": "*",
"esm": "^3.2.5"
"@agoric/zoe": "*"
},
"ava": {
"files": [
"test/**/test-*.js"
],
"require": [
"esm"
],
"timeout": "10m"
},
"keywords": [],
Expand Down
2 changes: 1 addition & 1 deletion contract/src/contract.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
import '@agoric/zoe/exported';
import '@agoric/zoe/exported.js';
import { AmountMath } from '@agoric/ertp';

/**
Expand Down
12 changes: 7 additions & 5 deletions contract/test/test-contract.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
// @ts-check

/* global __dirname */

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

import bundleSource from '@agoric/bundle-source';

import { E } from '@agoric/eventual-send';
import { makeFakeVatAdmin } from '@agoric/zoe/tools/fakeVatAdmin';
import { makeFakeVatAdmin } from '@agoric/zoe/tools/fakeVatAdmin.js';
import { makeZoe } from '@agoric/zoe';
import { AmountMath } from '@agoric/ertp';

const contractPath = `${__dirname}/../src/contract`;
const filename = new URL(import.meta.url).pathname;
const dirname = path.dirname(filename);

const contractPath = `${dirname}/../src/contract.js`;

test('zoe - mint payments', async (t) => {
const zoe = makeZoe(makeFakeVatAdmin().admin);
Expand Down
7 changes: 0 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
"version": "0.0.1",
"private": true,
"useWorkspaces": true,
"main": "index.js",
"parsers": {
"js": "mjs"
},
"workspaces": [
"api",
"contract",
Expand Down Expand Up @@ -37,9 +33,6 @@
"agoric": "*",
"eslint-plugin-eslint-comments": "^3.1.2"
},
"resolutions": {
"**/esm": "agoric-labs/esm#Agoric-built"
},
"prettier": {
"trailingComma": "all",
"singleQuote": true,
Expand Down
4 changes: 1 addition & 3 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"author": "Agoric",
"license": "Apache-2.0",
"homepage": ".",
"parsers": {
"js": "mjs"
},
"type": "module",
"scripts": {
"build": "parcel build public/index.html",
"lint-check": "eslint '**/*.{js,jsx}'",
Expand Down
4 changes: 2 additions & 2 deletions ui/public/lib/api-client.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @ts-check
/* globals window, WebSocket */

import { registerSocket, closeSocket, getActiveSocket } from './socket';
import { registerSocket, closeSocket, getActiveSocket } from './socket.js';

import dappConstants from './constants';
import dappConstants from './constants.js';

const { API_URL } = dappConstants;

Expand Down
2 changes: 1 addition & 1 deletion ui/public/lib/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Allow the runtime to override the defaults with __DAPP_CONSTANTS__
import defaults from '../conf/defaults';
import defaults from '../conf/defaults.js';

// eslint-disable-next-line no-underscore-dangle, no-undef
export default globalThis.__DAPP_CONSTANTS__ || defaults;
2 changes: 1 addition & 1 deletion ui/public/lib/wallet-client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
/* globals window document */

import { registerSocket, getActiveSocket, closeSocket } from './socket';
import { registerSocket, getActiveSocket, closeSocket } from './socket.js';

// Wallet bridge

Expand Down
6 changes: 3 additions & 3 deletions ui/public/src/connect.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-check
/* globals document */
import { rpc } from '../lib/socket';
import { activateSocket as startApi } from '../lib/api-client';
import { activateSocket as startBridge } from '../lib/wallet-client';
import { rpc } from '../lib/socket.js';
import { activateSocket as startApi } from '../lib/api-client.js';
import { activateSocket as startBridge } from '../lib/wallet-client.js';

const $messages = /** @type {HTMLDivElement} */ (document.getElementById(
`messages`,
Expand Down
6 changes: 3 additions & 3 deletions ui/public/src/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-check
/* globals document mdc */
import 'regenerator-runtime/runtime';
import dappConstants from '../lib/constants';
import { connect } from './connect';
import 'regenerator-runtime/runtime.js';
import dappConstants from '../lib/constants.js';
import { connect } from './connect.js';

const {
INVITE_BRAND_BOARD_ID,
Expand Down

0 comments on commit 301c337

Please sign in to comment.