@jujulego/jill 1.1.16 → 1.2.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 (71) hide show
  1. package/dist/commands/each.command.d.ts +16 -0
  2. package/dist/commands/each.command.d.ts.map +1 -0
  3. package/dist/commands/each.command.js +203 -0
  4. package/dist/commands/each.command.js.map +1 -0
  5. package/dist/commands/info.command.d.ts +8 -0
  6. package/dist/commands/info.command.d.ts.map +1 -0
  7. package/dist/commands/info.command.js +178 -0
  8. package/dist/commands/info.command.js.map +1 -0
  9. package/dist/commands/list.command.d.ts +21 -0
  10. package/dist/commands/list.command.d.ts.map +1 -0
  11. package/dist/commands/list.command.js +251 -0
  12. package/dist/commands/list.command.js.map +1 -0
  13. package/dist/commands/run.command.d.ts +12 -0
  14. package/dist/commands/run.command.d.ts.map +1 -0
  15. package/dist/commands/run.command.js +111 -0
  16. package/dist/commands/run.command.js.map +1 -0
  17. package/dist/core.plugin.d.ts +2 -0
  18. package/dist/core.plugin.d.ts.map +1 -0
  19. package/dist/core.plugin.js +22 -0
  20. package/dist/core.plugin.js.map +1 -0
  21. package/dist/index.d.ts +4 -9
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +13 -26
  24. package/dist/index.js.map +1 -0
  25. package/dist/main.d.ts.map +1 -0
  26. package/dist/main.js +45 -141
  27. package/dist/main.js.map +1 -0
  28. package/dist/task-logger.d.ts.map +1 -0
  29. package/dist/task-logger.js +28 -17
  30. package/dist/task-logger.js.map +1 -0
  31. package/package.json +38 -25
  32. package/dist/commands/each.d.ts +0 -12
  33. package/dist/commands/each.js +0 -74
  34. package/dist/commands/info.d.ts +0 -5
  35. package/dist/commands/info.js +0 -42
  36. package/dist/commands/list.d.ts +0 -15
  37. package/dist/commands/list.js +0 -119
  38. package/dist/commands/run.d.ts +0 -9
  39. package/dist/commands/run.js +0 -43
  40. package/dist/filters/affected.d.ts +0 -10
  41. package/dist/filters/affected.js +0 -81
  42. package/dist/filters/filter.d.ts +0 -8
  43. package/dist/filters/filter.js +0 -35
  44. package/dist/filters/index.d.ts +0 -2
  45. package/dist/filters/index.js +0 -21
  46. package/dist/logger.d.ts +0 -32
  47. package/dist/logger.js +0 -189
  48. package/dist/myr/command.d.ts +0 -2
  49. package/dist/myr/command.js +0 -52
  50. package/dist/myr/commands/kill.d.ts +0 -5
  51. package/dist/myr/commands/kill.js +0 -34
  52. package/dist/myr/commands/list.d.ts +0 -10
  53. package/dist/myr/commands/list.js +0 -91
  54. package/dist/myr/commands/spawn.d.ts +0 -7
  55. package/dist/myr/commands/spawn.js +0 -39
  56. package/dist/myr/commands/stop.d.ts +0 -2
  57. package/dist/myr/commands/stop.js +0 -31
  58. package/dist/myr/myr-client.d.ts +0 -16
  59. package/dist/myr/myr-client.js +0 -455
  60. package/dist/myr/myr.process.d.ts +0 -1
  61. package/dist/myr/myr.process.js +0 -42
  62. package/dist/myr/watch.d.ts +0 -8
  63. package/dist/myr/watch.js +0 -79
  64. package/dist/pipeline.d.ts +0 -9
  65. package/dist/pipeline.js +0 -52
  66. package/dist/utils/cli-list.d.ts +0 -15
  67. package/dist/utils/cli-list.js +0 -86
  68. package/dist/utils/deps-tree.d.ts +0 -2
  69. package/dist/utils/deps-tree.js +0 -51
  70. package/dist/wrapper.d.ts +0 -9
  71. package/dist/wrapper.js +0 -38
package/dist/main.js CHANGED
@@ -1,151 +1,55 @@
1
1
  "use strict";
2
2
 
