@knocklabs/cli 0.2.0 → 0.2.2
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 +258 -36
- package/dist/commands/branch/create.js +56 -0
- package/dist/commands/branch/delete.js +60 -0
- package/dist/commands/branch/list.js +89 -0
- package/dist/commands/commit/get.js +4 -4
- package/dist/commands/commit/index.js +47 -2
- package/dist/commands/commit/list.js +61 -13
- package/dist/commands/guide/activate.js +48 -4
- package/dist/commands/guide/generate-types.js +4 -1
- package/dist/commands/guide/get.js +46 -3
- package/dist/commands/guide/list.js +46 -3
- package/dist/commands/guide/pull.js +6 -4
- package/dist/commands/guide/push.js +4 -3
- package/dist/commands/guide/validate.js +4 -3
- package/dist/commands/layout/get.js +46 -1
- package/dist/commands/layout/list.js +46 -1
- package/dist/commands/layout/pull.js +6 -2
- package/dist/commands/layout/push.js +4 -1
- package/dist/commands/layout/validate.js +4 -1
- package/dist/commands/login.js +1 -0
- package/dist/commands/logout.js +1 -0
- package/dist/commands/message-type/get.js +46 -3
- package/dist/commands/message-type/list.js +46 -3
- package/dist/commands/message-type/pull.js +6 -4
- package/dist/commands/message-type/push.js +4 -3
- package/dist/commands/message-type/validate.js +4 -3
- package/dist/commands/partial/get.js +46 -1
- package/dist/commands/partial/list.js +46 -1
- package/dist/commands/partial/pull.js +6 -2
- package/dist/commands/partial/push.js +4 -1
- package/dist/commands/partial/validate.js +6 -1
- package/dist/commands/pull.js +28 -8
- package/dist/commands/push.js +27 -8
- package/dist/commands/translation/get.js +5 -1
- package/dist/commands/translation/list.js +5 -1
- package/dist/commands/translation/pull.js +8 -3
- package/dist/commands/translation/push.js +4 -1
- package/dist/commands/translation/validate.js +4 -1
- package/dist/commands/whoami.js +7 -8
- package/dist/commands/workflow/activate.js +47 -3
- package/dist/commands/workflow/generate-types.js +4 -1
- package/dist/commands/workflow/get.js +9 -4
- package/dist/commands/workflow/list.js +5 -1
- package/dist/commands/workflow/pull.js +6 -2
- package/dist/commands/workflow/push.js +4 -1
- package/dist/commands/workflow/run.js +46 -2
- package/dist/commands/workflow/validate.js +4 -1
- package/dist/lib/api-v1.js +57 -20
- package/dist/lib/helpers/arg.js +24 -0
- package/dist/lib/helpers/command.js +14 -0
- package/dist/lib/helpers/flag.js +18 -0
- package/dist/lib/helpers/request.js +48 -2
- package/dist/lib/helpers/string.js +4 -0
- package/dist/lib/marshal/commit/index.js +0 -1
- package/dist/lib/marshal/index.isomorphic.js +8 -4
- package/dist/lib/marshal/reusable-step/helpers.js +72 -0
- package/dist/lib/marshal/reusable-step/index.js +19 -0
- package/dist/lib/marshal/reusable-step/processor.isomorphic.js +86 -0
- package/dist/lib/marshal/{commit → reusable-step}/types.js +0 -1
- package/dist/lib/resources.js +6 -1
- package/dist/lib/urls.js +4 -0
- package/oclif.manifest.json +489 -50
- package/package.json +16 -5
- package/dist/commands/ping.js +0 -37
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return BranchList;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _core = require("@oclif/core");
|
|
12
|
+
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _date = require("../../lib/helpers/date");
|
|
14
|
+
const _page = require("../../lib/helpers/page");
|
|
15
|
+
const _request = require("../../lib/helpers/request");
|
|
16
|
+
function _define_property(obj, key, value) {
|
|
17
|
+
if (key in obj) {
|
|
18
|
+
Object.defineProperty(obj, key, {
|
|
19
|
+
value: value,
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
obj[key] = value;
|
|
26
|
+
}
|
|
27
|
+
return obj;
|
|
28
|
+
}
|
|
29
|
+
function _interop_require_default(obj) {
|
|
30
|
+
return obj && obj.__esModule ? obj : {
|
|
31
|
+
default: obj
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
class BranchList extends _basecommand.default {
|
|
35
|
+
async run() {
|
|
36
|
+
const resp = await this.request();
|
|
37
|
+
const { flags } = this.props;
|
|
38
|
+
if (flags.json) return resp;
|
|
39
|
+
this.render(resp);
|
|
40
|
+
}
|
|
41
|
+
async request(pageParams = {}) {
|
|
42
|
+
const queryParams = (0, _page.toPageParams)({
|
|
43
|
+
...this.props.flags,
|
|
44
|
+
...pageParams
|
|
45
|
+
});
|
|
46
|
+
return (0, _request.withSpinnerV2)(()=>this.apiV1.mgmtClient.get("/v1/branches", {
|
|
47
|
+
query: queryParams
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
async render(data) {
|
|
51
|
+
const { entries } = data;
|
|
52
|
+
this.log(`‣ Showing ${entries.length} branches off of the development environment\n`);
|
|
53
|
+
_core.ux.table(entries, {
|
|
54
|
+
slug: {
|
|
55
|
+
header: "Slug"
|
|
56
|
+
},
|
|
57
|
+
created_at: {
|
|
58
|
+
header: "Created at",
|
|
59
|
+
get: (entry)=>(0, _date.formatDate)(entry.created_at)
|
|
60
|
+
},
|
|
61
|
+
updated_at: {
|
|
62
|
+
header: "Updated at",
|
|
63
|
+
get: (entry)=>(0, _date.formatDate)(entry.updated_at)
|
|
64
|
+
},
|
|
65
|
+
last_commit_at: {
|
|
66
|
+
header: "Last commit at",
|
|
67
|
+
get: (entry)=>entry.last_commit_at ? (0, _date.formatDate)(entry.last_commit_at) : "Never"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return this.prompt(data);
|
|
71
|
+
}
|
|
72
|
+
async prompt(data) {
|
|
73
|
+
const { page_info } = data;
|
|
74
|
+
const pageAction = await (0, _page.maybePromptPageAction)(page_info);
|
|
75
|
+
const pageParams = pageAction && (0, _page.paramsForPageAction)(pageAction, page_info);
|
|
76
|
+
if (pageParams) {
|
|
77
|
+
this.log("\n");
|
|
78
|
+
const resp = await this.request(pageParams);
|
|
79
|
+
return this.render(resp);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Hide until branches are released in GA
|
|
84
|
+
_define_property(BranchList, "hidden", true);
|
|
85
|
+
_define_property(BranchList, "summary", "Display all existing branches off of the development environment.");
|
|
86
|
+
_define_property(BranchList, "flags", {
|
|
87
|
+
..._page.pageFlags
|
|
88
|
+
});
|
|
89
|
+
_define_property(BranchList, "enableJsonFlag", true);
|
|
@@ -33,10 +33,10 @@ function _interop_require_default(obj) {
|
|
|
33
33
|
}
|
|
34
34
|
class CommitGet extends _basecommand.default {
|
|
35
35
|
async run() {
|
|
36
|
-
const { flags } = this.props;
|
|
37
|
-
const resp = await (0, _request.
|
|
38
|
-
if (flags.json) return resp
|
|
39
|
-
this.render(resp
|
|
36
|
+
const { flags, args } = this.props;
|
|
37
|
+
const resp = await (0, _request.withSpinnerV2)(()=>this.apiV1.mgmtClient.commits.retrieve(args.id));
|
|
38
|
+
if (flags.json) return resp;
|
|
39
|
+
this.render(resp);
|
|
40
40
|
}
|
|
41
41
|
render(commit) {
|
|
42
42
|
this.log(`‣ Showing commit \`${commit.id}\` in \`${commit.environment}\` environment`);
|
|
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _const = require("../../lib/helpers/const");
|
|
15
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
14
16
|
const _request = require("../../lib/helpers/request");
|
|
15
17
|
const _ux = require("../../lib/helpers/ux");
|
|
16
18
|
function _define_property(obj, key, value) {
|
|
@@ -31,16 +33,58 @@ function _interop_require_default(obj) {
|
|
|
31
33
|
default: obj
|
|
32
34
|
};
|
|
33
35
|
}
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
37
|
+
if (typeof WeakMap !== "function") return null;
|
|
38
|
+
var cacheBabelInterop = new WeakMap();
|
|
39
|
+
var cacheNodeInterop = new WeakMap();
|
|
40
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
41
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
42
|
+
})(nodeInterop);
|
|
43
|
+
}
|
|
44
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
45
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
48
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
49
|
+
return {
|
|
50
|
+
default: obj
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
54
|
+
if (cache && cache.has(obj)) {
|
|
55
|
+
return cache.get(obj);
|
|
56
|
+
}
|
|
57
|
+
var newObj = {
|
|
58
|
+
__proto__: null
|
|
59
|
+
};
|
|
60
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
61
|
+
for(var key in obj){
|
|
62
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
63
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
64
|
+
if (desc && (desc.get || desc.set)) {
|
|
65
|
+
Object.defineProperty(newObj, key, desc);
|
|
66
|
+
} else {
|
|
67
|
+
newObj[key] = obj[key];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
newObj.default = obj;
|
|
72
|
+
if (cache) {
|
|
73
|
+
cache.set(obj, newObj);
|
|
74
|
+
}
|
|
75
|
+
return newObj;
|
|
76
|
+
}
|
|
34
77
|
class Commit extends _basecommand.default {
|
|
35
78
|
async run() {
|
|
36
79
|
const { flags } = this.props;
|
|
80
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
37
81
|
// Confirm first as we are about to commit changes to go live in the
|
|
38
82
|
// development environment, unless forced.
|
|
39
|
-
const prompt =
|
|
83
|
+
const prompt = `Commit all changes in the ${scope}?`;
|
|
40
84
|
const input = flags.force || await (0, _ux.promptToConfirm)(prompt);
|
|
41
85
|
if (!input) return;
|
|
42
86
|
await (0, _request.withSpinner)(()=>this.apiV1.commitAllChanges(this.props));
|
|
43
|
-
this.log(`‣ Successfully committed all changes in
|
|
87
|
+
this.log(`‣ Successfully committed all changes in ${scope}`);
|
|
44
88
|
}
|
|
45
89
|
}
|
|
46
90
|
_define_property(Commit, "summary", "Commit all changes in development environment.");
|
|
@@ -52,6 +96,7 @@ _define_property(Commit, "flags", {
|
|
|
52
96
|
_const.KnockEnv.Development
|
|
53
97
|
]
|
|
54
98
|
}),
|
|
99
|
+
branch: _flag.branch,
|
|
55
100
|
"commit-message": _core.Flags.string({
|
|
56
101
|
summary: "Use the given value as the commit message.",
|
|
57
102
|
char: "m"
|
|
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _date = require("../../lib/helpers/date");
|
|
15
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
14
16
|
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
15
17
|
const _page = require("../../lib/helpers/page");
|
|
16
18
|
const _request = require("../../lib/helpers/request");
|
|
@@ -33,6 +35,47 @@ function _interop_require_default(obj) {
|
|
|
33
35
|
default: obj
|
|
34
36
|
};
|
|
35
37
|
}
|
|
38
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
39
|
+
if (typeof WeakMap !== "function") return null;
|
|
40
|
+
var cacheBabelInterop = new WeakMap();
|
|
41
|
+
var cacheNodeInterop = new WeakMap();
|
|
42
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
43
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
44
|
+
})(nodeInterop);
|
|
45
|
+
}
|
|
46
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
47
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
51
|
+
return {
|
|
52
|
+
default: obj
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
56
|
+
if (cache && cache.has(obj)) {
|
|
57
|
+
return cache.get(obj);
|
|
58
|
+
}
|
|
59
|
+
var newObj = {
|
|
60
|
+
__proto__: null
|
|
61
|
+
};
|
|
62
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
63
|
+
for(var key in obj){
|
|
64
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
65
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
66
|
+
if (desc && (desc.get || desc.set)) {
|
|
67
|
+
Object.defineProperty(newObj, key, desc);
|
|
68
|
+
} else {
|
|
69
|
+
newObj[key] = obj[key];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
newObj.default = obj;
|
|
74
|
+
if (cache) {
|
|
75
|
+
cache.set(obj, newObj);
|
|
76
|
+
}
|
|
77
|
+
return newObj;
|
|
78
|
+
}
|
|
36
79
|
class CommitList extends _basecommand.default {
|
|
37
80
|
async run() {
|
|
38
81
|
// Validate that resource-type and resource-id are used together
|
|
@@ -56,7 +99,7 @@ class CommitList extends _basecommand.default {
|
|
|
56
99
|
}
|
|
57
100
|
async render(data) {
|
|
58
101
|
const { entries } = data;
|
|
59
|
-
const {
|
|
102
|
+
const { promoted } = this.props.flags;
|
|
60
103
|
let qualifier = "";
|
|
61
104
|
if (promoted === true) {
|
|
62
105
|
qualifier = "(showing only promoted)";
|
|
@@ -64,32 +107,36 @@ class CommitList extends _basecommand.default {
|
|
|
64
107
|
if (promoted === false) {
|
|
65
108
|
qualifier = "(showing only unpromoted)";
|
|
66
109
|
}
|
|
67
|
-
|
|
110
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
111
|
+
this.log(`‣ Showing ${entries.length} commits in ${scope} ${qualifier}\n`);
|
|
68
112
|
/*
|
|
69
113
|
* Commits table
|
|
70
|
-
*/
|
|
114
|
+
*/ const formattedEntries = entries.map((entry)=>({
|
|
115
|
+
id: entry.id,
|
|
116
|
+
resource: entry.resource.type,
|
|
117
|
+
identifier: entry.resource.identifier,
|
|
118
|
+
author: (0, _commit.formatCommitAuthor)(entry),
|
|
119
|
+
commit_message: entry.commit_message ? entry.commit_message.trim() : "",
|
|
120
|
+
created_at: (0, _date.formatDate)(entry.created_at)
|
|
121
|
+
}));
|
|
122
|
+
_core.ux.table(formattedEntries, {
|
|
71
123
|
id: {
|
|
72
124
|
header: "ID"
|
|
73
125
|
},
|
|
74
126
|
resource: {
|
|
75
|
-
header: "Resource"
|
|
76
|
-
get: (entry)=>entry.resource.type
|
|
127
|
+
header: "Resource"
|
|
77
128
|
},
|
|
78
129
|
identifier: {
|
|
79
|
-
header: "Identifier"
|
|
80
|
-
get: (entry)=>entry.resource.identifier
|
|
130
|
+
header: "Identifier"
|
|
81
131
|
},
|
|
82
132
|
author: {
|
|
83
|
-
header: "Author"
|
|
84
|
-
get: (entry)=>(0, _commit.formatCommitAuthor)(entry)
|
|
133
|
+
header: "Author"
|
|
85
134
|
},
|
|
86
135
|
commit_message: {
|
|
87
|
-
header: "Commit message"
|
|
88
|
-
get: (entry)=>entry.commit_message ? entry.commit_message.trim() : ""
|
|
136
|
+
header: "Commit message"
|
|
89
137
|
},
|
|
90
138
|
created_at: {
|
|
91
|
-
header: "Created at"
|
|
92
|
-
get: (entry)=>(0, _date.formatDate)(entry.created_at)
|
|
139
|
+
header: "Created at"
|
|
93
140
|
}
|
|
94
141
|
});
|
|
95
142
|
return this.prompt(data);
|
|
@@ -111,6 +158,7 @@ _define_property(CommitList, "flags", {
|
|
|
111
158
|
default: "development",
|
|
112
159
|
summary: "The environment to use."
|
|
113
160
|
}),
|
|
161
|
+
branch: _flag.branch,
|
|
114
162
|
promoted: _core.Flags.boolean({
|
|
115
163
|
summary: "Show only promoted or unpromoted changes between the given environment and the subsequent environment.",
|
|
116
164
|
allowNo: true
|
|
@@ -10,7 +10,8 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
-
const
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
14
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
14
15
|
const _request = require("../../lib/helpers/request");
|
|
15
16
|
const _ux = require("../../lib/helpers/ux");
|
|
16
17
|
function _define_property(obj, key, value) {
|
|
@@ -31,9 +32,51 @@ function _interop_require_default(obj) {
|
|
|
31
32
|
default: obj
|
|
32
33
|
};
|
|
33
34
|
}
|
|
35
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
36
|
+
if (typeof WeakMap !== "function") return null;
|
|
37
|
+
var cacheBabelInterop = new WeakMap();
|
|
38
|
+
var cacheNodeInterop = new WeakMap();
|
|
39
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
40
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
41
|
+
})(nodeInterop);
|
|
42
|
+
}
|
|
43
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
44
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
45
|
+
return obj;
|
|
46
|
+
}
|
|
47
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
48
|
+
return {
|
|
49
|
+
default: obj
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
53
|
+
if (cache && cache.has(obj)) {
|
|
54
|
+
return cache.get(obj);
|
|
55
|
+
}
|
|
56
|
+
var newObj = {
|
|
57
|
+
__proto__: null
|
|
58
|
+
};
|
|
59
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
60
|
+
for(var key in obj){
|
|
61
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
62
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
63
|
+
if (desc && (desc.get || desc.set)) {
|
|
64
|
+
Object.defineProperty(newObj, key, desc);
|
|
65
|
+
} else {
|
|
66
|
+
newObj[key] = obj[key];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
newObj.default = obj;
|
|
71
|
+
if (cache) {
|
|
72
|
+
cache.set(obj, newObj);
|
|
73
|
+
}
|
|
74
|
+
return newObj;
|
|
75
|
+
}
|
|
34
76
|
class GuideActivate extends _basecommand.default {
|
|
35
77
|
async run() {
|
|
36
78
|
const { args, flags } = this.props;
|
|
79
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
37
80
|
// Validate that either status OR from/until is provided
|
|
38
81
|
const hasStatus = flags.status !== undefined;
|
|
39
82
|
const hasFrom = Boolean(flags.from);
|
|
@@ -52,7 +95,7 @@ class GuideActivate extends _basecommand.default {
|
|
|
52
95
|
action = `Deactivate at ${flags.until}`;
|
|
53
96
|
}
|
|
54
97
|
// 1. Confirm before activating or deactivating the guide, unless forced.
|
|
55
|
-
const prompt = `${action} \`${args.guideKey}\` guide in
|
|
98
|
+
const prompt = `${action} \`${args.guideKey}\` guide in ${scope}?`;
|
|
56
99
|
const input = flags.force || await (0, _ux.promptToConfirm)(prompt);
|
|
57
100
|
if (!input) return;
|
|
58
101
|
// 2. Proceed to make a request to set the guide status.
|
|
@@ -73,7 +116,7 @@ class GuideActivate extends _basecommand.default {
|
|
|
73
116
|
} else {
|
|
74
117
|
actioned = "scheduled";
|
|
75
118
|
}
|
|
76
|
-
this.log(`‣ Successfully ${actioned} \`${args.guideKey}\` guide in
|
|
119
|
+
this.log(`‣ Successfully ${actioned} \`${args.guideKey}\` guide in ${scope}`);
|
|
77
120
|
}
|
|
78
121
|
}
|
|
79
122
|
_define_property(GuideActivate, "summary", "Activate or deactivate a guide in a given environment.");
|
|
@@ -81,7 +124,7 @@ _define_property(GuideActivate, "description", `
|
|
|
81
124
|
This enables or disables a guide in a given environment without
|
|
82
125
|
needing to go through environment promotion.
|
|
83
126
|
|
|
84
|
-
You can activate or deactivate a guide immediately or schedule it to be activated
|
|
127
|
+
You can activate or deactivate a guide immediately or schedule it to be activated
|
|
85
128
|
or deactivated at a later time using the --from and --until flags.
|
|
86
129
|
`.trim());
|
|
87
130
|
_define_property(GuideActivate, "flags", {
|
|
@@ -91,6 +134,7 @@ _define_property(GuideActivate, "flags", {
|
|
|
91
134
|
required: true,
|
|
92
135
|
summary: "The environment to use."
|
|
93
136
|
}),
|
|
137
|
+
branch: _flag.branch,
|
|
94
138
|
status: (0, _flag.booleanStr)({
|
|
95
139
|
summary: "The guide active status to set. Cannot be used with --from/--until.",
|
|
96
140
|
exclusive: [
|
|
@@ -12,6 +12,7 @@ const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
|
12
12
|
const _core = require("@oclif/core");
|
|
13
13
|
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
14
14
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
15
|
+
const _command = require("../../lib/helpers/command");
|
|
15
16
|
const _const = require("../../lib/helpers/const");
|
|
16
17
|
const _error = require("../../lib/helpers/error");
|
|
17
18
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
@@ -109,7 +110,8 @@ class GuideGenerateTypes extends _basecommand.default {
|
|
|
109
110
|
const lines = _guide.generateIndexTypeTS(mapping);
|
|
110
111
|
await _fsextra.appendFile(outputFilePath, lines.join("\n"));
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
114
|
+
this.log(`‣ Successfully generated types for ${count} message type(s) using ${scope} and wrote them to ${outputFilePath}`);
|
|
113
115
|
}
|
|
114
116
|
async listAllGuides(pageParams = {}, guidesFetchedSoFar = []) {
|
|
115
117
|
const props = (0, _objectisomorphic.merge)(this.props, {
|
|
@@ -141,6 +143,7 @@ _define_property(GuideGenerateTypes, "flags", {
|
|
|
141
143
|
summary: "Select the environment to generate types for.",
|
|
142
144
|
default: _const.KnockEnv.Development
|
|
143
145
|
}),
|
|
146
|
+
branch: _flag.branch,
|
|
144
147
|
"output-file": _flag.filePath({
|
|
145
148
|
summary: `The output file to write the generated types to. We currently support ${supportedExts} files only. Your file extension will determine the target language for the generated types.`,
|
|
146
149
|
required: true
|
|
@@ -10,8 +10,10 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _date = require("../../lib/helpers/date");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
16
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
15
17
|
const _request = require("../../lib/helpers/request");
|
|
16
18
|
const _ux = require("../../lib/helpers/ux");
|
|
17
19
|
const _conditions = require("../../lib/marshal/conditions");
|
|
@@ -34,6 +36,47 @@ function _interop_require_default(obj) {
|
|
|
34
36
|
default: obj
|
|
35
37
|
};
|
|
36
38
|
}
|
|
39
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
40
|
+
if (typeof WeakMap !== "function") return null;
|
|
41
|
+
var cacheBabelInterop = new WeakMap();
|
|
42
|
+
var cacheNodeInterop = new WeakMap();
|
|
43
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
44
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
45
|
+
})(nodeInterop);
|
|
46
|
+
}
|
|
47
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
48
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
52
|
+
return {
|
|
53
|
+
default: obj
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
57
|
+
if (cache && cache.has(obj)) {
|
|
58
|
+
return cache.get(obj);
|
|
59
|
+
}
|
|
60
|
+
var newObj = {
|
|
61
|
+
__proto__: null
|
|
62
|
+
};
|
|
63
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
64
|
+
for(var key in obj){
|
|
65
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
66
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
67
|
+
if (desc && (desc.get || desc.set)) {
|
|
68
|
+
Object.defineProperty(newObj, key, desc);
|
|
69
|
+
} else {
|
|
70
|
+
newObj[key] = obj[key];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
newObj.default = obj;
|
|
75
|
+
if (cache) {
|
|
76
|
+
cache.set(obj, newObj);
|
|
77
|
+
}
|
|
78
|
+
return newObj;
|
|
79
|
+
}
|
|
37
80
|
class GuideGet extends _basecommand.default {
|
|
38
81
|
async run() {
|
|
39
82
|
_ux.spinner.start("‣ Loading");
|
|
@@ -57,7 +100,8 @@ class GuideGet extends _basecommand.default {
|
|
|
57
100
|
const { guideKey } = this.props.args;
|
|
58
101
|
const { environment: env, "hide-uncommitted-changes": committedOnly } = this.props.flags;
|
|
59
102
|
const qualifier = env === "development" && !committedOnly ? "(including uncommitted)" : "";
|
|
60
|
-
|
|
103
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
104
|
+
this.log(`‣ Showing guide \`${guideKey}\` in ${scope} ${qualifier}\n`);
|
|
61
105
|
/*
|
|
62
106
|
* Guide table
|
|
63
107
|
*/ const rows = [
|
|
@@ -120,13 +164,12 @@ class GuideGet extends _basecommand.default {
|
|
|
120
164
|
}
|
|
121
165
|
}
|
|
122
166
|
_define_property(GuideGet, "summary", "Display a single guide from an environment.");
|
|
123
|
-
// Hide until guides are released in GA.
|
|
124
|
-
_define_property(GuideGet, "hidden", true);
|
|
125
167
|
_define_property(GuideGet, "flags", {
|
|
126
168
|
environment: _core.Flags.string({
|
|
127
169
|
default: "development",
|
|
128
170
|
summary: "The environment to use."
|
|
129
171
|
}),
|
|
172
|
+
branch: _flag.branch,
|
|
130
173
|
"hide-uncommitted-changes": _core.Flags.boolean({
|
|
131
174
|
summary: "Hide any uncommitted changes."
|
|
132
175
|
})
|
|
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _date = require("../../lib/helpers/date");
|
|
15
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
14
16
|
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
15
17
|
const _page = require("../../lib/helpers/page");
|
|
16
18
|
const _request = require("../../lib/helpers/request");
|
|
@@ -33,6 +35,47 @@ function _interop_require_default(obj) {
|
|
|
33
35
|
default: obj
|
|
34
36
|
};
|
|
35
37
|
}
|
|
38
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
39
|
+
if (typeof WeakMap !== "function") return null;
|
|
40
|
+
var cacheBabelInterop = new WeakMap();
|
|
41
|
+
var cacheNodeInterop = new WeakMap();
|
|
42
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
43
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
44
|
+
})(nodeInterop);
|
|
45
|
+
}
|
|
46
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
47
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
51
|
+
return {
|
|
52
|
+
default: obj
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
56
|
+
if (cache && cache.has(obj)) {
|
|
57
|
+
return cache.get(obj);
|
|
58
|
+
}
|
|
59
|
+
var newObj = {
|
|
60
|
+
__proto__: null
|
|
61
|
+
};
|
|
62
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
63
|
+
for(var key in obj){
|
|
64
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
65
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
66
|
+
if (desc && (desc.get || desc.set)) {
|
|
67
|
+
Object.defineProperty(newObj, key, desc);
|
|
68
|
+
} else {
|
|
69
|
+
newObj[key] = obj[key];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
newObj.default = obj;
|
|
74
|
+
if (cache) {
|
|
75
|
+
cache.set(obj, newObj);
|
|
76
|
+
}
|
|
77
|
+
return newObj;
|
|
78
|
+
}
|
|
36
79
|
class GuideList extends _basecommand.default {
|
|
37
80
|
async run() {
|
|
38
81
|
const resp = await this.request();
|
|
@@ -52,7 +95,8 @@ class GuideList extends _basecommand.default {
|
|
|
52
95
|
const { entries } = data;
|
|
53
96
|
const { environment: env, "hide-uncommitted-changes": committedOnly } = this.props.flags;
|
|
54
97
|
const qualifier = env === "development" && !committedOnly ? "(including uncommitted)" : "";
|
|
55
|
-
|
|
98
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
99
|
+
this.log(`‣ Showing ${entries.length} guides in ${scope} ${qualifier}\n`);
|
|
56
100
|
/*
|
|
57
101
|
* Guides list table
|
|
58
102
|
*/ _core.ux.table(entries, {
|
|
@@ -97,13 +141,12 @@ class GuideList extends _basecommand.default {
|
|
|
97
141
|
}
|
|
98
142
|
}
|
|
99
143
|
_define_property(GuideList, "summary", "Display all guides for an environment.");
|
|
100
|
-
// Hide until guides are released in GA.
|
|
101
|
-
_define_property(GuideList, "hidden", true);
|
|
102
144
|
_define_property(GuideList, "flags", {
|
|
103
145
|
environment: _core.Flags.string({
|
|
104
146
|
default: "development",
|
|
105
147
|
summary: "The environment to use."
|
|
106
148
|
}),
|
|
149
|
+
branch: _flag.branch,
|
|
107
150
|
"hide-uncommitted-changes": _core.Flags.boolean({
|
|
108
151
|
summary: "Hide any uncommitted changes."
|
|
109
152
|
}),
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
|
|
12
12
|
const _core = require("@oclif/core");
|
|
13
13
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
14
|
+
const _command = require("../../lib/helpers/command");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
15
16
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
16
17
|
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
@@ -109,7 +110,8 @@ class GuidePull extends _basecommand.default {
|
|
|
109
110
|
});
|
|
110
111
|
await _guide.writeGuideDirFromData(dirContext, resp.data);
|
|
111
112
|
const action = dirContext.exists ? "updated" : "created";
|
|
112
|
-
|
|
113
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
114
|
+
this.log(`‣ Successfully ${action} \`${dirContext.key}\` at ${dirContext.abspath} using ${scope}`);
|
|
113
115
|
}
|
|
114
116
|
async pullAllGuides() {
|
|
115
117
|
const { flags } = this.props;
|
|
@@ -126,7 +128,8 @@ class GuidePull extends _basecommand.default {
|
|
|
126
128
|
await _guide.writeGuidesIndexDir(targetDirCtx, guides);
|
|
127
129
|
_ux.spinner.stop();
|
|
128
130
|
const action = targetDirCtx.exists ? "updated" : "created";
|
|
129
|
-
|
|
131
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
132
|
+
this.log(`‣ Successfully ${action} the guides directory at ${targetDirCtx.abspath} using ${scope}`);
|
|
130
133
|
}
|
|
131
134
|
async listAllGuides(pageParams = {}, guidesFetchedSoFar = []) {
|
|
132
135
|
const props = (0, _objectisomorphic.merge)(this.props, {
|
|
@@ -178,14 +181,13 @@ class GuidePull extends _basecommand.default {
|
|
|
178
181
|
return this.error("Missing 1 required arg:\nguideKey");
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
|
-
// Hide until guides are released in GA.
|
|
182
|
-
_define_property(GuidePull, "hidden", true);
|
|
183
184
|
_define_property(GuidePull, "summary", "Pull one or more guides from an environment into a local file system.");
|
|
184
185
|
_define_property(GuidePull, "flags", {
|
|
185
186
|
environment: _core.Flags.string({
|
|
186
187
|
default: "development",
|
|
187
188
|
summary: "The environment to use."
|
|
188
189
|
}),
|
|
190
|
+
branch: _flag.branch,
|
|
189
191
|
all: _core.Flags.boolean({
|
|
190
192
|
summary: "Whether to pull all guides from the specified environment."
|
|
191
193
|
}),
|
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _const = require("../../lib/helpers/const");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
15
16
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
@@ -130,11 +131,10 @@ class GuidePush extends _basecommand.default {
|
|
|
130
131
|
// 4. Display a success message.
|
|
131
132
|
const guideKeys = guides.map((g)=>g.key);
|
|
132
133
|
const actioned = flags.commit ? "pushed and committed" : "pushed";
|
|
133
|
-
|
|
134
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
135
|
+
this.log(`‣ Successfully ${actioned} ${guides.length} guide(s) to ${scope}:\n` + (0, _string.indentString)(guideKeys.join("\n"), 4));
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
|
-
// Hide until guides are released in GA.
|
|
137
|
-
_define_property(GuidePush, "hidden", true);
|
|
138
138
|
_define_property(GuidePush, "summary", "Push one or more guides from a local file system to Knock.");
|
|
139
139
|
_define_property(GuidePush, "flags", {
|
|
140
140
|
environment: _core.Flags.string({
|
|
@@ -144,6 +144,7 @@ _define_property(GuidePush, "flags", {
|
|
|
144
144
|
_const.KnockEnv.Development
|
|
145
145
|
]
|
|
146
146
|
}),
|
|
147
|
+
branch: _flag.branch,
|
|
147
148
|
all: _core.Flags.boolean({
|
|
148
149
|
summary: "Whether to push all guides from the target directory."
|
|
149
150
|
}),
|