contensis-cli 1.0.0-beta.66 → 1.0.0-beta.67
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 +97 -24
- package/dist/commands/execute.js +93 -0
- package/dist/commands/execute.js.map +7 -0
- package/dist/commands/get.js +1 -1
- package/dist/commands/get.js.map +2 -2
- package/dist/commands/index.js +11 -5
- package/dist/commands/index.js.map +2 -2
- package/dist/localisation/en-GB.js +7 -5
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/services/ContensisCliService.js +14 -4
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/shell.js +5 -2
- package/dist/shell.js.map +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/execute.ts +106 -0
- package/src/commands/get.ts +1 -0
- package/src/commands/index.ts +11 -4
- package/src/localisation/en-GB.ts +20 -7
- package/src/services/ContensisCliService.ts +20 -5
- package/src/shell.ts +5 -2
- package/src/version.ts +1 -1
- package/dist/commands/release.js +0 -47
- package/dist/commands/release.js.map +0 -7
- package/src/commands/release.ts +0 -32
package/dist/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/version.ts"],
|
|
4
|
-
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.
|
|
4
|
+
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.67\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contensis-cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.67",
|
|
4
4
|
"description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
|
|
5
5
|
"repository": "https://github.com/contensis/node-cli",
|
|
6
6
|
"homepage": "https://github.com/contensis/node-cli/tree/main/packages/contensis-cli#readme",
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Argument, Command } from 'commander';
|
|
2
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
+
|
|
4
|
+
export const makeExecuteCommand = () => {
|
|
5
|
+
const execute = new Command()
|
|
6
|
+
.command('execute')
|
|
7
|
+
.description('execute block actions')
|
|
8
|
+
.addHelpText('after', `\n`)
|
|
9
|
+
.showHelpAfterError(true)
|
|
10
|
+
.exitOverride();
|
|
11
|
+
|
|
12
|
+
const block = execute
|
|
13
|
+
.command('block')
|
|
14
|
+
.description('execute block command to invoke block actions');
|
|
15
|
+
|
|
16
|
+
const action = block
|
|
17
|
+
.command('action')
|
|
18
|
+
.description('execute block action command to invoke block actions');
|
|
19
|
+
|
|
20
|
+
const blockIdArg = new Argument(
|
|
21
|
+
'<block-id>',
|
|
22
|
+
'the name of the block to perform action with'
|
|
23
|
+
);
|
|
24
|
+
const blockVersionArg = new Argument(
|
|
25
|
+
'<version>',
|
|
26
|
+
'the block version to perform action with'
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
action
|
|
30
|
+
.command('release')
|
|
31
|
+
.description('release a block version')
|
|
32
|
+
.addArgument(blockIdArg)
|
|
33
|
+
.addArgument(blockVersionArg)
|
|
34
|
+
.usage('<block-id> <version>')
|
|
35
|
+
.addHelpText(
|
|
36
|
+
'after',
|
|
37
|
+
`
|
|
38
|
+
Example call:
|
|
39
|
+
> execute block action release contensis-app 3\n`
|
|
40
|
+
)
|
|
41
|
+
.action(async (blockId: string, version: string, opts) => {
|
|
42
|
+
await cliCommand(
|
|
43
|
+
['execute', 'block', 'action', 'release', blockId],
|
|
44
|
+
opts
|
|
45
|
+
).ExecuteBlockAction('release', blockId, version);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
action
|
|
49
|
+
.command('makelive')
|
|
50
|
+
.description('make a block version live')
|
|
51
|
+
.addArgument(blockIdArg)
|
|
52
|
+
.addArgument(blockVersionArg)
|
|
53
|
+
.usage('<block-id> <version>')
|
|
54
|
+
.addHelpText(
|
|
55
|
+
'after',
|
|
56
|
+
`
|
|
57
|
+
Example call:
|
|
58
|
+
> execute block action makelive contensis-app 3\n`
|
|
59
|
+
)
|
|
60
|
+
.action(async (blockId: string, version: string, opts) => {
|
|
61
|
+
await cliCommand(
|
|
62
|
+
['execute', 'block', 'action', 'makelive', blockId],
|
|
63
|
+
opts
|
|
64
|
+
).ExecuteBlockAction('makeLive', blockId, version);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
action
|
|
68
|
+
.command('rollback')
|
|
69
|
+
.description('rollback a live block version to last live version')
|
|
70
|
+
.addArgument(blockIdArg)
|
|
71
|
+
.addArgument(blockVersionArg)
|
|
72
|
+
.usage('<block-id> <version>')
|
|
73
|
+
.addHelpText(
|
|
74
|
+
'after',
|
|
75
|
+
`
|
|
76
|
+
Example call:
|
|
77
|
+
> execute block action rollback contensis-app 3\n`
|
|
78
|
+
)
|
|
79
|
+
.action(async (blockId: string, version: string, opts) => {
|
|
80
|
+
await cliCommand(
|
|
81
|
+
['execute', 'block', 'action', 'rollback', blockId],
|
|
82
|
+
opts
|
|
83
|
+
).ExecuteBlockAction('rollback', blockId, version);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
action
|
|
87
|
+
.command('markasbroken')
|
|
88
|
+
.description('mark a block version as broken')
|
|
89
|
+
.addArgument(blockIdArg)
|
|
90
|
+
.addArgument(blockVersionArg)
|
|
91
|
+
.usage('<block-id> <version>')
|
|
92
|
+
.addHelpText(
|
|
93
|
+
'after',
|
|
94
|
+
`
|
|
95
|
+
Example call:
|
|
96
|
+
> execute block action markasbroken contensis-app 3\n`
|
|
97
|
+
)
|
|
98
|
+
.action(async (blockId: string, version: string, opts) => {
|
|
99
|
+
await cliCommand(
|
|
100
|
+
['execute', 'block', 'action', 'markasbroken', blockId],
|
|
101
|
+
opts
|
|
102
|
+
).ExecuteBlockAction('markAsBroken', blockId, version);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return execute;
|
|
106
|
+
};
|
package/src/commands/get.ts
CHANGED
package/src/commands/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { LIB_VERSION } from '~/version';
|
|
|
4
4
|
import { makeConnectCommand } from './connect';
|
|
5
5
|
import { makeCreateCommand } from './create';
|
|
6
6
|
import { makeDiffCommand } from './diff';
|
|
7
|
+
import { makeExecuteCommand } from './execute';
|
|
7
8
|
import { makeGetCommand } from './get';
|
|
8
9
|
import {
|
|
9
10
|
addAuthenticationOptions,
|
|
@@ -16,7 +17,6 @@ import { makeImportCommand } from './import';
|
|
|
16
17
|
import { makeListCommand } from './list';
|
|
17
18
|
import { makeLoginCommand } from './login';
|
|
18
19
|
import { makePushCommand } from './push';
|
|
19
|
-
import { makeReleaseCommand } from './release';
|
|
20
20
|
import { makeRemoveCommand } from './remove';
|
|
21
21
|
import { makeSetCommand } from './set';
|
|
22
22
|
|
|
@@ -31,6 +31,13 @@ const commands = () => {
|
|
|
31
31
|
: str.trim() && Logger.help(str);
|
|
32
32
|
},
|
|
33
33
|
})
|
|
34
|
+
.addHelpText(
|
|
35
|
+
'after',
|
|
36
|
+
Logger.helpText`
|
|
37
|
+
>> Each command has its own help - for example:
|
|
38
|
+
> login --help\n > get --help
|
|
39
|
+
`
|
|
40
|
+
)
|
|
34
41
|
.exitOverride()
|
|
35
42
|
.showHelpAfterError(true);
|
|
36
43
|
|
|
@@ -42,6 +49,9 @@ const commands = () => {
|
|
|
42
49
|
program.addCommand(
|
|
43
50
|
addGlobalOptions(makeCreateCommand()).copyInheritedSettings(program)
|
|
44
51
|
);
|
|
52
|
+
program.addCommand(
|
|
53
|
+
addGlobalOptions(makeExecuteCommand()).copyInheritedSettings(program)
|
|
54
|
+
);
|
|
45
55
|
program.addCommand(
|
|
46
56
|
addGlobalOptions(
|
|
47
57
|
addGetEntryOptions(addImportOptions(makeDiffCommand()))
|
|
@@ -64,9 +74,6 @@ const commands = () => {
|
|
|
64
74
|
program.addCommand(
|
|
65
75
|
addGlobalOptions(makePushCommand()).copyInheritedSettings(program)
|
|
66
76
|
);
|
|
67
|
-
program.addCommand(
|
|
68
|
-
addGlobalOptions(makeReleaseCommand()).copyInheritedSettings(program)
|
|
69
|
-
);
|
|
70
77
|
program.addCommand(
|
|
71
78
|
addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)
|
|
72
79
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BlockActionType,
|
|
2
3
|
BlockRunningStatus,
|
|
3
4
|
MigrateModelsResult,
|
|
4
5
|
MigrateStatus,
|
|
@@ -279,14 +280,26 @@ export const LogMessages = {
|
|
|
279
280
|
`[${env}] Unable to push block ${Logger.highlightText(
|
|
280
281
|
id
|
|
281
282
|
)} in project ${projectId}`,
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
actionComplete: (
|
|
284
|
+
action: BlockActionType,
|
|
285
|
+
id: string,
|
|
286
|
+
env: string,
|
|
287
|
+
projectId?: string
|
|
288
|
+
) =>
|
|
289
|
+
`[${env}] Block action ${Logger.highlightText(
|
|
290
|
+
action
|
|
291
|
+
)} on ${Logger.highlightText(
|
|
284
292
|
id
|
|
285
|
-
)} in project ${projectId}`,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
293
|
+
)} in project ${projectId} requested successfully`,
|
|
294
|
+
actionFailed: (
|
|
295
|
+
action: BlockActionType,
|
|
296
|
+
id: string,
|
|
297
|
+
env: string,
|
|
298
|
+
projectId?: string
|
|
299
|
+
) =>
|
|
300
|
+
`[${env}] Problem executing action ${Logger.highlightText(
|
|
301
|
+
action
|
|
302
|
+
)} on block ${Logger.highlightText(id)} in project ${projectId}`,
|
|
290
303
|
deleted: (id: string, env: string, projectId?: string) =>
|
|
291
304
|
`[${env}] Deleted block ${Logger.highlightText(
|
|
292
305
|
id
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
ContentTypesResult,
|
|
21
21
|
Model,
|
|
22
22
|
MigrateModelsResult,
|
|
23
|
+
BlockActionType,
|
|
23
24
|
} from 'migratortron';
|
|
24
25
|
import { Entry, Role } from 'contensis-management-api/lib/models';
|
|
25
26
|
|
|
@@ -1901,14 +1902,18 @@ class ContensisCli {
|
|
|
1901
1902
|
}
|
|
1902
1903
|
};
|
|
1903
1904
|
|
|
1904
|
-
|
|
1905
|
+
ExecuteBlockAction = async (
|
|
1906
|
+
action: BlockActionType,
|
|
1907
|
+
blockId: string,
|
|
1908
|
+
version: string
|
|
1909
|
+
) => {
|
|
1905
1910
|
const { currentEnv, env, log, messages } = this;
|
|
1906
1911
|
const contensis = await this.ConnectContensis();
|
|
1907
1912
|
if (contensis) {
|
|
1908
|
-
//
|
|
1913
|
+
// Execute block action
|
|
1909
1914
|
const [err, blockVersion] = await contensis.blocks.BlockAction(
|
|
1910
1915
|
blockId,
|
|
1911
|
-
|
|
1916
|
+
action,
|
|
1912
1917
|
version
|
|
1913
1918
|
);
|
|
1914
1919
|
|
|
@@ -1916,7 +1921,12 @@ class ContensisCli {
|
|
|
1916
1921
|
this.HandleFormattingAndOutput(blockVersion, () => {
|
|
1917
1922
|
// print the version detail to console
|
|
1918
1923
|
log.success(
|
|
1919
|
-
messages.blocks.
|
|
1924
|
+
messages.blocks.actionComplete(
|
|
1925
|
+
action,
|
|
1926
|
+
blockId,
|
|
1927
|
+
currentEnv,
|
|
1928
|
+
env.currentProject
|
|
1929
|
+
)
|
|
1920
1930
|
);
|
|
1921
1931
|
printBlockVersion(this, blockVersion);
|
|
1922
1932
|
});
|
|
@@ -1924,7 +1934,12 @@ class ContensisCli {
|
|
|
1924
1934
|
|
|
1925
1935
|
if (err) {
|
|
1926
1936
|
log.error(
|
|
1927
|
-
messages.blocks.
|
|
1937
|
+
messages.blocks.actionFailed(
|
|
1938
|
+
action,
|
|
1939
|
+
blockId,
|
|
1940
|
+
currentEnv,
|
|
1941
|
+
env.currentProject
|
|
1942
|
+
)
|
|
1928
1943
|
);
|
|
1929
1944
|
log.error(jsonFormatter(err));
|
|
1930
1945
|
}
|
package/src/shell.ts
CHANGED
|
@@ -139,6 +139,10 @@ class ContensisShell {
|
|
|
139
139
|
'create project',
|
|
140
140
|
'create role',
|
|
141
141
|
'diff models',
|
|
142
|
+
'execute block action release',
|
|
143
|
+
'execute block action makelive',
|
|
144
|
+
'execute block action rollback',
|
|
145
|
+
'execute block action markasbroken',
|
|
142
146
|
'get block',
|
|
143
147
|
'get block logs',
|
|
144
148
|
'get contenttype',
|
|
@@ -161,7 +165,6 @@ class ContensisShell {
|
|
|
161
165
|
'list roles',
|
|
162
166
|
'list webhooks',
|
|
163
167
|
'push block',
|
|
164
|
-
'release block',
|
|
165
168
|
'remove components',
|
|
166
169
|
'remove contenttypes',
|
|
167
170
|
'remove key',
|
|
@@ -182,7 +185,7 @@ class ContensisShell {
|
|
|
182
185
|
{
|
|
183
186
|
type: 'command',
|
|
184
187
|
name: 'cmd',
|
|
185
|
-
autoCompletion: availableCommands,
|
|
188
|
+
autoCompletion: availableCommands.sort(),
|
|
186
189
|
autocompletePrompt: log.infoText(messages.app.autocomplete()),
|
|
187
190
|
message: `${userId ? `${userId}@` : ''}${currentEnvironment || ''}>`,
|
|
188
191
|
context: 0,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.0.0-beta.
|
|
1
|
+
export const LIB_VERSION = "1.0.0-beta.67";
|
package/dist/commands/release.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var release_exports = {};
|
|
20
|
-
__export(release_exports, {
|
|
21
|
-
makeReleaseCommand: () => makeReleaseCommand
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(release_exports);
|
|
24
|
-
var import_commander = require("commander");
|
|
25
|
-
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
-
const makeReleaseCommand = () => {
|
|
27
|
-
const release = new import_commander.Command().command("release").description("release command").addHelpText("after", `
|
|
28
|
-
`).showHelpAfterError(true).exitOverride();
|
|
29
|
-
release.command("block").description("release a block version").argument("<block-id>", "the name of the block to release").argument("<version>", "the block version to release").usage("<block-id> <version>").addHelpText(
|
|
30
|
-
"after",
|
|
31
|
-
`
|
|
32
|
-
Example call:
|
|
33
|
-
> release block contensis-app 3
|
|
34
|
-
`
|
|
35
|
-
).action(async (blockId, version, opts) => {
|
|
36
|
-
await (0, import_ContensisCliService.cliCommand)(["release", "block", blockId], opts).ReleaseBlock(
|
|
37
|
-
blockId,
|
|
38
|
-
version
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
return release;
|
|
42
|
-
};
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
makeReleaseCommand
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=release.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/commands/release.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\n\nexport const makeReleaseCommand = () => {\n const release = new Command()\n .command('release')\n .description('release command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n release\n .command('block')\n .description('release a block version')\n .argument('<block-id>', 'the name of the block to release')\n .argument('<version>', 'the block version to release')\n .usage('<block-id> <version>')\n .addHelpText(\n 'after',\n `\nExample call:\n > release block contensis-app 3\\n`\n )\n .action(async (blockId: string, version: string, opts) => {\n await cliCommand(['release', 'block', blockId], opts).ReleaseBlock(\n blockId,\n version\n );\n });\n\n return release;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAEpB,MAAM,qBAAqB,MAAM;AACtC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,SAAS,EACjB,YAAY,iBAAiB,EAC7B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,OAAO,EACf,YAAY,yBAAyB,EACrC,SAAS,cAAc,kCAAkC,EACzD,SAAS,aAAa,8BAA8B,EACpD,MAAM,sBAAsB,EAC5B;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,SAAiB,SAAiB,SAAS;AACxD,cAAM,uCAAW,CAAC,WAAW,SAAS,OAAO,GAAG,IAAI,EAAE;AAAA,MACpD;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAEH,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/src/commands/release.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
-
|
|
4
|
-
export const makeReleaseCommand = () => {
|
|
5
|
-
const release = new Command()
|
|
6
|
-
.command('release')
|
|
7
|
-
.description('release command')
|
|
8
|
-
.addHelpText('after', `\n`)
|
|
9
|
-
.showHelpAfterError(true)
|
|
10
|
-
.exitOverride();
|
|
11
|
-
|
|
12
|
-
release
|
|
13
|
-
.command('block')
|
|
14
|
-
.description('release a block version')
|
|
15
|
-
.argument('<block-id>', 'the name of the block to release')
|
|
16
|
-
.argument('<version>', 'the block version to release')
|
|
17
|
-
.usage('<block-id> <version>')
|
|
18
|
-
.addHelpText(
|
|
19
|
-
'after',
|
|
20
|
-
`
|
|
21
|
-
Example call:
|
|
22
|
-
> release block contensis-app 3\n`
|
|
23
|
-
)
|
|
24
|
-
.action(async (blockId: string, version: string, opts) => {
|
|
25
|
-
await cliCommand(['release', 'block', blockId], opts).ReleaseBlock(
|
|
26
|
-
blockId,
|
|
27
|
-
version
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
return release;
|
|
32
|
-
};
|