3
- var _helpers = require("yargs/helpers");
4
-
5
- var _yargs = _interopRequireDefault(require("yargs"));
6
-
7
- var _each = require("./commands/each");
3
+ var _jillCommon = require("@jujulego/jill-common");
4
+
5
+ var _core = require("./core.plugin");
6
+
7
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
8
+ function adopt(value) {
9
+ return value instanceof P ? value : new P(function (resolve) {
10
+ resolve(value);
11
+ });
12
+ }
13
+
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) {
16
+ try {
17
+ step(generator.next(value));
18
+ } catch (e) {
19
+ reject(e);
20
+ }
21
+ }
8
22
 
9
- var _info = require("./commands/info");
23
+ function rejected(value) {
24
+ try {
25
+ step(generator["throw"](value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ }
10
30
 
11
- var _list = require("./commands/list");
31
+ function step(result) {
32
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
33
+ }
12
34
 
13
- var _run = require("./commands/run");
35
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
36
+ });
37
+ };
14
38
 
15
- var _command = require("./myr/command");
39
+ // Class
40
+ class JillApp extends _jillCommon.Application {
41
+ constructor() {
42
+ super(...arguments); // Attributes
16
43
 
17
- var _watch = require("./myr/watch");
44
+ this.name = 'jill';
45
+ this.corePlugin = _core.corePlugin;
46
+ }
18
47
 
19
- var _wrapper = require("./wrapper");
48
+ } // Bootstrap
20
49
 
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
50
 
