contensis-cli 1.3.1-beta.9 → 1.4.1-beta.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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.4.0](https://github.com/contensis/cli/compare/contensis-cli-v1.3.0...contensis-cli-v1.4.0) (2024-12-05)
4
+
5
+
6
+ ### Features
7
+
8
+ * add `--format html` option to output results to a HTML table ([b607f39](https://github.com/contensis/cli/commit/b607f399be300e8a00c8e89e2d21e1fe3300b3e3))
9
+ * add `--no-publish` option to commands that import entries so any committed entries are left in draft workflow state ([a2db317](https://github.com/contensis/cli/commit/a2db3171db8ba4acc7c4309a5be356487646676b))
10
+ * add `push asset` command to push a supplied asset to a location in the cms ([af9e41a](https://github.com/contensis/cli/commit/af9e41a9d88eeed5caac3c50d606959d89cbcce1))
11
+ * add `remove env` command to remove a cached environment connection ([bd774df](https://github.com/contensis/cli/commit/bd774df78423ab59d3ac6a651d2320944d3fb56c))
12
+ * add `update field` command to find a specific phrase in an entry field and replace it with another in all returned entries ([9e56024](https://github.com/contensis/cli/commit/9e5602499566fa7227d145bcf84d13c2867714aa))
13
+ * read environments and current environment projects from session cache and add these to autocomplete `connect` and `set project` commands ([9c2ff36](https://github.com/contensis/cli/commit/9c2ff36c888a0cff5debba46628520f0a55f5f15))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * add missing command to autocomplete available commands ([e3c5a99](https://github.com/contensis/cli/commit/e3c5a9918d4fbe3ceac6440f7725f368726dc915))
19
+ * less false positives when diffing built entries in `import`, `copy` and `update` commands ([cf34914](https://github.com/contensis/cli/commit/cf34914d3c2eed9f62241e4042aef21fc9999539))
20
+ * null check console output for model defaults in `import models` command ([0e1d9c9](https://github.com/contensis/cli/commit/0e1d9c980ae1cb0fddc758e913b5b483d6c2979f))
21
+ * refine console messaging in `update field` command ([7fd9eab](https://github.com/contensis/cli/commit/7fd9eab63daed9cae0bb24d48be34d1a4542e082))
22
+ * sort environments alphabetically in `list envs` output ([80166ce](https://github.com/contensis/cli/commit/80166ce721bbee9ffe524b38e559f998055beb85))
23
+ * tidy up console messaging for some import operations ([8f18611](https://github.com/contensis/cli/commit/8f18611f5ba5d29c370c126b60458a60155c17b2))
24
+
3
25
  ## [1.3.0](https://github.com/contensis/cli/compare/contensis-cli-v1.2.1...contensis-cli-v1.3.0) (2024-09-24)
4
26
 
5
27
 
package/README.md CHANGED
@@ -225,6 +225,7 @@ contensis >
225
225
  - [Get started](#get-started)
226
226
  - [Connect to a Contensis Cloud environment](#connect-to-a-contensis-cloud-environment)
227
227
  - [Login to a connected Contensis environment](#login-to-a-connected-contensis-environment)
228
+ - [Manage connected environments](#manage-connected-environments)
228
229
  - [Manage Projects](#manage-projects)
229
230
  - [List projects](#list-projects)
230
231
  - [Set current project](#set-current-project)
@@ -278,16 +279,20 @@ contensis >
278
279
  - [Import from a file](#import-from-a-file-1)
279
280
  - [Import entries further reading](#import-entries-further-reading)
280
281
  - [Remove entries](#remove-entries)
282
+ - [Push asset](#push-asset)
281
283
  - [Copy an entry field](#copy-an-entry-field)
282
284
  - [Copy a simple entry field](#copy-a-simple-entry-field)
283
285
  - [Limit entries when copying field content](#limit-entries-when-copying-field-content)
284
286
  - [Copy a composer into a canvas field](#copy-a-composer-into-a-canvas-field)
285
287
  - [Copy a field using a template](#copy-a-field-using-a-template)
286
288
  - [Copy a field and save the entries as output](#copy-a-field-and-save-the-entries-as-output)
289
+ - [Update an entry field](#update-an-entry-field)
287
290
 
288
291
  ## Get started
289
292
 
290
- Press `[tab]` key at any time to show suggested commands or to attempt to auto-complete the command you are typign
293
+ Press `[tab]` key at any time to show suggested commands or to attempt to auto-complete the command you are typing
294
+
295
+ You can use tab to auto-complete a `connect <alias>` or `set project <project-id>` command for the environment(s) you are connected to
291
296
 
292
297
  ```shell
293
298
  >> Available commands:
@@ -354,6 +359,31 @@ If you are logging in via a script or service you will likely be using an API ke
354
359
 
355
360
  If you need to skip this step for any reason you could [pass connection details anywhere](#pass-connection-details-anywhere)
356
361
 
362
+ ## Manage connected environments
363
+
364
+ See a list of all previously connected environments with the `list envs` command
365
+
366
+ Use the `remove env` command followed by the cloud alias if you wish to remove any of these environments from your CLI cache
367
+
368
+ ```shell
369
+ contensis t.durden@example-dev> list envs
370
+ [cli] ✅ Environments store found containing 7 environments
371
+ - demoSite
372
+ - * example-dev
373
+ - forms
374
+ - insytful
375
+ - leif
376
+ - trial-00
377
+ - webinar
378
+
379
+ contensis t.durden@example-dev> remove env trial-00
380
+ [cli] ✅ Environments store found containing 7 environments
381
+ [cli] ✅ Removed environment trial-00 from session cache
382
+ -------------------------------------
383
+
384
+ contensis t.durden@example-dev>
385
+ ```
386
+
357
387
  ## Manage Projects
358
388
 
359
389
  ### List projects
@@ -624,7 +654,9 @@ contensis t.durden@example-dev>
624
654
 
625
655
  ### Get entries
626
656
 
627
- Use the `get entries` command
657
+ Use the `get entries` command to search for entries using the Management API
658
+
659
+ Many options are available that can be used to return the right list of entries: run `get entries --help`
628
660
 
629
661
  The simplest usage is `get entries {keyword}` or `get entries "{search phrase}"`
630
662
 
@@ -818,7 +850,7 @@ website t.durden@example-dev>
818
850
 
819
851
  Override the output format with the `--format` or `-f` option.
820
852
 
821
- Available options are: `json`, `xml` or `csv`
853
+ Available options are: `json`, `csv`, `xml` or `html`
822
854
 
823
855
  The `--format` and `--output` options are available with most commands (check command `--help`)
824
856
 
@@ -1521,7 +1553,7 @@ The output will be the same as the `import models` examples above
1521
1553
 
1522
1554
  ### Import from another Contensis environment
1523
1555
 
1524
- 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.
1556
+ 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 your `get entries` test commands to fetch all of the entries that will eventually be imported.
1525
1557
 
1526
1558
  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
1527
1559
 
@@ -1715,6 +1747,22 @@ website t.durden@example-dev>
1715
1747
 
1716
1748
  <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
1717
1749
 
1750
+ ## Push asset
1751
+
1752
+ The `push asset` command allows you to push a single file into your Contensis instance
1753
+
1754
+ The file can be local
1755
+
1756
+ ```shell
1757
+ push asset image "Bicycle" "A child's bicycle" --from-file "C:\Users\t.durden\Pictures\bicycle.png" --target-file-path /image-library/samples/
1758
+ ```
1759
+
1760
+ Or the file can be downloaded from a http location
1761
+
1762
+ ```shell
1763
+ push asset image "Bicycle" "A child's bicycle" --from-url "https://thumbs.example.com/modern-child-bicycle.jpg" --target-file-path /image-library/samples/
1764
+ ```
1765
+
1718
1766
  ## Copy an entry field
1719
1767
 
1720
1768
  This command allows us to copy the contents of one entry field to another, this is useful if, for example - when a field is named incorrectly, or was specified originally as one field type but we would like to curate and present this content differently in future.
@@ -1859,7 +1907,7 @@ copy field courseInstance modules modules --zenql "sys.contentTypeId=courseInsta
1859
1907
 
1860
1908
  This example will populate a repeating entry link field called `modules` within the `courseInstance` content type with the template we've supplied
1861
1909
 
1862
- Using the `copy field` command with a `--zenql` statement to narrow down the entries to update, we can supply a template that is a hard-coded JSON string (with escaped quotes) with an `"id"` that is a valid entry id to link to this field.
1910
+ Using the `copy field` command with a `--zenql` statement to narrow down the entries to update, we can supply a template that is a hard-coded JSON string (with escaped quotes) with an `"id"` that is a valid entry id to link to this field.
1863
1911
 
1864
1912
  Adding `--output-detail changes` will output a diff for each changed entry to the console. For larger jobs use the `--output file.json` option to review the changes that will be made.
1865
1913
 
@@ -1876,3 +1924,27 @@ Add the `--save-entries` option to the `copy field` command, remember to also in
1876
1924
  ```shell
1877
1925
  copy field contentPage composer canvas --save-entries --output canvas-entries.json
1878
1926
  ```
1927
+
1928
+ ## Update an entry field
1929
+
1930
+ The `update field` command can be thought of as a "find and replace" feature, where we can look for a particular value (or RegExp) in a list of entries and replace any found values with a supplied replacement value.
1931
+
1932
+ ```shell
1933
+ update field content "find me" "replacement value"
1934
+ ```
1935
+
1936
+ A number of ways exist to limit the entries we check and make changes with
1937
+
1938
+ ```shell
1939
+ update field content "Em.*?mith" "Emma Davies" --zenql "searchContent~'Emma Smith'"
1940
+ ```
1941
+
1942
+ ```shell
1943
+ update field content "Em.*?mith" "Emma Davies" --search "Emma Smith"
1944
+ ```
1945
+
1946
+ Update one or more entries by their id
1947
+
1948
+ ```shell
1949
+ update field content "Em.*?mith" "Emma Davies" --id defb707b-fcfa-4c7e-baf8-6472edb5ec25 c92390dd-7bb1-5f5d-8fbd-0d7f41232ac3
1950
+ ```
@@ -161,7 +161,7 @@ class ContensisCli {
161
161
  PrintEnvironments = async () => {
162
162
  const { log, messages } = this;
163
163
  const { currentEnvironment, environments = {} } = this.cache;
164
- const envKeys = Object.keys(environments);
164
+ const envKeys = Object.keys(environments).sort();
165
165
  log.success(messages.envs.found(envKeys.length));
166
166
  await this.HandleFormattingAndOutput(envKeys, () => {
167
167
  for (const env of envKeys) {