From 03c8026470c45de007716fcb226185f1ca0e0e19 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Wed, 8 Dec 2021 14:28:38 +0530 Subject: [PATCH] prep for release --- README.md | 4 +--- package.json | 33 ++++++++++++++++++++++++++------- tsconfig.json | 24 ++++++------------------ webpack.config.js | 31 ++++++++++++------------------- 4 files changed, 45 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 8444fa7..b57b7b8 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,7 @@ To generate proof-of-work, per mCaptcha specification: ```typescript -import {generate_proof} from "@mcaptcha/pow_sha256-polyfill"; /* yet to -be published in npm */ - +import {generate_proof} from "@mcaptcha/pow_sha256-polyfill"; let salt = "randomsaltvalueprovidedbymcaptcha"; let phrase = "randomphrasevalueprovidedbymcaptcha"; diff --git a/package.json b/package.json index 1d8fc43..b1b51eb 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,13 @@ { "author": "Aravinth Manivannan ", - "name": "pow_sha256-polyfill", + "name": "@mcaptcha/pow_sha256-polyfill", + "version": "0.1.0-alpha-1", "license": "(MIT OR Apache-2.0)", - "keywords": [ - "mCaptcha", - "CAPTCHA", - "proof of work" - ], + "keywords": ["mCaptcha", "CAPTCHA", "proof of work"], + "browser": "dist/index.js", + "types": "dist/index.d.ts", + "files": ["dist"], + "homepage": "https://mcaptcha.org", "bugs": { "url": "https://github.com/mCaptcha/pow_sha256-polyfill/issues", @@ -16,7 +17,25 @@ "type": "git", "url": "https://github.com/mCaptcha/pow_sha256-polyfill.git" }, - "version": "0.1.0", + "funding": [ + { + "type": "individual", + "url": "http://mcaptcha.org/donate" + }, + { + "type": "liberapay", + "url": "https://liberapay.com/mcaptcha" + }, + { + "type": "individual", + "url": "http://batsense.net/donate" + }, + { + "type": "liberapay", + "url": "https://liberapay.com/realaravinth" + } + ], + "scripts": { "build": "webpack --mode production", "doc": "yarn typedoc src/index.ts", diff --git a/tsconfig.json b/tsconfig.json index 9c6294a..23484db 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,30 +2,18 @@ "compilerOptions": { "incremental": true, "target": "es2020", - "module": "es2020", + "lib": ["es2015", "dom"], + "module": "commonjs", "allowJs": false, "sourceMap": true, - "outDir": "./dist/bundle", + "declaration": true, + "outDir": "./dist/", "rootDir": "./src/", "removeComments": true, "moduleResolution": "node", - //"strict": true, + "strict": true, "noImplicitAny": true, - //"strictNullChecks": true, - //"strictFunctionTypes": true, - //"strictBindCallApply": true, - //"strictPropertyInitialization": true, - //"noImplicitThis": true, - //"alwaysStrict": true, - - //"noUnusedLocals": true, - //"noUnusedParameters": true, - //"noImplicitReturns": true, - //"noFallthroughCasesInSwitch": true, - //"noUncheckedIndexedAccess": true, - //"noPropertyAccessFromIndexSignature": true, - "esModuleInterop": true, "skipLibCheck": true, @@ -37,8 +25,8 @@ "docs", "jest.config.ts", "**/*.test.ts", - "src/test-data.ts", "tmp", + "dist", "**/*setupTests" ], diff --git a/webpack.config.js b/webpack.config.js index ea19175..dfc8fd2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,43 +1,36 @@ -('use strict'); -const path = require('path'); +("use strict"); +const path = require("path"); -const dist = path.resolve(__dirname, 'dist'); +const dist = path.resolve(__dirname, "dist"); module.exports = { //devtool: 'inline-source-map', //mode: 'development', - mode: 'production', - entry: './src/index.ts', + mode: "production", + entry: "./src/", output: { path: dist, - filename: 'bundle.js', + libraryTarget: "umd", + filename: "index.js", + library: "pow256-polyfill", }, module: { rules: [ { - test: /\.tsx?$/, - loader: 'ts-loader', + test: /\.ts$/, + loader: "ts-loader", }, ], }, resolve: { - extensions: ['.ts', '.tsx', '.js'], + extensions: [".ts", ".tsx", ".js"], }, plugins: [], optimization: { minimizer: [ // For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line - `...`, + "...", ], }, - experiments: { - // executeModule: true, - // outputModule: true, - //syncWebAssembly: true, - // topLevelAwait: true, - //asyncWebAssembly: true, - // layers: true, - // lazyCompilation: true, - }, };