contensis-cli 1.0.0-beta.48 → 1.0.0-beta.49

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
@@ -1,20 +1,42 @@
1
1
  # Contensis CLI
2
2
 
3
- Use Contensis from your favourite terminal with NodeJS
3
+ Use Contensis from your favourite terminal
4
4
 
5
- Install the package via `npm` as a global module
5
+ Install the package via `npm` as a global module (requires NodeJS)
6
6
 
7
7
  ```shell
8
8
  npm i contensis-cli --global
9
9
  ```
10
10
 
11
- ## CLI usage
11
+ Alternatively, download the executable for your operating system from the [Releases page](https://github.com/contensis/node-cli/releases)
12
+
13
+ ## Skip to section
14
+
15
+ - ### [Contensis Shell](#contensis-shell)
16
+ - [Use in Terminal](#cli-usage)
17
+ - [Pass connection details anywhere](#pass-connection-details-anywhere)
18
+ - [Use in Docker](#use-in-docker)
19
+ - [Run cli commands](#run-cli-commands)
20
+ - [Persist connections to a local file](#persist-connections-to-a-local-file)
21
+ - [Use in GitLab CI](#use-in-gitlab-ci)
22
+ - [Use in GitHub CI](#use-in-github-ci)
23
+ - [Running headless?](#running-headless-)
24
+
25
+ ## Use in Terminal
26
+
27
+ Try
12
28
 
13
29
  ```shell
14
- contensis-cli connect example-dev
30
+ contensis connect example-dev
15
31
  ```
16
32
 
17
- The CLI uses the same commands and arguments as the shell. It is recommended you use and familiarise yourself with the cli via the shell and use the `contensis-cli` command to use the same cli commands in script-based context such as continuous integration.
33
+ or
34
+
35
+ ```shell
36
+ contensis help
37
+ ```
38
+
39
+ The CLI uses exactly the same commands as the shell. It is recommended you use and familiarise yourself with the cli by using the shell and then use the same cli commands when you need to in script-based context such as continuous integration environments.
18
40
 
19
41
  ### Pass connection details anywhere
20
42
 
@@ -31,16 +53,91 @@ You can supply the following options with any command - although they don't appe
31
53
  -s --shared-secret
32
54
  ```
33
55
 
34
- ### Running headless?
56
+ Using this approach in the cli or the shell will assume these credentials are for your current envioronment and will set the local environment cache for subsequent commands
57
+
58
+ ## Use in Docker
59
+
60
+ Running the container with the `-it` docker options will launch a shell session
61
+
62
+ ```bash
63
+ docker pull ghcr.io/contensis/node-cli/main/app:latest
64
+ docker run --rm -it ghcr.io/contensis/node-cli/main/app:latest
65
+ ```
66
+
67
+ ### Run cli commands
68
+
69
+ Add the cli command and any options after the container image in the `docker run` command e.g.
70
+
71
+ ```bash
72
+ docker run --rm ghcr.io/contensis/node-cli/main/app:latest get entries "test"
73
+ ```
74
+
75
+ ### Persist connections to a local file
76
+
77
+ To use the cli container for multiple commands or to save connections for future sessions, map a volume to the docker container
78
+
79
+ <aside>
80
+ ⚠️ Ensure a file called `environments.json` exists before mapping the volume to the docker container. If it doesn’t exist, create this empty file first.
81
+
82
+ </aside>
83
+
84
+ Linux
85
+
86
+ ```bash
87
+ touch environments.json
88
+ docker run --rm -v $(pwd)/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
89
+ ```
90
+
91
+ Windows
92
+
93
+ ```powershell
94
+ echo {} > environments.json
95
+ docker run --rm -v ${PWD}/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
96
+ ```
97
+
98
+ ## Use in GitLab CI
99
+
100
+ ```yaml
101
+ push-to-contensis-block:
102
+ stage: push-to-contensis
103
+ only:
104
+ - master
105
+ image: ghcr.io/contensis/node-cli/main/app:release
106
+ script:
107
+ # Create CI/CD Variables in repo settings called CONTENSIS_CLIENT_ID and CONTENSIS_SHARED_SECRET
108
+ - contensis connect example-dev --project-id website --client-id $CONTENSIS_CLIENT_ID --shared-secret $CONTENSIS_SHARED_SECRET
109
+ - contensis push block example-website-block $APP_IMAGE:latest --release
110
+ ```
111
+
112
+ ## Use in GitHub CI
113
+
114
+ ```yaml
115
+ - name: Push block to Contensis
116
+ uses: contensis/cli-action@v1
117
+ with:
118
+ block-id: example-website-block
119
+ # auto-release: true # release the block straight away
120
+ alias: example-dev
121
+ project-id: website
122
+ client-id: ${{ secrets.CONTENSIS_CLIENT_ID }} # create secrets for actions
123
+ shared-secret: ${{ secrets.CONTENSIS_SHARED_SECRET }} # in repo settings
124
+ tag-repo: true # tag commit with block version
125
+ git-token: ${{ github.token }} # to allow the git tag
126
+ ```
127
+
128
+ ## Running headless?
35
129
 
36
130
  Most lightweight CI environments will likely not ship with the ability to easily load and unlock an encrypted keychain.
37
131
 
38
- In these environments you will see a warning message when using the cli with any credentials
132
+ In these environments you will see a warning message when using the cli with any credentials, in most cases this type of envioronment is normally disposed of after the command/session has completed and the warning can be safely ignored.
39
133
 
40
134
  ```shell
41
135
  [WARN] Could not connect to local keystore - your password could be stored unencrypted!
42
136
  ```
43
137
 
138
+ > **Note**
139
+ > There is a workaround for installing a secret store and launching an X11 session with an unlocked keyring which has been left in here below for anyone who wishes to try it
140
+
44
141
  ~~The required credentials to run commands are stored and read from a secret store `libsecret`. Without the secret store running and unlocked we receive an error `Cannot autolaunch D-Bus without X11 $DISPLAY`~~
45
142
 
46
143
  ```shell
@@ -82,6 +179,46 @@ Press [TAB] for suggestions
82
179
  contensis >
83
180
  ```
84
181
 
182
+ ## Skip to section
183
+
184
+ - [Get started](#get-started)
185
+ - [Connect to a Contensis Cloud environment](#connect-to-a-contensis-cloud-environment)
186
+ - [Login to a connected Contensis environment](#login-to-a-connected-contensis-environment)
187
+ - [Manage Projects](#manage-projects)
188
+ - [List projects](#list-projects)
189
+ - [Set current project](#set-current-project)
190
+ - [Get project metadata](#get-project-metadata)
191
+ - [Set project metadata](#set-project-metadata)
192
+ - [Content Models](#content-models)
193
+ - [List content models](#list-content-models)
194
+ - [Examine a content model](#examine-a-content-model)
195
+ - [List content types, components](#list-content-types--components)
196
+ - [Examine a content type or component](#examine-a-content-type-or-component)
197
+ - [Entries](#entries)
198
+ - [Get entries](#get-entries)
199
+ - [Get an entry by id](#get-an-entry-by-id)
200
+ - [Get an entry with all of its dependents](#get-an-entry-with-all-of-its-dependents)
201
+ - [Get entries with a ZenQL statement](#get-entries-with-a-zenql-statement)
202
+ - [Choose entry fields to output](#choose-entry-fields-to-output)
203
+ - [Output results to a file](#output-results-to-a-file)
204
+ - [Format output](#format-output)
205
+ - [Manage API keys](#manage-api-keys)
206
+ - [List keys](#list-keys)
207
+ - [Create key](#create-key)
208
+ - [Remove key](#remove-key)
209
+ - [Manage content Blocks](#manage-content-blocks)
210
+ - [List blocks](#list-blocks)
211
+ - [Get block](#get-block)
212
+ - [Get block logs](#get-block-logs)
213
+ - [Push a block](#push-a-block)
214
+ - [Release a block version](#release-a-block-version)
215
+ - [Import content models](#import-content-models)
216
+ - [Import from another Contensis environment](#import-from-another-contensis-environment)
217
+ - [From a file](#from-a-file)
218
+ - [Import entries](#import-entries)
219
+ - [Import from another Contensis environment](#import-from-another-contensis-environment-1)
220
+ - [Import from a file](#import-from-a-file)
221
+
85
222
  ## Get started
86
223
 
87
224
  Press `[tab]` key at any time to show suggested commands or to attempt to auto-complete the command you are typign
@@ -107,6 +244,8 @@ Example call:
107
244
  > connect example-dev
108
245
  ```
109
246
 
247
+ Just type `help` to show the cli command help
248
+
110
249
  ## Connect to a Contensis Cloud environment
111
250
 
112
251
  Use the connect command followed by the cloud alias of your environment
@@ -121,9 +260,9 @@ contensis > connect example-dev
121
260
  contensis example-dev>
122
261
  ```
123
262
 
124
- After connecting you will notice the shell prompt will now contain the current "connected" environment - `contensis example-dev> `
263
+ After connecting you will notice the shell prompt will now contain the current "connected" environment e.g. `contensis example-dev> `
125
264
 
126
- The CMS must be online and available in order to connect to it
265
+ Contensis must be online and available in order to connect to it
127
266
 
128
267
  ```shell
129
268
  contensis > connect exemple-dev
@@ -145,9 +284,13 @@ contensis example-dev> login t.durden
145
284
  contensis t.durden@example-dev>
146
285
  ```
147
286
 
148
- If you are logging in via a script or service you will likely be using an API key set up in Contensis, you would provide the full credentials with the command `login {clientId} -s {sharedSecret}`
287
+ If you are logging in via a script or service you will likely be using an API key set up in Contensis, you would provide the full credentials with the command `login {clientId} -s {sharedSecret}`.
288
+
289
+ If you need to skip this step for any reason you could [pass connection details anywhere](#pass-connection-details-anywhere)
290
+
291
+ ## Manage Projects
149
292
 
150
- ## List projects
293
+ ### List projects
151
294
 
152
295
  Issuing the command `list projects` will fetch a list of projects from the connected Contensis environment
153
296
 
@@ -167,7 +310,7 @@ contensis example-dev> list projects
167
310
  [cli] ℹ Introduce yourself with "login {username}" or "login {clientId} -s {secret}"
168
311
  ```
169
312
 
170
- ## Set current project
313
+ ### Set current project
171
314
 
172
315
  Set your current working project with the `set project {projectId}` command
173
316
 
@@ -187,7 +330,151 @@ intranet t.durden@example-dev>
187
330
 
188
331
  You will notice the `contensis` prompt has been updated to show your current connected project
189
332
 
190
- ## List content types, components
333
+ ### Get project metadata
334
+
335
+ ```shell
336
+ contensis t.durden@example-dev> get project
337
+
338
+ id: contensis
339
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
340
+ name: Contensis
341
+ description:
342
+ primaryLanguage: en-GB
343
+ supportedLanguages:
344
+ en-GB
345
+ color: cobalt
346
+
347
+ contensis t.durden@example-dev>
348
+ ```
349
+
350
+ ### Set project metadata
351
+
352
+ Update a project name
353
+
354
+ ```shell
355
+ contensis t.durden@example-dev> set project name "Contensis website"
356
+ [cli] ✅ [example-dev] Updated project contensis
357
+ id: contensis
358
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
359
+ name: Contensis website
360
+ description:
361
+ primaryLanguage: en-GB
362
+ supportedLanguages:
363
+ en-GB
364
+ color: cobalt
365
+
366
+ contensis t.durden@example-dev>
367
+ ```
368
+
369
+ Update a project's description
370
+
371
+ ```shell
372
+ contensis t.durden@example-dev> set project description "Main product site"
373
+ [cli] ✅ [example-dev] Updated project contensis
374
+ id: contensis
375
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
376
+ name: Contensis website
377
+ description: Main product site
378
+ primaryLanguage: en-GB
379
+ supportedLanguages:
380
+ en-GB
381
+ color: cobalt
382
+
383
+ contensis t.durden@example-dev>
384
+ ```
385
+
386
+ ## Content Models
387
+
388
+ Manage your content models like you are the chosen one
389
+
390
+ ### List content models
391
+
392
+ ```shell
393
+ contensis t.durden@example-dev> list models
394
+ [cli] ✅ [website] Content models [ 19 ]
395
+
396
+ - accessibleVideo { required by: 3 }
397
+ - blogListing { components: 1, contentTypes: 2, references: 33, required by: 4 }
398
+ - blogPost { components: 2, contentTypes: 6, references: 33, required by: 9 }
399
+ - callToAction { contentTypes: 9, references: 33, required by: 5 }
400
+ - category { required by: 1 }
401
+ - contentPage { components: 5, contentTypes: 6, references: 33, required by: 7 }
402
+ - externalLink { required by: 2 }
403
+ - growingConditions { components: 1, references: 1, required by: 1 }
404
+ - homepage { components: 4, contentTypes: 8, references: 33, required by: 3 }
405
+ - landingPage { components: 9, contentTypes: 12, references: 33, required by: 7 }
406
+ - person { required by: 2 }
407
+ - plant { components: 2, contentTypes: 3, references: 8, required by: 10 }
408
+ - plantType { required by: 2 }
409
+ - pot { components: 2, contentTypes: 1, references: 3, required by: 11 }
410
+ - productListing { components: 1, references: 1, required by: 4 }
411
+ - review { contentTypes: 3, references: 10, required by: 1 }
412
+ - siteSettings
413
+ - tag { required by: 5 }
414
+
415
+ contensis t.durden@example-dev>
416
+ ```
417
+
418
+ ### Examine a content model
419
+
420
+ A `model` is a complete view of a content type that includes all of its dependents - and the dependents of those dependents
421
+
422
+ - `contentTypes` are the content types that have content linked to the model directly from this content type
423
+ - `components` are the content types that have content linked to the model directly from this content type
424
+ - `dependencies` is an exhaustive list of dependencies and inner dependents [the values in brackets are the models that have required it to make it a dependency]
425
+ - `dependencyOf` is a list of all the other content types (or components) that reference this content type directly, this model is a dependency of those
426
+
427
+ ```shell
428
+ contensis t.durden@example-dev> get model plant
429
+ [cli] ✅ Content models in contensis:
430
+
431
+ id: plant
432
+ dataFormat: model
433
+ name:
434
+ en-GB: Plant
435
+ description:
436
+ en-GB: Use this content type to store information about individual plants.
437
+ contentTypes:
438
+ growingConditions
439
+ plantType
440
+ tag
441
+ components:
442
+ externalPromotion
443
+ plantVariant
444
+ dependencyOf:
445
+ callToAction
446
+ homepage
447
+ landingPage
448
+ review
449
+ button
450
+ cardRow
451
+ curatedProductSlider
452
+ featuredBlogPosts
453
+ featuredProduct
454
+ promotedProduct
455
+ dependencies:
456
+ growingConditions
457
+ [plant]
458
+ plantType
459
+ [plant]
460
+ pot
461
+ [plantVariant]
462
+ tag
463
+ [plant, pot]
464
+ externalPromotion
465
+ [plant, pot]
466
+ icon
467
+ [growingConditions]
468
+ plantVariant
469
+ [plant]
470
+ potVariant
471
+ [pot]
472
+
473
+
474
+ contensis t.durden@example-dev>
475
+ ```
476
+
477
+ ### List content types, components
191
478
 
192
479
  ```shell
193
480
  contensis t.durden@example-dev> list contenttypes
@@ -212,12 +499,12 @@ contensis t.durden@example-dev> list contenttypes
212
499
  - tag [1 field]
213
500
  ```
214
501
 
215
- ## Examine a content type or component
502
+ ### Examine a content type or component
216
503
 
217
504
  ```shell
218
505
  contensis t.durden@example-dev> get contenttype pot
219
506
  [cli] ✅ [website] Content type "pot"
220
- uuid: adc051ee-d584-4f2a-ba42-5e6190edadb8
507
+ uuid: 929a99d2-fe5c-4781-84fa-f5a3738aa96d
221
508
  id: pot
222
509
  projectId: website
223
510
  name:
@@ -226,19 +513,19 @@ contensis t.durden@example-dev> get contenttype pot
226
513
  entryTitleField: productName
227
514
  entryDescriptionField: description
228
515
  fields:
229
- productName: string
516
+ productName**: string
230
517
  description: string
231
- externalPromotion: object
518
+ externalPromotion: object<component.externalpromotion>
232
519
  colour: string
233
520
  material: string
234
- potVariant: objectArray
235
- primaryImage: object
236
- photos: objectArray
237
- externalCardImage: object
238
- tags: objectArray
521
+ potVariant: objectArray<component.potvariant>
522
+ primaryImage: object<image>
523
+ photos: objectArray<image>
524
+ externalCardImage: object<image>
525
+ tags: objectArray<entry, tag>
239
526
  defaultLanguage: en-GB
240
527
  supportedLanguages:
241
- 0: en-GB
528
+ en-GB
242
529
  workflowId: contensisEntryBasic
243
530
  dataFormat: entry
244
531
  groups:
@@ -250,7 +537,9 @@ contensis t.durden@example-dev> get contenttype pot
250
537
  contensis t.durden@example-dev>
251
538
  ```
252
539
 
253
- ## Get entries
540
+ ## Entries
541
+
542
+ ### Get entries
254
543
 
255
544
  Use the `get entries` command
256
545
 
@@ -280,7 +569,7 @@ Found 8 entries in [website]
280
569
  website t.durden@example-dev>
281
570
  ```
282
571
 
283
- ## Get an entry by id
572
+ ### Get an entry by id
284
573
 
285
574
  ```shell
286
575
  website t.durden@example-dev> get entries --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
@@ -299,7 +588,7 @@ Found 1 entries in [website]
299
588
  website t.durden@example-dev>
300
589
  ```
301
590
 
302
- ## Get an entry with all of its dependents
591
+ ### Get an entry with all of its dependents
303
592
 
304
593
  Add the `--dependents` or `-d` flag to your `get entries` command to also find and fetch all dependent (linked) entries, recursively finding and including any dependent entries found inside those dependents.
305
594
 
@@ -333,7 +622,7 @@ Found 12 entries in [website]
333
622
  website t.durden@example-dev>
334
623
  ```
335
624
 
336
- ## Get entries with a ZenQL statement
625
+ ### Get entries with a ZenQL statement
337
626
 
338
627
  Use a ZenQL statement to find entries with the `--zenql` or `-q` option, add your statement inside `"double quotes"`. Refer to [ZenQL documentation](https://www.contensis.com/help-and-docs/user-guides/zenql-search) and test your statement for the right results in the Contensis web UI.
339
628
 
@@ -374,7 +663,7 @@ Found 21 entries in [website]
374
663
  website t.durden@example-dev>
375
664
  ```
376
665
 
377
- ## Choose entry fields to output
666
+ ### Choose entry fields to output
378
667
 
379
668
  Add the `--fields` or `-f` option to your `get entries` command to limit and order the entry fields that are returned, add the api key of each field to be returned separated by a space
380
669
 
@@ -406,7 +695,7 @@ Found 12 entries in [website]
406
695
  website t.durden@example-dev>
407
696
  ```
408
697
 
409
- ## Output results to a file
698
+ ### Output results to a file
410
699
 
411
700
  Use the `--output` or `-o` option followed by the file name you wish for command output to be written to
412
701
 
@@ -489,7 +778,7 @@ website t.durden@example-dev>
489
778
 
490
779
  Run `list keys` again and you will see your new API key has been removed from the list of keys
491
780
 
492
- ## Manage Content Blocks
781
+ ## Manage content Blocks
493
782
 
494
783
  You can manage blocks for any Contensis project using the following commands
495
784
 
@@ -554,7 +843,10 @@ website t.durden@example-dev> get block logs contensis-website master
554
843
  website t.durden@example-dev>
555
844
  ```
556
845
 
557
- ### Push block
846
+ ### Push a block
847
+
848
+ > **Note**
849
+ > It is far simpler doing this in [GitLab CI](#use-in-gitlab-ci) or [GitHub CI Actions](#use-in-github-ci)
558
850
 
559
851
  ```shell
560
852
  website t.durden@example-dev> push block cli-test-block ghcr.io/contensis/contensis-app:build-4359 master --release --commit-id 9ee20333 --commit-message "chore: sample commit message" --commit-datetime 2022-11-03T22:34 --author-email b.macka@zengenti.com --committer-email b.macka@zengenti.com --repository-url https://github.com/contensis/contensis-app.git --provider GitlabSelfHosted
@@ -563,69 +855,354 @@ website t.durden@example-dev> push block cli-test-block ghcr.io/contensis/conten
563
855
  website t.durden@example-dev>
564
856
  ```
565
857
 
566
- ## Use in Docker
858
+ ### Release a block version
567
859
 
568
- Running the container with the `-it` docker options will launch a shell session
860
+ First get the latest block version number
569
861
 
570
- ```bash
571
- docker pull ghcr.io/contensis/node-cli/main/app:latest
572
- docker run --rm -it ghcr.io/contensis/node-cli/main/app:latest
862
+ ```shell
863
+ website t.durden@example-dev>get block contensis-website master latest
864
+ [cli] [example-dev] Block contensis-website in project website:
865
+ v78 contensis-website
866
+ state: available
867
+ released: no
868
+ status:
869
+ deployment: deployed
870
+ workflow: draft
871
+ running status: available
872
+ datacentres:
873
+ hq: available
874
+ london: available
875
+ manchester: faulted
876
+ source:
877
+ commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
878
+ message: build: syntax [nobuild]
879
+ committed: [22/11/2022 06:50] t.durden@zengenti.com
880
+ pushed: [22/11/2022 06:52] Gitlab CI block push
881
+ https://github.com/contensis/contensis-website/commit/b946c1029c1b35aefee2e1a6b5780ddaf205ee74
882
+ image:
883
+ uri: ghcr.io/contensis/contensis-website/main/app
884
+ tag: latest
885
+ staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=draft
886
+
887
+ website t.durden@example-dev>
573
888
  ```
574
889
 
575
- ### Run cli commands
890
+ Add the block version number to the `release block` command
576
891
 
577
- Add the cli command and any options after the container image in the `docker run` command e.g.
892
+ ```shell
578
893
 
579
- ```bash
580
- docker run --rm ghcr.io/contensis/node-cli/main/app:latest get entries "test"
894
+ website t.durden@example-dev> release block contensis-website 78
895
+ [cli] [example-dev] Released block contensis-website in project website
896
+ v78 contensis-website
897
+ state: available
898
+ released: [23/11/2022 01:42] n.flatley
899
+ status:
900
+ deployment: deployed
901
+ workflow: released
902
+ running status: available
903
+ datacentres:
904
+ hq: available
905
+ london: available
906
+ manchester: faulted
907
+ source:
908
+ commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
909
+ message: build: syntax [nobuild]
910
+ committed: [22/11/2022 06:50] t.durden@zengenti.com
911
+ pushed: [22/11/2022 06:52] Gitlab CI block push
912
+ null
913
+ image:
914
+ uri: ghcr.io/contensis/contensis-website/main/app
915
+ tag: latest
916
+ staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=released
917
+
918
+ website t.durden@example-dev>
581
919
  ```
582
920
 
583
- ### Persist connections to a local file
921
+ ## Import content models
584
922
 
585
- To use the cli container for multiple commands or to save connections for future sessions, map a volume to the docker container
923
+ Connect to your "source" environment first, ensure you can fetch the models and these models contain the dependencies you plan on importing from here with the `get models` command. Add the `--dependents` option to fetch all of the entries that will eventually be imported.
586
924
 
587
- <aside>
588
- ⚠️ Ensure a file called `environments.json` exists before mapping the volume to the docker container. If it doesn’t exist, create this empty file first.
925
+ When you are happy your models contain the right dependencies for your import, connect to the "target" environment (and project) then use the same arguments as before except with the `import entries` command
589
926
 
590
- </aside>
927
+ ### Import from another Contensis environment
591
928
 
592
- Linux
929
+ Specify a list of models to import
593
930
 
594
- ```bash
595
- touch environments.json
596
- docker run --rm -v $(pwd)/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
931
+ ```shell
932
+ website t.durden@example-dev> import models plant --source-alias example-dev --source-project-id leif
933
+
934
+ -------------------------------------
935
+ -- IMPORT PREVIEW --
936
+
937
+ Content types:
938
+ - growingConditions [website: no change] v1.0
939
+ required by: [plant]
940
+ references: [icon]
941
+ - plant [website: update] v2.0
942
+ references: [growingConditions, plantGenus, plantType, tag]
943
+ diff: ...{'id':'<+>genus','name':{'en-GB':'Genus'},'dataType':'object','dataFormat':'entry','description':{},'default':null,'validations':{'allowedContentTypes':{'contentTypes':['plantGenus'],'message':null}},'editor':null,'groupId':'main'},{'id':'</+>plantVariant','name':{'en-GB':'Plant variant'}...
944
+ - plantGenus [website: create] v0.1
945
+ required by: [plant]
946
+ - plantType [website: no change] v1.0
947
+ required by: [plant]
948
+ - pot [website: no change] v2.0
949
+ required by: [plantVariant]
950
+ references: [externalPromotion, potVariant, tag]
951
+ - tag [website: no change] v1.0
952
+ required by: [plant, pot]
953
+
954
+ Components:
955
+ - externalPromotion [website: no change] v1.0
956
+ required by: [plant, pot]
957
+ - icon [website: no change] v1.0
958
+ required by: [growingConditions]
959
+ - plantVariant [website: no change] v2.0
960
+ required by: [plant]
961
+ references: [pot]
962
+ - potVariant [website: no change] v1.0
963
+ required by: [pot]
964
+
965
+ website t.durden@example-dev>
597
966
  ```
598
967
 
599
- Windows
968
+ Or import every model from the source
600
969
 
601
- ```powershell
602
- echo {} > environments.json
603
- docker run --rm -v ${PWD}/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
970
+ ```shell
971
+ website t.durden@example-dev> import models --source-alias example-dev --source-project-id leif
972
+ -------------------------------------
973
+ -- IMPORT PREVIEW --
974
+
975
+ Content types:
976
+ - accessibleVideo [website: no change] v1.0
977
+ required by: [blogPost, contentPage, landingPage]
978
+ - alert [website: create] v0.1
979
+ - blogListing [website: no change] v2.0
980
+ required by: [button, callToAction, homepage, landingPage]
981
+ references: [blogPost, callToAction, pageMetadata]
982
+ - blogPost [website: update] v3.0
983
+ required by: [blogListing, blogPost, button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
984
+ references: [accessibleVideo, blogPost, callToAction, category, externalPromotion, featuredProduct, person, tag]
985
+ diff: ...
986
+ - callToAction [website: no change] v2.0
987
+ required by: [blogListing, blogPost, contentPage, homepage, landingPage]
988
+ references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
989
+ - campus [website: create] v0.1
990
+ - category [website: no change] v1.0
991
+ required by: [blogPost, department, listing]
992
+ - contentPage [website: no change] v2.0
993
+ required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
994
+ references: [accessibleVideo, blogPost, callToAction, callout, cardRow, contentPage, featuredProduct, formPicker, landingPage, pageMetadata, tag]
995
+ - department [website: two-pass] v0.1
996
+ references: [category]
997
+ - event [website: create] v0.1
998
+ - externalLink [website: no change] v1.0
999
+ required by: [button, callToAction]
1000
+ - form [website: create] v0.1
1001
+ - growingConditions [website: no change] v1.0
1002
+ required by: [listing, plant]
1003
+ references: [icon]
1004
+ - homepage [website: update] v2.0
1005
+ required by: [button, callToAction, landingPage]
1006
+ references: [blogListing, blogPost, callToAction, contentPage, curatedProductSlider, filteredProductSlider, landingPage, pageMetadata, plant, pot, productListing, promotedProduct]
1007
+ diff: ...
1008
+ - landingPage [website: update] v2.0
1009
+ required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1010
+ references: [accessibleVideo, blogListing, blogPost, bodyCopy, callToAction, contentBlock, contentPage, curatedProductSlider, featuredBlogPosts, featuredProduct, filteredProductSlider, formPicker, homepage, landingPage, pageMetadata, plant, pot, productListing, promotedProduct, review, tag]
1011
+ diff: ...
1012
+ - listing [website: two-pass] v0.1
1013
+ references: [category, growingConditions, plantType, tag]
1014
+ - newsArticle [website: two-pass] v0.1
1015
+ references: [person]
1016
+ - newsTest [website: two-pass] v0.1
1017
+ references: [person]
1018
+ - person [website: no change] v1.0
1019
+ required by: [blogPost, newsArticle, newsTest, review]
1020
+ - plant [website: update] v2.0
1021
+ required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, promotedProduct, review]
1022
+ references: [externalPromotion, growingConditions, plantGenus, plantType, plantVariant, tag]
1023
+ diff: ...
1024
+ - plantFamily [website: two-pass] v0.1
1025
+ required by: [plantOrder]
1026
+ references: [plantGenus]
1027
+ - plantGenus [website: create] v0.1
1028
+ required by: [plant, plantFamily]
1029
+ - plantOrder [website: two-pass] v0.1
1030
+ references: [plantFamily]
1031
+ - plantType [website: no change] v1.0
1032
+ required by: [filteredProductSlider, listing, plant]
1033
+ - pot [website: no change] v2.0
1034
+ required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, plantVariant, promotedProduct, review]
1035
+ references: [externalPromotion, potVariant, tag]
1036
+ - productListing [website: no change] v1.0
1037
+ required by: [button, callToAction, homepage, landingPage]
1038
+ references: [pageMetadata]
1039
+ - review [website: no change] v2.0
1040
+ required by: [landingPage]
1041
+ references: [person, plant, pot]
1042
+ - siteSettings [website: no change] v1.0
1043
+ - tag [website: no change] v1.0
1044
+ required by: [blogPost, contentPage, landingPage, listing, plant, pot]
1045
+ - testLang [website: create] v0.1
1046
+
1047
+ Components:
1048
+ - bodyCopy [website: no change] v1.0
1049
+ required by: [landingPage]
1050
+ - button [website: no change] v2.0
1051
+ required by: [promotedProduct]
1052
+ references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
1053
+ - callout [website: no change] v1.0
1054
+ required by: [contentPage, event]
1055
+ - cardRow [website: no change] v2.0
1056
+ required by: [contentPage]
1057
+ references: [blogPost, contentPage, landingPage, plant, pot]
1058
+ - contentBlock [website: no change] v1.0
1059
+ required by: [landingPage]
1060
+ - curatedProductSlider [website: no change] v2.0
1061
+ required by: [homepage, landingPage]
1062
+ references: [plant, pot]
1063
+ - externalPromotion [website: no change] v1.0
1064
+ required by: [blogPost, plant, pot]
1065
+ - featuredBlogPosts [website: no change] v2.0
1066
+ required by: [landingPage]
1067
+ references: [blogPost, contentPage, landingPage, plant, pot]
1068
+ - featuredProduct [website: no change] v2.0
1069
+ required by: [blogPost, contentPage, landingPage]
1070
+ references: [plant, pot]
1071
+ - filteredProductSlider [website: no change] v2.0
1072
+ required by: [homepage, landingPage]
1073
+ references: [plantType]
1074
+ - formPicker [website: no change] v1.0
1075
+ required by: [contentPage, landingPage]
1076
+ - icon [website: no change] v1.0
1077
+ required by: [growingConditions]
1078
+ - pageMetadata [website: no change] v1.0
1079
+ required by: [blogListing, contentPage, homepage, landingPage, productListing]
1080
+ - plantVariant [website: no change] v2.0
1081
+ required by: [plant]
1082
+ references: [pot]
1083
+ - potVariant [website: no change] v1.0
1084
+ required by: [pot]
1085
+ - promotedProduct [website: update] v2.0
1086
+ required by: [homepage, landingPage]
1087
+ references: [button, plant, pot]
1088
+ diff: ...
1089
+
1090
+ website t.durden@example-dev>
604
1091
  ```
605
1092
 
606
- ## Use in GitLab CI
1093
+ ### Import from a file
607
1094
 
608
- ```yaml
609
- push-to-contensis-block:
610
- stage: push-to-contensis
611
- only:
612
- - master
613
- image: ghcr.io/contensis/node-cli/main/app:latest
614
- script:
615
- # - contensis connect zenhub-dev --project-id migratortron --client-id 02c8fae0-1aa6-46d3-a0a4-9674fa7f10f1 --shared-secret 47a52c7755324debbcc984865e87200b-35b17f3d39ae40ee9b118358c4dd1666-a516b7c30ebb449ca26e93157588cd26
616
- - contensis push block example-website-block $APP_IMAGE:latest --release -a example-dev -p website -id 02c8fae0-1aa6-46d3-a0a4-9674fa7f10f1 -s 47a52c7755324debbcc984865e87200b-35b17f3d39ae40ee9b118358c4dd1666-a516b7c30ebb449ca26e93157588cd26
1095
+ ```shell
1096
+ website t.durden@example-dev> import models --from-file ./content-models.json
617
1097
  ```
618
1098
 
619
- ## Use in GitHub CI
1099
+ The output will be the same as the previous command
620
1100
 
621
- ```yaml
622
- - name: Push block to Contensis
623
- uses: contensis/cli-action@v1
624
- with:
625
- block-id: example-website-block
626
- # auto-release: true
627
- alias: zenhub-dev
628
- project-id: contensis
629
- client-id: ${{ secrets.CONTENSIS_CLIENT_ID }}
630
- shared-secret: ${{ secrets.CONTENSIS_SHARED_SECRET }}
1101
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
1102
+
1103
+ ## Import entries
1104
+
1105
+ The import commands are made possible by using the `migratortron` library. There is further documentation here:
1106
+
1107
+ - [`migratortron` on npmjs](https://www.npmjs.com/package/migratortron)
1108
+ - [`contensis-importer` on npmjs](https://www.npmjs.com/package/contensis-importer)
1109
+
1110
+ ### Import from another Contensis environment
1111
+
1112
+ Connect to your "source" environment first, ensure you can fetch the entries you plan on importing from here and your query / filters are working to fetch exactly the data you are expecting with the `get entries` command. Add the `--dependents` option to fetch all of the entries that will eventually be imported.
1113
+
1114
+ When you are happy you can fetch only the data you intend to import, connect to the "target" environment (and project) then use the same query as before except with the `import entries` command
1115
+
1116
+ ```shell
1117
+ website t.durden@example-dev> import entries --preserve-guids --zenql "sys.contentTypeId = plant" --source-alias example-dev --source-project-id leif
1118
+ -------------------------------------
1119
+ -- IMPORT PREVIEW --
1120
+ [23/11 02:10:48] [INFO] Fetching initial entries in project 'leif'
1121
+ [23/11 02:10:48] [INFO] Finding entries in project 'website'
1122
+ [23/11 02:10:49] [INFO] Building asset entries
1123
+ [23/11 02:10:49] [INFO] Building content entries
1124
+ --------------------------------------------
1125
+
1126
+ 1 errors
1127
+
1128
+ id error
1129
+ -----------------------------------------------------------
1130
+ 0 Content type 'plantGenus' does not exist in
1131
+ project 'website'
1132
+ -----------------------------------------------------------
1133
+ [23/11 02:10:49] [OK] Done migrating entries
1134
+
1135
+ growingConditions Likes high humidity
1136
+ 636b925b-a386-4c56-9f33-96cd99cc391c no change
1137
+ growingConditions Needs plenty of light
1138
+ 2d80e638-eb0d-4bc5-bc96-42b7b8f20678 no change
1139
+ growingConditions Partial shade
1140
+ 711251f9-f9c6-473b-8b62-0ec8a0d4978c no change
1141
+ growingConditions Prefers dry conditions
1142
+ d815819d-61c6-4037-95d3-c503acf52153 no change
1143
+
1144
+ plant Aloe vera
1145
+ 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 no change
1146
+ plant Areca palm
1147
+ 0d94dbf2-89f8-45fb-96d5-175ae1f382ce no change
1148
+ plant Boston fern
1149
+ 43a60005-ea92-4b32-9af3-79560e48ecec no change
1150
+ plant Calathea orbifolia
1151
+ f0cac96c-39a1-4b85-b14b-e8d7d3d08767 no change
1152
+ plant Canary Island Date Palm
1153
+ d647012b-897e-4b6b-bfb5-b9844ef3d648 no change
1154
+
1155
+ plantGenus Aglaonema
1156
+ 98347340-a11c-4ee5-b4e7-1ae3b75496a2 error
1157
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1158
+
1159
+ plantGenus Alocasia
1160
+ fa464489-6476-4694-b3d4-e77d0c00a185 error
1161
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1162
+
1163
+ plantGenus Aloe
1164
+ 309d5fd7-a21f-45a8-8abb-f01f820b8f16 error
1165
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1166
+
1167
+ plantGenus Beaucarnea
1168
+ 4ebdcc63-929f-4b06-8848-fe046468a63d error
1169
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1170
+
1171
+
1172
+ plantType Ferns
1173
+ 90e128f5-582c-4430-a232-72022271ec8b no change
1174
+ plantType Foliage
1175
+ 25f5a78b-9274-4cc9-9a58-03d8dcd4cd17 no change
1176
+ plantType Orchids
1177
+ 44abca5b-a49b-48a1-8823-811ab31983c0 no change
1178
+ plantType Palm
1179
+ d66447c5-2198-4b19-bad3-c921e9ef0db0 no change
1180
+ plantType Succulents
1181
+ 70149568-9725-4c39-8ff5-ef69221a0899 no change
1182
+
1183
+ pot Barro decorated terracotta pot
1184
+ fa67e1c6-0637-4548-bd4f-c207ec62af0e no change
1185
+ pot Bianco white pot
1186
+ e3b7907c-f524-45e4-ba5f-e62d1557b477 no change
1187
+ pot Canasta mid-sized pot
1188
+ 058b20ba-99f7-49ec-9017-a0df35b00dcc no change
1189
+ pot Geo mid-sized pot
1190
+ dafc4810-a62e-43e5-a056-ab1248181eaf no change
1191
+ pot Grå small grey pot
1192
+ f2022069-7a92-491d-b197-a3564ab9a8ca no change
1193
+
1194
+ tag Promoted
1195
+ 3659a333-8d10-4325-9ea6-2f49ae47e7fe no change
1196
+
1197
+ website t.durden@example-dev>
631
1198
  ```
1199
+
1200
+ ### Import from a file
1201
+
1202
+ ```shell
1203
+ website t.durden@example-dev> import entries --preserve-guids --from-file ./content-entries.json
1204
+ ```
1205
+
1206
+ The output will be the same as the previous command
1207
+
1208
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>