contensis-cli 1.0.0-beta.10 → 1.0.0-beta.100
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 +71 -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 +65 -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 +297 -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 +374 -0
- package/dist/mappers/DevInit-to-CIWorkflow.js.map +7 -0
- package/dist/mappers/DevInit-to-RolePermissions.js +56 -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 +1211 -420
- package/dist/services/ContensisCliService.js.map +3 -3
- package/dist/services/ContensisDevService.js +368 -0
- package/dist/services/ContensisDevService.js.map +7 -0
- package/dist/services/ContensisRoleService.js +114 -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 +116 -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 +128 -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 +42 -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 +14 -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 +83 -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 +428 -66
- package/src/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.ts +44 -0
- package/src/mappers/DevInit-to-CIWorkflow.ts +526 -0
- package/src/mappers/DevInit-to-RolePermissions.ts +32 -0
- package/src/mappers/DevRequests-to-RequestHanderSiteConfigYaml.ts +44 -0
- package/src/models/CliService.d.ts +36 -0
- package/src/models/DevService.d.ts +40 -0
- package/src/models/JsModules.d.ts +2 -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 +1532 -508
- package/src/services/ContensisDevService.ts +434 -0
- package/src/services/ContensisRoleService.ts +108 -0
- package/src/shell.ts +68 -18
- package/src/util/console.printer.ts +240 -78
- package/src/util/diff.ts +124 -0
- package/src/util/dotenv.ts +37 -0
- package/src/util/find.ts +8 -0
- package/src/util/git.ts +131 -0
- package/src/util/index.ts +16 -7
- package/src/util/logger.ts +145 -31
- package/src/util/os.ts +12 -0
- package/src/util/timers.ts +24 -0
- package/src/util/yaml.ts +13 -0
- package/src/version.ts +1 -1
package/src/commands/set.ts
CHANGED
|
@@ -5,35 +5,215 @@ import { shell } from '~/shell';
|
|
|
5
5
|
export const makeSetCommand = () => {
|
|
6
6
|
const set = new Command()
|
|
7
7
|
.command('set')
|
|
8
|
+
.description('set command')
|
|
9
|
+
.addHelpText('after', `\n`)
|
|
8
10
|
.showHelpAfterError(true)
|
|
9
11
|
.exitOverride();
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
const project = set
|
|
11
14
|
.command('project')
|
|
15
|
+
.description('set current working project')
|
|
12
16
|
.argument('<projectId>', 'the project id to work with')
|
|
13
17
|
.usage('<projectId>')
|
|
18
|
+
.addHelpText(
|
|
19
|
+
'after',
|
|
20
|
+
`
|
|
21
|
+
Example call:
|
|
22
|
+
> set project website\n`
|
|
23
|
+
)
|
|
14
24
|
.action(async projectId => {
|
|
15
|
-
const
|
|
25
|
+
const nextProjectId = cliCommand([
|
|
16
26
|
'set',
|
|
17
27
|
'project',
|
|
18
28
|
projectId,
|
|
19
29
|
]).SetProject(projectId);
|
|
20
|
-
if (
|
|
30
|
+
if (nextProjectId) await shell().restart();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
project
|
|
34
|
+
.command('name')
|
|
35
|
+
.description('update project name')
|
|
36
|
+
.argument('<"Project name">', 'update the current project name')
|
|
37
|
+
.usage('<"Project name">')
|
|
38
|
+
.addHelpText(
|
|
39
|
+
'after',
|
|
40
|
+
`
|
|
41
|
+
Example call:
|
|
42
|
+
> set project name "Project name"\n`
|
|
43
|
+
)
|
|
44
|
+
.action(async (name: string, opts) => {
|
|
45
|
+
await cliCommand(['set', 'project', 'name'], opts).UpdateProject({
|
|
46
|
+
name,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
project
|
|
51
|
+
.command('description')
|
|
52
|
+
.description('update project description')
|
|
53
|
+
.argument(
|
|
54
|
+
'<"Project description">',
|
|
55
|
+
'update the current project description'
|
|
56
|
+
)
|
|
57
|
+
.usage('<"Project description">')
|
|
58
|
+
.addHelpText(
|
|
59
|
+
'after',
|
|
60
|
+
`
|
|
61
|
+
Example call:
|
|
62
|
+
> set project description "Description of project"\n`
|
|
63
|
+
)
|
|
64
|
+
.action(async (description: string, opts) => {
|
|
65
|
+
await cliCommand(['set', 'project', 'description'], opts).UpdateProject({
|
|
66
|
+
description,
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const role = set.command('role').description('update a role');
|
|
71
|
+
|
|
72
|
+
role
|
|
73
|
+
.command('name')
|
|
74
|
+
.description('update role name')
|
|
75
|
+
.argument('<"Role name">', 'update the existing role name')
|
|
76
|
+
.argument('<"New name">', 'the new name for the role')
|
|
77
|
+
.usage('<"Role name"> <"New name">')
|
|
78
|
+
.addHelpText(
|
|
79
|
+
'after',
|
|
80
|
+
`
|
|
81
|
+
Example call:
|
|
82
|
+
> set role name "Existing name" "New role name"\n`
|
|
83
|
+
)
|
|
84
|
+
.action(async (roleNameOrId: string, newName: string, opts) => {
|
|
85
|
+
await cliCommand(['set', 'role', 'name'], opts).UpdateRole(roleNameOrId, {
|
|
86
|
+
name: newName,
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
role
|
|
91
|
+
.command('description')
|
|
92
|
+
.description('update role description')
|
|
93
|
+
.argument('<"Role name" or id>', 'the existing role name or id to update')
|
|
94
|
+
.argument('<"New description">', 'the new description for the role')
|
|
95
|
+
.usage('<"Role name"> <"New description">')
|
|
96
|
+
.addHelpText(
|
|
97
|
+
'after',
|
|
98
|
+
`
|
|
99
|
+
Example call:
|
|
100
|
+
> set role description "Existing role" "New role description"\n`
|
|
101
|
+
)
|
|
102
|
+
.action(async (roleNameOrId: string, description: string, opts) => {
|
|
103
|
+
await cliCommand(['set', 'role', 'description'], opts).UpdateRole(
|
|
104
|
+
roleNameOrId,
|
|
105
|
+
{
|
|
106
|
+
description,
|
|
107
|
+
}
|
|
108
|
+
);
|
|
21
109
|
});
|
|
110
|
+
|
|
111
|
+
role
|
|
112
|
+
.command('enabled')
|
|
113
|
+
.description('enable or disable a role')
|
|
114
|
+
.argument('<"Role name" or id>', 'the existing role name or id to update')
|
|
115
|
+
.usage('<"Role name"> --disabled')
|
|
116
|
+
.option('--disabled', 'disable the role', false)
|
|
117
|
+
.addHelpText(
|
|
118
|
+
'after',
|
|
119
|
+
`
|
|
120
|
+
Example call:
|
|
121
|
+
> set role enabled "Existing role"\n
|
|
122
|
+
> set role enabled "Other role" --disabled\n`
|
|
123
|
+
)
|
|
124
|
+
.action(async (roleNameOrId: string, opts) => {
|
|
125
|
+
await cliCommand(
|
|
126
|
+
['set', 'role', opts.disabled ? 'disabled' : 'enabled'],
|
|
127
|
+
opts
|
|
128
|
+
).UpdateRole(roleNameOrId, {
|
|
129
|
+
enabled: !opts.disabled,
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
role
|
|
134
|
+
.command('assignments')
|
|
135
|
+
.description('assign users, groups or keys to a role')
|
|
136
|
+
.argument('<"Role name" or id>', 'the role name or id to update')
|
|
137
|
+
.option(
|
|
138
|
+
'-users --assign-users [assign-users...]',
|
|
139
|
+
'the user id(s) to assign'
|
|
140
|
+
)
|
|
141
|
+
.option(
|
|
142
|
+
'-groups --assign-groups [assign-groups...]',
|
|
143
|
+
'the groups name(s) to assign'
|
|
144
|
+
)
|
|
145
|
+
.option('-keys --assign-keys [assign-keys...]', 'the key name(s) to assign')
|
|
146
|
+
.addHelpText(
|
|
147
|
+
'after',
|
|
148
|
+
`
|
|
149
|
+
Example call:
|
|
150
|
+
> set role assignments "My role" --assign-users admin \n`
|
|
151
|
+
)
|
|
152
|
+
.action(async (roleNameOrId: string, opts) => {
|
|
153
|
+
await cliCommand(['set', 'role', 'assignments'], opts).UpdateRole(
|
|
154
|
+
roleNameOrId,
|
|
155
|
+
{
|
|
156
|
+
assignments: {
|
|
157
|
+
apiKeys: opts.assignKeys || undefined,
|
|
158
|
+
groups: opts.assignGroups || undefined,
|
|
159
|
+
users: opts.assignUsers || undefined,
|
|
160
|
+
},
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
role
|
|
166
|
+
.command('permissions')
|
|
167
|
+
.description('add entry permissions to a role')
|
|
168
|
+
.argument('<"Role name" or id>', 'the role name or id to update')
|
|
169
|
+
.option(
|
|
170
|
+
'-contenttypes --content-type-ids [content-type-id...]',
|
|
171
|
+
'any content type ids to add permissions for'
|
|
172
|
+
)
|
|
173
|
+
.option(
|
|
174
|
+
'--entry-actions [entry-actions...]',
|
|
175
|
+
'the entry actions to add to the role permissions'
|
|
176
|
+
)
|
|
177
|
+
.option(
|
|
178
|
+
'--entry-languages [entry-languages...]',
|
|
179
|
+
'the entry languages to add to the role permissions'
|
|
180
|
+
)
|
|
181
|
+
.addHelpText(
|
|
182
|
+
'after',
|
|
183
|
+
`
|
|
184
|
+
Example call:
|
|
185
|
+
> set role permissions "My role" --content-type-id blogs -- \n`
|
|
186
|
+
)
|
|
187
|
+
.action(async (roleNameOrId: string, opts) => {
|
|
188
|
+
await cliCommand(['set', 'role', 'permissions'], opts).UpdateRole(
|
|
189
|
+
roleNameOrId,
|
|
190
|
+
{
|
|
191
|
+
permissions: {
|
|
192
|
+
entries: opts.contentTypeIds?.map((id: string) => ({
|
|
193
|
+
id,
|
|
194
|
+
actions: opts.entryActions || [],
|
|
195
|
+
languages: opts.entryLanguages || [],
|
|
196
|
+
})),
|
|
197
|
+
},
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
|
|
22
202
|
set
|
|
23
203
|
.command('version')
|
|
204
|
+
.description('set content version')
|
|
24
205
|
.addArgument(
|
|
25
206
|
new Argument('<versionStatus>', 'content version status')
|
|
26
207
|
.choices(['latest', 'published'])
|
|
27
208
|
.default('latest')
|
|
28
209
|
)
|
|
29
210
|
.usage('<latest/published>')
|
|
211
|
+
.addHelpText('after', `\n`)
|
|
30
212
|
.action(async versionStatus => {
|
|
31
|
-
const success =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
]).SetVersion(versionStatus);
|
|
36
|
-
if (success) await shell().start();
|
|
213
|
+
const success = cliCommand(['set', 'version', versionStatus]).SetVersion(
|
|
214
|
+
versionStatus
|
|
215
|
+
);
|
|
216
|
+
if (success) await shell().restart();
|
|
37
217
|
});
|
|
38
218
|
|
|
39
219
|
return set;
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import commands from './commands';
|
|
2
2
|
import { logError } from './util/logger';
|
|
3
3
|
import ContensisCli from './services/ContensisCliService';
|
|
4
|
-
import { jsonFormatter } from './util/json.formatter';
|
|
5
|
-
// new ContensisCli(process.argv).DoCommandTasksAsync();
|
|
6
4
|
|
|
7
5
|
// This is the CLI part of the app
|
|
8
6
|
const program = commands();
|
|
@@ -12,8 +10,7 @@ program
|
|
|
12
10
|
ContensisCli.quit();
|
|
13
11
|
})
|
|
14
12
|
.catch((err: any) => {
|
|
15
|
-
if (!err.name?.includes('CommanderError'))
|
|
13
|
+
if (err && !err.name?.includes('CommanderError'))
|
|
16
14
|
logError(err, `CLI ${err.toString()}`);
|
|
17
15
|
ContensisCli.quit(err);
|
|
18
16
|
});
|
|
19
|
-
//.exitOverride(() => console.log('exit override!!!'));
|