@knocklabs/cli 0.1.6 → 0.1.8

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/README.md CHANGED
@@ -16,7 +16,7 @@ $ npm install -g @knocklabs/cli
16
16
  $ knock COMMAND
17
17
  running command...
18
18
  $ knock (--version)
19
- @knocklabs/cli/0.1.6 linux-x64 node-v18.18.0
19
+ @knocklabs/cli/0.1.8 linux-x64 node-v18.18.2
20
20
  $ knock --help [COMMAND]
21
21
  USAGE
22
22
  $ knock COMMAND
@@ -28,6 +28,8 @@ USAGE
28
28
 
29
29
  <!-- commands -->
30
30
  * [`knock commit`](#knock-commit)
31
+ * [`knock commit get ID`](#knock-commit-get-id)
32
+ * [`knock commit list`](#knock-commit-list)
31
33
  * [`knock commit promote`](#knock-commit-promote)
32
34
  * [`knock help [COMMANDS]`](#knock-help-commands)
33
35
  * [`knock layout get EMAILLAYOUTKEY`](#knock-layout-get-emaillayoutkey)
@@ -75,23 +77,65 @@ FLAGS
75
77
  --service-token=<value> (required) The service token to authenticate with.
76
78
  ```
77
79
 
78
- _See code: [dist/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/commit/index.ts)_
80
+ _See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/commit/index.ts)_
81
+
82
+ ## `knock commit get ID`
83
+
84
+ Display a single commit
85
+
86
+ ```
87
+ USAGE
88
+ $ knock commit get ID --service-token <value> [--json]
89
+
90
+ FLAGS
91
+ --service-token=<value> (required) The service token to authenticate with.
92
+
93
+ GLOBAL FLAGS
94
+ --json Format output as json.
95
+ ```
96
+
97
+ _See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/commit/get.ts)_
98
+
99
+ ## `knock commit list`
100
+
101
+ Display all commits in an environment
102
+
103
+ ```
104
+ USAGE
105
+ $ knock commit list --service-token <value> [--environment <value>] [--promoted] [--after <value>] [--before
106
+ <value>] [--limit <value>] [--json]
107
+
108
+ FLAGS
109
+ --after=<value> The cursor after which to fetch the next page.
110
+ --before=<value> The cursor before which to fetch the previous page.
111
+ --environment=<value> [default: development] The environment to use.
112
+ --limit=<value> The total number of entries to fetch per page.
113
+ --[no-]promoted Show only promoted or unpromoted changes between the given environment and the subsequent
114
+ environment.
115
+ --service-token=<value> (required) The service token to authenticate with.
116
+
117
+ GLOBAL FLAGS
118
+ --json Format output as json.
119
+ ```
120
+
121
+ _See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/commit/list.ts)_
79
122
 
80
123
  ## `knock commit promote`
81
124
 
82
- Promote all changes to the destination environment.
125
+ Promote one or all commits to the subsequent environment.
83
126
 
84
127
  ```
85
128
  USAGE
86
- $ knock commit promote --service-token <value> --to <value> [--force]
129
+ $ knock commit promote --service-token <value> [--to <value>] [--force] [--only <value>]
87
130
 
88
131
  FLAGS
89
132
  --force Remove the confirmation prompt.
133
+ --only=<value> The target commit id to promote to the subsequent environment
90
134
  --service-token=<value> (required) The service token to authenticate with.
91
- --to=<value> (required) The destination environment to promote changes from the preceding environment.
135
+ --to=<value> The destination environment to promote all changes from the preceding environment.
92
136
  ```
93
137
 
94
- _See code: [dist/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/commit/promote.ts)_
138
+ _See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/commit/promote.ts)_
95
139
 
96
140
  ## `knock help [COMMANDS]`
97
141
 
@@ -131,7 +175,7 @@ GLOBAL FLAGS
131
175
  --json Format output as json.
132
176
  ```
133
177
 
134
- _See code: [dist/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/layout/get.ts)_
178
+ _See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/layout/get.ts)_
135
179
 
136
180
  ## `knock layout list`
137
181
 
@@ -154,7 +198,7 @@ GLOBAL FLAGS
154
198
  --json Format output as json.
155
199
  ```
156
200
 
157
- _See code: [dist/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/layout/list.ts)_
201
+ _See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/layout/list.ts)_
158
202
 
159
203
  ## `knock layout pull [EMAILLAYOUTKEY]`
160
204
 
@@ -174,7 +218,7 @@ FLAGS
174
218
  --service-token=<value> (required) The service token to authenticate with.
175
219
  ```
176
220
 
177
- _See code: [dist/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/layout/pull.ts)_
221
+ _See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/layout/pull.ts)_
178
222
 
179
223
  ## `knock layout push [EMAILLAYOUTKEY]`
180
224
 
@@ -196,7 +240,7 @@ FLAGS
196
240
  --service-token=<value> (required) The service token to authenticate with.
197
241
  ```
198
242
 
199
- _See code: [dist/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/layout/push.ts)_
243
+ _See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/layout/push.ts)_
200
244
 
201
245
  ## `knock layout validate [EMAILLAYOUTKEY]`
202
246
 
@@ -215,7 +259,7 @@ FLAGS
215
259
  --service-token=<value> (required) The service token to authenticate with.
216
260
  ```
217
261
 
218
- _See code: [dist/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/layout/validate.ts)_
262
+ _See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/layout/validate.ts)_
219
263
 
220
264
  ## `knock plugins`
221
265
 
@@ -238,7 +282,7 @@ EXAMPLES
238
282
  $ knock plugins
239
283
  ```
240
284
 
241
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.1/src/commands/plugins/index.ts)_
285
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.4/src/commands/plugins/index.ts)_
242
286
 
243
287
  ## `knock plugins:install PLUGIN...`
244
288
 
@@ -303,7 +347,7 @@ EXAMPLES
303
347
  $ knock plugins:inspect myplugin
304
348
  ```
305
349
 
306
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.1/src/commands/plugins/inspect.ts)_
350
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.4/src/commands/plugins/inspect.ts)_
307
351
 
308
352
  ## `knock plugins:install PLUGIN...`
309
353
 
@@ -343,7 +387,7 @@ EXAMPLES
343
387
  $ knock plugins:install someuser/someplugin
344
388
  ```
345
389
 
346
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.1/src/commands/plugins/install.ts)_
390
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.4/src/commands/plugins/install.ts)_
347
391
 
348
392
  ## `knock plugins:link PLUGIN`
349
393
 
@@ -373,7 +417,7 @@ EXAMPLES
373
417
  $ knock plugins:link myplugin
374
418
  ```
375
419
 
376
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.1/src/commands/plugins/link.ts)_
420
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.4/src/commands/plugins/link.ts)_
377
421
 
