livingdocs-cli 1.3.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/0.0.0 darwin-x64 node-v12.10.0
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,42 +29,47 @@ 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)
37
37
  * [`livingdocs-cli project-config:drafts`](#livingdocs-cli-project-configdrafts)
38
+ * [`livingdocs-cli project-config:import-design`](#livingdocs-cli-project-configimport-design)
38
39
  * [`livingdocs-cli project-config:plan`](#livingdocs-cli-project-configplan)
39
40
  * [`livingdocs-cli project-config:publish`](#livingdocs-cli-project-configpublish)
40
41
  * [`livingdocs-cli project-config:upload`](#livingdocs-cli-project-configupload)
41
42
  * [`livingdocs-cli project-config:upload_assets`](#livingdocs-cli-project-configupload_assets)
42
43
 
43
- ## `livingdocs-cli cli-config:print`
44
+ ## `livingdocs-cli component-library:build`
44
45
 
45
- Print current CLI configuration
46
+ Build a Component Library JSON file
46
47
 
47
48
  ```
48
49
  USAGE
49
- $ 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
50
55
  ```
51
56
 
52
- _See code: [src/commands/cli-config/print.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v0.0.0/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)_
53
58
 
54
- ## `livingdocs-cli component-library:build`
59
+ ## `livingdocs-cli config:print`
55
60
 
56
- Build a Component Library JSON file
61
+ Print current CLI configuration
57
62
 
58
63
  ```
59
64
  USAGE
60
- $ livingdocs-cli component-library:build
65
+ $ livingdocs-cli config:print
61
66
 
62
67
  OPTIONS
63
- -d, --dist=dist The folder where the output will be written.
64
- -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.
65
70
  ```
66
71
 
67
- _See code: [src/commands/component-library/build.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v0.0.0/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)_
68
73
 
69
74
  ## `livingdocs-cli design-server:start`
70
75
 
@@ -75,13 +80,14 @@ USAGE
75
80
  $ livingdocs-cli design-server:start
76
81
 
77
82
  OPTIONS
78
- -d, --dist=dist (required) The folder to load designs from.
79
- -p, --port=port [default: 9030] The port of the design-server.
80
- --assets=assets Asset folder to serve static files.
83
+ -d, --dist=dist (required) The folder to load designs from.
84
+ -p, --port=port [default: 9030] The port of the design-server.
85
+ --assets=assets Asset folder to serve static files.
86
+ --basePath=basePath The basePath to set in `assets.basePath`.
81
87
  --verbose
82
88
  ```
83
89
 
84
- _See code: [src/commands/design-server/start.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v0.0.0/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)_
85
91
 
86
92
  ## `livingdocs-cli help [COMMAND]`
87
93
 
@@ -98,7 +104,7 @@ OPTIONS
98
104
  --all see all commands in CLI
99
105
  ```
100
106
 
101
- _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)_
102
108
 
103
109
  ## `livingdocs-cli project-config:download`
104
110
 
@@ -110,17 +116,20 @@ USAGE
110
116
 
111
117
  OPTIONS
112
118
  -d, --dist=dist The folder where the output will be written.
119
+ -e, --env=env If used configuration options are loaded from .livingdocs-cli file.
113
120
 
114
- -h, --host=host [default: http://localhost:9090] The livingdocs host.
121
+ -h, --host=host (required) [default: http://localhost:9090] The livingdocs host.
115
122
  Can be set by the environment variable 'LI_HOST'.
116
123
 
117
- -t, --token=token (required) The Access Token to your project (needs write permission).
124
+ -p, --project=project If used configuration options are loaded from .livingdocs-cli file.
125
+
126
+ -t, --token=token (required) Access Token for your project (needs `public-api:config:read` permission).
118
127
  Can be set by the environment variable 'LI_TOKEN'.
119
128
 
120
129
  --format=js|js/html|json The format of the files written.
121
130
  ```
122
131
 
123
- _See code: [src/commands/project-config/download.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v0.0.0/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)_
124
133
 
125
134
  ## `livingdocs-cli project-config:drafts`
126
135
 
@@ -134,11 +143,28 @@ OPTIONS
134
143
  -h, --host=host [default: http://localhost:9090] The livingdocs host.
135
144
  Can be set by the environment variable 'LI_HOST'.
136
145
 
137
- -t, --token=token (required) The Access Token to your project (needs write permission).
146
+ -t, --token=token (required) Access Token for your project (needs `public-api:config:read` permission).
138
147
  Can be set by the environment variable 'LI_TOKEN'.
139
148
  ```
140
149
 
141
- _See code: [src/commands/project-config/drafts.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v0.0.0/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)_
151
+
152
+ ## `livingdocs-cli project-config:import-design`
153
+
154
+ Import a design into a given project configuration
155
+
156
+ ```
157
+ USAGE
158
+ $ livingdocs-cli project-config:import-design
159
+
160
+ OPTIONS
161
+ -d, --dist=dist (required) The folder where the output will be written.
162
+ -e, --env=env If used configuration options are loaded from .livingdocs-cli file.
163
+ -p, --project=project If used configuration options are loaded from .livingdocs-cli file.
164
+ -u, --designUri=designUri (required) URL of the design to import
165
+ ```
166
+
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)_
142
168
 
143
169
  ## `livingdocs-cli project-config:plan`
144
170
 
@@ -149,16 +175,19 @@ USAGE
149
175
  $ livingdocs-cli project-config:plan
150
176
 
151
177
  OPTIONS
152
- -d, --dist=dist The folder or filename where to download to.
178
+ -d, --dist=dist (required) The folder or filename to the channelConfig.
179
+ -e, --env=env If used configuration options are loaded from .livingdocs-cli file.
153
180
 
154
- -h, --host=host [default: http://localhost:9090] The livingdocs host.
155
- Can be set by the environment variable 'LI_HOST'.
181
+ -h, --host=host (required) [default: http://localhost:9090] The livingdocs host.
182
+ Can be set by the environment variable 'LI_HOST'.
156
183
 
157
- -t, --token=token (required) The Access Token to your project (needs write permission).
158
- Can be set by the environment variable 'LI_TOKEN'.
184
+ -p, --project=project If used configuration options are loaded from .livingdocs-cli file.
185
+
186
+ -t, --token=token (required) Access Token for your project (needs `public-api:config:write` permission).
187
+ Can be set by the environment variable 'LI_TOKEN'.
159
188
  ```
160
189
 
161
- _See code: [src/commands/project-config/plan.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v0.0.0/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)_
162
191
 
163
192
  ## `livingdocs-cli project-config:publish`
164
193
 
@@ -169,16 +198,19 @@ USAGE
169
198
  $ livingdocs-cli project-config:publish
170
199
 
171
200
  OPTIONS
172
- -d, --dist=dist The folder to publish from.
201
+ -d, --dist=dist (required) The folder or filename to the channelConfig.
202
+ -e, --env=env If used configuration options are loaded from .livingdocs-cli file.
173
203
 
174
- -h, --host=host [default: http://localhost:9090] The livingdocs host.
175
- Can be set by the environment variable 'LI_HOST'.
204
+ -h, --host=host (required) [default: http://localhost:9090] The livingdocs host.
205
+ Can be set by the environment variable 'LI_HOST'.
176
206
 
177
- -t, --token=token (required) The Access Token to your project (needs write permission).
178
- Can be set by the environment variable 'LI_TOKEN'.
207
+ -p, --project=project If used configuration options are loaded from .livingdocs-cli file.
208
+
209
+ -t, --token=token (required) Access Token for your project (needs `public-api:config:write` permission).
210
+ Can be set by the environment variable 'LI_TOKEN'.
179
211
  ```
180
212
 
181
- _See code: [src/commands/project-config/publish.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v0.0.0/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)_
182
214
 
183
215
  ## `livingdocs-cli project-config:upload`
184
216
 
@@ -189,18 +221,21 @@ USAGE
189
221
  $ livingdocs-cli project-config:upload
190
222
 
191
223
  OPTIONS
192
- -d, --dist=dist The folder or filename where to download to.
224
+ -d, --dist=dist (required) The folder or filename to the channelConfig.
225
+ -e, --env=env If used configuration options are loaded from .livingdocs-cli file.
193
226
 
194
- -h, --host=host [default: http://localhost:9090] The livingdocs host.
227
+ -h, --host=host (required) [default: http://localhost:9090] The livingdocs host.
195
228
  Can be set by the environment variable 'LI_HOST'.
196
229
 
197
- -t, --token=token (required) The Access Token to your project (needs write permission).
230
+ -p, --project=project If used configuration options are loaded from .livingdocs-cli file.
231
+
232
+ -t, --token=token (required) Access Token for your project (needs `public-api:config:write` permission).
198
233
  Can be set by the environment variable 'LI_TOKEN'.
199
234
 
200
235
  --draftName=draftName (required) The name of the draft the config will be saved under.
201
236
  ```
202
237
 
203
- _See code: [src/commands/project-config/upload.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v0.0.0/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)_
204
239
 
205
240
  ## `livingdocs-cli project-config:upload_assets`
206
241
 
@@ -216,9 +251,9 @@ OPTIONS
216
251
  -h, --host=host [default: http://localhost:9090] The livingdocs host.
217
252
  Can be set by the environment variable 'LI_HOST'.
218
253
 
219
- -t, --token=token (required) The Access Token to your project (needs write permission).
254
+ -t, --token=token (required) Access Token for your project (needs `public-api:config:write` permission).
220
255
  Can be set by the environment variable 'LI_TOKEN'.
221
256
  ```
222
257
 
223
- _See code: [src/commands/project-config/upload_assets.js](https://github.com/livingdocsIO/livingdocs-cli/blob/v0.0.0/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)_
224
259
  <!-- commandsstop -->
@@ -0,0 +1 @@
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": "1.3.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",
@@ -15,8 +15,7 @@
15
15
  "test": "mocha --forbid-only \"test/**/*.test.js\"",
16
16
  "test:coverage": "nyc mocha --forbid-only \"test/**/*.test.js\"",
17
17
  "posttest": "eslint .",
18
- "version": "oclif-dev readme && git add README.md",
19
- "postversion": "/release/node_modules/.bin/set-ci"
18
+ "version": "oclif-dev readme && git add README.md"
20
19
  },
21
20
  "dependencies": {
22
21
  "@oclif/command": "^1.5.19",
@@ -24,38 +23,40 @@
24
23
  "@oclif/plugin-help": "^2.2.1",
25
24
  "@oclif/plugin-not-found": "^1.2.3",
26
25
  "@oclif/plugin-warn-if-update-available": "^1.7.0",
27
- "axios": "^0.19.0",
26
+ "axios": "^0.21.2",
28
27
  "chalk": "^2.4.2",
29
28
  "cheerio": "^1.0.0-rc.3",
30
29
  "dedent": "^0.7.0",
31
30
  "fastify": "^2.10.0",
32
31
  "fastify-cors": "^2.1.3",
33
32
  "fastify-static": "^2.5.0",
34
- "fs-extra": "^8.1.0",
33
+ "fs-extra": "^10.0.0",
35
34
  "globby": "^10.0.1",
36
35
  "html-minifier": "^4.0.0",
37
36
  "inquirer": "^7.0.0",
38
37
  "javascript-stringify": "^2.0.0",
39
38
  "js-beautify": "^1.10.2",
40
- "lodash": "^4.17.15",
39
+ "js-yaml": "^4.1.0",
40
+ "lodash": "^4.17.21",
41
41
  "nanoid": "^2.1.0",
42
42
  "npmlog": "^4.1.2",
43
43
  "p-queue": "^6.1.1",
44
44
  "pino-pretty": "^3.2.2",
45
+ "prettify-html": "0.0.2",
45
46
  "warning-header-parser": "^2.0.0"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@oclif/dev-cli": "^1.22.2",
49
50
  "@oclif/test": "^1.2.5",
50
51
  "chai": "^4.2.0",
51
- "eslint": "^6.3.0",
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"
56
57
  },
57
58
  "engines": {
58
- "node": ">=8.0.0"
59
+ "node": ">=14.0.0"
59
60
  },
60
61
  "files": [
61
62
  "/bin",
@@ -84,11 +85,11 @@
84
85
  "isCi": true,
85
86
  "name": "Drone",
86
87
  "service": "drone",
87
- "commit": "520b8f8fd20d7f11fa391de57e84b0b89b09c3ac",
88
- "build": "37",
88
+ "commit": "1de7088cc46f9c07a51f0dc57a1f44ac7a324ae0",
89
+ "build": "82",
89
90
  "branch": "master",
90
91
  "isPr": false,
91
92
  "slug": "livingdocsIO/livingdocs-cli",
92
- "date": "2020-03-26T21:52:50.081Z"
93
+ "date": "2022-01-03T10:00:09.235Z"
93
94
  }
94
95
  }
@@ -5,16 +5,16 @@ const sharedFlags = require('../../lib/cli/shared_flags')
5
5
  const parseComponents = require('../../lib/parsing/parse_components')
6
6
  const writeComponentLibrary = require('../../lib/write_component_library')
7
7
 
8
- const description = `Build a Component Library JSON file`
9
- const commandFlags = {
10
- src: flags.string({
11
- char: 's',
12
- description: 'The folder with your .html component templates'
13
- }),
14
- dist: sharedFlags.dist
15
- }
16
-
17
8
  class BuildCommand extends Command {
9
+ static description = `Build a Component Library JSON file`
10
+
11
+ static flags = {
12
+ src: flags.string({
13
+ char: 's',
14
+ description: 'The folder with your .html component templates'
15
+ }),
16
+ dist: sharedFlags.dist
17
+ }
18
18
 
19
19
  async run () {
20
20
  const {src, dist} = this.parse(BuildCommand).flags
@@ -41,6 +41,4 @@ class BuildCommand extends Command {
41
41
 
42
42
  }
43
43
 
44
- BuildCommand.description = description
45
- BuildCommand.flags = commandFlags
46
44
  module.exports = BuildCommand
@@ -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
@@ -4,29 +4,28 @@ const {Command, flags} = require('@oclif/command')
4
4
 
5
5
  const loadDesigns = require('../../lib/load_designs')
6
6
 
7
- const description = `Start a design server for development`
8
-
9
- const commandFlags = {
10
- port: flags.integer({
11
- char: 'p',
12
- description: 'The port of the design-server.',
13
- default: 9030
14
- }),
15
- dist: flags.string({
16
- char: 'd',
17
- description: 'The folder to load designs from.',
18
- required: true
19
- }),
20
- assets: flags.string({
21
- description: 'Asset folder to serve static files.'
22
- }),
23
- basePath: flags.string({
24
- description: 'The basePath to set in `assets.basePath`.'
25
- }),
26
- verbose: flags.boolean()
27
- }
28
-
29
7
  class DesignServerCommand extends Command {
8
+ static description = `Start a design server for development`
9
+
10
+ static flags = {
11
+ port: flags.integer({
12
+ char: 'p',
13
+ description: 'The port of the design-server.',
14
+ default: 9030
15
+ }),
16
+ dist: flags.string({
17
+ char: 'd',
18
+ description: 'The folder to load designs from.',
19
+ required: true
20
+ }),
21
+ assets: flags.string({
22
+ description: 'Asset folder to serve static files.'
23
+ }),
24
+ basePath: flags.string({
25
+ description: 'The basePath to set in `assets.basePath`.'
26
+ }),
27
+ verbose: flags.boolean()
28
+ }
30
29
 
31
30
  async run () {
32
31
  let host
@@ -86,9 +85,20 @@ class DesignServerCommand extends Command {
86
85
  return
87
86
  }
88
87
 
89
- designConfig.assets = designConfig.assets || {}
90
- const defaultBasePath = `${host}/designs/${designName}/${version}`
91
- designConfig.assets.basePath = basePath || defaultBasePath
88
+ const designBasePath = basePath || `${host}/designs/${designName}/${version}`
89
+ if (
90
+ typeof designConfig.assets === 'object' &&
91
+ !designConfig.assets.basePath
92
+ ) {
93
+ designConfig.assets.basePath = designBasePath
94
+ }
95
+
96
+ if (
97
+ typeof designConfig.designSettings?.assets === 'object' &&
98
+ !designConfig.designSettings.assets.basePath
99
+ ) {
100
+ designConfig.designSettings.assets.basePath = designBasePath
101
+ }
92
102
 
93
103
  reply.send(designConfig)
94
104
  })
@@ -126,6 +136,4 @@ function setupStaticFolder ({fastify, assets}) {
126
136
  })
127
137
  }
128
138
 
129
- DesignServerCommand.description = description
130
- DesignServerCommand.flags = commandFlags
131
139
  module.exports = DesignServerCommand
@@ -9,21 +9,20 @@ const writeConfig = require('../../lib/write_channel_config')
9
9
  const errorReporter = require('../../lib/api/error_reporter')
10
10
  const assertDistFolder = require('../../lib/cli/assert_dist_folder')
11
11
 
12
- const description = `Download a project configuration`
13
- const commandFlags = {
14
- project: sharedFlags.project,
15
- env: sharedFlags.env,
16
- token: {...sharedFlags.configReadToken, required: true},
17
- host: {...sharedFlags.host, required: true},
18
- dist: sharedFlags.dist,
19
- format: flags.string({
20
- options: ['js', 'js/html', 'json'],
21
- description: 'The format of the files written.',
22
- dependsOn: ['dist']
23
- })
24
- }
25
-
26
12
  class DownloadCommand extends Command {
13
+ static description = `Download a project configuration`
14
+ static flags = {
15
+ project: sharedFlags.project,
16
+ env: sharedFlags.env,
17
+ token: {...sharedFlags.configReadToken, required: true},
18
+ host: {...sharedFlags.host, required: true},
19
+ dist: sharedFlags.dist,
20
+ format: flags.string({
21
+ options: ['js', 'js/html', 'json'],
22
+ description: 'The format of the files written.',
23
+ dependsOn: ['dist']
24
+ })
25
+ }
27
26
 
28
27
  async run () {
29
28
  const {token, host, dist, format} = this.parse(DownloadCommand).flags
@@ -74,6 +73,4 @@ class DownloadCommand extends Command {
74
73
  }
75
74
  }
76
75
 
77
- DownloadCommand.description = description
78
- DownloadCommand.flags = commandFlags
79
76
  module.exports = DownloadCommand
@@ -5,13 +5,12 @@ 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
7
 
8
- const description = `List project configuration drafts`
9
- const commandFlags = {
10
- token: {...sharedFlags.configReadToken, required: true},
11
- host: sharedFlags.host
12
- }
13
-
14
8
  class DraftsCommand extends Command {
9
+ static description = `List project configuration drafts`
10
+ static flags = {
11
+ token: {...sharedFlags.configReadToken, required: true},
12
+ host: sharedFlags.host
13
+ }
15
14
 
16
15
  async run () {
17
16
  const {token, host} = this.parse(DraftsCommand).flags
@@ -32,6 +31,4 @@ class DraftsCommand extends Command {
32
31
  }
33
32
  }
34
33
 
35
- DraftsCommand.description = description
36
- DraftsCommand.flags = commandFlags
37
34
  module.exports = DraftsCommand
@@ -1,4 +1,5 @@
1
1
  const chalk = require('chalk')
2
+ const _ = require('lodash')
2
3
  const {Command} = require('@oclif/command')
3
4
 
4
5
  const sharedFlags = require('../../lib/cli/shared_flags')
@@ -31,11 +32,29 @@ class ImportDesignCommand extends Command {
31
32
  }
32
33
 
33
34
  const design = await downloadDesign(designUri)
34
- const designV2 = parseDesignV2(design)
35
+ const designV2 = parseDesignV2(design, this.log)
35
36
 
36
37
  config.components = designV2.components
37
38
  config.designSettings = designV2.designSettings
38
39
 
40
+ if (design.v !== 2) {
41
+ _.each(config.contentTypes, (ct) => {
42
+ // write wrapper on each content-type
43
+ const matchingLayout = _.find(design.layouts, l => l.name === ct.handle)
44
+ if (matchingLayout) ct.editorWrapper = matchingLayout.wrapper
45
+ else ct.editorWrapper = design.wrapper
46
+ // write components on content-type
47
+ if (matchingLayout) {
48
+ ct.components = _.reduce(matchingLayout.groups, (acc, g) => {
49
+ acc = _.union(acc, _.map(g.components, c => ({name: c})))
50
+ return acc
51
+ }, [])
52
+ }
53
+ // write default content on content-type
54
+ if (matchingLayout) ct.defaultContent = matchingLayout.defaultContent || []
55
+ })
56
+ }
57
+
39
58
  await writeConfig({
40
59
  destination: dist,
41
60
  channelConfig: config,