contensis-cli 1.0.0-beta.5 → 1.0.0-beta.50

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.
Files changed (71) hide show
  1. package/README.md +669 -74
  2. package/dist/commands/connect.js +3 -3
  3. package/dist/commands/connect.js.map +2 -2
  4. package/dist/commands/create.js +30 -10
  5. package/dist/commands/create.js.map +2 -2
  6. package/dist/commands/diff.js +57 -0
  7. package/dist/commands/diff.js.map +7 -0
  8. package/dist/commands/get.js +61 -12
  9. package/dist/commands/get.js.map +2 -2
  10. package/dist/commands/globalOptions.js +22 -17
  11. package/dist/commands/globalOptions.js.map +2 -2
  12. package/dist/commands/import.js +36 -10
  13. package/dist/commands/import.js.map +2 -2
  14. package/dist/commands/index.js +9 -1
  15. package/dist/commands/index.js.map +2 -2
  16. package/dist/commands/list.js +19 -8
  17. package/dist/commands/list.js.map +2 -2
  18. package/dist/commands/login.js +3 -3
  19. package/dist/commands/login.js.map +2 -2
  20. package/dist/commands/push.js +8 -4
  21. package/dist/commands/push.js.map +2 -2
  22. package/dist/commands/release.js +47 -0
  23. package/dist/commands/release.js.map +7 -0
  24. package/dist/commands/remove.js +10 -8
  25. package/dist/commands/remove.js.map +2 -2
  26. package/dist/commands/set.js +53 -12
  27. package/dist/commands/set.js.map +2 -2
  28. package/dist/localisation/en-GB.js +97 -47
  29. package/dist/localisation/en-GB.js.map +2 -2
  30. package/dist/providers/CredentialProvider.js +36 -7
  31. package/dist/providers/CredentialProvider.js.map +3 -3
  32. package/dist/providers/SessionCacheProvider.js +21 -1
  33. package/dist/providers/SessionCacheProvider.js.map +2 -2
  34. package/dist/providers/file-provider.js +8 -4
  35. package/dist/providers/file-provider.js.map +3 -3
  36. package/dist/services/ContensisCliService.js +600 -336
  37. package/dist/services/ContensisCliService.js.map +3 -3
  38. package/dist/shell.js +27 -10
  39. package/dist/shell.js.map +3 -3
  40. package/dist/util/console.printer.js +170 -47
  41. package/dist/util/console.printer.js.map +2 -2
  42. package/dist/util/index.js +5 -2
  43. package/dist/util/index.js.map +3 -3
  44. package/dist/util/logger.js +45 -13
  45. package/dist/util/logger.js.map +2 -2
  46. package/dist/version.js +1 -1
  47. package/dist/version.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/commands/connect.ts +3 -2
  50. package/src/commands/create.ts +37 -8
  51. package/src/commands/diff.ts +41 -0
  52. package/src/commands/get.ts +80 -5
  53. package/src/commands/globalOptions.ts +18 -17
  54. package/src/commands/import.ts +43 -4
  55. package/src/commands/index.ts +9 -1
  56. package/src/commands/list.ts +35 -9
  57. package/src/commands/login.ts +3 -2
  58. package/src/commands/push.ts +9 -2
  59. package/src/commands/release.ts +32 -0
  60. package/src/commands/remove.ts +12 -4
  61. package/src/commands/set.ts +65 -9
  62. package/src/localisation/en-GB.ts +142 -64
  63. package/src/providers/CredentialProvider.ts +39 -6
  64. package/src/providers/SessionCacheProvider.ts +29 -2
  65. package/src/providers/file-provider.ts +8 -4
  66. package/src/services/ContensisCliService.ts +741 -387
  67. package/src/shell.ts +31 -11
  68. package/src/util/console.printer.ts +234 -66
  69. package/src/util/index.ts +12 -6
  70. package/src/util/logger.ts +84 -15
  71. package/src/version.ts +1 -1
@@ -1,26 +1,55 @@
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';
4
5
 
