-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add archiver and improve design
- Loading branch information
Showing
6 changed files
with
32 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
const path = require('path'); | ||
const ncp = require('ncp').ncp; | ||
const source = path.resolve(__dirname, '../../build/firefox/static'); | ||
const destination = path.resolve(__dirname, '../../build/chrome/static'); | ||
const buildPatch = path.resolve(__dirname, '../../build/') | ||
const firefoxStatic = buildPatch + '/firefox/static'; | ||
const chromeStatic = buildPatch + '/chrome/static'; | ||
const file_system = require('fs'); | ||
const archiver = require('archiver'); | ||
const manifest = require(buildPatch + '/firefox/manifest.json'); | ||
|
||
console.log('Copying builded files to Chrome extension directory...'); | ||
ncp(source, destination, function (err) { | ||
ncp(firefoxStatic, chromeStatic, function (err) { | ||
if (err) { | ||
return console.error(err); | ||
} else { | ||
console.log('done!'); | ||
} | ||
}); | ||
|
||
}); | ||
|
||
console.log('Creating zip packages...'); | ||
const extVersion = manifest['version']; | ||
const browsers = ['firefox', 'chrome']; | ||
browsers.forEach( browser => { | ||
const output = file_system.createWriteStream(`${buildPatch}/hohser-${extVersion}_${browser}.zip`); | ||
const archive = archiver('zip', {zlib: { level: 9 } }); | ||
archive.pipe(output); | ||
archive.directory(`${buildPatch}/${browser}`, false); | ||
archive.finalize(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters