mirror of
https://github.com/chylex/Firefox-SCsCC.git
synced 2025-05-12 09:34:04 +02:00
add scripts
This commit is contained in:
parent
baf5c6c8a0
commit
85d7bae776
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
build
|
||||
dist
|
||||
node_modules
|
||||
|
11
package.json
11
package.json
@ -7,10 +7,15 @@
|
||||
"license": "GPL-2.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "webpack --watch",
|
||||
"build": "webpack"
|
||||
"clean": "rimraf dist",
|
||||
"watch": "webpack --watch",
|
||||
"pack": "webpack",
|
||||
"archive": "node scripts/archive",
|
||||
"start": "run-s clean watch",
|
||||
"build": "run-s clean pack archive"
|
||||
},
|
||||
"devDependencies": {
|
||||
"archiver": "^1.3.0",
|
||||
"babel-core": "^6.24.0",
|
||||
"babel-loader": "^6.4.1",
|
||||
"babel-preset-env": "^1.2.2",
|
||||
@ -19,6 +24,8 @@
|
||||
"eslint-config-airbnb-base": "^11.0.0",
|
||||
"eslint-plugin-import": "^2.2.0",
|
||||
"file-loader": "^0.10.1",
|
||||
"npm-run-all": "^4.0.2",
|
||||
"rimraf": "^2.6.1",
|
||||
"webpack": "^2.2.1"
|
||||
}
|
||||
}
|
||||
|
37
scripts/archive.js
Normal file
37
scripts/archive.js
Normal file
@ -0,0 +1,37 @@
|
||||
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}] */
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const archiver = require('archiver');
|
||||
const manifest = require('../dist/manifest.json');
|
||||
|
||||
const inPath = path.resolve(process.cwd(), 'dist');
|
||||
const outPath = path.resolve(process.cwd(), 'build');
|
||||
|
||||
const onError = (err) => {
|
||||
throw err;
|
||||
};
|
||||
|
||||
const createArchive = (err) => {
|
||||
if (err) onError(err);
|
||||
|
||||
const outFile = `scscc-v${manifest.version}.zip`;
|
||||
const output = fs.createWriteStream(path.join(outPath, outFile));
|
||||
const archive = archiver('zip', {
|
||||
zlib: { level: 9 },
|
||||
});
|
||||
|
||||
output.on('close', () => {
|
||||
console.log('DONE:', archive.pointer(), 'total bytes');
|
||||
});
|
||||
|
||||
archive.on('error', onError);
|
||||
|
||||
archive.pipe(output);
|
||||
|
||||
archive.glob('**/*', { cwd: inPath });
|
||||
|
||||
archive.finalize();
|
||||
};
|
||||
|
||||
fs.mkdir(outPath, createArchive);
|
Loading…
Reference in New Issue
Block a user