378
422
  ## `knock plugins:uninstall PLUGIN...`
379
423
 
@@ -421,7 +465,7 @@ ALIASES
421
465
  $ knock plugins remove
422
466
  ```
423
467
 
424
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.1/src/commands/plugins/uninstall.ts)_
468
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.4/src/commands/plugins/uninstall.ts)_
425
469
 
426
470
  ## `knock plugins:uninstall PLUGIN...`
427
471
 
@@ -462,7 +506,7 @@ DESCRIPTION
462
506
  Update installed plugins.
463
507
  ```
464
508
 
465
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.1/src/commands/plugins/update.ts)_
509
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.9.4/src/commands/plugins/update.ts)_
466
510
 
467
511
  ## `knock translation get TRANSLATIONREF`
468
512
 
@@ -487,7 +531,7 @@ GLOBAL FLAGS
487
531
  --json Format output as json.
488
532
  ```
489
533
 
490
- _See code: [dist/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/translation/get.ts)_
534
+ _See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/translation/get.ts)_
491
535
 
492
536
  ## `knock translation list`
493
537
 
@@ -510,7 +554,7 @@ GLOBAL FLAGS
510
554
  --json Format output as json.
511
555
  ```
512
556
 
513
- _See code: [dist/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/translation/list.ts)_
557
+ _See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/translation/list.ts)_
514
558
 
515
559
  ## `knock translation pull [TRANSLATIONREF]`
516
560
 
@@ -535,7 +579,7 @@ FLAGS
535
579
  --translations-dir=<value> The target directory path to pull all translations into.
536
580
  ```
537
581
 
538
- _See code: [dist/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/translation/pull.ts)_
582
+ _See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/translation/pull.ts)_
539
583
 
540
584
  ## `knock translation push [TRANSLATIONREF]`
541
585
 
@@ -562,7 +606,7 @@ FLAGS
562
606
  --translations-dir=<value> The target directory path to find all translations to push.
563
607
  ```
564
608
 
565
- _See code: [dist/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/translation/push.ts)_
609
+ _See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/translation/push.ts)_
566
610
 
567
611
  ## `knock translation validate [TRANSLATIONREF]`
