Skip to content

Commit

Permalink
build: bundle all modules
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeysova committed Oct 21, 2020
1 parent 3363ff9 commit 74fbcdc
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 8 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
.LSOverride

# Icon must end with two \r
Icon
Icon

# Thumbnails
._*
Expand Down Expand Up @@ -178,3 +178,6 @@ $RECYCLE.BIN/
*.lnk

# End of https://www.gitignore.io/api/node,windows,linux,macos

patronum.cjs.js
patronum.cjs.js.map
34 changes: 34 additions & 0 deletions .scripts/rollup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const path = require('path');
const { rollup } = require('rollup');
const { babel } = require('@rollup/plugin-babel');
const { terser } = require('rollup-plugin-terser');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');

const plugins = [
nodeResolve({ extensions: ['.js'] }),
commonjs({ extensions: ['.js'] }),
terser({}),
];

async function main() {
const build = await rollup({
input: path.resolve(__dirname, '..', 'index.js'),
external: ['effector'],
plugins,
});

await build.write({
file: path.resolve(__dirname, '..', 'patronum.cjs.js'),
format: 'cjs',
freeze: false,
exports: 'named',
sourcemap: true,
externalLiveBindings: false,
});
}

main().catch((error) => {
console.error(error);
process.exit(-1);
});
5 changes: 4 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Security Policy

<!--
## Supported Versions
Expand All @@ -12,9 +13,11 @@ currently being supported with security updates.
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |
-->

## Reporting a Vulnerability

Create new issue with label `security then:
Create new issue with label `security` then:

- add your `yarn.lock` or `package-lock.json` files under the spoiler
- mark vulnerable dependencies if have
- add reproduction example with vulnerability
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "patronum",
"version": "0.110.0",
"description": "☄️ Effector utility library delivering modularity and convenience",
"main": "index.js",
"main": "patronum.cjs.js",
"types": "index.d.ts",
"scripts": {
"test": "yarn test:code && yarn test:types",
Expand All @@ -11,7 +11,7 @@
"commit": "git-cz",
"format": "prettier --write \"./src/**/**.{ts,tsx,js,jsx,json}\"",
"lint": "eslint ./",
"prepublishOnly": "node ./.scripts/build.js && prettier --write ./babel-preset-plugins.json"
"prepublishOnly": "node ./.scripts/build.js && node ./.scripts/rollup.js && prettier --write ./babel-preset-plugins.json"
},
"files": [
"*/*.d.ts",
Expand All @@ -21,7 +21,8 @@
"babel-preset-plugins.json",
"babel-preset.js",
"index.d.ts",
"index.js",
"patronum.cjs.js",
"patronum.cjs.js.map",
"library.js"
],
"repository": {
Expand All @@ -45,6 +46,9 @@
"@eslint-kit/eslint-config-node": "^2.0.0",
"@eslint-kit/eslint-config-prettier": "^2.0.0",
"@eslint-kit/eslint-config-typescript": "^3.1.1",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@types/jest": "^26.0.14",
"@typescript-eslint/parser": "^4.2.0",
"camel-case": "^4.1.1",
Expand All @@ -57,6 +61,8 @@
"jest": "^26.4.2",
"lint-staged": "^9.5.0",
"prettier": "^1.19.1",
"rollup": "^2.32.1",
"rollup-plugin-terser": "^7.0.2",
"tsd": "^0.13.1",
"typescript": "^4.0.3"
},
Expand Down
Loading

0 comments on commit 74fbcdc

Please sign in to comment.