yot-cdk-runner
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -8,6 +8,7 @@ try { | ||
function main() { | ||
const [command, name] = getArgv()._; | ||
const argv = getArgv(); | ||
const [command, name] = argv._; | ||
switch (command) { | ||
case "build": | ||
require("./lib/build")(name); | ||
require("./lib/build")(name, !!argv.watch, !!argv.compress); | ||
break; | ||
@@ -14,0 +15,0 @@ case "generate": |
@@ -5,5 +5,6 @@ const { | ||
moduleExists, | ||
zip, | ||
} = require("yot-cdk-core"); | ||
module.exports = function build(name, watch = false) { | ||
module.exports = function build(name, watch = false, compress = false) { | ||
if (!name) { | ||
@@ -14,2 +15,7 @@ logErrorMessage("Must provide a component name."); | ||
if (watch && compress) { | ||
logErrorMessage("Cannot use watch and compress options combined."); | ||
process.exit(); | ||
} | ||
const configSrv = new ConfigService(); | ||
@@ -46,2 +52,10 @@ if (!configSrv.hasComponent(name)) { | ||
if (compress) { | ||
child.once("close", () => { | ||
zip(buildConf.output, (filename) => { | ||
console.log(`Compressed output into file '${filename}'`); | ||
}); | ||
}); | ||
} | ||
const _exitAll = () => { | ||
@@ -48,0 +62,0 @@ child.kill("SIGINT"); |
{ | ||
"name": "yot-cdk-runner", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "", | ||
@@ -13,4 +13,4 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"yot-cdk-core": "^0.0.15" | ||
"yot-cdk-core": "^0.0.16" | ||
} | ||
} |
@@ -31,3 +31,3 @@ # Component Development Kit Runner | ||
| ARGUMENT | DESCRIPTION | VALUE TYPE | | ||
| Argument | Description | Value type | | ||
| ------------------ | ----------------------------------- | ---------- | | ||
@@ -38,5 +38,6 @@ | `<component-name>` | The name of the component to build. | `string` | | ||
| OPTION | DESCRIPTION | VALUE TYPE | DEFAULT | | ||
| ------- | -------------------------------------------- | ---------- | ------- | | ||
| `--zip` | Compresses the build output into a zip-file. | `boolean` | `false` | | ||
| Option | Description | Value type | Default | | ||
| ------------ | -------------------------------------- | ---------- | ------- | | ||
| `--compress` | Compress build output into a zip-file. | `boolean` | `false` | | ||
| `--watch` | Run build when files change. | `boolean` | `false` | | ||
@@ -55,4 +56,4 @@ --- | ||
| ARGUMENT | DESCRIPTION | VALUE TYPE | | ||
| Argument | Description | Value type | | ||
| ------------------ | ----------------------------------- | ---------- | | ||
| `<component-name>` | The name of the component to build. | `string` | |
5975
146
57