Skip to content

Commit

Permalink
ability to locally save bundled theme after push
Browse files Browse the repository at this point in the history
  • Loading branch information
willym1 committed Mar 29, 2018
1 parent 3246da5 commit f9610d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion bin/stencil-push
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Program
.version(pkg.version)
.option('--host [hostname]', 'specify the api host', apiHost)
.option('-f, --file [filename]', 'specify the filename of the bundle to upload')
.option('-s, --save [filename]', 'specify the filename to save the bundle as')
.parse(process.argv);

if (!versionCheck()) {
Expand All @@ -21,7 +22,8 @@ if (!versionCheck()) {

stencilPush(Object.assign({}, options, {
apiHost: Program.host || apiHost,
bundleZipPath: Program.file
bundleZipPath: Program.file,
saveBundleName: Program.save
}), (err, result) => {
if (err) {
console.log('not ok'.red + ` -- ${err}`);
Expand Down
16 changes: 12 additions & 4 deletions lib/stencil-push.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,23 @@ utils.getThemes = (options, callback) => {

utils.generateBundle = (options, callback) => {
let bundle;
let output = {
dest: os.tmpdir(),
name: uuid(),
};

if (options.bundleZipPath) {
return async.nextTick(callback.bind(null, null, options));
}

bundle = new Bundle(themePath, themeConfig, themeConfig.getRawConfig(), {
dest: os.tmpdir(),
name: uuid(),
});
if (options.saveBundleName) {
output = {
dest: themePath,
name: options.saveBundleName
};
}

bundle = new Bundle(themePath, themeConfig, themeConfig.getRawConfig(), output);

bundle.initBundle((err, bundleZipPath) => {
if (err) {
Expand Down

0 comments on commit f9610d0

Please sign in to comment.