livingdocs-cli 2.2.0 → 2.3.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 +17 -9
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
- package/src/commands/config/print.js +4 -2
- package/src/commands/project-config/plan.js +6 -7
- package/src/commands/project-config/publish.js +7 -8
- package/src/commands/project-config/upload.js +6 -7
- package/src/lib/cli/shared_flags.js +13 -0
package/README.md
CHANGED
|
@@ -14,6 +14,10 @@ npm install -g livingdocs-cli
|
|
|
14
14
|
livingdocs-cli --help
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
## Documentation
|
|
18
|
+
|
|
19
|
+
[Livingdocs CLI documentation](https://docs.livingdocs.io/reference-docs/cli)
|
|
20
|
+
|
|
17
21
|
# Commands Reference
|
|
18
22
|
<!-- commands -->
|
|
19
23
|
* [`livingdocs-cli component-library:build`](#livingdocs-cli-component-librarybuild)
|
|
@@ -38,7 +42,7 @@ OPTIONS
|
|
|
38
42
|
-s, --src=src The folder with your .html component templates
|
|
39
43
|
```
|
|
40
44
|
|
|
41
|
-
_See code: [src/commands/component-library/build.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
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)_
|
|
42
46
|
|
|
43
47
|
## `livingdocs-cli config:print`
|
|
44
48
|
|
|
@@ -53,7 +57,7 @@ OPTIONS
|
|
|
53
57
|
-p, --project=project If used configuration options are loaded from .livingdocs-cli file.
|
|
54
58
|
```
|
|
55
59
|
|
|
56
|
-
_See code: [src/commands/config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
60
|
+
_See code: [src/commands/config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.3.0/src/commands/config/print.js)_
|
|
57
61
|
|
|
58
62
|
## `livingdocs-cli design-server:start`
|
|
59
63
|
|
|
@@ -71,7 +75,7 @@ OPTIONS
|
|
|
71
75
|
--verbose
|
|
72
76
|
```
|
|
73
77
|
|
|
74
|
-
_See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
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)_
|
|
75
79
|
|
|
76
80
|
## `livingdocs-cli help [COMMAND]`
|
|
77
81
|
|
|
@@ -113,7 +117,7 @@ OPTIONS
|
|
|
113
117
|
--format=js|js/html|json The format of the files written.
|
|
114
118
|
```
|
|
115
119
|
|
|
116
|
-
_See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
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)_
|
|
117
121
|
|
|
118
122
|
## `livingdocs-cli project-config:import-design`
|
|
119
123
|
|
|
@@ -130,7 +134,7 @@ OPTIONS
|
|
|
130
134
|
-u, --designUri=designUri (required) URL of the design to import
|
|
131
135
|
```
|
|
132
136
|
|
|
133
|
-
_See code: [src/commands/project-config/import-design.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
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)_
|
|
134
138
|
|
|
135
139
|
## `livingdocs-cli project-config:plan`
|
|
136
140
|
|
|
@@ -141,7 +145,7 @@ USAGE
|
|
|
141
145
|
$ livingdocs-cli project-config:plan
|
|
142
146
|
|
|
143
147
|
OPTIONS
|
|
144
|
-
-d, --dist=dist
|
|
148
|
+
-d, --dist=dist The folder where the output will be written.
|
|
145
149
|
-e, --env=env If used configuration options are loaded from .livingdocs-cli file.
|
|
146
150
|
|
|
147
151
|
-h, --host=host (required) [default: http://localhost:9090] The livingdocs host.
|
|
@@ -149,11 +153,13 @@ OPTIONS
|
|
|
149
153
|
|
|
150
154
|
-p, --project=project If used configuration options are loaded from .livingdocs-cli file.
|
|
151
155
|
|
|
156
|
+
-s, --source=source The folder or filename to the project config.
|
|
157
|
+
|
|
152
158
|
-t, --token=token (required) Access Token for your project (needs `public-api:config:write` permission).
|
|
153
159
|
Can be set by the environment variable 'LI_TOKEN'.
|
|
154
160
|
```
|
|
155
161
|
|
|
156
|
-
_See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
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)_
|
|
157
163
|
|
|
158
164
|
## `livingdocs-cli project-config:publish`
|
|
159
165
|
|
|
@@ -164,7 +170,7 @@ USAGE
|
|
|
164
170
|
$ livingdocs-cli project-config:publish
|
|
165
171
|
|
|
166
172
|
OPTIONS
|
|
167
|
-
-d, --dist=dist
|
|
173
|
+
-d, --dist=dist The folder where the output will be written.
|
|
168
174
|
-e, --env=env If used configuration options are loaded from .livingdocs-cli file.
|
|
169
175
|
|
|
170
176
|
-h, --host=host (required) [default: http://localhost:9090] The livingdocs host.
|
|
@@ -172,9 +178,11 @@ OPTIONS
|
|
|
172
178
|
|
|
173
179
|
-p, --project=project If used configuration options are loaded from .livingdocs-cli file.
|
|
174
180
|
|
|
181
|
+
-s, --source=source The folder or filename to the project config.
|
|
182
|
+
|
|
175
183
|
-t, --token=token (required) Access Token for your project (needs `public-api:config:write` permission).
|
|
176
184
|
Can be set by the environment variable 'LI_TOKEN'.
|
|
177
185
|
```
|
|
178
186
|
|
|
179
|
-
_See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.
|
|
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)_
|
|
180
188
|
<!-- commandsstop -->
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.
|
|
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":[]}}}
|
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.3.0",
|
|
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": "b794df59cabaa3a259571d0bf38ffa215820f09c",
|
|
90
|
+
"build": "94",
|
|
91
91
|
"branch": "master",
|
|
92
92
|
"isPr": false,
|
|
93
93
|
"slug": "livingdocsIO/livingdocs-cli",
|
|
94
|
-
"date": "2022-01-
|
|
94
|
+
"date": "2022-01-08T14:01:02.392Z"
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -21,13 +21,15 @@ class ListConfigCommand extends Command {
|
|
|
21
21
|
|
|
22
22
|
this.printVar(`LI_HOST`, 'host', sessionConfig)
|
|
23
23
|
this.printVar(`LI_TOKEN`, 'token', sessionConfig)
|
|
24
|
+
this.printVar(`LI_SOURCE_FOLDER`, 'sourceFolder', sessionConfig)
|
|
24
25
|
this.printVar(`LI_DIST_FOLDER`, 'distFolder', sessionConfig)
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
printVar (name, prop, sessionConfig) {
|
|
28
29
|
const varObj = getVar(name, prop, sessionConfig)
|
|
29
30
|
|
|
30
|
-
this.log(chalk.green(`${name}`), chalk.gray(` (source: ${varObj.source})`))
|
|
31
|
+
if (varObj.source) this.log(chalk.green(`${name}`), chalk.gray(` (source: ${varObj.source})`))
|
|
32
|
+
else this.log(chalk.green(`${name}`))
|
|
31
33
|
this.log(chalk.gray(`${varObj.value}\n`))
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -51,7 +53,7 @@ function getVar (key, prop, sessionConfig) {
|
|
|
51
53
|
} else {
|
|
52
54
|
return {
|
|
53
55
|
value: '[undefined]',
|
|
54
|
-
source:
|
|
56
|
+
source: undefined
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
}
|
|
@@ -13,18 +13,17 @@ class PlanCommand extends Command {
|
|
|
13
13
|
env: sharedFlags.env,
|
|
14
14
|
token: {...sharedFlags.configWriteToken, required: true},
|
|
15
15
|
host: {...sharedFlags.host, required: true},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
required: true,
|
|
19
|
-
description: 'The folder or filename to the project config.'
|
|
20
|
-
}
|
|
16
|
+
source: {...sharedFlags.source},
|
|
17
|
+
dist: {...sharedFlags.dist}
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
async run () {
|
|
24
|
-
const {token, host, dist} = this.parse(PlanCommand).flags
|
|
21
|
+
const {token, host, source, dist} = this.parse(PlanCommand).flags
|
|
25
22
|
const reportError = errorReporter(this.log, host, {verbose: true})
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
if (!source && !dist) throw new Error('Missing a source param')
|
|
25
|
+
|
|
26
|
+
const config = await readChannelConfig({source: source || dist})
|
|
28
27
|
|
|
29
28
|
await liApi.plan({host, token, channelConfig: config})
|
|
30
29
|
.then((result) => {
|
|
@@ -16,18 +16,17 @@ class PublishCommand extends Command {
|
|
|
16
16
|
env: sharedFlags.env,
|
|
17
17
|
token: {...sharedFlags.configWriteToken, required: true},
|
|
18
18
|
host: {...sharedFlags.host, required: true},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
required: true,
|
|
22
|
-
description: 'The folder or filename to the project config.'
|
|
23
|
-
}
|
|
19
|
+
source: {...sharedFlags.source},
|
|
20
|
+
dist: {...sharedFlags.dist}
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
async run () {
|
|
27
|
-
const {token, host, dist} = this.parse(PublishCommand).flags
|
|
24
|
+
const {token, host, source, dist} = this.parse(PublishCommand).flags
|
|
28
25
|
const reportError = errorReporter(this.log, host, {verbose: true})
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
if (!source && !dist) throw new Error('Missing a source param')
|
|
28
|
+
|
|
29
|
+
const config = await readChannelConfig({source: source || dist})
|
|
31
30
|
.catch((err) => {
|
|
32
31
|
this.log(chalk.red('✕ Parsing Failed'))
|
|
33
32
|
throw err
|
|
@@ -56,7 +55,7 @@ class PublishCommand extends Command {
|
|
|
56
55
|
.then((result) => {
|
|
57
56
|
resultReporter(result, this.log)
|
|
58
57
|
updateRevisionNumber({
|
|
59
|
-
source: dist,
|
|
58
|
+
source: source || dist,
|
|
60
59
|
revisionNumberBefore: config.$baseRevision,
|
|
61
60
|
revisionNumber: result.revisionNumber
|
|
62
61
|
})
|
|
@@ -15,11 +15,10 @@ class UploadCommand extends Command {
|
|
|
15
15
|
env: sharedFlags.env,
|
|
16
16
|
token: {...sharedFlags.configWriteToken, required: true},
|
|
17
17
|
host: {...sharedFlags.host, required: true},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
required: true
|
|
21
|
-
|
|
22
|
-
}),
|
|
18
|
+
source: {
|
|
19
|
+
...sharedFlags.source,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
23
22
|
draftName: flags.string({
|
|
24
23
|
description: 'The name of the draft the config will be saved under.',
|
|
25
24
|
required: true
|
|
@@ -27,10 +26,10 @@ class UploadCommand extends Command {
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
async run () {
|
|
30
|
-
const {token, host,
|
|
29
|
+
const {token, host, source} = this.parse(UploadCommand).flags
|
|
31
30
|
const reportError = errorReporter(this.log, host, {verbose: true})
|
|
32
31
|
|
|
33
|
-
const config = await readChannelConfig({source
|
|
32
|
+
const config = await readChannelConfig({source})
|
|
34
33
|
.catch((err) => {
|
|
35
34
|
this.log(chalk.red('✕ Parsing Failed'))
|
|
36
35
|
throw err
|
|
@@ -66,6 +66,19 @@ module.exports = {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}),
|
|
69
|
+
source: flags.string({
|
|
70
|
+
char: 's',
|
|
71
|
+
description: 'The folder or filename to the project config.',
|
|
72
|
+
|
|
73
|
+
default ({options, flags: givenFlags}) {
|
|
74
|
+
const sessionConfig = getCliConfig(givenFlags)
|
|
75
|
+
if (sessionConfig) {
|
|
76
|
+
return sessionConfig.sourceFolder
|
|
77
|
+
} else {
|
|
78
|
+
return process.env.LI_SOURCE_FOLDER
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}),
|
|
69
82
|
designUri: flags.string({
|
|
70
83
|
char: 'u',
|
|
71
84
|
description: 'URL of the design to import',
|