livingdocs-cli 2.3.0 → 2.4.1

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 CHANGED
@@ -42,7 +42,7 @@ OPTIONS
42
42
  -s, --src=src The folder with your .html component templates
43
43
  ```
44
44
 
45
- _See code: [src/commands/component-library/build.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.0/src/commands/component-library/build.js)_
45
+ _See code: [src/commands/component-library/build.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.4.1/src/commands/component-library/build.js)_
46
46
 
47
47
  ## `livingdocs-cli config:print`
48
48
 
@@ -57,7 +57,7 @@ OPTIONS
57
57
  -p, --project=project If used configuration options are loaded from .livingdocs-cli file.
58
58
  ```
59
59
 
60
- _See code: [src/commands/config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.0/src/commands/config/print.js)_
60
+ _See code: [src/commands/config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.4.1/src/commands/config/print.js)_
61
61
 
62
62
  ## `livingdocs-cli design-server:start`
63
63
 
@@ -68,14 +68,15 @@ USAGE
68
68
  $ livingdocs-cli design-server:start
69
69
 
70
70
  OPTIONS
71
- -d, --dist=dist (required) The folder to load designs from.
72
- -p, --port=port [default: 9030] The port of the design-server.
73
- --assets=assets Asset folder to serve static files.
74
- --basePath=basePath The basePath to set in `assets.basePath`.
71
+ -a, --address=address The address of the design-server.
72
+ -d, --dist=dist (required) The folder to load designs from.
73
+ -p, --port=port [default: 9030] The port of the design-server.
74
+ --assets=assets Asset folder to serve static files.
75
+ --basePath=basePath The basePath to set in `assets.basePath`.
75
76
  --verbose
76
77
  ```
77
78
 
78
- _See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.0/src/commands/design-server/start.js)_
79
+ _See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.4.1/src/commands/design-server/start.js)_
79
80
 
80
81
  ## `livingdocs-cli help [COMMAND]`
81
82
 
@@ -117,7 +118,7 @@ OPTIONS
117
118
  --format=js|js/html|json The format of the files written.
118
119
  ```
119
120
 
120
- _See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.0/src/commands/project-config/download.js)_
121
+ _See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.4.1/src/commands/project-config/download.js)_
121
122
 
122
123
  ## `livingdocs-cli project-config:import-design`
123
124
 
@@ -134,7 +135,7 @@ OPTIONS
134
135
  -u, --designUri=designUri (required) URL of the design to import
135
136
  ```
136
137
 
137
- _See code: [src/commands/project-config/import-design.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.0/src/commands/project-config/import-design.js)_
138
+ _See code: [src/commands/project-config/import-design.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.4.1/src/commands/project-config/import-design.js)_
138
139
 
139
140
  ## `livingdocs-cli project-config:plan`
140
141
 
@@ -159,7 +160,7 @@ OPTIONS
159
160
  Can be set by the environment variable 'LI_TOKEN'.
160
161
  ```
161
162
 
162
- _See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.0/src/commands/project-config/plan.js)_
163
+ _See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.4.1/src/commands/project-config/plan.js)_
163
164
 
164
165
  ## `livingdocs-cli project-config:publish`
165
166
 
@@ -182,7 +183,9 @@ OPTIONS
182
183
 
183
184
  -t, --token=token (required) Access Token for your project (needs `public-api:config:write` permission).
184
185
  Can be set by the environment variable 'LI_TOKEN'.
186
+
187
+ -y, --yes Confirm
185
188
  ```
186
189
 
187
- _See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.0/src/commands/project-config/publish.js)_
190
+ _See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.4.1/src/commands/project-config/publish.js)_
188
191
  <!-- commandsstop -->
@@ -1 +1 @@
1
- {"version":"2.3.0","commands":{"component-library:build":{"id":"component-library:build","description":"Build a Component Library JSON file","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"src":{"name":"src","type":"option","char":"s","description":"The folder with your .html component templates"},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written."}},"args":[]},"config:print":{"id":"config:print","description":"Print current CLI configuration","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."}},"args":[]},"design-server:start":{"id":"design-server:start","description":"Start a design server for development","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"The port of the design-server.","default":9030},"dist":{"name":"dist","type":"option","char":"d","description":"The folder to load designs from.","required":true},"assets":{"name":"assets","type":"option","description":"Asset folder to serve static files."},"basePath":{"name":"basePath","type":"option","description":"The basePath to set in `assets.basePath`."},"verbose":{"name":"verbose","type":"boolean","allowNo":false}},"args":[]},"project-config:download":{"id":"project-config:download","description":"Download a project configuration","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:read` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","required":true,"default":"http://localhost:9090"},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written."},"format":{"name":"format","type":"option","description":"The format of the files written.","options":["js","js/html","json"]}},"args":[]},"project-config:drafts":{"id":"project-config:drafts","description":"List project configuration drafts","pluginName":"livingdocs-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:read` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","default":"http://localhost:9090"}},"args":[]},"project-config:import-design":{"id":"project-config:import-design","description":"Import a design into a given project configuration","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written.","required":true},"designUri":{"name":"designUri","type":"option","char":"u","description":"URL of the design to import","required":true}},"args":[]},"project-config:plan":{"id":"project-config:plan","description":"See what would be updated in a publish command","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:write` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","required":true,"default":"http://localhost:9090"},"source":{"name":"source","type":"option","char":"s","description":"The folder or filename to the project config."},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written."}},"args":[]},"project-config:publish":{"id":"project-config:publish","description":"Publish a project configuration to your project","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:write` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","required":true,"default":"http://localhost:9090"},"source":{"name":"source","type":"option","char":"s","description":"The folder or filename to the project config."},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written."}},"args":[]},"project-config:upload":{"id":"project-config:upload","description":"Upload a ChannelConfig into a draft for your project","pluginName":"livingdocs-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:write` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","required":true,"default":"http://localhost:9090"},"source":{"name":"source","type":"option","char":"s","description":"The folder or filename to the project config.","required":true},"draftName":{"name":"draftName","type":"option","description":"The name of the draft the config will be saved under.","required":true}},"args":[]},"project-config:upload_assets":{"id":"project-config:upload_assets","description":"Upload assets to your project","pluginName":"livingdocs-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:write` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","default":"http://localhost:9090"},"assets":{"name":"assets","type":"option","char":"a","description":"The folder where you asset files are located."}},"args":[]}}}
1
+ {"version":"2.4.1","commands":{"component-library:build":{"id":"component-library:build","description":"Build a Component Library JSON file","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"src":{"name":"src","type":"option","char":"s","description":"The folder with your .html component templates"},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written."}},"args":[]},"config:print":{"id":"config:print","description":"Print current CLI configuration","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."}},"args":[]},"design-server:start":{"id":"design-server:start","description":"Start a design server for development","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"The port of the design-server.","default":9030},"address":{"name":"address","type":"option","char":"a","description":"The address of the design-server."},"dist":{"name":"dist","type":"option","char":"d","description":"The folder to load designs from.","required":true},"assets":{"name":"assets","type":"option","description":"Asset folder to serve static files."},"basePath":{"name":"basePath","type":"option","description":"The basePath to set in `assets.basePath`."},"verbose":{"name":"verbose","type":"boolean","allowNo":false}},"args":[]},"project-config:download":{"id":"project-config:download","description":"Download a project configuration","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:read` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","required":true,"default":"http://localhost:9090"},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written."},"format":{"name":"format","type":"option","description":"The format of the files written.","options":["js","js/html","json"]}},"args":[]},"project-config:drafts":{"id":"project-config:drafts","description":"List project configuration drafts","pluginName":"livingdocs-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:read` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","default":"http://localhost:9090"}},"args":[]},"project-config:import-design":{"id":"project-config:import-design","description":"Import a design into a given project configuration","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written.","required":true},"designUri":{"name":"designUri","type":"option","char":"u","description":"URL of the design to import","required":true}},"args":[]},"project-config:plan":{"id":"project-config:plan","description":"See what would be updated in a publish command","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:write` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","required":true,"default":"http://localhost:9090"},"source":{"name":"source","type":"option","char":"s","description":"The folder or filename to the project config."},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written."}},"args":[]},"project-config:publish":{"id":"project-config:publish","description":"Publish a project configuration to your project","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"yes":{"name":"yes","type":"boolean","char":"y","description":"Confirm","allowNo":false},"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:write` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","required":true,"default":"http://localhost:9090"},"source":{"name":"source","type":"option","char":"s","description":"The folder or filename to the project config."},"dist":{"name":"dist","type":"option","char":"d","description":"The folder where the output will be written."}},"args":[]},"project-config:upload":{"id":"project-config:upload","description":"Upload a ChannelConfig into a draft for your project","pluginName":"livingdocs-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"If used configuration options are loaded from .livingdocs-cli file."},"env":{"name":"env","type":"option","char":"e","description":"If used configuration options are loaded from .livingdocs-cli file."},"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:write` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","required":true,"default":"http://localhost:9090"},"source":{"name":"source","type":"option","char":"s","description":"The folder or filename to the project config.","required":true},"draftName":{"name":"draftName","type":"option","description":"The name of the draft the config will be saved under.","required":true}},"args":[]},"project-config:upload_assets":{"id":"project-config:upload_assets","description":"Upload assets to your project","pluginName":"livingdocs-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"Access Token for your project (needs `public-api:config:write` permission).\nCan be set by the environment variable 'LI_TOKEN'.","required":true},"host":{"name":"host","type":"option","char":"h","description":"The livingdocs host.\nCan be set by the environment variable 'LI_HOST'.","default":"http://localhost:9090"},"assets":{"name":"assets","type":"option","char":"a","description":"The folder where you asset files are located."}},"args":[]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "livingdocs-cli",
3
3
  "description": "Livingdocs Command Line Utility",
4
- "version": "2.3.0",
4
+ "version": "2.4.1",
5
5
  "author": "Livingdocs AG",
6
6
  "repository": "livingdocsIO/livingdocs-cli",
7
7
  "homepage": "https://github.com/livingdocsIO/livingdocs-cli",
@@ -86,11 +86,11 @@
86
86
  "isCi": true,
87
87
  "name": "Drone",
88
88
  "service": "drone",
89
- "commit": "b794df59cabaa3a259571d0bf38ffa215820f09c",
90
- "build": "94",
89
+ "commit": "7d697c6169bf306d31b76f4fe85f0e4ce94ac805",
90
+ "build": "107",
91
91
  "branch": "master",
92
92
  "isPr": false,
93
93
  "slug": "livingdocsIO/livingdocs-cli",
94
- "date": "2022-01-08T14:01:02.392Z"
94
+ "date": "2022-03-25T12:54:58.687Z"
95
95
  }
