Skip to content

Commit

Permalink
move bundles to dist folder and make minification optional
Browse files Browse the repository at this point in the history
  • Loading branch information
remusao committed Jun 20, 2019
1 parent 8262aec commit 11f5efe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
node_modules/
background.bundle.js
background.bundle.js.map
content-script.bundle.js
content-script.bundle.js.map
dist/
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
},
"permissions": [ "http://*/*", "https://*/*","tabs", "activeTab", "webRequest", "webRequestBlocking","unlimitedStorage", "webNavigation", "<all_urls>"],
"background": {
"scripts": ["background.bundle.js"]
"scripts": ["./dist/background.bundle.js"]
},
"content_scripts": [{
"matches" : ["http://*/*", "https://*/*"],
"match_about_blank": true,
"js": ["content-script.bundle.js"],
"js": ["./dist/content-script.bundle.js"],
"all_frames": true,
"run_at": "document_end"
}],
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
"description": "Local sheriff is a reconnaissance tool in your browser for your data.",
"main": "background.js",
"scripts": {
"build": "rollup --config rollup.config.js",
"clean": "rm -frv dist",
"build": "rollup --config rollup.config.js --environment BUILD:production",
"prestart": "npm run clean",
"watch": "rollup --config rollup.config.js --watch",
"prestart": "npm run clean",
"lint": "web-ext lint",
"start": "concurrently 'npm run watch' 'web-ext run --source-dir . --firefox /usr/bin/firefox'"
"start": "concurrently 'npm run watch' 'web-ext run --source-dir . --firefox /usr/bin/firefox'",
"prestart": "npm run clean"
},
"repository": {
"type": "git",
Expand Down
11 changes: 8 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@ import resolve from 'rollup-plugin-node-resolve';
import json from 'rollup-plugin-json';
import compiler from '@ampproject/rollup-plugin-closure-compiler';

const mode = process.env.BUILD === 'production' ? 'production' : 'development';

const plugins = [
json(),
resolve({
preferBuiltins: false,
}),
commonjs(),
compiler(),
];

if (mode === 'production') {
plugins.push(compiler());
}

export default [
{
input: './background.js',
output: {
file: 'background.bundle.js',
file: './dist/background.bundle.js',
format: 'iife',
name: 'localSheriff',
sourcemap: true,
Expand All @@ -26,7 +31,7 @@ export default [
{
input: './scripts/content-script.js',
output: {
file: 'content-script.bundle.js',
file: './dist/content-script.bundle.js',
format: 'iife',
name: 'localSheriff',
sourcemap: true,
Expand Down

0 comments on commit 11f5efe

Please sign in to comment.