livingdocs-cli 2.0.1 → 2.1.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
@@ -20,7 +20,7 @@ $ npm install -g livingdocs-cli
20
20
  $ livingdocs-cli COMMAND
21
21
  running command...
22
22
  $ livingdocs-cli (-v|--version|version)
23
- livingdocs-cli/2.0.1 linux-x64 node-v16.11.1
23
+ livingdocs-cli/2.1.0 linux-x64 node-v16.11.1
24
24
  $ livingdocs-cli --help [COMMAND]
25
25
  USAGE
26
26
  $ livingdocs-cli COMMAND
@@ -29,8 +29,8 @@ USAGE
29
29
  <!-- usagestop -->
30
30
  # Commands
31
31
  <!-- commands -->
32
- * [`livingdocs-cli cli-config:print`](#livingdocs-cli-cli-configprint)
33
32
  * [`livingdocs-cli component-library:build`](#livingdocs-cli-component-librarybuild)
33
+ * [`livingdocs-cli config:print`](#livingdocs-cli-configprint)
34
34
  * [`livingdocs-cli design-server:start`](#livingdocs-cli-design-serverstart)
35
35
  * [`livingdocs-cli help [COMMAND]`](#livingdocs-cli-help-command)
36
36
  * [`livingdocs-cli project-config:download`](#livingdocs-cli-project-configdownload)
@@ -41,31 +41,35 @@ USAGE
41
41
  * [`livingdocs-cli project-config:upload`](#livingdocs-cli-project-configupload)
42
42
  * [`livingdocs-cli project-config:upload_assets`](#livingdocs-cli-project-configupload_assets)
43
43
 
44
- ## `livingdocs-cli cli-config:print`
44
+ ## `livingdocs-cli component-library:build`
45
45
 
46
- Print current CLI configuration
46
+ Build a Component Library JSON file
47
47
 
48
48
  ```
49
49
  USAGE
50
- $ livingdocs-cli cli-config:print
50
+ $ livingdocs-cli component-library:build
51
+
52
+ OPTIONS
53
+ -d, --dist=dist The folder where the output will be written.
54
+ -s, --src=src The folder with your .html component templates
51
55
  ```
52
56
 
53
- _See code: [src/commands/cli-config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/cli-config/print.js)_
57
+ _See code: [src/commands/component-library/build.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/component-library/build.js)_
54
58
 
55
- ## `livingdocs-cli component-library:build`
59
+ ## `livingdocs-cli config:print`
56
60
 
57
- Build a Component Library JSON file
61
+ Print current CLI configuration
58
62
 
59
63
  ```
60
64
  USAGE
61
- $ livingdocs-cli component-library:build
65
+ $ livingdocs-cli config:print
62
66
 
63
67
  OPTIONS
64
- -d, --dist=dist The folder where the output will be written.
65
- -s, --src=src The folder with your .html component templates
68
+ -e, --env=env If used configuration options are loaded from .livingdocs-cli file.
69
+ -p, --project=project If used configuration options are loaded from .livingdocs-cli file.
66
70
  ```
67
71
 
68
- _See code: [src/commands/component-library/build.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/component-library/build.js)_
72
+ _See code: [src/commands/config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/config/print.js)_
69
73
 
70
74
  ## `livingdocs-cli design-server:start`
71
75
 
@@ -83,7 +87,7 @@ OPTIONS
83
87
  --verbose
84
88
  ```
85
89
 
86
- _See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/design-server/start.js)_
90
+ _See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/design-server/start.js)_
87
91
 
88
92
  ## `livingdocs-cli help [COMMAND]`
89
93
 
@@ -100,7 +104,7 @@ OPTIONS
100
104
  --all see all commands in CLI
101
105
  ```
102
106
 
103
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.2.1/src/commands/help.ts)_
107
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.2.3/src/commands/help.ts)_
104
108
 
105
109
  ## `livingdocs-cli project-config:download`
106
110
 
@@ -125,7 +129,7 @@ OPTIONS
125
129
  --format=js|js/html|json The format of the files written.
126
130
  ```
127
131
 
128
- _See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/project-config/download.js)_
132
+ _See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/project-config/download.js)_
129
133
 
130
134
  ## `livingdocs-cli project-config:drafts`
131
135
 
@@ -143,7 +147,7 @@ OPTIONS
143
147
  Can be set by the environment variable 'LI_TOKEN'.
144
148
  ```
145
149
 
146
- _See code: [src/commands/project-config/drafts.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/project-config/drafts.js)_
150
+ _See code: [src/commands/project-config/drafts.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/project-config/drafts.js)_
147
151
 
148
152
  ## `livingdocs-cli project-config:import-design`
149
153
 
@@ -160,7 +164,7 @@ OPTIONS
160
164
  -u, --designUri=designUri (required) URL of the design to import
161
165
  ```
162
166
 
163
- _See code: [src/commands/project-config/import-design.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/project-config/import-design.js)_
167
+ _See code: [src/commands/project-config/import-design.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/project-config/import-design.js)_
164
168
 
165
169
  ## `livingdocs-cli project-config:plan`
166
170
 
@@ -183,7 +187,7 @@ OPTIONS
183
187
  Can be set by the environment variable 'LI_TOKEN'.
184
188
  ```
185
189
 
186
- _See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/project-config/plan.js)_
190
+ _See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/project-config/plan.js)_
187
191
 
188
192
  ## `livingdocs-cli project-config:publish`
189
193
 
@@ -206,7 +210,7 @@ OPTIONS
206
210
  Can be set by the environment variable 'LI_TOKEN'.
207
211
  ```
208
212
 
209
- _See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/project-config/publish.js)_
213
+ _See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/project-config/publish.js)_
210
214
 
211
215
  ## `livingdocs-cli project-config:upload`
212
216
 
@@ -231,7 +235,7 @@ OPTIONS
231
235
  --draftName=draftName (required) The name of the draft the config will be saved under.
232
236
  ```
233
237
 
234
- _See code: [src/commands/project-config/upload.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/project-config/upload.js)_
238
+ _See code: [src/commands/project-config/upload.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/project-config/upload.js)_
235
239
 
236
240
  ## `livingdocs-cli project-config:upload_assets`
237
241
 
@@ -251,5 +255,5 @@ OPTIONS
251
255
  Can be set by the environment variable 'LI_TOKEN'.
252
256
  ```
253
257
 
254
- _See code: [src/commands/project-config/upload_assets.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.0.1/src/commands/project-config/upload_assets.js)_
258
+ _See code: [src/commands/project-config/upload_assets.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v2.1.0/src/commands/project-config/upload_assets.js)_
255
259
  <!-- commandsstop -->
@@ -1 +1 @@
1
- {"version":"2.0.1","commands":{"cli-config:print":{"id":"cli-config:print","description":"Print current CLI configuration","pluginName":"livingdocs-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"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":[]},"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","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 channelConfig.","required":true}},"args":[]},"project-config:publish":{"id":"project-config:publish","description":"Publish a ChannelConfig 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 channelConfig.","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","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","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.1.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","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 channelConfig.","required":true}},"args":[]},"project-config:publish":{"id":"project-config:publish","description":"Publish a ChannelConfig 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 channelConfig.","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","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","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.0.1",
4
+ "version": "2.1.0",
5
5
  "author": "Livingdocs AG",
6
6
  "repository": "livingdocsIO/livingdocs-cli",
7
7
  "homepage": "https://github.com/livingdocsIO/livingdocs-cli",
@@ -30,13 +30,14 @@
30
30
  "fastify": "^2.10.0",
31
31
  "fastify-cors": "^2.1.3",
32
32
  "fastify-static": "^2.5.0",
33
- "fs-extra": "^8.1.0",
33
+ "fs-extra": "^10.0.0",
34
34
  "globby": "^10.0.1",
35
35
  "html-minifier": "^4.0.0",
36
36
  "inquirer": "^7.0.0",
37
37
  "javascript-stringify": "^2.0.0",
38
38
  "js-beautify": "^1.10.2",
39
- "lodash": "^4.17.15",
39
+ "js-yaml": "^4.1.0",
40
+ "lodash": "^4.17.21",
40
41
  "nanoid": "^2.1.0",
41
42
  "npmlog": "^4.1.2",
42
43
  "p-queue": "^6.1.1",
@@ -48,8 +49,8 @@
48
49
  "@oclif/dev-cli": "^1.22.2",
49
50
  "@oclif/test": "^1.2.5",
50
51
  "chai": "^4.2.0",
51
- "eslint": "^8.0.1",
52
- "eslint-config-oclif": "^3.1.0",
52
+ "eslint": "^8.5.0",
53
+ "eslint-config-oclif": "^4.0.0",
53
54
  "mocha": "^6.2.0",
54
55
  "nock": "^11.3.3",
55
56
  "nyc": "^14.1.1"
@@ -84,11 +85,11 @@
84
85
  "isCi": true,
85
86
  "name": "Drone",
86
87
  "service": "drone",
87
- "commit": "ffb53d4f5e402ac0f3b663811e1551ff04e29e5d",
88
- "build": "80",
88
+ "commit": "1de7088cc46f9c07a51f0dc57a1f44ac7a324ae0",
89
+ "build": "82",
89
90
  "branch": "master",
90
91
  "isPr": false,
91
92
  "slug": "livingdocsIO/livingdocs-cli",
92
- "date": "2021-12-10T15:16:18.151Z"
93
+ "date": "2022-01-03T10:00:09.235Z"
93
94
  }
94
95
  }
@@ -0,0 +1,59 @@
1
+ const chalk = require('chalk')
2
+ const {Command} = require('@oclif/command')
3
+
4
+ const sharedFlags = require('../../lib/cli/shared_flags')
5
+ const loadCliConfig = require('../../lib/cli/load_cli_config')
6
+
7
+ const defaults = {
8
+ LI_HOST: 'http://localhost:9090'
9
+ }
10
+
11
+ class ListConfigCommand extends Command {
12
+ static description = `Print current CLI configuration`
13
+ static flags = {
14
+ project: sharedFlags.project,
15
+ env: sharedFlags.env
16
+ }
17
+
18
+ async run () {
19
+ const {project, env} = this.parse(ListConfigCommand).flags
20
+ const sessionConfig = loadCliConfig({project, env})
21
+
22
+ this.printVar(`LI_HOST`, 'host', sessionConfig)
23
+ this.printVar(`LI_TOKEN`, 'token', sessionConfig)
24
+ this.printVar(`LI_DIST_FOLDER`, 'distFolder', sessionConfig)
25
+ }
26
+
27
+ printVar (name, prop, sessionConfig) {
28
+ const varObj = getVar(name, prop, sessionConfig)
29
+
30
+ this.log(chalk.green(`${name}`), chalk.gray(` (source: ${varObj.source})`))
31
+ this.log(chalk.gray(`${varObj.value}\n`))
32
+ }
33
+ }
34
+
35
+ function getVar (key, prop, sessionConfig) {
36
+ if (sessionConfig?.[prop] !== undefined) {
37
+ return {
38
+ value: sessionConfig?.[prop],
39
+ source: '.livingdocs-cli file'
40
+ }
41
+ } else if (process.env[key]) {
42
+ return {
43
+ value: process.env[key],
44
+ source: 'environment variable'
45
+ }
46
+ } else if (defaults[key]) {
47
+ return {
48
+ value: defaults[key],
49
+ source: 'default value'
50
+ }
51
+ } else {
52
+ return {
53
+ value: '[undefined]',
54
+ source: 'not set'
55
+ }
56
+ }
57
+ }
58
+
59
+ module.exports = ListConfigCommand
@@ -1,4 +1,6 @@
1
1
  const fs = require('fs-extra')
2
+ const yaml = require('js-yaml')
3
+
2
4
  const _get = require('lodash/get')
3
5
 
4
6
  let cliConfig
@@ -31,7 +33,8 @@ function readFile () {
31
33
  const filepath = `${workingDir}/.livingdocs-cli`
32
34
 
33
35
  if (fs.existsSync(filepath)) {
34
- const config = fs.readJsonSync(filepath)
36
+
37
+ const config = yaml.load(fs.readFileSync(filepath))
35
38
  return config
36
39
 
37
40
  }
@@ -1,45 +0,0 @@
1
- const chalk = require('chalk')
2
- const {Command} = require('@oclif/command')
3
-
4
- const defaults = {
5
- LI_HOST: 'http://localhost:9090'
6
- }
7
-
8
- class ListConfigCommand extends Command {
9
- static description = `Print current CLI configuration`
10
- static flags = {}
11
-
12
- async run () {
13
- this.printVar(`LI_HOST`)
14
- this.printVar(`LI_TOKEN`)
15
- this.printVar(`LI_DIST_FOLDER`)
16
- }
17
-
18
- printVar (name) {
19
- const varObj = getVar(name)
20
-
21
- this.log(chalk.green(`${name}`), chalk.gray(` (source: ${varObj.source})`))
22
- this.log(chalk.gray(`${varObj.value}\n`))
23
- }
24
- }
25
-
26
- function getVar (key) {
27
- if (process.env[key]) {
28
- return {
29
- value: process.env[key],
30
- source: 'environment variable'
31
- }
32
- } else if (defaults[key]) {
33
- return {
34
- value: defaults[key],
35
- source: 'default value'
36
- }
37
- } else {
38
- return {
39
- value: '[undefined]',
40
- source: 'not set'
41
- }
42
- }
43
- }
44
-
45
- module.exports = ListConfigCommand