-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create initial skeleton for dapp-agoric-basics #1
Changes from all commits
97f2988
2484642
1aebf6f
ddb6784
b70f60c
e65dec3
e189ba3
a2a76e2
5135911
a252bf0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Lint and Test | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
all: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
- name: Use Node.js 18.8.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
# use node 18.8.x until Agoric/agoric-sdk#8636 | ||
node-version: "18.8.x" | ||
- name: yarn install | ||
run: yarn | ||
- name: yarn lint | ||
run: yarn lint | ||
- name: yarn test | ||
run: yarn test |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "agoric-basics-agservers", | ||
"version": "0.0.1", | ||
"description": "Agoric server instances for dapp-agoric-basics", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "exit 0", | ||
"test": "exit 0", | ||
"lint": "exit 0", | ||
"lint-check": "exit 0", | ||
"lint-fix": "exit 0" | ||
}, | ||
"author": "Agoric", | ||
"license": "Apache-2.0" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This dapp has no API. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"$note": "@agoric/[email protected] expects an api/package.json", | ||
"name": "agoric-basics-api", | ||
"version": "0.1.0" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// This file can contain .js-specific Typescript compiler config. | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"module": "ES2022", | ||
|
||
"noEmit": true, | ||
"downlevelIteration": true, | ||
"strictNullChecks": true, | ||
"moduleResolution": "node" | ||
}, | ||
"include": ["src/**/*.js", "test/**/*.js", "exported.js", "globals.d.ts"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"name": "agoric-basics-contract", | ||
"version": "0.1.0", | ||
"private": true, | ||
"description": "Agoric Basics Contract", | ||
"type": "module", | ||
"scripts": { | ||
"test": "ava --verbose", | ||
"lint": "eslint '**/*.js'", | ||
"lint:fix": "eslint --fix '**/*.js'" | ||
}, | ||
"devDependencies": { | ||
"@agoric/deploy-script-support": "^0.10.4-u12.0", | ||
"@agoric/eslint-config": "dev", | ||
"@endo/bundle-source": "^2.8.0", | ||
"@endo/eslint-plugin": "^0.5.2", | ||
"@endo/init": "^0.5.60", | ||
"@endo/promise-kit": "0.2.56", | ||
"@endo/ses-ava": "^0.2.44", | ||
"@jessie.js/eslint-plugin": "^0.4.0", | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
"@typescript-eslint/parser": "^6.7.0", | ||
"agoric": "^0.21.2-u12.0", | ||
"ava": "^5.3.0", | ||
"eslint": "^8.47.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-jessie": "^0.0.6", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-ava": "^14.0.0", | ||
"eslint-plugin-github": "^4.10.0", | ||
"eslint-plugin-import": "^2.25.3", | ||
"eslint-plugin-jsdoc": "^46.4.3", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"import-meta-resolve": "^2.2.1", | ||
"prettier": "^3.0.3", | ||
"prettier-plugin-jsdoc": "^1.0.0", | ||
"type-coverage": "^2.26.3", | ||
"typescript": "~5.2.2" | ||
}, | ||
"dependencies": { | ||
"@agoric/ertp": "^0.16.3-u12.0", | ||
"@agoric/zoe": "^0.26.3-u12.0", | ||
"@endo/far": "^0.2.22", | ||
"@endo/marshal": "^0.8.9", | ||
"@endo/patterns": "^0.2.5" | ||
}, | ||
"ava": { | ||
"files": [ | ||
"test/**/test-*.js" | ||
], | ||
"timeout": "10m" | ||
}, | ||
"keywords": [], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Agoric/dapp-agoric-basics" | ||
}, | ||
"author": "Agoric", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/Agoric/dapp-agoric-basics/issues" | ||
}, | ||
"homepage": "https://github.com/Agoric/dapp-agoric-basics#readme", | ||
"eslintConfig": { | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaVersion": 2021 | ||
}, | ||
"extends": [ | ||
"@agoric" | ||
] | ||
}, | ||
"prettier": { | ||
"trailingComma": "all", | ||
"arrowParens": "avoid", | ||
"singleQuote": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// @ts-check | ||
import { Far } from '@endo/far'; | ||
|
||
const greet = who => `Hello, ${who}!`; | ||
|
||
export const start = () => { | ||
return { | ||
publicFacet: Far('Hello', { greet }), | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// @ts-check | ||
import '@endo/init'; | ||
import { E } from '@endo/far'; | ||
// eslint-disable-next-line import/no-unresolved -- https://github.com/avajs/ava/issues/2951 | ||
import test from 'ava'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we might need to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
import { start } from '../src/agoric-basics-contract.js'; | ||
|
||
test('contract greets by name', async t => { | ||
const { publicFacet } = start(); | ||
const actual = await E(publicFacet).greet('Bob'); | ||
t.is(actual, 'Hello, Bob!'); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @file Test using bundleSource() on the contract. | ||
*/ | ||
|
||
// @ts-check | ||
|
||
// eslint-disable-next-line import/no-unresolved -- https://github.com/avajs/ava/issues/2951 | ||
import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; | ||
|
||
import bundleSource from '@endo/bundle-source'; | ||
import { makeZoeKitForTest } from '@agoric/zoe/tools/setup-zoe.js'; | ||
import { E, passStyleOf } from '@endo/far'; | ||
import { createRequire } from 'module'; | ||
|
||
const myRequire = createRequire(import.meta.url); | ||
const contractPath = myRequire.resolve(`../src/agoric-basics-contract.js`); | ||
|
||
test('bundleSource() bundles the contract for use with zoe', async t => { | ||
const bundle = await bundleSource(contractPath); | ||
t.is(bundle.moduleFormat, 'endoZipBase64'); | ||
t.log(bundle.endoZipBase64Sha512); | ||
t.true(bundle.endoZipBase64.length > 10_000); | ||
|
||
const { zoeService: zoe } = makeZoeKitForTest(); | ||
const installation = await E(zoe).install(bundle); | ||
t.log(installation); | ||
t.is(passStyleOf(installation), 'remotable'); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "agoric-basics", | ||
"version": "0.1.0", | ||
"license": "Apache-2.0", | ||
"private": true, | ||
"useWorkspaces": true, | ||
"workspaces": [ | ||
"contract" | ||
], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm. no endo resolutions to work around Agoric/agoric-sdk#8621 I was expecting something started with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added an issue: |
||
"scripts": { | ||
"lint": "yarn workspaces run lint", | ||
"test": "yarn workspaces run test" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. As a heads up,
dapp-offer-up
has a backlog item to expand this configuration to include type checking, andno-void
+no-floating-promises
rules: Agoric/dapp-offer-up#35 (comment)This has been blocked by lack of type support in the current releases, which prevents us from checking this sort of thing into CI: Agoric/dapp-offer-up#31 (This assumption may need to be revisited, as the two eslint rules seem separate from typechecking)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, created #2 to track this