-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from adambullmer/prod-build-keys
Prod build keys Fixed #4
- Loading branch information
Showing
7 changed files
with
220 additions
and
32 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs') | ||
const path = require('path') | ||
const zipFolder = require('zip-folder') | ||
|
||
const appRootPath = process.cwd() | ||
const DEST_DIR = process.argv[2] | ||
const DEST_ZIP_DIR = path.join(appRootPath, `${DEST_DIR}-zip`) | ||
const { name, version } = require(path.join(appRootPath, 'package.json')) | ||
|
||
const makeDestZipDirIfNotExists = () => { | ||
if (!fs.existsSync(DEST_ZIP_DIR)) { | ||
fs.mkdirSync(DEST_ZIP_DIR) | ||
} | ||
} | ||
|
||
const buildZip = (src, dist, zipFilename) => { | ||
console.info(`Building ${zipFilename}...`) | ||
|
||
return new Promise((resolve, reject) => { | ||
zipFolder(src, path.join(dist, zipFilename), (err) => { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve() | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
const main = () => { | ||
const zipFilename = `${name}-v${version}.zip` | ||
|
||
makeDestZipDirIfNotExists() | ||
|
||
buildZip(DEST_DIR, DEST_ZIP_DIR, zipFilename) | ||
.then(() => console.info('OK')) | ||
.catch(console.err) | ||
} | ||
|
||
main() |
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
Oops, something went wrong.