568
612
 
@@ -587,7 +631,7 @@ FLAGS
587
631
  --translations-dir=<value> The target directory path to find all translations to validate.
588
632
  ```
589
633
 
590
- _See code: [dist/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/translation/validate.ts)_
634
+ _See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/translation/validate.ts)_
591
635
 
592
636
  ## `knock whoami`
593
637
 
@@ -604,7 +648,7 @@ GLOBAL FLAGS
604
648
  --json Format output as json.
605
649
  ```
606
650
 
607
- _See code: [dist/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/whoami.ts)_
651
+ _See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/whoami.ts)_
608
652
 
609
653
  ## `knock workflow activate WORKFLOWKEY`
610
654
 
@@ -631,7 +675,7 @@ DESCRIPTION
631
675
  with `false` in order to deactivate it.
632
676
  ```
633
677
 
634
- _See code: [dist/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/workflow/activate.ts)_
678
+ _See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/workflow/activate.ts)_
635
679
 
636
680
  ## `knock workflow get WORKFLOWKEY`
637
681
 
@@ -651,7 +695,7 @@ GLOBAL FLAGS
651
695
  --json Format output as json.
652
696
  ```
653
697
 
654
- _See code: [dist/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/workflow/get.ts)_
698
+ _See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/workflow/get.ts)_
655
699
 
656
700
  ## `knock workflow list`
657
701
 
@@ -674,7 +718,7 @@ GLOBAL FLAGS
674
718
  --json Format output as json.
675
719
  ```
676
720
 
677
- _See code: [dist/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/workflow/list.ts)_
721
+ _See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/workflow/list.ts)_
678
722
 
679
723
  ## `knock workflow pull [WORKFLOWKEY]`
680
724
 
@@ -694,7 +738,7 @@ FLAGS
694
738
  --workflows-dir=<value> The target directory path to pull all workflows into.
695
739
  ```
696
740
 
697
- _See code: [dist/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/workflow/pull.ts)_
741
+ _See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/workflow/pull.ts)_
698
742
 
699
743
  ## `knock workflow push [WORKFLOWKEY]`
700
744
 
@@ -715,7 +759,7 @@ FLAGS
715
759
  --workflows-dir=<value> The target directory path to find all workflows to push.
716
760
  ```
717
761
 
718
- _See code: [dist/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/workflow/push.ts)_
762
+ _See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/workflow/push.ts)_
719
763
 
720
764
  ## `knock workflow run WORKFLOWKEY`
721
765
 
@@ -736,7 +780,7 @@ FLAGS
736
780
  --tenant=<value> A tenant id for the workflow run.
737
781
  ```
738
782
 
739
- _See code: [dist/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/workflow/run.ts)_
783
+ _See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/workflow/run.ts)_
740
784
 
741
785
  ## `knock workflow validate [WORKFLOWKEY]`
742
786
 
@@ -755,5 +799,5 @@ FLAGS
755
799
  --workflows-dir=<value> The target directory path to find all workflows to validate.
