fix(base64): Refine package.json
MODIFY
packages/base64/package.json
packages/base64/package.json
"name": "@endo/base64",
"version": "0.1.0",
"description": "Transcodes base64",
- "parsers": {
- "js": "mjs"
- },
"author": "Agoric",
"license": "Apache-2.0",
"type": "module",
+ "parsers": {
+ "js": "mjs"
+ },
"main": "./dist/base64.cjs",
"module": "./src/main.js",
"browser": "./dist/base64.umd.js",
"build:dist": "rollup --config rollup.config.js",
"build:types": "tsc src/*.js --declaration --allowJs --emitDeclarationOnly --outDir types",
"clean": "rm -rf dist",
- "lint": "yarn lint-check",
- "lint-check": "eslint '**/*.js'",
+ "cover": "nyc ava",
+ "lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
"prepublish": "yarn clean && yarn build",
- "test": "ava",
- "test:nyc": "nyc ava"
+ "test": "ava"
},
+ "dependencies": {},
"devDependencies": {
+ "@rollup/plugin-commonjs": "^13.0.0",
"@rollup/plugin-node-resolve": "^6.1.0",
"ava": "^3.12.1",
"babel-eslint": "^10.0.3",
"files": [
"LICENSE*",
"dist",
- "types",
- "src"
+ "src",
+ "types"
],
"publishConfig": {
"access": "public"

MODIFY
packages/base64/rollup.config.js
packages/base64/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';
-const name = 'base64';
-const umd = 'Base64';
+const metaPath = new URL('package.json', import.meta.url).pathname;
+const meta = JSON.parse(fs.readFileSync(metaPath, 'utf-8'));
+const name = meta.name.split('/').pop();
+const umd = meta.umd || name;
export default [
{
@@ -17,7 +21,7 @@ export default [
format: 'cjs',
},
],
- plugins: [resolve()],
+ plugins: [resolve(), commonjs()],
},
{
input: 'src/main.js',
@@ -26,7 +30,7 @@ export default [
format: 'umd',
name: umd,
},
- plugins: [resolve()],
+ plugins: [resolve(), commonjs()],
},
{
input: 'src/main.js',
@@ -35,6 +39,6 @@ export default [
format: 'umd',
name: umd,
},
- plugins: [resolve(), terser()],
+ plugins: [resolve(), commonjs(), terser()],
},
];

fix(base64): Refine package.json