@webqit/webflo 0.11.44 → 0.11.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "0.11.44",
15
+ "version": "0.11.46",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -8,7 +8,7 @@ import SimpleGit from 'simple-git';
8
8
  import { spawn } from 'child_process';
9
9
  import { _any } from '@webqit/util/arr/index.js';
10
10
  import { _beforeLast } from '@webqit/util/str/index.js';
11
- import { _isObject } from '@webqit/util/js/index.js';
11
+ import { _isObject, _isNumeric } from '@webqit/util/js/index.js';
12
12
  import Webhooks from '@octokit/webhooks';
13
13
 
14
14
  /**
@@ -97,7 +97,7 @@ export async function deploy(origin) {
97
97
  cx.logger.success(cx.logger.f`[${cx.logger.style.comment(_date)}][AUTODEPLOY] On-deploy script: ${origin.ondeploy}!`);
98
98
  cx.logger.log('');
99
99
  }
100
- if (origin.ondeploy) {
100
+ if ((origin.ondeploy || '').trim()) {
101
101
  const run = cmd => new Promise((resolve, reject) => {
102
102
  cmd = cmd.split(' ').map(a => a.trim()).filter(a => a);
103
103
  const child = spawn(cmd.shift(), cmd, {
@@ -190,19 +190,24 @@ export async function webhook(httpEvent, router, next) {
190
190
  cx.logger.log('');
191
191
  cx.logger.log('---------------------------');
192
192
  }
193
- if (exitCode === 0) {
193
+ if (deployParams.ondeploy_autoexit) {
194
194
  if (cx.logger) {
195
195
  cx.logger.log('');
196
196
  var _date = (new Date).toUTCString();
197
- cx.logger.success(cx.logger.f`[${cx.logger.style.comment(_date)}][AUTODEPLOY] Auto-exit: ${true}; exiting...`);
197
+ cx.logger.success(cx.logger.f`[${cx.logger.style.comment(_date)}][AUTODEPLOY] Exiting (${exitCode})...`);
198
198
  cx.logger.log('');
199
199
  }
200
- if (deployParams.ondeploy_autoexit) {
201
- process.exit();
200
+ if (_isNumeric(deployParams.ondeploy_autoexit)) {
201
+ setTimeout(() => {
202
+ process.exit(exitCode);
203
+ }, parseInt(deployParams.ondeploy_autoexit));
204
+
205
+ } else {
206
+ process.exit(exitCode);
202
207
  }
203
208
  }
204
209
  resolve(
205
- new httpEvent.Response(null, { status: exitCode === 0 ? 200 : 500 })
210
+ new httpEvent.Response(undefined, { status: exitCode === 0 ? 200 : 500 })
206
211
  );
207
212
  });
208
213
  webhookEventHandler.receive({