Skip to content

Commit

Permalink
add size dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sayan-rudder committed Mar 23, 2020
1 parent b367ddf commit 9ed810f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
"version": "1.1.0-beta.2",
"description": "",
"main": "./dist/browser.min.js",
"size-limit": [
{
"path": "dist/rudder-analytics.min.js",
"import": "{ createComponent }",
"brotli": true
}
],
"scripts": {
"test": "./scripts/run_tests.sh",
"buildDevBrowser": "NODE_ENV=false uglify=false rollup -c",
"buildProdBrowser": "NODE_ENV=false ENV=prod uglify=true rollup -c",
"buildProdBrowserGzip": "NODE_ENV=false ENV=prod ENC=gzip uglify=true rollup -c",
"buildProdBrowserBrotli": "NODE_ENV=false ENV=prod ENC=br uglify=true rollup -c",
"buildDevNode": "NODE_ENV=true uglify=false rollup -c",
"buildProdNode": "NODE_ENV=true ENV=prod uglify=true rollup -c",
"size-build": "npm run buildProdBrowser",
"size": "npm run size-build && size-limit",
"changelog": "auto-changelog -p -t keepachangelog -u true -l false --sort-commits date-desc "
},
"author": "",
Expand Down Expand Up @@ -41,6 +52,7 @@
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/preset-env": "^7.6.2",
"@size-limit/preset-big-lib": "^4.4.1",
"eslint": "^6.1.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.2.0",
Expand All @@ -51,8 +63,10 @@
"eslint-plugin-react-hooks": "^1.7.0",
"rollup": "^1.22.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-brotli": "^2.0.2",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-gzip": "^2.3.0",
"rollup-plugin-javascript-obfuscator": "^1.0.4",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-builtins": "^2.1.2",
Expand All @@ -61,6 +75,7 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-strip": "^1.2.2",
"rollup-plugin-terser": "^5.1.2",
"rollup-plugin-uglify": "^6.0.3"
"rollup-plugin-uglify": "^6.0.3",
"size-limit": "^4.4.1"
}
}
30 changes: 9 additions & 21 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { terser } from "rollup-plugin-terser";
import builtins from "rollup-plugin-node-builtins";
import globals from "rollup-plugin-node-globals";
import json from "rollup-plugin-json";
import obfuscatorPlugin from "rollup-plugin-javascript-obfuscator";
import gzipPlugin from "rollup-plugin-gzip";
import brotli from "rollup-plugin-brotli";
import { version } from "./package.json";
export default {
input: "analytics.js",
Expand All @@ -15,7 +16,11 @@ export default {
{
file:
process.env.ENV == "prod"
? "dist/rudder-analytics.min.js"
? process.env.ENC == "gzip"
? "dist/rudder-analytics.min.gzip.js"
: process.env.ENC == "br"
? "dist/rudder-analytics.min.br.js"
: "dist/rudder-analytics.min.js"
: "dist/browser.js",
format: "iife",
name: "rudderanalytics",
Expand Down Expand Up @@ -56,24 +61,7 @@ export default {
exclude: "node_modules/**"
}),
process.env.uglify === "true" && terser(),
process.env.ENV == "prod" &&
obfuscatorPlugin({
compact: true,
controlFlowFlattening: true,
deadCodeInjection: false,
debugProtection: false,
disableConsoleOutput: false,
identifierNamesGenerator: "mangled",
log: false,
renameGlobals: false,
rotateStringArray: true,
selfDefending: false,
sourceMap: false,
stringArray: false,
stringArrayEncoding: false,
transformObjectKeys: false,
unicodeEscapeSequence: false
})
//process.env.uglify === "true" && uglify()
process.env.ENC === "gzip" && gzipPlugin(),
process.env.ENC === "br" && brotli()
]
};

0 comments on commit 9ed810f

Please sign in to comment.