-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replace rollup with esbuild * Downgrade jest and fix tests * Add extensions to all imports 😴 * Missed a few extensions
- Loading branch information
Showing
30 changed files
with
1,864 additions
and
2,242 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,34 @@ | |
"version": "0.15.0", | ||
"description": "In-browser key management with IndexedDB and the Web Crypto API", | ||
"keywords": [], | ||
"main": "index.cjs.js", | ||
"module": "index.es5.js", | ||
"browser": "index.umd.js", | ||
"typings": "types/index.d.ts", | ||
"type": "module", | ||
"main": "lib/index.js", | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./*": "./lib/*", | ||
"./package.json": "./package.json" | ||
}, | ||
"types": "lib/index.d.ts", | ||
"typesVersions": { | ||
"*": { | ||
"lib/index.d.ts": [ | ||
"lib/index.d.ts" | ||
], | ||
"*": [ | ||
"lib/*" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"lib", | ||
"dist", | ||
"README.md", | ||
"CHANGELOG.md", | ||
"LICENSE", | ||
"package.json", | ||
"!*.test.ts", | ||
"docs" | ||
], | ||
"author": "Daniel Holmgren <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
|
@@ -19,52 +43,35 @@ | |
"scripts": { | ||
"lint": "yarn eslint src/**/*.ts test/**/*.ts", | ||
"prebuild": "rimraf dist", | ||
"build": "tsc && rollup -c rollup.config.ts", | ||
"build": "tsc && yarn run build:minified", | ||
"build:minified": "node scripts/build-minified.js", | ||
"start": "tsc -w", | ||
"test": "jest --coverage", | ||
"test:watch": "jest --coverage --watch", | ||
"test:prod": "npm run lint && npm run test -- --no-cache", | ||
"do-publish": "yarn build && cp package.json LICENSE README.md dist/ && cd dist && npm publish", | ||
"precommit": "lint-staged" | ||
}, | ||
"lint-staged": { | ||
"{src,test}/**/*.ts": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true | ||
"prepare": "yarn build", | ||
"publish-dry": "npm publish --dry-run", | ||
"publish-alpha": "npm publish --tag alpha", | ||
"publish-latest": "npm publish --tag latest" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^25.1.3", | ||
"@types/node": "^13.7.4", | ||
"@typescript-eslint/eslint-plugin": "^2.21.0", | ||
"@typescript-eslint/parser": "^2.21.0", | ||
"braces": "^3.0.2", | ||
"eslint": "^6.8.0", | ||
"jest": "^25.1.0", | ||
"jest-config": "^25.1.0", | ||
"lint-staged": "^10.0.7", | ||
"prettier": "^1.19.1", | ||
"prompt": "^1.0.0", | ||
"replace-in-file": "^5.0.2", | ||
"@types/jest": "^26.0.0", | ||
"@types/node": "^16.9.1", | ||
"@typescript-eslint/eslint-plugin": "^4.31.0", | ||
"@typescript-eslint/parser": "^4.31.0", | ||
"esbuild": "^0.12.27", | ||
"eslint": "^7.32.0", | ||
"jest": "^26.0.0", | ||
"jest-config": "^26.0.0", | ||
"jest-ts-webcompat-resolver": "^1.0.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^1.31.1", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-node-polyfills": "^0.2.1", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-typescript2": "^0.26.0", | ||
"ts-jest": "^25.2.1", | ||
"ts-node": "^8.6.2", | ||
"typescript": "^3.8.2" | ||
"ts-jest": "^26.0.0", | ||
"ts-node": "^10.2.1", | ||
"typescript": "^4.4.2" | ||
}, | ||
"dependencies": { | ||
"@ungap/global-this": "^0.4.3", | ||
"localforage": "^1.7.3", | ||
"@ungap/global-this": "^0.4.4", | ||
"localforage": "^1.10.0", | ||
"uint8arrays": "^3.0.0" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import esbuild from "esbuild" | ||
import fs from "fs" | ||
import zlib from "zlib" | ||
|
||
|
||
const globalName = "keystore" | ||
const outfile = "dist/index.umd.min.js" | ||
const outfileGz = `${outfile}.gz` | ||
|
||
// From https://github.com/umdjs/umd/blob/36fd1135ba44e758c7371e7af72295acdebce010/templates/returnExports.js | ||
const umd = { | ||
banner: | ||
`(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module. | ||
define([], factory); | ||
} else if (typeof module === 'object' && module.exports) { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(); | ||
} else { | ||
// Browser globals (root is window) | ||
root.${globalName} = factory(); | ||
} | ||
}(typeof self !== 'undefined' ? self : this, function () { `, | ||
footer: | ||
`return ${globalName}; | ||
}));` | ||
} | ||
|
||
console.log("📦 bundling & minifying...") | ||
|
||
esbuild.buildSync({ | ||
entryPoints: ["src/index.ts"], | ||
outfile, | ||
bundle: true, | ||
minify: true, | ||
sourcemap: true, | ||
platform: "browser", | ||
format: "iife", | ||
target: "es2020", | ||
globalName, | ||
banner: { | ||
js: umd.banner, | ||
}, | ||
footer: { | ||
js: umd.footer, | ||
}, | ||
}) | ||
|
||
console.log(`📝 Wrote ${outfile} and ${outfile}.map`) | ||
|
||
console.log("💎 compressing into .gz") | ||
|
||
const fileContents = fs.createReadStream(outfile) | ||
const writeStream = fs.createWriteStream(outfileGz) | ||
const gzip = zlib.createGzip() | ||
|
||
fileContents.pipe(gzip).pipe(writeStream) | ||
|
||
console.log(`📝 Wrote ${outfileGz}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.