-
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
13 changed files
with
1,046 additions
and
41 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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
composer.phar | ||
/vendor/ | ||
|
||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control | ||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file | ||
# composer.lock | ||
/node_modules/ | ||
.DS_Store |
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
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
Binary file not shown.
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,73 @@ | ||
const cmd = require('node-cmd'); | ||
const fs = require('fs-extra'); | ||
const co = require('co'); | ||
const archiver = require('archiver'); | ||
const pkg = fs.readJsonSync('./package.json'); | ||
|
||
/** | ||
* Run system command | ||
* | ||
* @param cmdString | ||
* @returns {Promise} | ||
*/ | ||
const systemCmd = cmdString => { | ||
return new Promise((resolve) => { | ||
cmd.get( | ||
cmdString, | ||
(data, err, stderr) => { | ||
console.log(cmdString); | ||
console.log(data); | ||
if (err) { | ||
console.log(err); | ||
} | ||
if (stderr) { | ||
console.log(stderr); | ||
} | ||
resolve(data); | ||
} | ||
); | ||
}); | ||
} | ||
|
||
const zipPromise = (src, dist) => { | ||
return new Promise((resolve, reject) => { | ||
const archive = archiver.create('zip', {}); | ||
const output = fs.createWriteStream(dist); | ||
|
||
// listen for all archive data to be written | ||
output.on('close', () => { | ||
console.log(archive.pointer() + ' total bytes'); | ||
console.log('Archiver has been finalized and the output file descriptor has closed.'); | ||
resolve(); | ||
}); | ||
|
||
// good practice to catch this error explicitly | ||
archive.on('error', (err) => { | ||
reject(err); | ||
}); | ||
|
||
archive.pipe(output); | ||
archive.directory(src).finalize(); | ||
}); | ||
} | ||
|
||
co(function* () { | ||
try { | ||
fs.mkdirsSync(`Base`); | ||
fs.mkdirsSync(`build`); | ||
fs.copySync(`./LICENSE`, `Base/LICENSE`); | ||
fs.copySync(`./README.md`, `Base/README.md`); | ||
fs.copySync(`./Api.php`, `Base/Api.php`); | ||
fs.copySync(`./ServiceProvider.php`, `Base/ServiceProvider.php`); | ||
fs.copySync(`./db`, `Base/db`); | ||
fs.copySync(`./GET`, `Base/GET`); | ||
fs.copySync(`./theme`, `Base/theme`); | ||
yield zipPromise(`Base`, `./build/the-base.zip`); | ||
fs.removeSync(`Base`); | ||
yield systemCmd('git add -A'); | ||
yield systemCmd(`git commit -m "v${pkg.version}"`); | ||
yield systemCmd('git push'); | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
}); |
Oops, something went wrong.