contensis-cli 1.2.2-beta.17 → 1.2.2-beta.18

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
@@ -1792,9 +1792,9 @@ Consult the command `copy field --help` to see all of the available options
1792
1792
  , in order to transform the contents of a Composer field in an entry to a canvas field type, we achieve this by rendering each item in the Composer as simple HTML representation internally before parsing this markup and converting it to canvas then adding the output to our destination entry field, working in the same way as if we were copying the contents of a rich text field type (containing markup) to a canvas field.
1793
1793
 
1794
1794
  ```shell
1795
- contensis t.durden@example-dev> copy field contentPage composer canvas --output-entries changes
1795
+ contensis t.durden@example-dev> copy field contentPage composer canvas --output-entries changes
1796
1796
  -------------------------------------
1797
- -- IMPORT PREVIEW --
1797
+ -- IMPORT PREVIEW --
1798
1798
  [07/05 17:02:51] [INFO] OK to copy contentPage[composer]<objectArray> field into contentPage[canvas]<objectArray> in website on example-dev [canvas]
1799
1799
  [07/05 17:02:51] [INFO] Searching for initial entries in example-dev project 'website'
1800
1800
  [07/05 17:02:53] [INFO] Finding 1 entries in example-dev project 'website'
@@ -1802,7 +1802,7 @@ contensis t.durden@example-dev> copy field contentPage composer canvas --output-
1802
1802
 
1803
1803
  1/1 entries to migrate into [website]
1804
1804
 
1805
- contentTypeId status total
1805
+ contentTypeId status total
1806
1806
  ----------------------------------------------
1807
1807
  contentPage update 1
1808
1808
  ----------------------------------------------
@@ -1833,10 +1833,12 @@ website t.durden@example-dev>
1833
1833
 
1834
1834
  For fine-grained control of what is rendered or copied into the target field we can supply a `--template` option with a string value that is a [LiquidJS](https://liquidjs.com/tutorials/intro-to-liquid.html) template with access to variables we can use to directly drive how the output is written into our target field
1835
1835
 
1836
- The syntax for applying a template with the `copy field` command is
1836
+ The syntax for applying a template with the `copy field` command is
1837
+
1837
1838
  ```shell
1838
1839
  copy field blog description kicker --template "<h2>{{ value }}</h2>"
1839
1840
  ```
1841
+
1840
1842
  in this example the `value` from `description` field will be wrapped in a `<h2>` tag before being added to the `kicker` field
1841
1843
 
1842
1844
  The template must be surrounded in double-quotes and be entered (or pasted) in a single line for it to be parsed correctly with the intended command.
@@ -1847,6 +1849,22 @@ Escape characters and new lines can be introduced inside templates when calling
1847
1849
 
1848
1850
  Further documentation on using [templates](docs/copy_field_templates.md)
1849
1851
 
1852
+ ### Copy a hard-coded entry link into a field using a template
1853
+
1854
+ Useful to pre-populate an entry link field with a default entry in existing content
1855
+
1856
+ ```shell
1857
+ copy field courseInstance modules modules --zenql "sys.contentTypeId=courseInstance and modules NOT EXISTS" --template "{{ '[ { \"sys\": { \"id\": \"1d6a41de-5a61-474e-ab47-6e1e340d462c\", \"contentTypeId\": \"module\" } } ]' }}" --output-detail changes
1858
+ ```
1859
+
1860
+ This example will populate a repeating entry link field called `modules` within the `courseInstance` content type with the template we've supplied
1861
+
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.
1863
+
1864
+ 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
+
1866
+ To populate a non-repeating field remove the `[` and `]` from the supplied template
1867
+
1850
1868
  ### Copy a field and save the entries as output
1851
1869
 
1852
1870
  As we do not actually commit the output of a `copy field` command until specified we can also save the entries preview containing the new field data.
package/dist/version.js CHANGED
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  LIB_VERSION: () => LIB_VERSION
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const LIB_VERSION = "1.2.2-beta.17";
24
+ const LIB_VERSION = "1.2.2-beta.18";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  LIB_VERSION
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/version.ts"],
4
- "sourcesContent": ["export const LIB_VERSION = \"1.2.2-beta.17\";\n"],
4
+ "sourcesContent": ["export const LIB_VERSION = \"1.2.2-beta.18\";\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contensis-cli",
3
- "version": "1.2.2-beta.17",
3
+ "version": "1.2.2-beta.18",
4
4
  "description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
5
5
  "repository": "https://github.com/contensis/cli",
6
6
  "homepage": "https://github.com/contensis/cli/tree/main/packages/contensis-cli#readme",
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.2.2-beta.17";
1
+ export const LIB_VERSION = "1.2.2-beta.18";