diff --git a/.gitignore b/.gitignore index 17c696d..ce91edd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ node_modules/ .vscode/ dist/ coverage/ + +.rpt2_cache diff --git a/package.json b/package.json index 671dcde..ea12fc2 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,18 @@ "name": "maybetyped", "version": "0.0.0", "description": "Well-typed functional Maybe monad", - "main": "dist/src/index", - "types": "dist/src/index.d.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "module": "dist/index.mjs", "scripts": { "commitmsg": "commitlint -e $GIT_PARAMS", "lint": "tslint --config tslint.json --project . --format stylish", "test": "jest", + "rollup/cjs": "rollup --format cjs --config rollup.config.js --file dist/index.js", + "rollup/esm": "rollup --format esm --config rollup.config.js --file dist/index.mjs", "tsc": "tsc", - "prepush": "npm run -s lint && npm test", - "release": "rm -rf dist && npm run tsc && npx semantic-release" + "prepush": "run-s lint test", + "release": "rm -rf dist && run-s rollup/cjs rollup/esm && npx semantic-release" }, "repository": { "type": "git", @@ -56,6 +59,9 @@ "commitlint": "^7.0.0", "husky": "^0.14.3", "jest": "^22.4.3", + "npm-run-all": "^4.1.3", + "rollup": "^0.62.0", + "rollup-plugin-typescript2": "^0.15.1", "ts-jest": "^23.0.0", "ts-node": "^7.0.0", "tslint": "^5.9.1", diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..d8b139c --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,11 @@ +import typescript from 'rollup-plugin-typescript2'; + +export default { + input: './src/index.ts', + + plugins: [ + typescript({ + tsconfig: "tsconfig.json" + }) + ] +} diff --git a/tsconfig.json b/tsconfig.json index 174984d..ed2fe7f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "strict": true, "noUnusedLocals": true, "moduleResolution": "node", - "module": "commonjs", + "module": "esnext", "target": "es5", "noImplicitAny": true, "noImplicitThis": true, @@ -19,8 +19,7 @@ ], }, "include": [ - "src/", - "tests" + "src/" ], "exclude": [ "node_modules"