96
96
  }
@@ -13,6 +13,10 @@ class DesignServerCommand extends Command {
13
13
  description: 'The port of the design-server.',
14
14
  default: 9030
15
15
  }),
16
+ address: flags.string({
17
+ char: 'a',
18
+ description: 'The address of the design-server.'
19
+ }),
16
20
  dist: flags.string({
17
21
  char: 'd',
18
22
  description: 'The folder to load designs from.',
@@ -29,7 +33,8 @@ class DesignServerCommand extends Command {
29
33
 
30
34
  async run () {
31
35
  let host
32
- const {port, verbose, dist, assets, basePath} = this.parse(DesignServerCommand).flags
36
+ const {port, address: customAddress, verbose, dist, assets, basePath} =
37
+ this.parse(DesignServerCommand).flags
33
38
 
34
39
  const fastify = require('fastify')({
35
40
  logger: verbose ? {prettyPrint: true} : undefined
@@ -108,7 +113,7 @@ class DesignServerCommand extends Command {
108
113
  reply.sendFile(filePath)
109
114
  })
110
115
 
111
- fastify.listen(port, (err, address) => {
116
+ fastify.listen(port, customAddress, (err, address) => {
112
117
  if (err) throw err
113
118
  host = address
114
119
  if (!verbose) this.log(chalk.green(`server listening at ${address}`))
@@ -3,7 +3,7 @@ const {Command} = require('@oclif/command')
3
3
  const sharedFlags = require('../../lib/cli/shared_flags')
4
4
  const liApi = require('../../lib/api/livingdocs_api')
5
5
  const errorReporter = require('../../lib/api/error_reporter')
6
- const resultReporter = require('../../lib/api/channel_config_result_reporter')
6
+ const resultReporter = require('../../lib/api/project_config_result_reporter')
7
7
  const readChannelConfig = require('../../lib/read_channel_config')
8
8
 
9
9
  class PlanCommand extends Command {
@@ -27,7 +27,7 @@ class PlanCommand extends Command {
27
27
 
28
28
  await liApi.plan({host, token, channelConfig: config})
29
29
  .then((result) => {
30
- resultReporter(result, this.log)
30
+ resultReporter({result, log: this.log})
31
31
  })
32
32
  .catch(reportError)
33
33
  }
@@ -5,7 +5,7 @@ const inquirer = require('inquirer')
5
5
  const sharedFlags = require('../../lib/cli/shared_flags')
6
6
  const liApi = require('../../lib/api/livingdocs_api')
7
7
  const errorReporter = require('../../lib/api/error_reporter')
8
- const resultReporter = require('../../lib/api/channel_config_result_reporter')
8
+ const resultReporter = require('../../lib/api/project_config_result_reporter')
9
9
  const readChannelConfig = require('../../lib/read_channel_config')
10
10
  const updateRevisionNumber = require('../../lib/update_revision_number')
11
11
 
@@ -14,6 +14,7 @@ class PublishCommand extends Command {
14
14
  static flags = {
15
15
  project: sharedFlags.project,
16
16
  env: sharedFlags.env,
17
+ yes: sharedFlags.yes,
17
18
  token: {...sharedFlags.configWriteToken, required: true},
18
19
  host: {...sharedFlags.host, required: true},
19
20
  source: {...sharedFlags.source},
@@ -21,7 +22,7 @@ class PublishCommand extends Command {
21
22
  }
22
23
 
23
24
  async run () {
24
- const {token, host, source, dist} = this.parse(PublishCommand).flags
25
+ const {token, host, source, dist, env, yes} = this.parse(PublishCommand).flags
25
26
  const reportError = errorReporter(this.log, host, {verbose: true})
26
27
 
27
28
  if (!source && !dist) throw new Error('Missing a source param')
@@ -36,24 +37,30 @@ class PublishCommand extends Command {
36
37
  await liApi.plan({host, token, channelConfig: config})
37
38
  .then((result) => {
38
39
  ok = result.ok
39
- resultReporter(result, this.log)
40
+
41
+ // early return if there are no chagnes
42
+ if (!result.patches?.length) ok = false
43
+
44
+ resultReporter({result, log: this.log})
40
45
  })
41
46
  .catch(reportError)
42
47
 
43
48
  if (!ok) return
44
49
 
45
- const answers = await inquirer.prompt([{
46
- name: 'continue',
47
- type: 'confirm',
48
- default: false,
49
- message: `Are you sure to publish to production?`
50
- }])
50
+ if (!yes) {
51
+ const answers = await inquirer.prompt([{
52
+ name: 'continue',
53
+ type: 'confirm',
54
+ default: false,
55
+ message: `Are you sure to publish${env ? ` to ${env}` : ''}?`
56
+ }])
51
57
 
52
- if (!answers.continue) return
58
+ if (!answers.continue) return
59
+ }
53
60
 
54
61
  await liApi.publish({host, token, channelConfig: config})
55
62
  .then((result) => {
56
- resultReporter(result, this.log)
63
+ resultReporter({result, log: this.log})
57
64
  updateRevisionNumber({
58
65
  source: source || dist,
59
66
  revisionNumberBefore: config.$baseRevision,
@@ -4,7 +4,7 @@ const {Command, flags} = require('@oclif/command')
4
4
  const sharedFlags = require('../../lib/cli/shared_flags')
5
5
  const liApi = require('../../lib/api/livingdocs_api')
6
6
  const errorReporter = require('../../lib/api/error_reporter')
7
- const resultReporter = require('../../lib/api/channel_config_result_reporter')
7
+ const resultReporter = require('../../lib/api/project_config_result_reporter')
8
8
  const readChannelConfig = require('../../lib/read_channel_config')
9
9
 
10
10
  class UploadCommand extends Command {
@@ -38,7 +38,7 @@ class UploadCommand extends Command {
38
38
 
39
39
  await liApi.uploadDraft({host, token, channelConfig: config})
40
40
  .then((result) => {
41
- resultReporter(result, this.log)
41
+ resultReporter({result, log: this.log})
42
42
  })
43
43
  .catch(reportError)
44
44
  }
@@ -2,7 +2,7 @@ const chalk = require('chalk')
2
2
  const dedent = require('dedent')
3
3
  const diff = require('diff')
4
4
 
5
- module.exports = function (result, log) {
5
+ module.exports = function ({result, log, omitPatches}) {
6
6
  function info (msg) { log(msg) }
7
7
  function success (msg) { log(chalk.green(msg)) }
8
8
  function error (msg) { log(chalk.red(msg)) }
@@ -31,39 +31,34 @@ module.exports = function (result, log) {
31
31
  }
32
32
 
33
33
  if (result.ok) {
34
- const count = result.patches.length
35
- if (!result.patches || count === 0) {
34
+ const count = result.patches?.length
35
+ if (!count) {
36
36
  info(dedent`
37
37
  ✓ No Changes.
38
38
  `)
39
- } else {
40
- if (result.plan) {
41
- info(dedent`
42
- Plan
43
- ----
44
- `)
45
- info(`\nPatches (${count}):\n`)
46
- } else {
47
- success(dedent`
48
- ✓ Success. Channel Config Published.
49
-
50
- Revision: ${result.revisionNumber}
51
- DesignVersion: ${result.designVersion || '-'}
52
- `)
53
- info(`\nApplied Patches (${result.patches.length}):`)
54
- }
39
+ } else if (result.plan) {
40
+ info(dedent`
41
+ Plan
42
+ ----
43
+ `)
44
+ info(`\nPatches (${count}):\n`)
55
45
 
56
46
  for (const patch of result.patches) {
57
47
  info(`• [${patch.action}] ${patch.pointer}`)
58
48
  info(`${calcDiff(patch)}`)
59
49
  }
60
50
 
61
-
62
51
  if (count === 1) info(`\n✓ The patch looks good.\n`)
63
52
  else info(`\n✓ All ${count} patches look good.\n`)
64
- }
53
+ } else {
54
+ success(dedent`
55
+ ✓ Success. Channel Config Published.
65
56
 
66
- return
57
+ Revision: ${result.revisionNumber}
58
+ DesignVersion: ${result.designVersion || '-'}
59
+ `)
60
+ info(`\nApplied Patches (${result.patches.length}):`)
61
+ }
67
62
  }
68
63
 
69
64
  if (result.schemaErrors) {
@@ -75,7 +70,7 @@ module.exports = function (result, log) {
75
70
  }
76
71
 
77
72
  if (result.violations) {
78
- error(`\nInvalid Config: there are invliad configuration properties`)
73
+ error(`\nInvalid Config: there are invalid configuration properties`)
79
74
 
80
75
  for (const err of result.violations) {
81
76
  error(` • ${err.pointer}: ${err.message}`)
@@ -11,6 +11,11 @@ module.exports = {
11
11
  char: 'e',
12
12
  description: 'If used configuration options are loaded from .livingdocs-cli file.'
13
13
  }),
14
+ yes: flags.boolean({
15
+ char: 'y',
16
+ description: 'Confirm',
17
+ default () { return !process.stdin.isTTY }
18
+ }),
14
19
  configWriteToken: flags.string({
15
20
  char: 't',
16
21
  description: 'Access Token for your project (needs `public-api:config:write` permission).\n' +