756
800
  ```
757
801
 
758
- _See code: [dist/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.6/dist/commands/workflow/validate.ts)_
802
+ _See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.8/src/commands/workflow/validate.ts)_
759
803
  <!-- commandsstop -->
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: ()=>CommitGet
8
+ });
9
+ const _core = require("@oclif/core");
10
+ const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
11
+ const _date = require("../../lib/helpers/date");
12
+ const _request = require("../../lib/helpers/request");
13
+ const _commit = require("../../lib/marshal/commit");
14
+ function _interopRequireDefault(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ class CommitGet extends _baseCommand.default {
20
+ async run() {
21
+ const { flags } = this.props;
22
+ const resp = await (0, _request.withSpinner)(()=>this.apiV1.getCommit(this.props));
23
+ if (flags.json) return resp.data;
24
+ this.render(resp.data);
25
+ }
26
+ render(commit) {
27
+ this.log(`‣ Showing commit \`${commit.id}\` in \`${commit.environment}\` environment`);
28
+ /*
29
+ * Commit table
30
+ */ const rows = [
31
+ {
32
+ key: "ID",
33
+ value: commit.id
34
+ },
35
+ {
36
+ key: "Resource",
37
+ value: commit.resource.type
38
+ },
39
+ {
40
+ key: "Identifier",
41
+ value: commit.resource.identifier
42
+ },
43
+ {
44
+ key: "Author",
45
+ value: (0, _commit.formatCommitAuthor)(commit)
46
+ },
47
+ {
48
+ key: "Created at",
49
+ value: (0, _date.formatDate)(commit.created_at)
50
+ }
51
+ ];
52
+ this.log("");
53
+ _core.ux.table(rows, {
54
+ key: {
55
+ header: "Commit",
56
+ minWidth: 18
57
+ },
58
+ value: {
59
+ header: "",
60
+ minWidth: 16
61
+ }
62
+ });
63
+ this.log("");
64
+ if (commit.commit_message) {
65
+ this.log(commit.commit_message);
66
+ this.log("");
67
+ }
68
+ }
69
+ }
70
+ CommitGet.summary = "Display a single commit";
71
+ CommitGet.args = {
72
+ id: _core.Args.string({
73
+ required: true
74
+ })
75
+ };
76
+ CommitGet.enableJsonFlag = true;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: ()=>CommitList
8
+ });
9
+ const _core = require("@oclif/core");
10
+ const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
11
+ const _date = require("../../lib/helpers/date");
12
+ const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
13
+ const _page = require("../../lib/helpers/page");
14
+ const _request = require("../../lib/helpers/request");
15
+ const _commit = require("../../lib/marshal/commit");
16
+ function _interopRequireDefault(obj) {
17
+ return obj && obj.__esModule ? obj : {
18
+ default: obj
19
+ };
20
+ }
21
+ class CommitList extends _baseCommand.default {
22
+ async run() {
23
+ const resp = await this.request();
24
+ const { flags } = this.props;
25
+ if (flags.json) return resp.data;
26
+ this.render(resp.data);
27
+ }
28
+ async request(pageParams = {}) {
29
+ const props = (0, _objectIsomorphic.merge)(this.props, {
30
+ flags: {
31
+ ...pageParams
32
+ }
33
+ });
34
+ return (0, _request.withSpinner)(()=>this.apiV1.listCommits(props));
35
+ }
36
+ async render(data) {
37
+ const { entries } = data;
38
+ const { environment: env , promoted } = this.props.flags;
39
+ let qualifier = "";
40
+ if (promoted === true) {
41
+ qualifier = "(showing only promoted)";
42
+ }
43
+ if (promoted === false) {
44
+ qualifier = "(showing only unpromoted)";
45
+ }
46
+ this.log(`‣ Showing ${entries.length} commits in \`${env}\` environment ${qualifier}\n`);
47
+ /*
48
+ * Commits table
49
+ */ _core.ux.table(entries, {
50
+ id: {
51
+ header: "ID"
52
+ },
53
+ resource: {
54
+ header: "Resource",
55
+ get: (entry)=>entry.resource.type
56
+ },
57
+ identifier: {
58
+ header: "Identifier",
59
+ get: (entry)=>entry.resource.identifier
60
+ },
61
+ author: {
62
+ header: "Author",
63
+ get: (entry)=>(0, _commit.formatCommitAuthor)(entry)
64
+ },
65
+ commit_message: {
66
+ header: "Commit message",
67
+ get: (entry)=>entry.commit_message ? entry.commit_message.trim() : ""
68
+ },
69
+ created_at: {
70
+ header: "Created at",
71
+ get: (entry)=>(0, _date.formatDate)(entry.created_at)
72
+ }
73
+ });
74
+ return this.prompt(data);
75
+ }
76
+ async prompt(data) {
77
+ const { page_info } = data;
78
+ const pageAction = await (0, _page.maybePromptPageAction)(page_info);
79
+ const pageParams = pageAction && (0, _page.paramsForPageAction)(pageAction, page_info);
80
+ if (pageParams) {
81
+ this.log("\n");
82
+ const resp = await this.request(pageParams);
83
+ return this.render(resp.data);
84
+ }
85
+ }
86
+ }
87
+ CommitList.summary = "Display all commits in an environment";
88
+ CommitList.flags = {
89
+ environment: _core.Flags.string({
90
+ default: "development",
91
+ summary: "The environment to use."
92
+ }),
93
+ promoted: _core.Flags.boolean({
94
+ summary: "Show only promoted or unpromoted changes between the given environment and the subsequent environment.",
95
+ allowNo: true
96
+ }),
97
+ ..._page.pageFlags
98
+ };
99
+ CommitList.enableJsonFlag = true;
@@ -8,7 +8,9 @@ Object.defineProperty(exports, "default", {
8
8
  });
9
9
  const _core = require("@oclif/core");
10
10
  const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
