forked from qls0ulp/heybuddy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
594 additions
and
547 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const fs = require('fs-extra'); | ||
const child_process = require('child_process'); | ||
const archiver = require('archiver'); | ||
|
||
const PLATFORMS = ['chrome']; | ||
const GIT_URL = 'https://github.com/bewisse/heybuddy'; | ||
|
||
function zipDirectory(source, destFile) { | ||
const output = fs.createWriteStream(destFile); | ||
const archive = archiver('zip'); | ||
|
||
output.on('close', () => { | ||
console.log(archive.pointer() + ' total bytes'); | ||
console.log(`Finished creating ${destFile}`); | ||
}); | ||
|
||
archive.on('error', (err) => { | ||
throw err; | ||
}); | ||
archive.pipe(output); | ||
archive.directory(source, false); | ||
archive.finalize(); | ||
} | ||
|
||
fs.ensureDirSync('dist'); | ||
fs.emptyDirSync('dist'); | ||
for (const platform of PLATFORMS) { | ||
fs.emptyDirSync('build'); | ||
child_process.execSync(`npm run build-${platform}`); | ||
fs.copySync('build', `dist/${platform}/`); | ||
zipDirectory('build', `dist/${platform}.zip`); | ||
} | ||
|
||
child_process.execSync(`git clone ${GIT_URL} dist/master`); | ||
fs.emptyDirSync('dist/master/.git'); | ||
zipDirectory('dist/master', 'dist/master.zip'); |
Oops, something went wrong.