style(make-hardener): Regularize style and provide type defs
MODIFY
CONTRIBUTING.md
CONTRIBUTING.md
We now have a lint rule that ensures that `files` in `package.json` includes
at least `src`, `dist`, and all `LICENSE*` files, and we can remove this step
as our confidence grows in our release mechanisms.
-* If you have added an `index.d.ts`, you may need to explicitly note this in
- `files` as it is not checked yet.
* `npm publish` to publish the version.
Being a member of the project or organization and having two-factor
authentication may be necessary.

ADD
packages/make-hardener/.gitignore
+types
+dist

MODIFY
packages/make-hardener/NEWS.md
packages/make-hardener/NEWS.md
@@ -2,7 +2,14 @@ User-visible changes in make-hardener:
## Next release
-* No changes yet.
+* Hardens up the prototype chain and eliminates the notion of a "fringe set"
+ and the class of errors that harden would previously throw when object
+ prototypes were not already in the fringe set.
+* Provides TypeScript definitions.
+
+## Release 0.1.1 (8-Aug-2020)
+
+* This version makes its own `package.json` visible to dependees.
## Release 0.1.0 (13-Jul-2020)

MODIFY
packages/make-hardener/package.json
packages/make-hardener/package.json
"url": "https://github.com/Agoric/SES-shim/issues"
},
"type": "module",
+ "parsers": {
+ "js": "mjs"
+ },
"main": "./dist/make-hardener.cjs",
"module": "./src/main.js",
"browser": "./dist/make-hardener.umd.js",
"unpkg": "./dist/make-hardener.umd.js",
+ "types": "./types/main.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
}
},
"scripts": {
- "prepublish": "yarn run clean && yarn build",
+ "build": "yarn build:types && yarn build:dist",
+ "build:dist": "rollup --config rollup.config.js",
+ "build:types": "tsc src/*.js --declaration --allowJs --emitDeclarationOnly --outDir types",
"clean": "rm -rf dist",
- "lint": "yarn lint:types && yarn lint:js",
- "lint:types": "tsc --build jsconfig.json",
- "lint:js": "eslint '**/*.js'",
+ "cover": "nyc ava",
+ "lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
- "test": "ava",
- "build": "rollup --config rollup.config.js"
+ "lint:js": "eslint '**/*.js'",
+ "lint:types": "tsc --build jsconfig.json",
+ "prepublish": "yarn clean && yarn build",
+ "test": "ava"
},
"dependencies": {},
"devDependencies": {
"@agoric/eslint-config": "^0.1.0",
+ "@rollup/plugin-commonjs": "^13.0.0",
"@rollup/plugin-node-resolve": "^6.1.0",
+ "ava": "^3.12.1",
+ "babel-eslint": "^10.0.3",
+ "eslint": "^6.8.0",
+ "eslint-config-airbnb-base": "^14.0.0",
+ "eslint-config-prettier": "^6.9.0",
+ "eslint-plugin-eslint-comments": "^3.1.2",
+ "eslint-plugin-import": "^2.19.1",
+ "eslint-plugin-prettier": "^3.1.2",
+ "nyc": "^15.1.0",
+ "prettier": "^1.19.1",
"rollup": "1.31.0",
"rollup-plugin-terser": "^5.1.3",
- "ava": "^3.12.1"
+ "typescript": "^4.0.5"
},
- "ava": {
"files": [
- "test/**/test-*.js"
+ "LICENSE*",
+ "dist",
+ "src",
+ "types"
],
- "require": []
+ "publishConfig": {
+ "access": "public"
},
"eslintConfig": {
"extends": [
"trailingComma": "all",
"singleQuote": true
},
+ "ava": {
"files": [
- "LICENSE*",
- "dist",
- "src"
+ "test/**/test-*.js"
],
+ "timeout": "2m"
+ },
"directories": {
"test": "test"
}

MODIFY
packages/make-hardener/rollup.config.js
packages/make-hardener/rollup.config.js
import resolve from '@rollup/plugin-node-resolve';
+import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import fs from 'fs';
@@ -20,7 +21,7 @@ export default [
format: 'cjs',
},
],
- plugins: [resolve()],
+ plugins: [resolve(), commonjs()],
},
{
input: 'src/main.js',
@@ -29,7 +30,7 @@ export default [
format: 'umd',
name: umd,
},
- plugins: [resolve()],
+ plugins: [resolve(), commonjs()],
},
{
input: 'src/main.js',
@@ -38,6 +39,6 @@ export default [
format: 'umd',
name: umd,
},
- plugins: [resolve(), terser()],
+ plugins: [resolve(), commonjs(), terser()],
},
];

MODIFY
scripts/repackage.sh
scripts/repackage.sh
@@ -27,8 +27,12 @@ NEWPKGJSONHASH=$(
name: null,
version: null,
description: "Description forthcoming.",
+ keywords: [],
author: "Agoric",
license: "Apache-2.0",
+ homepage: null,
+ repository: null,
+ bugs: null,
type: null,
parsers: null,
main: null,
@@ -48,6 +52,14 @@ NEWPKGJSONHASH=$(
} + . + {
name: (.name // "@agoric/\($name)"),
version: (.version // "0.1.0"),
+ homepage: (.homepage // "https://github.com/Agoric/SES-shim/tree/master/packages/\($name)#readme"),
+ repository: {
+ type: "git",
+ url: "git+https://github.com/Agoric/SES-shim.git",
+ },
+ bugs: {
+ url: "https://github.com/Agoric/SES-shim/issues",
+ },
type: "module",
parsers: {"js": "mjs"},
main: "./dist/\($name).cjs",
@@ -111,6 +123,7 @@ NEWPKGJSONHASH=$(
files: ((.files // []) + [
"src",
"dist",
+ "types",
"LICENSE*"
]) | sort | unique,
"publishConfig": {

style(make-hardener): Regularize style and provide type defs