-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathstencil-push.js
More file actions
executable file
·36 lines (35 loc) · 1.45 KB
/
stencil-push.js
File metadata and controls
executable file
·36 lines (35 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env node
import 'colors';
import { PACKAGE_INFO } from '../constants.js';
import program from '../lib/commander.js';
import stencilPush from '../lib/stencil-push.js';
import { prepareCommand, printCliResultErrorAndExit } from '../lib/cliCommon.js';
program
.version(PACKAGE_INFO.version)
.option('-f, --file [filename]', 'specify the filename of the bundle to upload')
.option('-s, --save [filename]', 'specify the filename to save the bundle as')
.option('-S, --source-maps', 'Include source-maps in the bundle. This is useful for debugging')
.option('-a, --activate [variationname]', 'specify the variation of the theme to activate')
.option('-d, --delete', 'delete oldest private theme if upload limit reached')
.option(
'-c, --channel_ids <channelIds...>',
'specify the channel IDs of the storefront to push the theme to',
)
.option('-allc, --all_channels', 'push a theme to all available channels');
const cliOptions = prepareCommand(program);
const options = {
apiHost: cliOptions.host,
channelIds: cliOptions.channel_ids,
bundleZipPath: cliOptions.file,
activate: cliOptions.activate,
saveBundleName: cliOptions.save,
deleteOldest: cliOptions.delete,
allChannels: cliOptions.all_channels,
sourceMaps: cliOptions.source_maps,
};
stencilPush(options, (err, result) => {
if (err) {
printCliResultErrorAndExit(err);
}
console.log(`${'ok'.green} -- ${result}`);
});