contensis-cli 1.0.0-beta.9 → 1.0.0-beta.90
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 +1146 -78
- package/cli.js +3 -0
- package/dist/commands/connect.js +3 -3
- package/dist/commands/connect.js.map +2 -2
- package/dist/commands/create.js +45 -10
- package/dist/commands/create.js.map +2 -2
- package/dist/commands/dev.js +75 -0
- package/dist/commands/dev.js.map +7 -0
- package/dist/commands/diff.js +57 -0
- package/dist/commands/diff.js.map +7 -0
- package/dist/commands/execute.js +103 -0
- package/dist/commands/execute.js.map +7 -0
- package/dist/commands/get.js +169 -32
- package/dist/commands/get.js.map +3 -3
- package/dist/commands/globalOptions.js +37 -12
- package/dist/commands/globalOptions.js.map +2 -2
- package/dist/commands/import.js +47 -12
- package/dist/commands/import.js.map +2 -2
- package/dist/commands/index.js +22 -2
- package/dist/commands/index.js.map +2 -2
- package/dist/commands/list.js +53 -10
- package/dist/commands/list.js.map +2 -2
- package/dist/commands/login.js +2 -2
- package/dist/commands/login.js.map +2 -2
- package/dist/commands/push.js +17 -13
- package/dist/commands/push.js.map +2 -2
- package/dist/commands/remove.js +51 -8
- package/dist/commands/remove.js.map +2 -2
- package/dist/commands/set.js +139 -12
- package/dist/commands/set.js.map +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/localisation/en-GB.js +259 -49
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +56 -0
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +7 -0
- package/dist/mappers/DevInit-to-CIWorkflow.js +127 -0
- package/dist/mappers/DevInit-to-CIWorkflow.js.map +7 -0
- package/dist/mappers/DevInit-to-RolePermissions.js +54 -0
- package/dist/mappers/DevInit-to-RolePermissions.js.map +7 -0
- package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js +56 -0
- package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js.map +7 -0
- package/dist/models/CliService.d.js +17 -0
- package/dist/models/CliService.d.js.map +7 -0
- package/dist/models/DevService.d.js +17 -0
- package/dist/models/DevService.d.js.map +7 -0
- package/dist/providers/CredentialProvider.js +46 -14
- package/dist/providers/CredentialProvider.js.map +3 -3
- package/dist/providers/SessionCacheProvider.js +21 -1
- package/dist/providers/SessionCacheProvider.js.map +2 -2
- package/dist/providers/file-provider.js +12 -6
- package/dist/providers/file-provider.js.map +3 -3
- package/dist/services/ContensisCliService.js +1148 -421
- package/dist/services/ContensisCliService.js.map +3 -3
- package/dist/services/ContensisDevService.js +309 -0
- package/dist/services/ContensisDevService.js.map +7 -0
- package/dist/services/ContensisRoleService.js +87 -0
- package/dist/services/ContensisRoleService.js.map +7 -0
- package/dist/shell.js +58 -18
- package/dist/shell.js.map +3 -3
- package/dist/util/console.printer.js +171 -55
- package/dist/util/console.printer.js.map +2 -2
- package/dist/util/diff.js +102 -0
- package/dist/util/diff.js.map +7 -0
- package/dist/util/dotenv.js +57 -0
- package/dist/util/dotenv.js.map +7 -0
- package/dist/util/find.js +31 -0
- package/dist/util/find.js.map +7 -0
- package/dist/util/git.js +126 -0
- package/dist/util/git.js.map +7 -0
- package/dist/util/index.js +8 -2
- package/dist/util/index.js.map +3 -3
- package/dist/util/logger.js +90 -29
- package/dist/util/logger.js.map +3 -3
- package/dist/util/os.js +39 -0
- package/dist/util/os.js.map +7 -0
- package/dist/util/timers.js +49 -0
- package/dist/util/timers.js.map +7 -0
- package/dist/util/yaml.js +45 -0
- package/dist/util/yaml.js.map +7 -0
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/esbuild.config.js +3 -1
- package/package.json +12 -3
- package/src/commands/connect.ts +3 -2
- package/src/commands/create.ts +61 -8
- package/src/commands/dev.ts +69 -0
- package/src/commands/diff.ts +41 -0
- package/src/commands/execute.ts +117 -0
- package/src/commands/get.ts +242 -28
- package/src/commands/globalOptions.ts +42 -12
- package/src/commands/import.ts +58 -8
- package/src/commands/index.ts +22 -1
- package/src/commands/list.ts +85 -11
- package/src/commands/login.ts +2 -1
- package/src/commands/push.ts +18 -11
- package/src/commands/remove.ts +66 -4
- package/src/commands/set.ts +189 -9
- package/src/index.ts +1 -4
- package/src/localisation/en-GB.ts +374 -66
- package/src/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.ts +44 -0
- package/src/mappers/DevInit-to-CIWorkflow.ts +150 -0
- package/src/mappers/DevInit-to-RolePermissions.ts +33 -0
- package/src/mappers/DevRequests-to-RequestHanderSiteConfigYaml.ts +44 -0
- package/src/models/CliService.d.ts +36 -0
- package/src/models/DevService.d.ts +5 -0
- package/src/models/JsModules.d.ts +1 -0
- package/src/providers/CredentialProvider.ts +51 -18
- package/src/providers/SessionCacheProvider.ts +29 -2
- package/src/providers/file-provider.ts +17 -6
- package/src/services/ContensisCliService.ts +1458 -518
- package/src/services/ContensisDevService.ts +365 -0
- package/src/services/ContensisRoleService.ts +76 -0
- package/src/shell.ts +68 -18
- package/src/util/console.printer.ts +240 -78
- package/src/util/diff.ts +113 -0
- package/src/util/dotenv.ts +37 -0
- package/src/util/find.ts +8 -0
- package/src/util/git.ts +130 -0
- package/src/util/index.ts +16 -7
- package/src/util/logger.ts +145 -31
- package/src/util/os.ts +7 -0
- package/src/util/timers.ts +24 -0
- package/src/util/yaml.ts +13 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
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 yaml_exports = {};
|
|
20
|
+
__export(yaml_exports, {
|
|
21
|
+
parseYaml: () => parseYaml,
|
|
22
|
+
parseYamlDocument: () => parseYamlDocument,
|
|
23
|
+
stringifyYaml: () => stringifyYaml,
|
|
24
|
+
validateWorkflowYaml: () => validateWorkflowYaml
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(yaml_exports);
|
|
27
|
+
var import_core = require("@action-validator/core");
|
|
28
|
+
var import_yaml = require("yaml");
|
|
29
|
+
const parseYaml = import_yaml.parse;
|
|
30
|
+
const parseYamlDocument = import_yaml.parseDocument;
|
|
31
|
+
const stringifyYaml = import_yaml.stringify;
|
|
32
|
+
const validateWorkflowYaml = (yaml) => {
|
|
33
|
+
const { actionType, errors } = (0, import_core.validateWorkflow)(yaml);
|
|
34
|
+
if (actionType && errors.length === 0)
|
|
35
|
+
return true;
|
|
36
|
+
return errors;
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
parseYaml,
|
|
41
|
+
parseYamlDocument,
|
|
42
|
+
stringifyYaml,
|
|
43
|
+
validateWorkflowYaml
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=yaml.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/util/yaml.ts"],
|
|
4
|
+
"sourcesContent": ["import { validateWorkflow } from '@action-validator/core';\n\nimport { parse, parseDocument, stringify } from 'yaml';\n\nexport const parseYaml = parse;\nexport const parseYamlDocument = parseDocument;\nexport const stringifyYaml = stringify;\n\nexport const validateWorkflowYaml = (yaml: string) => {\n const { actionType, errors } = validateWorkflow(yaml);\n if (actionType && errors.length === 0) return true;\n return errors;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAEjC,kBAAgD;AAEzC,MAAM,YAAY;AAClB,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AAEtB,MAAM,uBAAuB,CAAC,SAAiB;AACpD,QAAM,EAAE,YAAY,OAAO,QAAI,8BAAiB,IAAI;AACpD,MAAI,cAAc,OAAO,WAAW;AAAG,WAAO;AAC9C,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/version.js
CHANGED
|
@@ -21,7 +21,7 @@ __export(version_exports, {
|
|
|
21
21
|
LIB_VERSION: () => LIB_VERSION
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const LIB_VERSION = "1.0.0-beta.
|
|
24
|
+
const LIB_VERSION = "1.0.0-beta.90";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
LIB_VERSION
|
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.90\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/esbuild.config.js
CHANGED
|
@@ -23,7 +23,9 @@ rimraf('./dist', () => {
|
|
|
23
23
|
platform: 'node',
|
|
24
24
|
format: 'cjs',
|
|
25
25
|
sourcemap: true,
|
|
26
|
-
|
|
26
|
+
// needs to be node12 to transform dynamic imports into requires
|
|
27
|
+
// so the bundles are compatible with the pkg exe builds
|
|
28
|
+
target: 'node12',
|
|
27
29
|
plugins: [globPlugin(), nodeExternalsPlugin()],
|
|
28
30
|
watch: watch && {
|
|
29
31
|
onRebuild(error) {
|
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.90",
|
|
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",
|
|
@@ -23,30 +23,39 @@
|
|
|
23
23
|
"author": "Zengenti",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@action-validator/core": "^0.5.3",
|
|
26
27
|
"app-root-path": "^3.1.0",
|
|
27
28
|
"chalk": "^4.1.2",
|
|
28
29
|
"commander": "^9.4.1",
|
|
29
30
|
"csv": "^6.1.0",
|
|
30
31
|
"dayjs": "^1.11.6",
|
|
32
|
+
"diff": "^5.1.0",
|
|
31
33
|
"figlet": "^1.5.2",
|
|
32
34
|
"flat": "^5.0.2",
|
|
35
|
+
"giturl": "^2.0.0",
|
|
36
|
+
"hosted-git-info": "^6.1.1",
|
|
33
37
|
"inquirer-command-prompt": "^0.1.0",
|
|
34
38
|
"json2csv": "^5.0.7",
|
|
35
39
|
"jsonpath-mapper": "^1.1.0",
|
|
36
40
|
"keytar": "^7.9.0",
|
|
37
41
|
"lodash": "^4.17.21",
|
|
38
|
-
"migratortron": "^1.0.0-beta.
|
|
42
|
+
"migratortron": "^1.0.0-beta.32",
|
|
39
43
|
"node-fetch": "^2.6.7",
|
|
44
|
+
"parse-git-config": "^3.0.0",
|
|
40
45
|
"patch-package": "^6.4.7",
|
|
41
|
-
"
|
|
46
|
+
"printable-characters": "^1.0.42",
|
|
47
|
+
"xml2js": "^0.4.23",
|
|
48
|
+
"yaml": "^2.3.1"
|
|
42
49
|
},
|
|
43
50
|
"devDependencies": {
|
|
44
51
|
"@types/figlet": "^1.5.4",
|
|
45
52
|
"@types/flat": "^5.0.2",
|
|
53
|
+
"@types/hosted-git-info": "^3.0.2",
|
|
46
54
|
"@types/inquirer": "^8.2.1",
|
|
47
55
|
"@types/json2csv": "^5.0.3",
|
|
48
56
|
"@types/lodash": "^4.14.182",
|
|
49
57
|
"@types/node-fetch": "^2.6.1",
|
|
58
|
+
"@types/parse-git-config": "^3.0.1",
|
|
50
59
|
"@types/xml2js": "^0.4.11",
|
|
51
60
|
"esbuild": "^0.14.43",
|
|
52
61
|
"esbuild-node-externals": "^1.4.1",
|
package/src/commands/connect.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { project } from './globalOptions';
|
|
|
6
6
|
export const makeConnectCommand = () => {
|
|
7
7
|
const connect = new Command()
|
|
8
8
|
.command('connect')
|
|
9
|
+
.description('connect to a Contensis instance')
|
|
9
10
|
.argument('<alias>', 'the Contensis Cloud alias to connect with')
|
|
10
11
|
.addOption(project)
|
|
11
12
|
.usage('<alias>')
|
|
@@ -16,8 +17,8 @@ Example call:
|
|
|
16
17
|
> connect example-dev`
|
|
17
18
|
)
|
|
18
19
|
.action(async (alias, opts) => {
|
|
19
|
-
await cliCommand(['connect', alias], opts).Connect(alias);
|
|
20
|
-
await shell().
|
|
20
|
+
await cliCommand(['connect', alias], { ...opts, alias }).Connect(alias);
|
|
21
|
+
await shell().restart();
|
|
21
22
|
});
|
|
22
23
|
return connect;
|
|
23
24
|
};
|
package/src/commands/create.ts
CHANGED
|
@@ -1,26 +1,57 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
import { Project } from 'contensis-core-api';
|
|
2
3
|
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
4
|
import { shell } from '~/shell';
|
|
5
|
+
import { isUuid } from '~/util';
|
|
4
6
|
|
|
5
7
|
export const makeCreateCommand = () => {
|
|
6
8
|
const create = new Command()
|
|
7
9
|
.command('create')
|
|
10
|
+
.description('create command')
|
|
11
|
+
.addHelpText('after', `\n`)
|
|
8
12
|
.showHelpAfterError(true)
|
|
9
13
|
.exitOverride();
|
|
10
14
|
|
|
11
15
|
create
|
|
12
16
|
.command('project')
|
|
17
|
+
.description('create a new project')
|
|
13
18
|
.argument('<projectId>', 'the id of the project to create')
|
|
14
|
-
.
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
.argument('<name>', 'the name of the project to create')
|
|
20
|
+
.argument('[description]', 'optional description of the project')
|
|
21
|
+
.option(
|
|
22
|
+
'-l --language',
|
|
23
|
+
'the default language of the project to create',
|
|
24
|
+
'en-GB'
|
|
25
|
+
)
|
|
26
|
+
.option(
|
|
27
|
+
'-langs --supported-languages <langs...>',
|
|
28
|
+
'space separated list of other supported languages'
|
|
29
|
+
)
|
|
30
|
+
.usage(
|
|
31
|
+
'projectId "Project name" ["Description of project"] --language en-GB --supported-languages es-ES de-DE nl-NL'
|
|
32
|
+
)
|
|
33
|
+
.addHelpText('after', `\n`)
|
|
34
|
+
.action(
|
|
35
|
+
async (projectId: string, name: string, description = '', opts: any) => {
|
|
36
|
+
const createProject: Project = {
|
|
37
|
+
id: projectId,
|
|
38
|
+
name,
|
|
39
|
+
description,
|
|
40
|
+
primaryLanguage: opts.language,
|
|
41
|
+
supportedLanguages: opts.supportedLanguages || [],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const project = await cliCommand(
|
|
45
|
+
['create', 'project', projectId],
|
|
46
|
+
opts
|
|
47
|
+
).CreateProject(createProject);
|
|
48
|
+
if (project) await shell().restart();
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
22
52
|
create
|
|
23
53
|
.command('key')
|
|
54
|
+
.description('create a new api key')
|
|
24
55
|
.argument('<"key name">', 'the name of the key to create')
|
|
25
56
|
.argument('["description"]', 'provide a description for the key (optional)')
|
|
26
57
|
.usage('<"key name"> ["description"] (both args in "double quotes")')
|
|
@@ -37,5 +68,27 @@ Example call:
|
|
|
37
68
|
);
|
|
38
69
|
});
|
|
39
70
|
|
|
71
|
+
create
|
|
72
|
+
.command('role')
|
|
73
|
+
.description('create a new role')
|
|
74
|
+
.argument('<"Role name">', 'the name of the role to create')
|
|
75
|
+
.argument('["Role description">', 'the description of the role')
|
|
76
|
+
.option('--disabled', 'do not enable the created role', false)
|
|
77
|
+
.addHelpText(
|
|
78
|
+
'after',
|
|
79
|
+
`
|
|
80
|
+
Example call:
|
|
81
|
+
> create role "My role" "This role is for testing" --disabled \n`
|
|
82
|
+
)
|
|
83
|
+
.action(async (roleName: string, description: string, opts) => {
|
|
84
|
+
await cliCommand(['create', 'role', roleName], opts).CreateRole({
|
|
85
|
+
name: roleName,
|
|
86
|
+
description,
|
|
87
|
+
enabled: !opts.disabled,
|
|
88
|
+
assignments: { apiKeys: [], groups: [], users: [] },
|
|
89
|
+
permissions: { contentTypes: [], entries: [] },
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
40
93
|
return create;
|
|
41
94
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { devCommand } from '~/services/ContensisDevService';
|
|
3
|
+
|
|
4
|
+
export const makeDevCommand = () => {
|
|
5
|
+
const dev = new Command()
|
|
6
|
+
.command('dev')
|
|
7
|
+
.description('dev command')
|
|
8
|
+
.addHelpText('after', `\n`)
|
|
9
|
+
.showHelpAfterError(true)
|
|
10
|
+
.exitOverride();
|
|
11
|
+
|
|
12
|
+
dev
|
|
13
|
+
.command('init')
|
|
14
|
+
.description(
|
|
15
|
+
'initialise a git clone directory to connect and deploy to Contensis'
|
|
16
|
+
)
|
|
17
|
+
.argument(
|
|
18
|
+
'[projectHome]',
|
|
19
|
+
'the path of the folder to initialise',
|
|
20
|
+
process.cwd()
|
|
21
|
+
)
|
|
22
|
+
.option(
|
|
23
|
+
'--url <url>',
|
|
24
|
+
'override the git url or add one to initialise a non-git folder'
|
|
25
|
+
)
|
|
26
|
+
.option(
|
|
27
|
+
'-d --dry-run',
|
|
28
|
+
'perform a dry run of the project initialisation where no changes are made',
|
|
29
|
+
true
|
|
30
|
+
)
|
|
31
|
+
.option(
|
|
32
|
+
'--commit',
|
|
33
|
+
'commit change (will eventually be deprecated in favour of --dry-run)'
|
|
34
|
+
)
|
|
35
|
+
.addHelpText(
|
|
36
|
+
'after',
|
|
37
|
+
`
|
|
38
|
+
Example call:
|
|
39
|
+
> dev init\n`
|
|
40
|
+
)
|
|
41
|
+
.action(async (projectHome: string, opts) => {
|
|
42
|
+
// TODO: add opts for overriding project name and git url
|
|
43
|
+
await devCommand(['dev', 'init', projectHome], opts).DevelopmentInit(
|
|
44
|
+
projectHome,
|
|
45
|
+
{ ...opts, dryRun: !opts.commit }
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
dev
|
|
50
|
+
.command('requests')
|
|
51
|
+
.description('launch request handler for local development')
|
|
52
|
+
.argument('[block-ids...]', 'ids of any blocks to develop locally')
|
|
53
|
+
.option('--args <args...>', 'override or add additional args')
|
|
54
|
+
.usage('[block-ids...]')
|
|
55
|
+
.addHelpText(
|
|
56
|
+
'after',
|
|
57
|
+
`
|
|
58
|
+
Example call:
|
|
59
|
+
> dev requests test-block-one\n`
|
|
60
|
+
)
|
|
61
|
+
.action(async (blockIds: string[] = [], opts) => {
|
|
62
|
+
await devCommand(
|
|
63
|
+
['dev', 'requests', blockIds.join(' ')],
|
|
64
|
+
opts
|
|
65
|
+
).ExecRequestHandler(blockIds, opts?.args);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return dev;
|
|
69
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
+
import { mapContensisOpts } from './globalOptions';
|
|
4
|
+
|
|
5
|
+
export const makeDiffCommand = () => {
|
|
6
|
+
const release = new Command()
|
|
7
|
+
.command('diff')
|
|
8
|
+
.description('diff command')
|
|
9
|
+
.addHelpText('after', `\n`)
|
|
10
|
+
.showHelpAfterError(true)
|
|
11
|
+
.exitOverride();
|
|
12
|
+
|
|
13
|
+
release
|
|
14
|
+
.command('models')
|
|
15
|
+
.description('differences with content models')
|
|
16
|
+
.argument(
|
|
17
|
+
'[model-ids...]',
|
|
18
|
+
'ids of any content types or components to diff (optional)'
|
|
19
|
+
)
|
|
20
|
+
.usage('[model-ids...]')
|
|
21
|
+
.addHelpText(
|
|
22
|
+
'after',
|
|
23
|
+
`
|
|
24
|
+
Example call:
|
|
25
|
+
> diff models blogPost\n`
|
|
26
|
+
)
|
|
27
|
+
.action(async (modelIds: string[] = [], opts) => {
|
|
28
|
+
await cliCommand(
|
|
29
|
+
['diff', 'models', modelIds.join(' ')],
|
|
30
|
+
opts,
|
|
31
|
+
mapContensisOpts({ modelIds, ...opts })
|
|
32
|
+
).DiffModels(
|
|
33
|
+
{
|
|
34
|
+
...opts,
|
|
35
|
+
},
|
|
36
|
+
modelIds
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return release;
|
|
41
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Argument, Command } from 'commander';
|
|
2
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
+
import { addGlobalOptions } from './globalOptions';
|
|
4
|
+
|
|
5
|
+
export const makeExecuteCommand = () => {
|
|
6
|
+
const execute = new Command()
|
|
7
|
+
.command('execute')
|
|
8
|
+
.description('execute block actions')
|
|
9
|
+
.addHelpText('after', `\n`)
|
|
10
|
+
.showHelpAfterError(true)
|
|
11
|
+
.exitOverride();
|
|
12
|
+
|
|
13
|
+
const block = execute
|
|
14
|
+
.command('block')
|
|
15
|
+
.description('execute block command to invoke block actions');
|
|
16
|
+
|
|
17
|
+
const action = block
|
|
18
|
+
.command('action')
|
|
19
|
+
.description('execute block action command to invoke block actions');
|
|
20
|
+
|
|
21
|
+
const blockIdArg = new Argument(
|
|
22
|
+
'<block-id>',
|
|
23
|
+
'the name of the block to perform action with'
|
|
24
|
+
);
|
|
25
|
+
const blockVersionArg = new Argument(
|
|
26
|
+
'<version>',
|
|
27
|
+
'the block version to perform action with'
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
action
|
|
31
|
+
.command('release')
|
|
32
|
+
.description('release a block version')
|
|
33
|
+
.addArgument(blockIdArg)
|
|
34
|
+
.argument('[version]', blockVersionArg.description, 'latest')
|
|
35
|
+
.usage('[block-id> <version]')
|
|
36
|
+
.addHelpText(
|
|
37
|
+
'after',
|
|
38
|
+
`
|
|
39
|
+
Example call:
|
|
40
|
+
> execute block action release contensis-app
|
|
41
|
+
|
|
42
|
+
Note: block actions are executed on blocks deployed from a "main" or "master" branch\n`
|
|
43
|
+
)
|
|
44
|
+
.action(async (blockId: string, version: string, opts) => {
|
|
45
|
+
await cliCommand(
|
|
46
|
+
['execute', 'block', 'action', 'release', blockId],
|
|
47
|
+
opts
|
|
48
|
+
).ExecuteBlockAction('release', blockId, version);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
action
|
|
52
|
+
.command('makelive')
|
|
53
|
+
.description('make a block version live')
|
|
54
|
+
.addArgument(blockIdArg)
|
|
55
|
+
.addArgument(blockVersionArg)
|
|
56
|
+
.usage('<block-id> <version>')
|
|
57
|
+
.addHelpText(
|
|
58
|
+
'after',
|
|
59
|
+
`
|
|
60
|
+
Example call:
|
|
61
|
+
> execute block action makelive contensis-app 3
|
|
62
|
+
|
|
63
|
+
Note: block actions are executed on blocks deployed from a "main" or "master" branch\n`
|
|
64
|
+
)
|
|
65
|
+
.action(async (blockId: string, version: string, opts) => {
|
|
66
|
+
await cliCommand(
|
|
67
|
+
['execute', 'block', 'action', 'makelive', blockId],
|
|
68
|
+
opts
|
|
69
|
+
).ExecuteBlockAction('makeLive', blockId, version);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
action
|
|
73
|
+
.command('rollback')
|
|
74
|
+
.description('rollback a live block version to last live version')
|
|
75
|
+
.addArgument(blockIdArg)
|
|
76
|
+
.addArgument(blockVersionArg)
|
|
77
|
+
.usage('<block-id> <version>')
|
|
78
|
+
.addHelpText(
|
|
79
|
+
'after',
|
|
80
|
+
`
|
|
81
|
+
Example call:
|
|
82
|
+
> execute block action rollback contensis-app 3
|
|
83
|
+
|
|
84
|
+
Note: block actions are executed on blocks deployed from a "main" or "master" branch\n`
|
|
85
|
+
)
|
|
86
|
+
.action(async (blockId: string, version: string, opts) => {
|
|
87
|
+
await cliCommand(
|
|
88
|
+
['execute', 'block', 'action', 'rollback', blockId],
|
|
89
|
+
opts
|
|
90
|
+
).ExecuteBlockAction('rollback', blockId, version);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
action
|
|
94
|
+
.command('markasbroken')
|
|
95
|
+
.description('mark a block version as broken')
|
|
96
|
+
.addArgument(blockIdArg)
|
|
97
|
+
.addArgument(blockVersionArg)
|
|
98
|
+
.usage('<block-id> <version>')
|
|
99
|
+
.addHelpText(
|
|
100
|
+
'after',
|
|
101
|
+
`
|
|
102
|
+
Example call:
|
|
103
|
+
> execute block action markasbroken contensis-app 3
|
|
104
|
+
|
|
105
|
+
Note: block actions are executed on blocks deployed from a "main" or "master" branch\n`
|
|
106
|
+
)
|
|
107
|
+
.action(async (blockId: string, version: string, opts) => {
|
|
108
|
+
await cliCommand(
|
|
109
|
+
['execute', 'block', 'action', 'markasbroken', blockId],
|
|
110
|
+
opts
|
|
111
|
+
).ExecuteBlockAction('markAsBroken', blockId, version);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Add global opts for inner sub-commands
|
|
115
|
+
addGlobalOptions(action);
|
|
116
|
+
return execute;
|
|
117
|
+
};
|