11
+ const _error = require("../../lib/helpers/error");
11
12
  const _request = require("../../lib/helpers/request");
13
+ const _string = require("../../lib/helpers/string");
12
14
  const _ux = require("../../lib/helpers/ux");
13
15
  function _interopRequireDefault(obj) {
14
16
  return obj && obj.__esModule ? obj : {
@@ -17,6 +19,35 @@ function _interopRequireDefault(obj) {
17
19
  }
18
20
  class CommitPromote extends _baseCommand.default {
19
21
  async run() {
22
+ const { flags } = this.props;
23
+ // Currently this command support two modes of operation based on the flags:
24
+ // * --to : Promotes all changes to the destination environment.
25
+ // * --only: Promotes one commit to the subsequent enviroment
26
+ // The absence or presence of both flags will result in an error.
27
+ if (flags.to && flags.only) {
28
+ throw new Error("`--to` and `--only` flags cannot be used together.\n See more help with --help");
29
+ }
30
+ if (!flags.to && !flags.only) {
31
+ throw new Error("You must specify either `--to` or `--only` flag.\n See more help with --help");
32
+ }
33
+ return flags.only ? this.promoteOneChange() : this.promoteAllChanges();
34
+ }
35
+ async promoteOneChange() {
36
+ const { flags } = this.props;
37
+ // Confirm first as we are about to promote the commit, unless forced.
38
+ const prompt = `Promote the commit \`${flags.only}\` ?`;
39
+ const input = flags.force || await (0, _ux.promptToConfirm)(prompt);
40
+ if (!input) return;
41
+ const resp = await (0, _request.withSpinner)(()=>this.apiV1.promoteOneChange(this.props));
42
+ if (!(0, _request.isSuccessResp)(resp)) {
43
+ const message = (0, _request.formatErrorRespMessage)(resp);
44
+ return this.error(new _error.ApiError(message));
45
+ }
46
+ const { commit } = resp.data;
47
+ this.log(`‣ Successfully promoted the commit \`${flags.only}\` into \`${commit.environment}\` environment`);
48
+ this.log((0, _string.indentString)(`Commit id: ${commit.id}`, 4));
49
+ }
50
+ async promoteAllChanges() {
20
51
  const { flags } = this.props;
21
52
  // Confirm first as we are about to promote changes to go live in the target
22
53
  // environment, unless forced.
@@ -27,13 +58,15 @@ class CommitPromote extends _baseCommand.default {
27
58
  this.log(`‣ Successfully promoted all changes to \`${flags.to}\` environment`);
28
59
  }
29
60
  }
30
- CommitPromote.summary = "Promote all changes to the destination environment.";
61
+ CommitPromote.summary = "Promote one or all commits to the subsequent environment.";
31
62
  CommitPromote.flags = {
32
63
  to: _core.Flags.string({
33
- summary: "The destination environment to promote changes from the preceding environment.",
34
- required: true
64
+ summary: "The destination environment to promote all changes from the preceding environment."
35
65
  }),
36
66
  force: _core.Flags.boolean({
37
67
  summary: "Remove the confirmation prompt."
68
+ }),
69
+ only: _core.Flags.string({
70
+ summary: "The target commit id to promote to the subsequent environment"
38
71
  })
39
72
  };
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "default", {
9
9
  const _core = require("@oclif/core");
10
10
  const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
11
11
  const _date = require("../../lib/helpers/date");
12
- const _object = require("../../lib/helpers/object");
12
+ const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
13
13
  const _page = require("../../lib/helpers/page");
14
14
  const _request = require("../../lib/helpers/request");
15
15
  function _interopRequireDefault(obj) {
@@ -25,7 +25,7 @@ class EmailLayoutList extends _baseCommand.default {
25
25
  this.render(resp.data);
26
26
  }
27
27
  async request(pageParams = {}) {
28
- const props = (0, _object.merge)(this.props, {
28
+ const props = (0, _objectIsomorphic.merge)(this.props, {
29
29
  flags: {
30
30
  ...pageParams
31
31
  }
@@ -11,7 +11,7 @@ const _core = require("@oclif/core");
11
11
  const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
12
12
  const _error = require("../../lib/helpers/error");
13
13
  const _flag = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/helpers/flag"));
14
- const _object = require("../../lib/helpers/object");
14
+ const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
15
15
  const _page = require("../../lib/helpers/page");
16
16
  const _request = require("../../lib/helpers/request");
17
17
  const _ux = require("../../lib/helpers/ux");
@@ -81,7 +81,7 @@ class EmailLayoutPull extends _baseCommand.default {
81
81
  if (!input) return;
82
82
  }
83
83
  const resp = await (0, _request.withSpinner)(()=>{
84
- const props = (0, _object.merge)(this.props, {
84
+ const props = (0, _objectIsomorphic.merge)(this.props, {
85
85
  args: {
86
86
  emailLayoutKey: dirContext.key
87
87
  },
@@ -114,7 +114,7 @@ class EmailLayoutPull extends _baseCommand.default {
114
114
  this.log(`‣ Successfully ${action} the layouts directory at ${targetDirCtx.abspath}`);
115
115
  }
116
116
  async listAllEmailLayouts(pageParams = {}, emailLayoutsFetchedSoFar = []) {
117
- const props = (0, _object.merge)(this.props, {
117
+ const props = (0, _objectIsomorphic.merge)(this.props, {
118
118
  flags: {
119
119
  ...pageParams,
120
120
  annotate: true,
@@ -11,7 +11,7 @@ const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/bas
11
11
  const _const = require("../../lib/helpers/const");
12
12
  const _error = require("../../lib/helpers/error");
13
13
  const _flag = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/helpers/flag"));
14
- const _object = require("../../lib/helpers/object");
14
+ const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
15
15
  const _request = require("../../lib/helpers/request");
16
16
  const _string = require("../../lib/helpers/string");
17
17
  const _ux = require("../../lib/helpers/ux");
@@ -89,7 +89,7 @@ class EmailLayoutPush extends _baseCommand.default {
89
89
  // 3. Finally push up each layout, abort on the first error.
90
90
  _ux.spinner.start(`‣ Pushing`);
91
91
  for (const layout of layouts){
92
- const props = (0, _object.merge)(this.props, {
92
+ const props = (0, _objectIsomorphic.merge)(this.props, {
93
93
  flags: {
94
94
  annotate: true
95
95
  }
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "default", {
9
9
  const _core = require("@oclif/core");
10
10
  const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
11
11
  const _date = require("../../lib/helpers/date");
12
- const _object = require("../../lib/helpers/object");
12
+ const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
13
13
  const _page = require("../../lib/helpers/page");
14
14
  const _request = require("../../lib/helpers/request");
15
15
  const _translation = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/marshal/translation"));
@@ -65,7 +65,7 @@ class TranslationList extends _baseCommand.default {
65
65
  this.render(resp.data);
66
66
  }
67
67
  async request(pageParams = {}) {
68
- const props = (0, _object.merge)(this.props, {
68
+ const props = (0, _objectIsomorphic.merge)(this.props, {
69
69
  flags: {
70
70
  ...pageParams
71
71
  }
@@ -10,7 +10,7 @@ const _core = require("@oclif/core");
10
10
  const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
11
11
  const _error = require("../../lib/helpers/error");
12
12
  const _flag = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/helpers/flag"));
13
- const _object = require("../../lib/helpers/object");
13
+ const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
14
14
  const _page = require("../../lib/helpers/page");
15
15
  const _request = require("../../lib/helpers/request");
16
16
  const _ux = require("../../lib/helpers/ux");
@@ -124,7 +124,7 @@ class TranslationPull extends _baseCommand.default {
124
124
  this.log(`‣ Successfully ${action} the translations directory at ${targetCtx.abspath}`);
125
125
  }
126
126
  async listAllTranslations(filters = {}, pageParams = {}, translationsFetchedSoFar = []) {
127
- const props = (0, _object.merge)(this.props, {
127
+ const props = (0, _objectIsomorphic.merge)(this.props, {
128
128
  flags: {
129
129
  ...pageParams,
130
130
  limit: _page.MAX_PAGINATION_LIMIT
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "default", {
9
9
  const _core = require("@oclif/core");
10
10
  const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
11
11
  const _date = require("../../lib/helpers/date");
12
- const _object = require("../../lib/helpers/object");
12
+ const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
13
13
  const _page = require("../../lib/helpers/page");
14
14
  const _request = require("../../lib/helpers/request");
15
15
  const _workflow = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/marshal/workflow"));
@@ -65,7 +65,7 @@ class WorkflowList extends _baseCommand.default {
65
65
  this.render(resp.data);
66
66
  }
67
67
  async request(pageParams = {}) {
68
- const props = (0, _object.merge)(this.props, {
68
+ const props = (0, _objectIsomorphic.merge)(this.props, {
69
69
  flags: {
70
70
  ...pageParams
71
71
  }