23
- // Bootstrap
24
- (async () => {
25
- // Options
26
- await (0, _yargs.default)((0, _helpers.hideBin)(process.argv)).scriptName('jill').option('project', {
27
- alias: 'p',
28
- type: 'string',
29
- description: 'Project root directory'
30
- }).option('package-manager', {
31
- choices: ['yarn', 'npm'],
32
- type: 'string',
33
- description: 'Force package manager'
34
- }).option('verbose', {
35
- alias: 'v',
36
- type: 'count',
37
- description: 'Set verbosity level (1 for verbose, 2 for debug)'
38
- }).parserConfiguration({
39
- 'populate--': true
40
- }).command(['list', 'ls'], 'List workspaces', {
41
- private: {
42
- type: 'boolean',
43
- group: 'Filters:',
44
- desc: 'Print only private workspaces'
45
- },
46
- 'with-script': {
47
- type: 'array',
48
- group: 'Filters:',
49
- desc: 'Print only workspaces having the given script'
50
- },
51
- affected: {
52
- alias: 'a',
53
- type: 'string',
54
- coerce: rev => rev === '' ? 'master' : rev,
55
- group: 'Affected:',
56
- desc: 'Print only affected workspaces towards given git revision. If no revision is given, it will check towards master.\n' + 'Replaces %name by workspace name.'
57
- },
58
- 'affected-rev-sort': {
59
- type: 'string',
60
- group: 'Affected:',
61
- desc: 'Sort applied to git tag / git branch command'
62
- },
63
- 'affected-rev-fallback': {
64
- type: 'string',
65
- default: 'master',
66
- group: 'Affected:',
67
- desc: 'Fallback revision, used if no revision matching the given format is found'
68
- },
69
- attrs: {
70
- type: 'array',
71
- choices: ['name', 'version', 'root', 'slug'],
72
- group: 'Format:',
73
- desc: 'Select printed attributes'
74
- },
75
- headers: {
76
- type: 'boolean',
77
- group: 'Format:',
78
- desc: 'Prints columns headers'
79
- },
80
- long: {
81
- alias: 'l',
82
- type: 'boolean',
83
- conflicts: 'attrs',
84
- group: 'Format:',
85
- desc: 'Prints name, version and root of all workspaces'
86
- },
87
- json: {
88
- type: 'boolean',
89
- group: 'Format:',
90
- desc: 'Prints data as a JSON array'
91
- }
92
- }, (0, _wrapper.commandHandler)(_list.listCommand)).command('info', 'Print workspace data', {
93
- workspace: {
94
- alias: 'w',
95
- type: 'string',
96
- desc: 'Workspace to use'
97
- }
98
- }, (0, _wrapper.commandHandler)(_info.infoCommand)).command('run <script>', 'Run script inside workspace', {
99
- workspace: {
100
- alias: 'w',
101
- type: 'string',
102
- desc: 'Workspace to use'
103
- },
104
- 'deps-mode': {
105
- choice: ['all', 'prod', 'none'],
106
- default: 'all',
107
- desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
108
- }
109
- }, (0, _wrapper.commandHandler)(_run.runCommand)).command('each <script>', 'Run script on selected workspaces', {
110
- 'deps-mode': {
111
- choice: ['all', 'prod', 'none'],
112
- default: 'all',
113
- desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
114
- },
115
- private: {
116
- type: 'boolean',
117
- group: 'Filters:',
118
- desc: 'Print only private workspaces'
119
- },
120
- affected: {
121
- alias: 'a',
122
- type: 'string',
123
- coerce: rev => rev === '' ? 'master' : rev,
124
- group: 'Affected:',
125
- desc: 'Print only affected workspaces towards given git revision. If no revision is given, it will check towards master.\n' + 'Replaces %name by workspace name.'
126
- },
127
- 'affected-rev-sort': {
128
- type: 'string',
129
- group: 'Affected:',
130
- desc: 'Sort applied to git tag / git branch command'
131
- },
132
- 'affected-rev-fallback': {
133
- type: 'string',
134
- default: 'master',
135
- group: 'Affected:',
136
- desc: 'Fallback revision, used if no revision matching the given format is found'
137
- }
138
- }, (0, _wrapper.commandHandler)(_each.eachCommand)).command('myr', 'Interact with myr server', _command.myrCommand).command('watch <script>', 'Run script inside workspace and watch over deps', {
139
- daemon: {
140
- alias: 'd',
141
- boolean: true,
142
- default: false,
143
- desc: 'Run watch script also in background'
144
- },
145
- workspace: {
146
- alias: 'w',
147
- type: 'string',
148
- desc: 'Workspace to use'
149
- }
150
- }, (0, _wrapper.commandHandler)(_watch.watchCommand)).demandCommand(1).help().example('$0 list -a', 'List all affected workspaces towards master branch').example('$0 list --no-private', 'List all public workspaces').parse();
151
- })();
51
+ (() => __awaiter(void 0, void 0, void 0, function* () {
52
+ const app = new JillApp();
53
+ yield app.parse();
54
+ }))();
55
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["main.ts","main.js"],"names":["__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","JillApp","Application","constructor","arguments","name","corePlugin","app","parse"],"mappings":";;AAAA;;AAEA;;ACFA,IAAIA,SAAS,GAAI,UAAQ,SAAKA,SAAd,IAA4B,UAAUC,OAAV,EAAmBC,UAAnB,EAA+BC,CAA/B,EAAkCC,SAAlC,EAA6C;AACrF,WAASC,KAAT,CAAeC,KAAf,EAAsB;AAAE,WAAOA,KAAK,YAAYH,CAAjB,GAAqBG,KAArB,GAA6B,IAAIH,CAAJ,CAAM,UAAUI,OAAV,EAAmB;AAAEA,MAAAA,OAAO,CAACD,KAAD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AA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;AACV,QAAMyB,GAAG,GAAG,IAAIN,OAAJ,EAAZ;AACA,QAAMM,GAAG,CAACC,KAAJ,EAAN;AACD,CAHW,CAAZ","file":"main.js","sourcesContent":["import { Application } from '@jujulego/jill-common';\n\nimport { corePlugin } from './core.plugin';\n\n// Class\nclass JillApp extends Application {\n // Attributes\n readonly name = 'jill';\n readonly corePlugin = corePlugin;\n}\n\n// Bootstrap\n(async () => {\n const app = new JillApp();\n await app.parse();\n})();\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { Application } from '@jujulego/jill-common';\nimport { corePlugin } from './core.plugin';\n// Class\nclass JillApp extends Application {\n constructor() {\n super(...arguments);\n // Attributes\n this.name = 'jill';\n this.corePlugin = corePlugin;\n }\n}\n// Bootstrap\n(() => __awaiter(void 0, void 0, void 0, function* () {\n const app = new JillApp();\n yield app.parse();\n}))();"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["task-logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGpD,oBAAY,eAAe,GAAG,eAAe,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAGnF,qBAAa,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAKvB;IAGF,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAK3B,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI;IACnE,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,IAAI;IAC7D,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,IAAI;IACtD,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,IAAI;CAI1D","file":"task-logger.d.ts","sourcesContent":["import { transport } from '@jujulego/jill-common';\nimport { Task, TaskSet } from '@jujulego/jill-core';\n\n// Types\nexport type TaskLoggerState = 'spin-multiple' | 'spin-simple' | 'fail' | 'succeed';\n\n// Class\nexport class TaskLogger {\n // Attributes\n private readonly _running = new Set<Task>();\n private readonly _formats = {\n 'spin-multiple': (count: number) => `Building ${count} workspaces ...`,\n 'spin-simple': (tsk: Task) => `Building ${tsk.context.workspace?.name} ...`,\n 'fail': (tsk: Task) => `Failed to build ${tsk.context.workspace?.name}`,\n 'succeed': (tsk: Task) => `${tsk.context.workspace?.name} built`,\n };\n\n // Methods\n private _refreshSpinner() {\n if (this._running.size > 1) {\n transport.spin(this._formats['spin-multiple'](this._running.size));\n } else if (this._running.size > 0) {\n const tsk = this._running.values().next().value;\n transport.spin(this._formats['spin-simple'](tsk));\n }\n }\n\n private _handleStarted(task: Task) {\n this._running.add(task);\n\n this._refreshSpinner();\n }\n\n private _handleCompleted(task: Task) {\n this._running.delete(task);\n\n if (task.status === 'failed') {\n transport.fail(this._formats['fail'](task));\n } else {\n transport.succeed(this._formats['succeed'](task));\n }\n\n this._refreshSpinner();\n }\n\n connect(set: TaskSet): void {\n set.on('started', (task) => this._handleStarted(task));\n set.on('completed', (task) => this._handleCompleted(task));\n }\n\n on(state: 'spin-multiple', format: (count: number) => string): void;\n on(state: 'spin-simple', format: (tsk: Task) => string): void;\n on(state: 'fail', format: (tsk: Task) => string): void;\n on(state: 'succeed', format: (tsk: Task) => string): void;\n on(state: TaskLoggerState, format: (arg: never) => string): void {\n this._formats[state] = format;\n }\n}\n"]}
@@ -5,31 +5,41 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.TaskLogger = void 0;
7
7
 
8
- var _logger = require("./logger");
9
-
10
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ var _jillCommon = require("@jujulego/jill-common");
11
9
 
12
10
  // Class
13
11
  class TaskLogger {
14
12
  constructor() {
15
- _defineProperty(this, "_running", new Set());
16
-
17
- _defineProperty(this, "_formats", {
13
+ // Attributes
14
+ this._running = new Set();
15
+ this._formats = {
18
16
  'spin-multiple': count => `Building ${count} workspaces ...`,
19
- 'spin-simple': tsk => `Building ${tsk.context.workspace?.name} ...`,
20
- 'fail': tsk => `Failed to build ${tsk.context.workspace?.name}`,
21
- 'succeed': tsk => `${tsk.context.workspace?.name} built`
22
- });
23
- }
17
+ 'spin-simple': tsk => {
18
+ var _a;
19
+
20
+ return `Building ${(_a = tsk.context.workspace) === null || _a === void 0 ? void 0 : _a.name} ...`;
21
+ },
22
+ 'fail': tsk => {
23
+ var _a;
24
+
25
+ return `Failed to build ${(_a = tsk.context.workspace) === null || _a === void 0 ? void 0 : _a.name}`;
26
+ },
27
+ 'succeed': tsk => {
28
+ var _a;
29
+
30
+ return `${(_a = tsk.context.workspace) === null || _a === void 0 ? void 0 : _a.name} built`;
31
+ }
32
+ };
33
+ } // Methods
34
+
24
35
 
25
- // Methods
26
36
  _refreshSpinner() {
27
37
  if (this._running.size > 1) {
28
- _logger.logger.spin(this._formats['spin-multiple'](this._running.size));
38
+ _jillCommon.transport.spin(this._formats['spin-multiple'](this._running.size));
29
39
  } else if (this._running.size > 0) {
30
40
  const tsk = this._running.values().next().value;
31
41
 
32
- _logger.logger.spin(this._formats['spin-simple'](tsk));
42
+ _jillCommon.transport.spin(this._formats['spin-simple'](tsk));
33
43
  }
34
44
  }
35
45
 
@@ -43,9 +53,9 @@ class TaskLogger {
43
53
  this._running.delete(task);
44
54
 
45
55
  if (task.status === 'failed') {
46
- _logger.logger.fail(this._formats['fail'](task));
56
+ _jillCommon.transport.fail(this._formats['fail'](task));
47
57
  } else {
48
- _logger.logger.succeed(this._formats['succeed'](task));
58
+ _jillCommon.transport.succeed(this._formats['succeed'](task));
49
59
  }
50
60
 
51
61
  this._refreshSpinner();
@@ -62,4 +72,5 @@ class TaskLogger {
62
72
 
63
73
  }
64
74
 
65
- exports.TaskLogger = TaskLogger;
75
+ exports.TaskLogger = TaskLogger;
76
+ //# sourceMappingURL=task-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["task-logger.ts"],"names":["TaskLogger","constructor","_running","Set","_formats","count","tsk","_a","context","workspace","name","_refreshSpinner","size","transport","spin","values","next","value","_handleStarted","task","add","_handleCompleted","delete","status","fail","succeed","connect","set","on","state","format"],"mappings":";;;;;;;AAAA;;AAMA;AACM,MAAOA,UAAP,CAAiB;AAAvBC,EAAAA,WAAA,GAAA;AACE;AACiB,SAAAC,QAAA,GAAW,IAAIC,GAAJ,EAAX;AACA,SAAAC,QAAA,GAAW;AAC1B,uBAAkBC,KAAD,IAAmB,YAAYA,KAAK,iBAD3B;AAE1B,qBAAgBC,GAAD,IAAc;AAAA,YAAAC,EAAA;;AAAC,eAAA,YAAY,CAAAA,EAAA,GAAAD,GAAG,CAACE,OAAJ,CAAYC,SAAZ,MAAqB,IAArB,IAAqBF,EAAA,KAAA,KAAA,CAArB,GAAqB,KAAA,CAArB,GAAqBA,EAAA,CAAEG,IAAI,MAAvC;AAA6C,OAFjD;AAG1B,cAASJ,GAAD,IA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CAAf;AACD,KAFD,MAEO;AACLN,4BAAUY,OAAV,CAAkB,KAAKrB,QAAL,CAAc,SAAd,EAAyBe,IAAzB,CAAlB;AACD;;AAED,SAAKR,eAAL;AACD;;AAEDe,EAAAA,OAAO,CAACC,GAAD,EAAa;AAClBA,IAAAA,GAAG,CAACC,EAAJ,CAAO,SAAP,EAAmBT,IAAD,IAAU,KAAKD,cAAL,CAAoBC,IAApB,CAA5B;AACAQ,IAAAA,GAAG,CAACC,EAAJ,CAAO,WAAP,EAAqBT,IAAD,IAAU,KAAKE,gBAAL,CAAsBF,IAAtB,CAA9B;AACD;;AAMDS,EAAAA,EAAE,CAACC,KAAD,EAAyBC,MAAzB,EAAuD;AACvD,SAAK1B,QAAL,CAAcyB,KAAd,IAAuBC,MAAvB;AACD;;AAjDoB","file":"task-logger.js","sourcesContent":["import { transport } from '@jujulego/jill-common';\nimport { Task, TaskSet } from '@jujulego/jill-core';\n\n// Types\nexport type TaskLoggerState = 'spin-multiple' | 'spin-simple' | 'fail' | 'succeed';\n\n// Class\nexport class TaskLogger {\n // Attributes\n private readonly _running = new Set<Task>();\n private readonly _formats = {\n 'spin-multiple': (count: number) => `Building ${count} workspaces ...`,\n 'spin-simple': (tsk: Task) => `Building ${tsk.context.workspace?.name} ...`,\n 'fail': (tsk: Task) => `Failed to build ${tsk.context.workspace?.name}`,\n 'succeed': (tsk: Task) => `${tsk.context.workspace?.name} built`,\n };\n\n // Methods\n private _refreshSpinner() {\n if (this._running.size > 1) {\n transport.spin(this._formats['spin-multiple'](this._running.size));\n } else if (this._running.size > 0) {\n const tsk = this._running.values().next().value;\n transport.spin(this._formats['spin-simple'](tsk));\n }\n }\n\n private _handleStarted(task: Task) {\n this._running.add(task);\n\n this._refreshSpinner();\n }\n\n private _handleCompleted(task: Task) {\n this._running.delete(task);\n\n if (task.status === 'failed') {\n transport.fail(this._formats['fail'](task));\n } else {\n transport.succeed(this._formats['succeed'](task));\n }\n\n this._refreshSpinner();\n }\n\n connect(set: TaskSet): void {\n set.on('started', (task) => this._handleStarted(task));\n set.on('completed', (task) => this._handleCompleted(task));\n }\n\n on(state: 'spin-multiple', format: (count: number) => string): void;\n on(state: 'spin-simple', format: (tsk: Task) => string): void;\n on(state: 'fail', format: (tsk: Task) => string): void;\n on(state: 'succeed', format: (tsk: Task) => string): void;\n on(state: TaskLoggerState, format: (arg: never) => string): void {\n this._formats[state] = format;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,14 +1,18 @@
1
1
  {
2
2
  "name": "@jujulego/jill",
3
- "version": "1.1.16",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
- "bin": "./bin/jill.js",
6
- "main": "./dist/main.js",
7
5
  "repository": {
8
6
  "type": "git",
9
7
  "url": "https://github.com/Jujulego/jill",
10
8
  "directory": "packages/cli"
11
9
  },
10
+ "bin": "./bin/jill.js",
11
+ "main": "./dist/main.js",
12
+ "files": [
13
+ "bin",
14
+ "dist"
15
+ ],
12
16
  "scripts": {
13
17
  "lint": "eslint {src,tests}/**/*.*",
14
18
  "clean": "gulp clean",
@@ -20,44 +24,53 @@
20
24
  "engines": {
21
25
  "node": "^14"
22
26
  },
27
+ "peerDependencies": {
28
+ "@jujulego/jill-myr": "1.2.0"
29
+ },
30
+ "peerDependenciesMeta": {
31
+ "@jujulego/jill-myr": {
32
+ "optional": true
33
+ }
34
+ },
23
35
  "dependencies": {
24
- "@jujulego/jill-core": "^1.1.11",
25
- "@jujulego/jill-myr": "^0.0.5",
36
+ "@jujulego/jill-common": "^1.2.0",
37
+ "@jujulego/jill-core": "^1.2.0",
26
38
  "@repeaterjs/repeater": "^3.0.4",
27
39
  "chalk": "^4.1.1",
28
40
  "graphql": "^15.7.2",
29
41
  "graphql-request": "^3.6.1",
42
+ "graphql-tag": "^2.12.6",
43
+ "graphql-ws": "^5.5.5",
30
44
  "ora": "^5.4.1",
31
45
  "slugify": "^1.6.0",
32
46
  "winston": "^3.3.3",
33
47
  "winston-transport": "^4.4.0",
48
+ "ws": "^8.3.0",
34
49
  "yargs": "^17.0.1"
35
50
  },
36
51
  "devDependencies": {
37
- "@babel/core": "7.16.0",
38
- "@babel/plugin-proposal-class-properties": "7.16.0",
39
- "@babel/preset-env": "7.16.4",
40
- "@babel/preset-typescript": "7.16.0",
41
- "@babel/runtime": "7.16.3",
42
- "@types/jest": "27.0.3",
43
- "@types/node": "14.17.34",
44
- "@types/yargs": "17.0.7",
45
- "@typescript-eslint/eslint-plugin": "5.4.0",
46
- "@typescript-eslint/parser": "5.4.0",
47
- "babel-jest": "27.3.1",
48
- "babel-plugin-macros": "3.1.0",
52
+ "@babel/core": "7.16.7",
53
+ "@babel/plugin-proposal-class-properties": "7.16.7",
54
+ "@babel/preset-env": "7.16.8",
55
+ "@babel/runtime": "7.16.7",
56
+ "@types/gulp": "4.0.9",
57
+ "@types/jest": "27.4.0",
58
+ "@types/node": "14.18.5",
59
+ "@types/ws": "8.2.1",
60
+ "@types/yargs": "17.0.8",
61
+ "@typescript-eslint/eslint-plugin": "5.9.1",
62
+ "@typescript-eslint/parser": "5.9.1",
49
63
  "del": "6.0.0",
50
- "eslint": "7.32.0",
51
- "eslint-plugin-jest": "25.2.4",
64
+ "eslint": "8.6.0",
65
+ "eslint-plugin-jest": "25.3.4",
52
66
  "eslint-plugin-workspaces": "0.7.0",
53
- "graphql.macro": "1.4.2",
54
67
  "gulp": "4.0.2",
55
- "gulp-babel": "8.0.0",
56
68
  "gulp-cli": "2.3.0",
57
- "gulp-typescript": "6.0.0-alpha.1",
58
- "jest": "27.3.1",
59
- "msw": "0.35.0",
69
+ "jest": "27.4.7",
70
+ "jill-tools": "0.0.0",
71
+ "msw": "0.36.4",
72
+ "ts-jest": "27.1.1",
60
73
  "ts-node": "10.4.0",
61
- "typescript": "4.4.4"
74
+ "typescript": "4.5.4"
62
75
  }
63
76
  }
@@ -1,12 +0,0 @@
1
- import { WorkspaceDepsMode } from '@jujulego/jill-core';
2
- import { CommandHandler } from '../wrapper';
3
- export interface EachArgs {
4
- script: string;
5
- 'deps-mode': WorkspaceDepsMode;
6
- '--': (string | number)[] | undefined;
7
- private: boolean | undefined;
8
- affected: string | undefined;
9
- 'affected-rev-fallback': string;
10
- 'affected-rev-sort': string | undefined;
11
- }
12
- export declare const eachCommand: CommandHandler<EachArgs>;
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.eachCommand = void 0;
7
-
8
- var _jillCore = require("@jujulego/jill-core");
9
-
10
- var _filters = require("../filters");
11
-
12
- var _logger = require("../logger");
13
-
14
- var _taskLogger = require("../task-logger");
15
-
16
- var _pipeline = require("../pipeline");
17
-
18
- // Handler
19
- const eachCommand = async (prj, argv) => {
20
- _logger.logger.spin('Loading project'); // Setup pipeline
21
-
22
-
23
- const pipeline = new _pipeline.Pipeline();
24
- pipeline.add(_filters.Filter.scripts([argv.script]));
25
-
26
- if (argv.private !== undefined) {
27
- pipeline.add(_filters.Filter.privateWorkspace(argv.private));
28
- }
29
-
30
- if (argv.affected !== undefined) {
31
- pipeline.add(new _filters.AffectedFilter(argv.affected, argv['affected-rev-fallback'], argv['affected-rev-sort']));
32
- } // Filter
33
-
34
-
35
- const workspaces = [];
36
-
37
- for await (const wks of pipeline.filter(prj.workspaces())) {
38
- workspaces.push(wks);
39
- }
40
-
41
- _logger.logger.stop();
42
-
43
- if (workspaces.length === 0) {
44
- _logger.logger.fail('No workspace found !');
45
-
46
- return 1;
47
- }
48
-
49
- _logger.logger.verbose(`Will run ${argv.script} in ${workspaces.map(wks => wks.name).join(', ')}`); // Run tasks
50
-
51
-
52
- const set = new _jillCore.TaskSet();
53
- const tasks = [];
54
-
55
- for (const wks of workspaces) {
56
- const task = await wks.run(argv.script, argv['--']?.map(arg => arg.toString()), {
57
- buildDeps: argv['deps-mode']
58
- });
59
- tasks.push(task);
60
- set.add(task);
61
- }
62
-
63
- const tlogger = new _taskLogger.TaskLogger();
64
- tlogger.on('spin-multiple', count => `Working in ${count} packages ...`);
65
- tlogger.on('spin-simple', tsk => tasks.includes(tsk) ? `Running ${argv.script} in ${tsk.context.workspace?.name} ...` : `Building ${tsk.context.workspace?.name} ...`);
66
- tlogger.on('fail', tsk => tasks.includes(tsk) ? `${tsk.context.workspace?.name} ${argv.script} failed` : `Failed to build ${tsk.context.workspace?.name}`);
67
- tlogger.on('succeed', tsk => tasks.includes(tsk) ? `${tsk.context.workspace?.name} ${argv.script} done` : `${tsk.context.workspace?.name} built`);
68
- tlogger.connect(set);
69
- set.start();
70
- const [result] = await set.waitFor('finished');
71
- return result.failed === 0 ? 0 : 1;
72
- };
73
-
74
- exports.eachCommand = eachCommand;
@@ -1,5 +0,0 @@
1
- import { CommandHandler } from '../wrapper';
2
- export interface InfoArgs {
3
- workspace: string | undefined;
4
- }
5
- export declare const infoCommand: CommandHandler<InfoArgs>;
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.infoCommand = void 0;
7
-
8
- var _chalk = _interopRequireDefault(require("chalk"));
9
-
10
- var _path = _interopRequireDefault(require("path"));
11
-
12
- var _logger = require("../logger");
13
-
14
- var _depsTree = require("../utils/deps-tree");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- // Handler
19
- const infoCommand = async (prj, argv) => {
20
- // Get workspace
21
- _logger.logger.spin('Loading project');
22
-
23
- const wks = await (argv.workspace ? prj.workspace(argv.workspace) : prj.currentWorkspace());
24
-
25
- if (!wks) {
26
- _logger.logger.fail(`Workspace ${argv.workspace || '.'} not found`);
27
-
28
- return 1;
29
- }
30
-
31
- _logger.logger.stop(); // Print data
32
-
33
-
34
- console.log((0, _chalk.default)`Workspace {bold ${wks.name}}:`);
35
- console.log((0, _chalk.default)`{bold Version:} ${wks.manifest.version || _chalk.default.grey('unset')}`);
36
- console.log((0, _chalk.default)`{bold Directory:} ${_path.default.relative(process.cwd(), wks.cwd) || '.'}`);
37
- console.log('');
38
- await (0, _depsTree.printDepsTree)(wks);
39
- return 0;
40
- };
41
-
42
- exports.infoCommand = infoCommand;
@@ -1,15 +0,0 @@
1
- import { CommandHandler } from '../wrapper';
2
- export declare type Attribute = 'name' | 'version' | 'root' | 'slug';
3
- export declare type Data = Partial<Record<Attribute, string>>;
4
- export interface ListArgs {
5
- private: boolean | undefined;
6
- 'with-script': string[] | undefined;
7
- affected: string | undefined;
8
- 'affected-rev-fallback': string;
9
- 'affected-rev-sort': string | undefined;
10
- attrs: Attribute[] | undefined;
11
- headers: boolean | undefined;
12
- long: boolean;
13
- json: boolean;
14
- }
15
- export declare const listCommand: CommandHandler<ListArgs>;
@@ -1,119 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.listCommand = void 0;
7
-
8
- var _chalk = _interopRequireDefault(require("chalk"));
9
-
10
- var _path = _interopRequireDefault(require("path"));
11
-
12
- var _slugify = _interopRequireDefault(require("slugify"));
13
-
14
- var _filters = require("../filters");
15
-
16
- var _logger = require("../logger");
17
-
18
- var _pipeline = require("../pipeline");
19
-
20
- var _cliList = require("../utils/cli-list");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- // Constants
25
- const LONG_ATTRIBUTES = ['name', 'version', 'root'];
26
- const JSON_ATTRIBUTES = ['name', 'version', 'slug', 'root'];
27
- const DEFAULT_ATTRIBUTES = ['name']; // Utils
28
-
29
- const extractors = {
30
- name: wks => wks.name,
31
- version: (wks, argv) => wks.manifest.version || (argv.json ? undefined : _chalk.default.grey('unset')),
32
- root: wks => wks.cwd,
33
- slug: wks => (0, _slugify.default)(wks.name)
34
- };
35
-
36
- function buildExtractor(attrs) {
37
- return (wks, argv) => {
38
- const data = {};
39
-
40
- for (const attr of attrs) {
41
- data[attr] = extractors[attr](wks, argv);
42
- }
43
-
44
- return data;
45
- };
46
- } // Handler
47
-
48
-
49
- const listCommand = async (prj, argv) => {
50
- _logger.logger.spin('Loading project'); // Setup pipeline
51
-
52
-
53
- const pipeline = new _pipeline.Pipeline();
54
-
55
- if (argv.private !== undefined) {
56
- pipeline.add(_filters.Filter.privateWorkspace(argv.private));
57
- }
58
-
59
- if (argv['with-script'] !== undefined) {
60
- pipeline.add(_filters.Filter.scripts(argv['with-script']));
61
- }
62
-
63
- if (argv.affected !== undefined) {
64
- pipeline.add(new _filters.AffectedFilter(argv.affected, argv['affected-rev-fallback'], argv['affected-rev-sort']));
65
- } // Filter
66
-
67
-
68
- const workspaces = [];
69
-
70
- for await (const wks of pipeline.filter(prj.workspaces())) {
71
- workspaces.push(wks);
72
- }
73
-
74
- _logger.logger.stop(); // Build data
75
-
76
-
77
- let attrs = argv.attrs || DEFAULT_ATTRIBUTES;
78
-
79
- if (!argv.attrs) {
80
- if (argv.long) {
81
- attrs = LONG_ATTRIBUTES;
82
- } else if (argv.json) {
83
- attrs = JSON_ATTRIBUTES;
84
- }
85
- }
86
-
87
- const data = workspaces.map(wks => buildExtractor(attrs)(wks, argv)); // Print data
88
-
89
- if (argv.json) {
90
- if (process.stdout.isTTY) {
91
- // Pretty print for ttys
92
- console.log(JSON.stringify(data, null, 2));
93
- } else {
94
- console.log(JSON.stringify(data));
95
- }
96
- } else {
97
- const list = new _cliList.CliList();
98
-
99
- if (argv.headers ?? attrs.length > 1) {
100
- list.setHeaders(attrs);
101
- }
102
-
103
- for (const d of data) {
104
- if (d.root) {
105
- d.root = _path.default.relative(process.cwd(), d.root) || '.';
106
- }
107
-
108
- list.add(attrs.map(attr => d[attr] || ''));
109
- }
110
-
111
- for (const d of list.lines()) {
112
- console.log(d);
113
- }
114
- }
115
-
116
- return 0;
117
- };
118
-
119
- exports.listCommand = listCommand;