@wpmoo/toolkit 0.9.4 → 0.9.6
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/dist/cli.js +393 -41
- package/dist/cockpit/command-registry.js +4 -0
- package/dist/cockpit/daily-prompts.js +29 -11
- package/dist/cockpit/menu.js +56 -13
- package/dist/cockpit/module-action-menu.js +40 -0
- package/dist/cockpit/module-browser.js +117 -0
- package/dist/daily-actions.js +40 -3
- package/dist/databases.js +46 -0
- package/dist/help.js +2 -2
- package/dist/menu-navigation.js +2 -2
- package/dist/module-actions.js +50 -1
- package/dist/prompts/index.js +65 -12
- package/dist/service-runtime-status.js +48 -0
- package/dist/templates.js +44 -5
- package/package.json +1 -1
package/dist/templates.js
CHANGED
|
@@ -279,6 +279,10 @@ const ANSI_DIM = '\u001B[2m';
|
|
|
279
279
|
const ANSI_INFO = '\u001B[38;2;139;166;190m';
|
|
280
280
|
const ANSI_TAGLINE = '\u001B[38;2;120;157;181m';
|
|
281
281
|
const ANSI_META = '\u001B[38;2;218;236;246m';
|
|
282
|
+
const ANSI_SUCCESS = '\u001B[32m';
|
|
283
|
+
const ANSI_ERROR = '\u001B[31m';
|
|
284
|
+
const ANSI_WARNING = '\u001B[33m';
|
|
285
|
+
const ANSI_DEFAULT_FOREGROUND = '\u001B[39m';
|
|
282
286
|
const ANSI_RESET = '\u001B[0m';
|
|
283
287
|
const BANNER_TAGLINE = 'Development, staging and production workflows for Odoo projects.';
|
|
284
288
|
function gradientColor(column, width) {
|
|
@@ -307,15 +311,50 @@ function renderDimInfo(value) {
|
|
|
307
311
|
function renderMetaInfo(value) {
|
|
308
312
|
return `${ANSI_META}${value}${ANSI_RESET}`;
|
|
309
313
|
}
|
|
314
|
+
function renderSuccessInfo(value) {
|
|
315
|
+
return `${ANSI_SUCCESS}${value}${ANSI_DEFAULT_FOREGROUND}`;
|
|
316
|
+
}
|
|
317
|
+
function renderErrorInfo(value) {
|
|
318
|
+
return `${ANSI_ERROR}${value}${ANSI_DEFAULT_FOREGROUND}`;
|
|
319
|
+
}
|
|
320
|
+
function renderWarningInfo(value) {
|
|
321
|
+
return `${ANSI_WARNING}${value}${ANSI_DEFAULT_FOREGROUND}`;
|
|
322
|
+
}
|
|
310
323
|
function renderTaglineInfo(value) {
|
|
311
324
|
return `${ANSI_TAGLINE}${value}${ANSI_RESET}`;
|
|
312
325
|
}
|
|
313
326
|
function renderBannerDetail(value) {
|
|
314
|
-
const match = /^(Environment|Last):(.*)$/u.exec(value);
|
|
327
|
+
const match = /^(Environment|Status|Last):(.*)$/u.exec(value);
|
|
315
328
|
if (!match) {
|
|
316
329
|
return renderDimInfo(value);
|
|
317
330
|
}
|
|
318
|
-
|
|
331
|
+
const label = match[1];
|
|
332
|
+
const detail = match[2] ?? '';
|
|
333
|
+
if (label === 'Status') {
|
|
334
|
+
const statusMatch = /^ (●) (.*)$/u.exec(detail);
|
|
335
|
+
if (statusMatch) {
|
|
336
|
+
const marker = statusMatch[1] ?? '';
|
|
337
|
+
const message = statusMatch[2] ?? '';
|
|
338
|
+
const renderMarker = message === 'Services running' ? renderSuccessInfo : renderWarningInfo;
|
|
339
|
+
return `${renderMetaInfo(`${label}:`)} ${renderMarker(marker)}${renderTaglineInfo(` ${message}`)}`;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (label === 'Last') {
|
|
343
|
+
const completedMatch = /^(.*?)( ✓ completed)$/u.exec(detail);
|
|
344
|
+
if (completedMatch) {
|
|
345
|
+
return `${renderMetaInfo(`${label}:`)}${renderDimInfo(completedMatch[1] ?? '')}${renderSuccessInfo(completedMatch[2] ?? '')}`;
|
|
346
|
+
}
|
|
347
|
+
const errorMatch = /^(.*?)( ✗ Error)(: .*)?$/u.exec(detail);
|
|
348
|
+
if (errorMatch) {
|
|
349
|
+
return [
|
|
350
|
+
renderMetaInfo(`${label}:`),
|
|
351
|
+
renderDimInfo(errorMatch[1] ?? ''),
|
|
352
|
+
renderErrorInfo(errorMatch[2] ?? ''),
|
|
353
|
+
renderTaglineInfo(errorMatch[3] ?? ''),
|
|
354
|
+
].join('');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return `${renderMetaInfo(`${label}:`)}${renderDimInfo(detail)}`;
|
|
319
358
|
}
|
|
320
359
|
export function renderBanner(details = [], options = {}) {
|
|
321
360
|
const title = `${applyBannerGradient('WPMoo Toolkit')}${options.version ? ` ${renderDimInfo(options.version)}` : ''}`;
|
|
@@ -392,7 +431,7 @@ usage() {
|
|
|
392
431
|
"psql") echo "Usage: ./moo psql [db]" ;;
|
|
393
432
|
"install") echo "Usage: ./moo install <module[,module]> [db]" ;;
|
|
394
433
|
"update") echo "Usage: ./moo update <module[,module]> [db]" ;;
|
|
395
|
-
"test") echo "Usage: ./moo test <module[,module]> [--db <db>] [--mode init|update] [--tags <tags>]" ;;
|
|
434
|
+
"test") echo "Usage: ./moo test <module[,module]> [--db <db>] [--mode auto|init|update] [--tags <tags>]" ;;
|
|
396
435
|
"resetdb") echo "Usage: ./moo resetdb [db] [module[,module]]" ;;
|
|
397
436
|
"snapshot") echo "Usage: ./moo snapshot [db] [snapshot-name]" ;;
|
|
398
437
|
"restore-snapshot") echo "Usage: ./moo restore-snapshot [--dry-run] <snapshot-name> [db]" ;;
|
|
@@ -467,8 +506,8 @@ validate_test_args() {
|
|
|
467
506
|
echo "Missing value for --mode" >&2
|
|
468
507
|
exit 2
|
|
469
508
|
fi
|
|
470
|
-
if [[ "$2" != "init" && "$2" != "update" ]]; then
|
|
471
|
-
echo "Invalid value for --mode: expected init or update" >&2
|
|
509
|
+
if [[ "$2" != "auto" && "$2" != "init" && "$2" != "update" ]]; then
|
|
510
|
+
echo "Invalid value for --mode: expected auto, init, or update" >&2
|
|
472
511
|
exit 2
|
|
473
512
|
fi
|
|
474
513
|
shift 2
|