5
6
  export const makeCreateCommand = () => {
6
7
  const create = new Command()
7
8
  .command('create')
9
+ .description('create command')
10
+ .addHelpText('after', `\n`)
8
11
  .showHelpAfterError(true)
9
12
  .exitOverride();
10
13
 
11
14
  create
12
15
  .command('project')
16
+ .description('create a new project')
13
17
  .argument('<projectId>', 'the id of the project to create')
14
- .usage('<projectId>')
15
- .action(async (projectId: string, opts: any) => {
16
- const project = await cliCommand(
17
- ['create', 'project', projectId],
18
- opts
19
- ).SetProject(projectId);
20
- if (project) await shell().start();
21
- });
18
+ .argument('<name>', 'the name of the project to create')
19
+ .argument('[description]', 'optional description of the project')
20
+ .option(
21
+ '-l, --language',
22
+ 'the default language of the project to create',
23
+ 'en-GB'
24
+ )
25
+ .option(
26
+ '-langs, --supported-languages <langs...>',
27
+ 'space separated list of other supported languages'
28
+ )
29
+ .usage(
30
+ 'projectId "Project name" ["Description of project"] --language en-GB --supported-languages es-ES de-DE nl-NL'
31
+ )
32
+ .addHelpText('after', `\n`)
33
+ .action(
34
+ async (projectId: string, name: string, description = '', opts: any) => {
35
+ const createProject: Project = {
36
+ id: projectId,
37
+ name,
38
+ description,
39
+ primaryLanguage: opts.language,
40
+ supportedLanguages: opts.supportedLanguages || [],
41
+ };
42
+
43
+ const project = await cliCommand(
44
+ ['create', 'project', projectId],
45
+ opts
46
+ ).CreateProject(createProject);
47
+ if (project) await shell().restart();
48
+ }
49
+ );
22
50
  create
23
51
  .command('key')
52
+ .description('create a new api key')
24
53
  .argument('<"key name">', 'the name of the key to create')
25
54
  .argument('["description"]', 'provide a description for the key (optional)')
26
55
  .usage('<"key name"> ["description"] (both args in "double quotes")')
@@ -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
+ };
@@ -5,11 +5,62 @@ import { mapContensisOpts } from './globalOptions';
5
5
  export const makeGetCommand = () => {
6
6
  const program = new Command()
7
7
  .command('get')
8
+ .addHelpText('after', `\n`)
8
9
  .showHelpAfterError(true)
9
10
  .exitOverride();
10
11
 
12
+ program
13
+ .command('version')
14
+ .description('get current Contensis version')
15
+ .addHelpText(
16
+ 'after',
17
+ `
18
+ Example call:
19
+ > version
20
+ `
21
+ )
22
+ .action(async opts => {
23
+ await cliCommand(['get', 'version'], opts).PrintContensisVersion();
24
+ });
25
+
26
+ program
27
+ .command('project')
28
+ .description('get a project')
29
+ .argument('[projectId]', 'id of the project to get (default: current)')
30
+ .addHelpText(
31
+ 'after',
32
+ `
33
+ Example call:
34
+ > get project website
35
+ `
36
+ )
37
+ .action(async (projectId: string, opts) => {
38
+ await cliCommand(['get', 'project', projectId], opts).PrintProject(
39
+ projectId
40
+ );
41
+ });
42
+
43
+ program
44
+ .command('model')
45
+ .description('get a content model')
46
+ .argument('<contentTypeId...>', 'ids of the content models to get')
47
+ .addHelpText(
48
+ 'after',
49
+ `
50
+ Example call:
51
+ > get model podcast podcastLinks
52
+ `
53
+ )
54
+ .action(async (modelIds: string[], opts) => {
55
+ await cliCommand(
56
+ ['get', 'model', modelIds.join(' ')],
57
+ opts
58
+ ).PrintContentModels(modelIds);
59
+ });
60
+
11
61
  program
12
62
  .command('contenttype')
63
+ .description('get a content type')
13
64
  .argument('<contentTypeId>', 'the API id of the content type to get')
14
65
  .addHelpText(
15
66
  'after',
@@ -19,12 +70,15 @@ Example call:
19
70
  `
20
71
  )
21
72
  .action(async (contentTypeId: string, opts) => {
22
- await cliCommand(['get', 'contenttype'], opts).PrintContentType(
23
- contentTypeId
24
- );
73
+ await cliCommand(
74
+ ['get', 'contenttype', contentTypeId],
75
+ opts
76
+ ).PrintContentType(contentTypeId);
25
77
  });
78
+
26
79
  program
27
80
  .command('component')
81
+ .description('get a component')
28
82
  .argument('<componentId>', 'the API id of the component to get')
29
83
  .addHelpText(
30
84
  'after',
@@ -34,15 +88,19 @@ Example call:
34
88
  `
35
89
  )
36
90
  .action(async (componentId: string, opts) => {
37
- await cliCommand(['get', 'component'], opts).PrintComponent(componentId);
91
+ await cliCommand(['get', 'component', componentId], opts).PrintComponent(
92
+ componentId
93
+ );
38
94
  });
95
+
39
96
  program
40
97
  .command('entries')
98
+ .description('get entries')
41
99
  .argument(
42
100
  '[search phrase]',
43
101
  'get entries with the search phrase, use quotes for multiple words'
44
102
  )
45
- .option('-i --id <id...>', 'the entry id to get')
103
+ .option('-i --id <id...>', 'the entry id(s) to get')
46
104
  .option(
47
105
  '-d, --dependents',
48
106
  'find and return any dependencies of all found entries'
@@ -76,6 +134,7 @@ Example call:
76
134
 
77
135
  const block = program
78
136
  .command('block')
137
+ .description('get a block or block version')
79
138
  .argument('[blockId]', 'the block to get version details for')
80
139
  .argument(
81
140
  '[branch]',
@@ -86,6 +145,13 @@ Example call:
86
145
  '[version]',
87
146
  'get a specific version of the block pushed to the specified branch'
88
147
  )
148
+ .addHelpText(
149
+ 'after',
150
+ `
151
+ Example call:
152
+ > get block contensis-website master latest
153
+ `
154
+ )
89
155
  .action(async (blockId: string, branch: string, version: string, opts) => {
90
156
  await cliCommand(['get', 'block'], opts).PrintBlockVersions(
91
157
  blockId,
@@ -103,6 +169,7 @@ Example call:
103
169
 
104
170
  block
105
171
  .command('logs')
172
+ .description('get logs for a block')
106
173
  .argument('[blockId]', 'the block to get version logs for')
107
174
  .argument(
108
175
  '[branch]',
@@ -116,6 +183,14 @@ Example call:
116
183
  )
117
184
  .addArgument(dataCenter)
118
185
  .usage('get block logs [blockId] [branch] [version] [dataCenter]')
186
+ .addHelpText(
187
+ 'after',
188
+ `
189
+ Example call:
190
+ > get block logs contensis-website master
191
+ > get block logs contensis-website master latest london
192
+ `
193
+ )
119
194
  .action(
120
195
  async (
121
196
  blockId: string,
@@ -3,19 +3,20 @@ import { url } from '~/util';
3
3
 
4
4
  export const mapContensisOpts = (opts: any = {}) => ({
5
5
  source:
6
- opts.sourceCms || opts.sourceProjectId
6
+ opts.sourceAlias || opts.sourceProjectId
7
7
  ? {
8
- url: opts.sourceCms
9
- ? url(opts.sourceCms, 'website').cms
8
+ url: opts.sourceAlias
9
+ ? url(opts.sourceAlias, 'website').cms
10
10
  : (undefined as any),
11
11
  project: opts.sourceProjectId || (undefined as any),
12
12
  }
13
13
  : undefined,
14
+ models: opts.modelIds,
14
15
  query:
15
- opts.id || opts.phrase || opts.fields
16
+ opts.id || opts.entryIds || opts.phrase || opts.fields
16
17
  ? {
17
18
  fields: opts.fields,
18
- includeIds: opts.id,
19
+ includeIds: opts.id || opts.entryIds,
19
20
  searchTerm: opts.phrase,
20
21
  }
21
22
  : undefined,
@@ -36,59 +37,59 @@ const format = new Option(
36
37
 
37
38
  /* Connect options */
38
39
  const alias = new Option(
39
- '-a --alias <alias>',
40
+ '-a, --alias <alias>',
40
41
  'the cloud CMS alias to connect your request with'
41
42
  );
42
43
 
43
44
  export const project = new Option(
44
- '-p --project-id <projectId>',
45
+ '-p, --project-id <projectId>',
45
46
  'the projectId to make your request with'
46
47
  );
47
48
 
48
49
  /* Authentication options */
49
50
  const user = new Option(
50
- '-u --user <user>',
51
+ '-u, --user <user>',
51
52
  'the username to authenticate your request with'
52
53
  );
53
54
  const password = new Option(
54
- '-pw --password <password>',
55
+ '-pw, --password <password>',
55
56
  'the password to use to login with (optional/insecure)'
56
57
  );
57
58
  const clientId = new Option(
58
- '-id --client-id <clientId>',
59
+ '-id, --client-id <clientId>',
59
60
  'the clientId to authenticate your request with'
60
61
  );
61
62
  const sharedSecret = new Option(
62
- '-s --shared-secret <sharedSecret>',
63
+ '-s, --shared-secret <sharedSecret>',
63
64
  'the shared secret to use when logging in with a client id'
64
65
  );
65
66
 
66
67
  /* Entry get options */
67
- const zenql = new Option(
68
+ export const zenql = new Option(
68
69
  '-q, --zenql <zenql>',
69
70
  'get entries with a supplied ZenQL statement'
70
71
  );
71
72
 
72
- const entryId = new Option('-i --id <id...>', 'the entry id to get');
73
+ export const entryId = new Option('-i --id <id...>', 'the entry id(s) to get');
73
74
 
74
75
  /* Import options */
75
76
  export const fromFile = new Option(
76
- '-file --from-file <fromFile>',
77
+ '-file, --from-file <fromFile>',
77
78
  'file path to import asset(s) from'
78
79
  );
79
80
 
80
81
  export const fromCms = new Option(
81
- '-source --source-alias <fromCms>',
82
+ '-source, --source-alias <fromCms>',
82
83
  'the cloud CMS alias to import asset(s) from'
83
84
  );
84
85
  export const fromProject = new Option(
85
- '-sp --source-project-id <fromProject>',
86
+ '-sp, --source-project-id <fromProject>',
86
87
  'the id of the Contensis project to import asset(s) from (Default: [last connected project])'
87
88
  );
88
89
 
89
90
  export const commit = new Option(
90
91
  '--commit',
91
- 'omit and only add this flag when you are happy with the preview of the import'
92
+ 'add this flag only after you have run a preview of the import and agree with the analysis'
92
93
  ).default(false);
93
94
 
94
95
  export const addConnectOptions = (program: Command) =>
@@ -6,15 +6,43 @@ import { commit, mapContensisOpts } from './globalOptions';
6
6
  export const makeImportCommand = () => {
7
7
  const program = new Command()
8
8
  .command('import')
9
+ .description('import command')
10
+ .addHelpText('after', `\n`)
9
11
  .showHelpAfterError(true)
10
12
  .exitOverride();
11
13
 
14
+ program
15
+ .command('models')
16
+ .description('import complete content models')
17
+ .argument('[modelIds...]', 'ids of the content models to import (optional)')
18
+ .addOption(commit)
19
+ .addHelpText(
20
+ 'after',
21
+ `
22
+ Example call:
23
+ > import models blogPost --from-file contentmodels-backup.json
24
+ > import models --source-alias example-dev
25
+ `
26
+ )
27
+ .action(async (modelIds: string[], opts) => {
28
+ await cliCommand(
29
+ ['import', 'models', modelIds.join(' ')],
30
+ opts,
31
+ mapContensisOpts({ modelIds, ...opts })
32
+ ).ImportContentModels({
33
+ fromFile: opts.fromFile,
34
+ commit: opts.commit,
35
+ });
36
+ });
37
+
12
38
  program
13
39
  .command('contenttypes')
40
+ .description('import content types')
14
41
  .argument(
15
- '[contentTypeIds]',
42
+ '[contentTypeIds...]',
16
43
  'Optional list of API id(s) of the content type(s) to import'
17
44
  )
45
+ .addOption(commit)
18
46
  .addHelpText(
19
47
  'after',
20
48
  `
@@ -24,7 +52,11 @@ Example call:
24
52
  `
25
53
  )
26
54
  .action(async (contentTypeIds: string[], opts) => {
27
- await cliCommand(['import', 'contenttypes'], opts).ImportContentTypes(
55
+ await cliCommand(
56
+ ['import', 'contenttypes'],
57
+ opts,
58
+ mapContensisOpts({ contentTypeIds, ...opts })
59
+ ).ImportContentTypes(
28
60
  {
29
61
  fromFile: opts.fromFile,
30
62
  commit: opts.commit,
@@ -35,10 +67,12 @@ Example call:
35
67
 
36
68
  program
37
69
  .command('components')
70
+ .description('import components')
38
71
  .argument(
39
- '[componentIds]',
72
+ '[componentIds...]',
40
73
  'Optional list of API id(s) of the component(s) to import'
41
74
  )
75
+ .addOption(commit)
42
76
  .addHelpText(
43
77
  'after',
44
78
  `
@@ -48,7 +82,11 @@ Example call:
48
82
  `
49
83
  )
50
84
  .action(async (componentIds: string[], opts) => {
51
- await cliCommand(['import', 'component'], opts).ImportComponents(
85
+ await cliCommand(
86
+ ['import', 'component'],
87
+ opts,
88
+ mapContensisOpts({ componentIds, ...opts })
89
+ ).ImportComponents(
52
90
  {
53
91
  fromFile: opts.fromFile,
54
92
  commit: opts.commit,
@@ -59,6 +97,7 @@ Example call:
59
97
 
60
98
  program
61
99
  .command('entries')
100
+ .description('import entries')
62
101
  .argument(
63
102
  '[search phrase]',
64
103
  'get entries with the search phrase, use quotes for multiple words'
@@ -3,6 +3,7 @@ import { Logger } from '~/util/logger';
3
3
  import { LIB_VERSION } from '~/version';
4
4
  import { makeConnectCommand } from './connect';
5
5
  import { makeCreateCommand } from './create';
6
+ import { makeDiffCommand } from './diff';
6
7
  import { makeGetCommand } from './get';
7
8
  import {
8
9
  addAuthenticationOptions,
@@ -15,6 +16,7 @@ import { makeImportCommand } from './import';
15
16
  import { makeListCommand } from './list';
16
17
  import { makeLoginCommand } from './login';
17
18
  import { makePushCommand } from './push';
19
+ import { makeReleaseCommand } from './release';
18
20
  import { makeRemoveCommand } from './remove';
19
21
  import { makeSetCommand } from './set';
20
22
 
@@ -37,9 +39,12 @@ const commands = () => {
37
39
  program
38
40
  )
39
41
  );
42
+ program.addCommand(
43
+ addGlobalOptions(makeCreateCommand()).copyInheritedSettings(program)
44
+ );
40
45
  program.addCommand(
41
46
  addGlobalOptions(
42
- addImportOptions(makeCreateCommand())
47
+ addGetEntryOptions(addImportOptions(makeDiffCommand()))
43
48
  ).copyInheritedSettings(program)
44
49
  );
45
50
  program.addCommand(
@@ -59,6 +64,9 @@ const commands = () => {
59
64
  program.addCommand(
60
65
  addGlobalOptions(makePushCommand()).copyInheritedSettings(program)
61
66
  );
67
+ program.addCommand(
68
+ addGlobalOptions(makeReleaseCommand()).copyInheritedSettings(program)
69
+ );
62
70
  program.addCommand(
63
71
  addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)
64
72
  );
@@ -1,20 +1,17 @@
1
1
  import { Command } from 'commander';
2
2
  import { cliCommand } from '~/services/ContensisCliService';
3
3
 
4
- // projects
5
- // content types
6
- // components
7
- // api keys
8
- // roles
9
- // webhooks
10
4
  export const makeListCommand = () => {
11
5
  const list = new Command()
12
6
  .command('list')
7
+ .description('list command')
8
+ .addHelpText('after', `\n`)
13
9
  .showHelpAfterError(true)
14
10
  .exitOverride();
15
11
 
16
12
  list
17
13
  .command('envs')
14
+ .description('List all previously connected environments')
18
15
  .addHelpText(
19
16
  'after',
20
17
  `
@@ -25,11 +22,31 @@ Example call:
25
22
  .action(opts => {
26
23
  cliCommand(['list', 'envs'], opts).PrintEnvironments();
27
24
  });
28
- list.command('projects').action(async opts => {
29
- await cliCommand(['list', 'projects'], opts).PrintProjects();
30
- });
25
+
26
+ list
27
+ .command('projects')
28
+ .description('print list of projects')
29
+ .action(async opts => {
30
+ await cliCommand(['list', 'projects'], opts).PrintProjects();
31
+ });
32
+
33
+ list
34
+ .command('models')
35
+ .description('print list of content models')
36
+ .addHelpText(
37
+ 'after',
38
+ `
39
+ Example call:
40
+ > list models
41
+ `
42
+ )
43
+ .action(async opts => {
44
+ await cliCommand(['list', 'models'], opts).PrintContentModels();
45
+ });
46
+
31
47
  list
32
48
  .command('contenttypes')
49
+ .description('print list of content types')
33
50
  .addHelpText(
34
51
  'after',
35
52
  `
@@ -40,8 +57,10 @@ Example call:
40
57
  .action(async opts => {
41
58
  await cliCommand(['list', 'contenttypes'], opts).PrintContentTypes();
42
59
  });
60
+
43
61
  list
44
62
  .command('components')
63
+ .description('print list of components')
45
64
  .addHelpText(
46
65
  'after',
47
66
  `
@@ -52,8 +71,10 @@ Example call:
52
71
  .action(async opts => {
53
72
  await cliCommand(['list', 'components'], opts).PrintComponents();
54
73
  });
74
+
55
75
  list
56
76
  .command('blocks')
77
+ .description('print list of content blocks')
57
78
  .addHelpText(
58
79
  'after',
59
80
  `
@@ -64,8 +85,10 @@ Example call:
64
85
  .action(async opts => {
65
86
  await cliCommand(['list', 'blocks'], opts).PrintBlocks();
66
87
  });
88
+
67
89
  list
68
90
  .command('keys')
91
+ .description('print list of API keys')
69
92
  .addHelpText(
70
93
  'after',
71
94
  `
@@ -76,10 +99,13 @@ Example call:
76
99
  .action(async opts => {
77
100
  await cliCommand(['list', 'keys'], opts).PrintApiKeys();
78
101
  });
102
+
79
103
  list
80
104
  .command('webhooks')
105
+ .description('print list of webhooks')
81
106
  .argument('[name]', 'find webhooks matching the supplied name')
82
107
  .option('-i --id <id...>', 'the subscription id(s) to get')
108
+ .addHelpText('after', `\n`)
83
109
  .action(async (name?: string, { id, ...opts }: any = {}) => {
84
110
  await cliCommand(['list', 'webhooks'], opts).PrintWebhookSubscriptions(
85
111
  id,
@@ -5,13 +5,14 @@ import { shell } from '~/shell';
5
5
  export const makeLoginCommand = () => {
6
6
  const login = new Command()
7
7
  .command('login')
8
+ .description('login to a connected Contensis instance')
8
9
  .argument('<user/clientId>', 'the username to login with')
9
10
  .argument(
10
11
  '[password]',
11
12
  'the password to use to login with (optional/insecure)'
12
13
  )
13
14
  .option(
14
- '-s --shared-secret <sharedSecret>',
15
+ '-s, --shared-secret <sharedSecret>',
15
16
  'the shared secret to use when logging in with a client id'
16
17
  )
17
18
  .usage('<user/clientId> [password] [-s <sharedSecret>]')
@@ -27,7 +28,7 @@ Example call:
27
28
  password,
28
29
  sharedSecret: opts.sharedSecret,
29
30
  });
30
- if (token) await shell().start();
31
+ if (token) await shell().restart();
31
32
  });
32
33
  return login;
33
34
  };
@@ -6,11 +6,14 @@ import { cliCommand } from '~/services/ContensisCliService';
6
6
  export const makePushCommand = () => {
7
7
  const push = new Command()
8
8
  .command('push')
9
+ .description('push command')
10
+ .addHelpText('after', `\n`)
9
11
  .showHelpAfterError(true)
10
12
  .exitOverride();
11
13
 
12
14
  push
13
15
  .command('block')
16
+ .description('push a block')
14
17
  .argument('<block-id>', 'the name of the block to push to')
15
18
  .argument(
16
19
  '<image uri:tag>',
@@ -55,7 +58,7 @@ export const makePushCommand = () => {
55
58
  'after',
56
59
  `
57
60
  Example call:
58
- > push block contensis-app ghcr.io/contensis/contensis-app/build-4359 master --release\n`
61
+ > push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release\n`
59
62
  )
60
63
  .action(async (blockId: string, imageUri: string, branch: string, opts) => {
61
64
  const cli = cliCommand(['push', 'block', blockId], opts);
@@ -99,7 +102,11 @@ Example call:
99
102
  branch: ['branch', 'CI_COMMIT_REF_NAME', 'GITHUB_REF_NAME'],
100
103
  commit: {
101
104
  id: ['commitId', 'CI_COMMIT_SHORT_SHA', 'GITHUB_SHA'],
102
- message: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}
105
+ message: {
106
+ $path: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}
107
+ $formatting: (msg?: string) =>
108
+ msg?.replace(/\\n/g, ' ').replace(/\\n/g, ' ').trim(),
109
+ },
103
110
  dateTime: ['commitDatetime', 'CI_COMMIT_TIMESTAMP'], // ${{ github.event.head_commit.timestamp }}
104
111
  authorEmail: ['authorEmail', 'GITLAB_USER_EMAIL', 'GITHUB_ACTOR'], // ${{ github.event.head_commit.author.email }}
105
112
  committerEmail: [
@@ -0,0 +1,32 @@
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
+ };