livingdocs-cli 2.3.0 → 2.3.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 +7 -7
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
- package/src/commands/project-config/plan.js +2 -2
- package/src/commands/project-config/publish.js +9 -5
- package/src/commands/project-config/upload.js +2 -2
- package/src/lib/api/{channel_config_result_reporter.js → project_config_result_reporter.js} +17 -22
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.
|
|
45
|
+
_See code: [src/commands/component-library/build.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.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.
|
|
60
|
+
_See code: [src/commands/config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.1/src/commands/config/print.js)_
|
|
61
61
|
|
|
62
62
|
## `livingdocs-cli design-server:start`
|
|
63
63
|
|
|
@@ -75,7 +75,7 @@ OPTIONS
|
|
|
75
75
|
--verbose
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
_See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.
|
|
78
|
+
_See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.1/src/commands/design-server/start.js)_
|
|
79
79
|
|
|
80
80
|
## `livingdocs-cli help [COMMAND]`
|
|
81
81
|
|
|
@@ -117,7 +117,7 @@ OPTIONS
|
|
|
117
117
|
--format=js|js/html|json The format of the files written.
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
_See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.
|
|
120
|
+
_See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.1/src/commands/project-config/download.js)_
|
|
121
121
|
|
|
122
122
|
## `livingdocs-cli project-config:import-design`
|
|
123
123
|
|
|
@@ -134,7 +134,7 @@ OPTIONS
|
|
|
134
134
|
-u, --designUri=designUri (required) URL of the design to import
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
_See code: [src/commands/project-config/import-design.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.
|
|
137
|
+
_See code: [src/commands/project-config/import-design.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.1/src/commands/project-config/import-design.js)_
|
|
138
138
|
|
|
139
139
|
## `livingdocs-cli project-config:plan`
|
|
140
140
|
|
|
@@ -159,7 +159,7 @@ OPTIONS
|
|
|
159
159
|
Can be set by the environment variable 'LI_TOKEN'.
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
_See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.
|
|
162
|
+
_See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.1/src/commands/project-config/plan.js)_
|
|
163
163
|
|
|
164
164
|
## `livingdocs-cli project-config:publish`
|
|
165
165
|
|
|
@@ -184,5 +184,5 @@ OPTIONS
|
|
|
184
184
|
Can be set by the environment variable 'LI_TOKEN'.
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
_See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.
|
|
187
|
+
_See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.1/src/commands/project-config/publish.js)_
|
|
188
188
|
<!-- commandsstop -->
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.3.
|
|
1
|
+
{"version":"2.3.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},"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":[]}}}
|
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.
|
|
4
|
+
"version": "2.3.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": "
|
|
90
|
-
"build": "
|
|
89
|
+
"commit": "b75862ecb749403df0d0e1409bb5985ce34e6ce4",
|
|
90
|
+
"build": "96",
|
|
91
91
|
"branch": "master",
|
|
92
92
|
"isPr": false,
|
|
93
93
|
"slug": "livingdocsIO/livingdocs-cli",
|
|
94
|
-
"date": "2022-01-
|
|
94
|
+
"date": "2022-01-20T17:38:54.308Z"
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -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/
|
|
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/
|
|
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
|
|
|
@@ -21,7 +21,7 @@ class PublishCommand extends Command {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
async run () {
|
|
24
|
-
const {token, host, source, dist} = this.parse(PublishCommand).flags
|
|
24
|
+
const {token, host, source, dist, env} = this.parse(PublishCommand).flags
|
|
25
25
|
const reportError = errorReporter(this.log, host, {verbose: true})
|
|
26
26
|
|
|
27
27
|
if (!source && !dist) throw new Error('Missing a source param')
|
|
@@ -36,7 +36,11 @@ class PublishCommand extends Command {
|
|
|
36
36
|
await liApi.plan({host, token, channelConfig: config})
|
|
37
37
|
.then((result) => {
|
|
38
38
|
ok = result.ok
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
// early return if there are no chagnes
|
|
41
|
+
if (!result.patches?.length) ok = false
|
|
42
|
+
|
|
43
|
+
resultReporter({result, log: this.log})
|
|
40
44
|
})
|
|
41
45
|
.catch(reportError)
|
|
42
46
|
|
|
@@ -46,14 +50,14 @@ class PublishCommand extends Command {
|
|
|
46
50
|
name: 'continue',
|
|
47
51
|
type: 'confirm',
|
|
48
52
|
default: false,
|
|
49
|
-
message: `Are you sure to publish to
|
|
53
|
+
message: `Are you sure to publish${env ? ` to ${env}` : ''}?`
|
|
50
54
|
}])
|
|
51
55
|
|
|
52
56
|
if (!answers.continue) return
|
|
53
57
|
|
|
54
58
|
await liApi.publish({host, token, channelConfig: config})
|
|
55
59
|
.then((result) => {
|
|
56
|
-
resultReporter(result, this.log)
|
|
60
|
+
resultReporter({result, log: this.log})
|
|
57
61
|
updateRevisionNumber({
|
|
58
62
|
source: source || dist,
|
|
59
63
|
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/
|
|
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
|
|
35
|
-
if (!
|
|
34
|
+
const count = result.patches?.length
|
|
35
|
+
if (!count) {
|
|
36
36
|
info(dedent`
|
|
37
37
|
✓ No Changes.
|
|
38
38
|
`)
|
|
39
|
-
} else {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
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) {
|