livingdocs-cli 2.1.2 → 2.2.0
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
|
@@ -9,9 +9,9 @@ Livingdocs Command Line Interface
|
|
|
9
9
|
|
|
10
10
|
## Setup
|
|
11
11
|
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g livingdocs-cli
|
|
14
|
+
livingdocs-cli --help
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
# Commands Reference
|
|
@@ -38,7 +38,7 @@ OPTIONS
|
|
|
38
38
|
-s, --src=src The folder with your .html component templates
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
_See code: [src/commands/component-library/build.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
41
|
+
_See code: [src/commands/component-library/build.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.2.0/src/commands/component-library/build.js)_
|
|
42
42
|
|
|
43
43
|
## `livingdocs-cli config:print`
|
|
44
44
|
|
|
@@ -53,7 +53,7 @@ OPTIONS
|
|
|
53
53
|
-p, --project=project If used configuration options are loaded from .livingdocs-cli file.
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
_See code: [src/commands/config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
56
|
+
_See code: [src/commands/config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.2.0/src/commands/config/print.js)_
|
|
57
57
|
|
|
58
58
|
## `livingdocs-cli design-server:start`
|
|
59
59
|
|
|
@@ -71,7 +71,7 @@ OPTIONS
|
|
|
71
71
|
--verbose
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
_See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
74
|
+
_See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.2.0/src/commands/design-server/start.js)_
|
|
75
75
|
|
|
76
76
|
## `livingdocs-cli help [COMMAND]`
|
|
77
77
|
|
|
@@ -113,7 +113,7 @@ OPTIONS
|
|
|
113
113
|
--format=js|js/html|json The format of the files written.
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
_See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
116
|
+
_See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.2.0/src/commands/project-config/download.js)_
|
|
117
117
|
|
|
118
118
|
## `livingdocs-cli project-config:import-design`
|
|
119
119
|
|
|
@@ -130,7 +130,7 @@ OPTIONS
|
|
|
130
130
|
-u, --designUri=designUri (required) URL of the design to import
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
_See code: [src/commands/project-config/import-design.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
133
|
+
_See code: [src/commands/project-config/import-design.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.2.0/src/commands/project-config/import-design.js)_
|
|
134
134
|
|
|
135
135
|
## `livingdocs-cli project-config:plan`
|
|
136
136
|
|
|
@@ -141,7 +141,7 @@ USAGE
|
|
|
141
141
|
$ livingdocs-cli project-config:plan
|
|
142
142
|
|
|
143
143
|
OPTIONS
|
|
144
|
-
-d, --dist=dist (required) The folder or filename to the
|
|
144
|
+
-d, --dist=dist (required) The folder or filename to the project config.
|
|
145
145
|
-e, --env=env If used configuration options are loaded from .livingdocs-cli file.
|
|
146
146
|
|
|
147
147
|
-h, --host=host (required) [default: http://localhost:9090] The livingdocs host.
|
|
@@ -153,18 +153,18 @@ OPTIONS
|
|
|
153
153
|
Can be set by the environment variable 'LI_TOKEN'.
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
-
_See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
156
|
+
_See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.2.0/src/commands/project-config/plan.js)_
|
|
157
157
|
|
|
158
158
|
## `livingdocs-cli project-config:publish`
|
|
159
159
|
|
|
160
|
-
Publish a
|
|
160
|
+
Publish a project configuration to your project
|
|
161
161
|
|
|
162
162
|
```
|
|
163
163
|
USAGE
|
|
164
164
|
$ livingdocs-cli project-config:publish
|
|
165
165
|
|
|
166
166
|
OPTIONS
|
|
167
|
-
-d, --dist=dist (required) The folder or filename to the
|
|
167
|
+
-d, --dist=dist (required) The folder or filename to the project config.
|
|
168
168
|
-e, --env=env If used configuration options are loaded from .livingdocs-cli file.
|
|
169
169
|
|
|
170
170
|
-h, --host=host (required) [default: http://localhost:9090] The livingdocs host.
|
|
@@ -176,5 +176,5 @@ OPTIONS
|
|
|
176
176
|
Can be set by the environment variable 'LI_TOKEN'.
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
_See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
179
|
+
_See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.2.0/src/commands/project-config/publish.js)_
|
|
180
180
|
<!-- commandsstop -->
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.
|
|
1
|
+
{"version":"2.2.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"},"dist":{"name":"dist","type":"option","char":"d","description":"The folder or filename to the project config.","required":true}},"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"},"dist":{"name":"dist","type":"option","char":"d","description":"The folder or filename to the project config.","required":true}},"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"},"dist":{"name":"dist","type":"option","char":"d","description":"The folder or filename to the channelConfig.","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.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"author": "Livingdocs AG",
|
|
6
6
|
"repository": "livingdocsIO/livingdocs-cli",
|
|
7
7
|
"homepage": "https://github.com/livingdocsIO/livingdocs-cli",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"chalk": "^2.4.2",
|
|
28
28
|
"cheerio": "^1.0.0-rc.3",
|
|
29
29
|
"dedent": "^0.7.0",
|
|
30
|
+
"diff": "^5.0.0",
|
|
30
31
|
"fastify": "^3.25.3",
|
|
31
32
|
"fastify-cors": "^6.0.2",
|
|
32
33
|
"fastify-static": "^4.5.0",
|
|
@@ -85,11 +86,11 @@
|
|
|
85
86
|
"isCi": true,
|
|
86
87
|
"name": "Drone",
|
|
87
88
|
"service": "drone",
|
|
88
|
-
"commit": "
|
|
89
|
-
"build": "
|
|
89
|
+
"commit": "d2d84b77ee70e61b52d84a7a100c07e1acbc2c8e",
|
|
90
|
+
"build": "91",
|
|
90
91
|
"branch": "master",
|
|
91
92
|
"isPr": false,
|
|
92
93
|
"slug": "livingdocsIO/livingdocs-cli",
|
|
93
|
-
"date": "2022-01-
|
|
94
|
+
"date": "2022-01-05T21:32:08.848Z"
|
|
94
95
|
}
|
|
95
96
|
}
|
|
@@ -10,7 +10,7 @@ const readChannelConfig = require('../../lib/read_channel_config')
|
|
|
10
10
|
const updateRevisionNumber = require('../../lib/update_revision_number')
|
|
11
11
|
|
|
12
12
|
class PublishCommand extends Command {
|
|
13
|
-
static description = `Publish a
|
|
13
|
+
static description = `Publish a project configuration to your project`
|
|
14
14
|
static flags = {
|
|
15
15
|
project: sharedFlags.project,
|
|
16
16
|
env: sharedFlags.env,
|
|
@@ -19,7 +19,7 @@ class PublishCommand extends Command {
|
|
|
19
19
|
dist: {
|
|
20
20
|
...sharedFlags.dist,
|
|
21
21
|
required: true,
|
|
22
|
-
description: 'The folder or filename to the
|
|
22
|
+
description: 'The folder or filename to the project config.'
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -33,12 +33,16 @@ class PublishCommand extends Command {
|
|
|
33
33
|
throw err
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
+
let ok = false
|
|
36
37
|
await liApi.plan({host, token, channelConfig: config})
|
|
37
38
|
.then((result) => {
|
|
39
|
+
ok = result.ok
|
|
38
40
|
resultReporter(result, this.log)
|
|
39
41
|
})
|
|
40
42
|
.catch(reportError)
|
|
41
43
|
|
|
44
|
+
if (!ok) return
|
|
45
|
+
|
|
42
46
|
const answers = await inquirer.prompt([{
|
|
43
47
|
name: 'continue',
|
|
44
48
|
type: 'confirm',
|
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
const chalk = require('chalk')
|
|
2
2
|
const dedent = require('dedent')
|
|
3
|
+
const diff = require('diff')
|
|
3
4
|
|
|
4
5
|
module.exports = function (result, log) {
|
|
5
6
|
function info (msg) { log(msg) }
|
|
6
7
|
function success (msg) { log(chalk.green(msg)) }
|
|
7
8
|
function error (msg) { log(chalk.red(msg)) }
|
|
9
|
+
function print (obj) { return JSON.stringify(obj, null, 2) }
|
|
10
|
+
|
|
11
|
+
function colorUpdate (entry) {
|
|
12
|
+
if (entry.added) return chalk.green(entry.value)
|
|
13
|
+
if (entry.removed) return chalk.red(entry.value)
|
|
14
|
+
return entry.value
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function calcDiff (patch) {
|
|
18
|
+
|
|
19
|
+
if (patch.action === 'update') {
|
|
20
|
+
const items = diff.diffJson(patch.valueBefore || '', patch.value)
|
|
21
|
+
return items.reduce((str, item) => {
|
|
22
|
+
return `${str}${colorUpdate(item)}`
|
|
23
|
+
}, '')
|
|
24
|
+
} else if (patch.action === 'remove') {
|
|
25
|
+
return patch.valueBefore
|
|
26
|
+
? chalk.red(print(patch.valueBefore))
|
|
27
|
+
: ''
|
|
28
|
+
} else {
|
|
29
|
+
return chalk.green(print(patch.value))
|
|
30
|
+
}
|
|
31
|
+
}
|
|
8
32
|
|
|
9
33
|
if (result.ok) {
|
|
10
|
-
|
|
34
|
+
const count = result.patches.length
|
|
35
|
+
if (!result.patches || count === 0) {
|
|
11
36
|
info(dedent`
|
|
12
37
|
✓ No Changes.
|
|
13
38
|
`)
|
|
@@ -16,9 +41,8 @@ module.exports = function (result, log) {
|
|
|
16
41
|
info(dedent`
|
|
17
42
|
Plan
|
|
18
43
|
----
|
|
19
|
-
✓ Everything looks ok.
|
|
20
44
|
`)
|
|
21
|
-
info(`\
|
|
45
|
+
info(`\nPatches (${count}):\n`)
|
|
22
46
|
} else {
|
|
23
47
|
success(dedent`
|
|
24
48
|
✓ Success. Channel Config Published.
|
|
@@ -30,9 +54,13 @@ module.exports = function (result, log) {
|
|
|
30
54
|
}
|
|
31
55
|
|
|
32
56
|
for (const patch of result.patches) {
|
|
33
|
-
info(
|
|
57
|
+
info(`• [${patch.action}] ${patch.pointer}`)
|
|
58
|
+
info(`${calcDiff(patch)}`)
|
|
34
59
|
}
|
|
35
|
-
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if (count === 1) info(`\n✓ The patch looks good.\n`)
|
|
63
|
+
else info(`\n✓ All ${count} patches look good.\n`)
|
|
36
64
|
}
|
|
37
65
|
|
|
38
66
|
return
|