yakuza0 2.22.13 → 2.22.14-beta.0

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.
Files changed (2) hide show
  1. package/cli/index.js +146 -110
  2. package/package.json +5 -3
package/cli/index.js CHANGED
@@ -62,7 +62,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
62
62
  process.env.YK_USAGE = 'CLI';
63
63
 
64
64
  var _require = require('child_process'),
65
- spawnSync = _require.spawnSync,
65
+ execSync = _require.execSync,
66
66
  spawn = _require.spawn;
67
67
  // const util = require('util');
68
68
  // const spawn = util.promisify(require('child_process').spawn);
@@ -193,11 +193,15 @@ var alias = function alias() {
193
193
  _server.global.__cln_appName__ = options.appName;
194
194
  };
195
195
 
196
+ var execCmd = function execCmd(cmd) {
197
+ execSync(cmd, { shell: true, stdio: 'inherit' });
198
+ };
199
+
196
200
  var run = exports.run = function () {
197
- var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(_argv) {
198
- return _regenerator2.default.wrap(function _callee14$(_context14) {
201
+ var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee15(_argv) {
202
+ return _regenerator2.default.wrap(function _callee15$(_context15) {
199
203
  while (1) {
200
- switch (_context14.prev = _context14.next) {
204
+ switch (_context15.prev = _context15.next) {
201
205
  case 0:
202
206
  _commander2.default.version(_package2.default.version, '-v, --version');
203
207
 
@@ -306,18 +310,50 @@ var run = exports.run = function () {
306
310
  };
307
311
  }());
308
312
 
313
+ _commander2.default.command('image').description('Build image.')
314
+ // .option('-y0ba, --yk0-build-app <appName>', 'Building a specified application')
315
+ .action(function () {
316
+ var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(cmd) {
317
+ var CS, CLNENV, CLNWORKERS, CLNVERSION;
318
+ return _regenerator2.default.wrap(function _callee5$(_context5) {
319
+ while (1) {
320
+ switch (_context5.prev = _context5.next) {
321
+ case 0:
322
+ CS = (0, _server.gPwd)();
323
+ CLNENV = process.env.CLN_IMAGE_ENV || 'docker';
324
+ CLNWORKERS = process.env.CLN_IMAGE_WORKERS || '2';
325
+ CLNVERSION = process.env.CLN_IMAGE_VERSION || CS;
326
+
327
+ execCmd('npm i -g pxnpm');
328
+ // execCmd('pxnpm update');
329
+ execCmd('cross-env YK_ENV=' + CLNENV + ' YK_SERVER_ENV=' + CLNENV + ' YK_VERSIONSHA=' + CS + ' YK_DOCKERNAME=' + CS + ' YK_MACHINE_TYPE=workstation YK0_env=docker pxnpm run build -workers=' + CLNWORKERS);
330
+ execCmd('cross-env docker build --build-arg YK_VERSIONSHA=' + CS + ' --build-arg YK_ENV=' + CLNENV + ' -t cln_img:' + CLNVERSION + ' .');
331
+
332
+ case 7:
333
+ case 'end':
334
+ return _context5.stop();
335
+ }
336
+ }
337
+ }, _callee5, undefined);
338
+ }));
339
+
340
+ return function (_x7) {
341
+ return _ref9.apply(this, arguments);
342
+ };
343
+ }());
344
+
309
345
  _commander2.default.command('build').description('build a model').option('-y0ba, --yk0-build-app <appName>', 'Building a specified application').option('-e, --env <envName>', 'yk server env')
310
346
  // .action(async ({app}) => {
311
347
  .action(function () {
312
- var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(_ref9) {
313
- var yk0BuildApp = _ref9.yk0BuildApp,
314
- env = _ref9.env;
348
+ var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(_ref10) {
349
+ var yk0BuildApp = _ref10.yk0BuildApp,
350
+ env = _ref10.env;
315
351
 
316
- var _ref11, apps, workers, cpuLen, i, run;
352
+ var _ref12, apps, workers, cpuLen, i, run;
317
353
 
318
- return _regenerator2.default.wrap(function _callee6$(_context6) {
354
+ return _regenerator2.default.wrap(function _callee7$(_context7) {
319
355
  while (1) {
320
- switch (_context6.prev = _context6.next) {
356
+ switch (_context7.prev = _context7.next) {
321
357
  case 0:
322
358
  // process.env.NODE_ENV = 'production';
323
359
  // process.env.NODE_CMD = 'build';
@@ -327,12 +363,12 @@ var run = exports.run = function () {
327
363
  _consola2.default.log('In the preparation...');
328
364
  process.env.NODE_ENV = 'production';
329
365
  process.env.NODE_CMD = 'build';
330
- _context6.next = 5;
366
+ _context7.next = 5;
331
367
  return gi({ app: yk0BuildApp, ykServerEnv: env });
332
368
 
333
369
  case 5:
334
- _ref11 = _context6.sent;
335
- apps = _ref11.apps;
370
+ _ref12 = _context7.sent;
371
+ apps = _ref12.apps;
336
372
  workers = process.env.npm_config_workers;
337
373
  cpuLen = _os2.default.cpus().length;
338
374
 
@@ -355,10 +391,10 @@ var run = exports.run = function () {
355
391
  };
356
392
 
357
393
  _server._.asyncMap(apps, function () {
358
- var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(key, j) {
359
- return _regenerator2.default.wrap(function _callee5$(_context5) {
394
+ var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(key, j) {
395
+ return _regenerator2.default.wrap(function _callee6$(_context6) {
360
396
  while (1) {
361
- switch (_context5.prev = _context5.next) {
397
+ switch (_context6.prev = _context6.next) {
362
398
  case 0:
363
399
  if (j < cpuLen) {
364
400
  i = j;
@@ -367,27 +403,27 @@ var run = exports.run = function () {
367
403
 
368
404
  case 1:
369
405
  case 'end':
370
- return _context5.stop();
406
+ return _context6.stop();
371
407
  }
372
408
  }
373
- }, _callee5, undefined);
409
+ }, _callee6, undefined);
374
410
  }));
375
411
 
376
- return function (_x8, _x9) {
377
- return _ref12.apply(this, arguments);
412
+ return function (_x9, _x10) {
413
+ return _ref13.apply(this, arguments);
378
414
  };
379
415
  }());
380
416
 
381
417
  case 13:
382
418
  case 'end':
383
- return _context6.stop();
419
+ return _context7.stop();
384
420
  }
385
421
  }
386
- }, _callee6, undefined);
422
+ }, _callee7, undefined);
387
423
  }));
388
424
 
389
- return function (_x7) {
390
- return _ref10.apply(this, arguments);
425
+ return function (_x8) {
426
+ return _ref11.apply(this, arguments);
391
427
  };
392
428
  }());
393
429
 
@@ -395,131 +431,131 @@ var run = exports.run = function () {
395
431
  // .option('-y0ba, --yk0-build-app <appName>', 'Building a specified application')
396
432
  // .action(async ({app}) => {
397
433
  .action(function () {
398
- var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(cmd) {
399
- return _regenerator2.default.wrap(function _callee7$(_context7) {
434
+ var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(cmd) {
435
+ return _regenerator2.default.wrap(function _callee8$(_context8) {
400
436
  while (1) {
401
- switch (_context7.prev = _context7.next) {
437
+ switch (_context8.prev = _context8.next) {
402
438
  case 0:
403
439
  process.env.NODE_ENV = 'production';
404
440
  process.env.NODE_CMD = 'build';
405
441
  // console.log(app);
406
442
  // gi({app: yk0BuildApp});
407
443
  alias({ appName: cmd });
408
- _context7.next = 5;
444
+ _context8.next = 5;
409
445
  return require(params.serverPath)('build', cmd);
410
446
 
411
447
  case 5:
412
448
  case 'end':
413
- return _context7.stop();
449
+ return _context8.stop();
414
450
  }
415
451
  }
416
- }, _callee7, undefined);
452
+ }, _callee8, undefined);
417
453
  }));
418
454
 
419
- return function (_x10) {
420
- return _ref13.apply(this, arguments);
455
+ return function (_x11) {
456
+ return _ref14.apply(this, arguments);
421
457
  };
422
458
  }());
423
459
 
424
- _commander2.default.command('generate').alias('g').description('generate a model').action((0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8() {
425
- return _regenerator2.default.wrap(function _callee8$(_context8) {
460
+ _commander2.default.command('generate').alias('g').description('generate a model').action((0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9() {
461
+ return _regenerator2.default.wrap(function _callee9$(_context9) {
426
462
  while (1) {
427
- switch (_context8.prev = _context8.next) {
463
+ switch (_context9.prev = _context9.next) {
428
464
  case 0:
429
465
  process.env.NODE_ENV = 'production';
430
- _context8.next = 3;
466
+ _context9.next = 3;
431
467
  return gi();
432
468
 
433
469
  case 3:
434
- _context8.prev = 3;
435
- _context8.next = 6;
470
+ _context9.prev = 3;
471
+ _context9.next = 6;
436
472
  return nuxtCli.run(['generate']);
437
473
 
438
474
  case 6:
439
- _context8.next = 12;
475
+ _context9.next = 12;
440
476
  break;
441
477
 
442
478
  case 8:
443
- _context8.prev = 8;
444
- _context8.t0 = _context8['catch'](3);
479
+ _context9.prev = 8;
480
+ _context9.t0 = _context9['catch'](3);
445
481
 
446
- _consola2.default.fatal(_context8.t0);
482
+ _consola2.default.fatal(_context9.t0);
447
483
  process.exit(2);
448
484
 
449
485
  case 12:
450
486
  case 'end':
451
- return _context8.stop();
487
+ return _context9.stop();
452
488
  }
453
489
  }
454
- }, _callee8, undefined, [[3, 8]]);
490
+ }, _callee9, undefined, [[3, 8]]);
455
491
  })));
456
492
 
457
- _commander2.default.command('clean').description('clean cache').action((0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9() {
458
- return _regenerator2.default.wrap(function _callee9$(_context9) {
493
+ _commander2.default.command('clean').description('clean cache').action((0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10() {
494
+ return _regenerator2.default.wrap(function _callee10$(_context10) {
459
495
  while (1) {
460
- switch (_context9.prev = _context9.next) {
496
+ switch (_context10.prev = _context10.next) {
461
497
  case 0:
462
498
  _rimraf2.default.sync(_paths2.default.hardSourceCache);
463
499
  _rimraf2.default.sync(_paths2.default.ykRootCacheDir);
464
500
 
465
501
  case 2:
466
502
  case 'end':
467
- return _context9.stop();
503
+ return _context10.stop();
468
504
  }
469
505
  }
470
- }, _callee9, undefined);
506
+ }, _callee10, undefined);
471
507
  })));
472
508
 
473
509
  _commander2.default.command('verify <cmd>').option('-ed, --edit <envName>', 'commit file').option('-m, --msg <msg>', 'commit msg').option('-y0ba, --yk0-build-app <appName>', 'Building a specified application').option('-e, --env <envName>', 'yk server env').description('husky').action(function () {
474
- var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(cmd, _ref16) {
475
- var edit = _ref16.edit,
476
- msg = _ref16.msg,
477
- yk0BuildApp = _ref16.yk0BuildApp,
478
- env = _ref16.env;
479
- return _regenerator2.default.wrap(function _callee10$(_context10) {
510
+ var _ref18 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(cmd, _ref17) {
511
+ var edit = _ref17.edit,
512
+ msg = _ref17.msg,
513
+ yk0BuildApp = _ref17.yk0BuildApp,
514
+ env = _ref17.env;
515
+ return _regenerator2.default.wrap(function _callee11$(_context11) {
480
516
  while (1) {
481
- switch (_context10.prev = _context10.next) {
517
+ switch (_context11.prev = _context11.next) {
482
518
  case 0:
483
519
  alias({ appName: "__common" });
484
520
 
485
521
  if (!(cmd !== "commit-init")) {
486
- _context10.next = 4;
522
+ _context11.next = 4;
487
523
  break;
488
524
  }
489
525
 
490
- _context10.next = 4;
526
+ _context11.next = 4;
491
527
  return gi({ app: yk0BuildApp, ykServerEnv: env, appsNoneExit: false });
492
528
 
493
529
  case 4:
494
- _context10.t0 = cmd;
495
- _context10.next = _context10.t0 === "commit-init" ? 7 : 8;
530
+ _context11.t0 = cmd;
531
+ _context11.next = _context11.t0 === "commit-init" ? 7 : 8;
496
532
  break;
497
533
 
498
534
  case 7:
499
- return _context10.abrupt('break', 14);
535
+ return _context11.abrupt('break', 14);
500
536
 
501
537
  case 8:
502
- _context10.next = 10;
538
+ _context11.next = 10;
503
539
  return (0, _verify.commitEsLint)({ edit: edit });
504
540
 
505
541
  case 10:
506
- _context10.next = 12;
542
+ _context11.next = 12;
507
543
  return (0, _verify.commitStyleLint)({ edit: edit });
508
544
 
509
545
  case 12:
510
- _context10.next = 14;
546
+ _context11.next = 14;
511
547
  return (0, _verify.commitMsg)({ edit: msg });
512
548
 
513
549
  case 14:
514
550
  case 'end':
515
- return _context10.stop();
551
+ return _context11.stop();
516
552
  }
517
553
  }
518
- }, _callee10, undefined);
554
+ }, _callee11, undefined);
519
555
  }));
520
556
 
521
- return function (_x11, _x12) {
522
- return _ref17.apply(this, arguments);
557
+ return function (_x12, _x13) {
558
+ return _ref18.apply(this, arguments);
523
559
  };
524
560
  }()
525
561
  // case "commit-eslint":
@@ -534,78 +570,78 @@ var run = exports.run = function () {
534
570
  );
535
571
 
536
572
  _commander2.default.command('server <cmd>').alias('s').option('-y0ba, --yk0-build-app <appName>', 'Building a specified application').option('-e, --env <envName>', 'yk server env').description('service control').action(function () {
537
- var _ref19 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(cmd, _ref18) {
538
- var yk0BuildApp = _ref18.yk0BuildApp,
539
- env = _ref18.env;
573
+ var _ref20 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(cmd, _ref19) {
574
+ var yk0BuildApp = _ref19.yk0BuildApp,
575
+ env = _ref19.env;
540
576
 
541
- var _ref20, apps;
577
+ var _ref21, apps;
542
578
 
543
- return _regenerator2.default.wrap(function _callee12$(_context12) {
579
+ return _regenerator2.default.wrap(function _callee13$(_context13) {
544
580
  while (1) {
545
- switch (_context12.prev = _context12.next) {
581
+ switch (_context13.prev = _context13.next) {
546
582
  case 0:
547
583
  if (!(_os2.default.platform() === 'win32')) {
548
- _context12.next = 3;
584
+ _context13.next = 3;
549
585
  break;
550
586
  }
551
587
 
552
588
  _consola2.default.error(_msg.errMsg['os.win32.cmd.server']);
553
- return _context12.abrupt('return');
589
+ return _context13.abrupt('return');
554
590
 
555
591
  case 3:
556
592
  process.env.NODE_ENV = 'production';
557
593
  process.env.NODE_CMD = 'server ' + cmd;
558
- _context12.next = 7;
594
+ _context13.next = 7;
559
595
  return gi({ app: yk0BuildApp, ykServerEnv: env });
560
596
 
561
597
  case 7:
562
- _ref20 = _context12.sent;
563
- apps = _ref20.apps;
598
+ _ref21 = _context13.sent;
599
+ apps = _ref21.apps;
564
600
 
565
601
  if (!['start', 'stop', 'restart', 'lite', 'container'].includes(cmd)) {
566
- _context12.next = 21;
602
+ _context13.next = 21;
567
603
  break;
568
604
  }
569
605
 
570
- _context12.t0 = cmd;
571
- _context12.next = _context12.t0 === 'lite' ? 13 : 17;
606
+ _context13.t0 = cmd;
607
+ _context13.next = _context13.t0 === 'lite' ? 13 : 17;
572
608
  break;
573
609
 
574
610
  case 13:
575
611
  alias({ appName: apps[0] });
576
- _context12.next = 16;
612
+ _context13.next = 16;
577
613
  return require(params.serverLite)(cmd);
578
614
 
579
615
  case 16:
580
- return _context12.abrupt('break', 19);
616
+ return _context13.abrupt('break', 19);
581
617
 
582
618
  case 17:
583
- _context12.next = 19;
619
+ _context13.next = 19;
584
620
  return _server._.asyncMap(apps, function () {
585
- var _ref21 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(key, j) {
586
- return _regenerator2.default.wrap(function _callee11$(_context11) {
621
+ var _ref22 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(key, j) {
622
+ return _regenerator2.default.wrap(function _callee12$(_context12) {
587
623
  while (1) {
588
- switch (_context11.prev = _context11.next) {
624
+ switch (_context12.prev = _context12.next) {
589
625
  case 0:
590
626
  alias({ appName: key });
591
- _context11.next = 3;
627
+ _context12.next = 3;
592
628
  return require(params.serverPath)(cmd, key, j !== apps.length - 1);
593
629
 
594
630
  case 3:
595
631
  case 'end':
596
- return _context11.stop();
632
+ return _context12.stop();
597
633
  }
598
634
  }
599
- }, _callee11, undefined);
635
+ }, _callee12, undefined);
600
636
  }));
601
637
 
602
- return function (_x15, _x16) {
603
- return _ref21.apply(this, arguments);
638
+ return function (_x16, _x17) {
639
+ return _ref22.apply(this, arguments);
604
640
  };
605
641
  }());
606
642
 
607
643
  case 19:
608
- _context12.next = 23;
644
+ _context13.next = 23;
609
645
  break;
610
646
 
611
647
  case 21:
@@ -614,14 +650,14 @@ var run = exports.run = function () {
614
650
 
615
651
  case 23:
616
652
  case 'end':
617
- return _context12.stop();
653
+ return _context13.stop();
618
654
  }
619
655
  }
620
- }, _callee12, undefined);
656
+ }, _callee13, undefined);
621
657
  }));
622
658
 
623
- return function (_x13, _x14) {
624
- return _ref19.apply(this, arguments);
659
+ return function (_x14, _x15) {
660
+ return _ref20.apply(this, arguments);
625
661
  };
626
662
  }()).on('--help', function () {
627
663
  console.log('');
@@ -633,29 +669,29 @@ var run = exports.run = function () {
633
669
  });
634
670
 
635
671
  _commander2.default.command('publish').alias('pub').description('Publish to server').action(function () {
636
- var _ref22 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(env, options) {
637
- return _regenerator2.default.wrap(function _callee13$(_context13) {
672
+ var _ref23 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(env, options) {
673
+ return _regenerator2.default.wrap(function _callee14$(_context14) {
638
674
  while (1) {
639
- switch (_context13.prev = _context13.next) {
675
+ switch (_context14.prev = _context14.next) {
640
676
  case 0:
641
677
  process.env.NODE_TYPE = 'publish';
642
- _context13.next = 3;
678
+ _context14.next = 3;
643
679
  return gi();
644
680
 
645
681
  case 3:
646
- _context13.next = 5;
682
+ _context14.next = 5;
647
683
  return require('../utils/deployment')();
648
684
 
649
685
  case 5:
650
686
  case 'end':
651
- return _context13.stop();
687
+ return _context14.stop();
652
688
  }
653
689
  }
654
- }, _callee13, undefined);
690
+ }, _callee14, undefined);
655
691
  }));
656
692
 
657
- return function (_x17, _x18) {
658
- return _ref22.apply(this, arguments);
693
+ return function (_x18, _x19) {
694
+ return _ref23.apply(this, arguments);
659
695
  };
660
696
  }());
661
697
 
@@ -666,12 +702,12 @@ var run = exports.run = function () {
666
702
 
667
703
  _commander2.default.parse(process.argv);
668
704
 
669
- case 12:
705
+ case 13:
670
706
  case 'end':
671
- return _context14.stop();
707
+ return _context15.stop();
672
708
  }
673
709
  }
674
- }, _callee14, undefined);
710
+ }, _callee15, undefined);
675
711
  }));
676
712
 
677
713
  return function run(_x3) {
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "yakuza0",
3
- "version": "2.22.13",
3
+ "version": "2.22.14-beta.0",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
+ "base": "babel --no-babelrc src -d /Users/ningfujun/work/repo/web/CLN_BASE_TEST/node_modules/yakuza0 -w --presets=env --plugins=transform-runtime,transform-object-rest-spread,add-module-exports",
7
8
  "build": "babel --no-babelrc src -d . --presets=env --plugins=transform-runtime,transform-object-rest-spread,add-module-exports",
8
9
  "pub:beta": "npm run build && npm version prerelease --preid=beta && npm publish --tag beta",
9
10
  "pub:hotfix": "npm run build && npm version prerelease --preid=hotfix && npm publish --tag hotfix",
@@ -41,6 +42,7 @@
41
42
  "babel-plugin-transform-object-rest-spread": "^6.26.0",
42
43
  "babel-plugin-transform-runtime": "^6.23.0",
43
44
  "babel-preset-env": "^1.6.1",
45
+ "cross-env": "^7.0.3",
44
46
  "chalk": "^2.4.1",
45
47
  "chokidar": "^3.0.0",
46
48
  "cli-progress": "^2.1.1",
@@ -106,12 +108,12 @@
106
108
  "tcp-port-used": "^1.0.1",
107
109
  "ua-parser-js": "^0.7.20",
108
110
  "v8-compile-cache": "^2.0.2",
109
- "yakuza1": "2.6.12"
111
+ "yakuza1": "^2.6.12"
110
112
  },
111
113
  "peerDependencies": {
112
114
  "@rdc/nuxt": "2.15.8",
113
115
  "core-js": "3.10.1",
114
116
  "eslint": "7.2.0",
115
- "yakuza1": "2.6.12"
117
+ "yakuza1": "^2.6.12"
116
118
  }
117
119
  }