Skip to content

Commit 6d94101

Browse files
stefanbuckjosephfrazier
authored andcommitted
Use npm script to build and pack extension (OctoLinker#107)
* Use npm script to build and pack extension * Fix archive creation * Do not copy manifest file The manifest is already copied by the npm script task `chrome-manifest`
1 parent ea30b42 commit 6d94101

File tree

6 files changed

+18
-66
lines changed

6 files changed

+18
-66
lines changed

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@ node_modules
22
npm-debug.log
33

44
dist/
5-
6-
chrome/*
7-
!chrome/manifest.json
8-
9-
firefox/*
10-
!firefox/manifest.json
5+
out/
File renamed without changes.

chrome/manifest.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

package.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@
1111
"pretest": "npm run lint",
1212
"test": "karma start",
1313
"test:watch": "karma start --no-single-run --auto-watch",
14-
"build": "webpack",
15-
"build:watch": "webpack --watch",
16-
"build-chrome": "webpack --output-path chrome",
17-
"build-firefox": "webpack --output-path firefox",
18-
"open-firefox": "web-ext run --source-dir firefox",
19-
"dist-chrome": "webpack -p --config webpack.dist.config.js --dist=chrome",
20-
"dist-firefox": "webpack -p --config webpack.dist.config.js --dist=firefox",
21-
"dist-all": "npm run dist-chrome && npm run dist-firefox"
14+
"chrome-manifest": "mkdir -p dist && json -e 'delete this.applications; this.permissions.shift()' < assets/manifest.json > dist/manifest.json",
15+
"chrome-build": "npm run chrome-manifest && webpack",
16+
"chrome-dist": "npm run chrome-build -- -p",
17+
"chrome-watch": "npm run chrome-manifest && webpack --watch",
18+
"chrome-pack": "npm run chrome-dist && mkdir -p out && zip -rj out/chrome-octolinker-$npm_package_version.zip dist",
19+
"firefox-manifest": "mkdir -p dist && cp assets/manifest.json dist/manifest.json",
20+
"firefox-build": "npm run firefox-manifest && webpack",
21+
"firefox-dist": "npm run firefox-build -- -p",
22+
"firefox-watch": "npm run firefox-manifest && webpack --watch",
23+
"firefox-pack": "npm run firefox-dist && mkdir -p out && zip -rj out/firefox-octolinker-$npm_package_version.zip dist/",
24+
"firefox-open": "npm run firefox-build && web-ext run --source-dir dist",
25+
"pack-repo": "mkdir -p out && zip -r out/octolinker-repository-$npm_package_version.zip * --exclude dist/\\* out/\\* node_modules/\\*"
2226
},
2327
"dependencies": {
2428
"JSONPath": "^0.11.2",
@@ -41,6 +45,7 @@
4145
"copy-webpack-plugin": "^3.0.1",
4246
"eslint": "^1.10.3",
4347
"eslint-config-airbnb": "2.1.1",
48+
"json": "^9.0.4",
4449
"json-loader": "^0.5.4",
4550
"karma-fixture": "^0.2.5",
4651
"karma-html2js-preprocessor": "^0.1.0",

webpack.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ module.exports = {
77
},
88
devtool: 'source-map',
99
output: {
10-
path: 'chrome',
10+
path: 'dist',
1111
filename: '[name].js',
1212
},
1313
plugins: [
1414
new CopyWebpackPlugin([
1515
{ from: 'assets' },
16-
]),
16+
], {
17+
ignore: ['manifest.json'],
18+
}),
1719
],
1820
module: {
1921
loaders: [

webpack.dist.config.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)