@jungvonmatt/contentful-migrations 6.2.6 → 7.0.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
@@ -36,6 +36,7 @@ This initializes migrations and stores the config values in the `package.json` o
36
36
  We use [`@jungvonmatt/contentful-config`](https://github.com/jungvonmatt/contentful-ssg/tree/main/packages/contentful-config) (built on [`@jungvonmatt/config-loader`](https://github.com/jungvonmatt/config-loader) and [`c12`](https://github.com/unjs/c12)) which provides extensive configuration loading capabilities from multiple sources.
37
37
 
38
38
  **Supported configuration locations (in order of priority):**
39
+
39
40
  - Configuration overrides passed via command line arguments
40
41
  - User-specified config file (via `--config` option)
41
42
  - `migrations.config.{js,ts,mjs,cjs,mts,cts}`
@@ -49,22 +50,24 @@ We use [`@jungvonmatt/contentful-config`](https://github.com/jungvonmatt/content
49
50
 
50
51
  **Extending configurations:**
51
52
  You can extend configurations from other files or remote sources using the `extends` property:
53
+
52
54
  ```js
53
55
  // migrations.config.js
54
56
  export default {
55
57
  extends: ['./base.config.js', 'github:user/repo'],
56
58
  // your config...
57
- }
59
+ };
58
60
  ```
59
61
 
60
62
  **Environment-specific configuration:**
63
+
61
64
  ```js
62
65
  // migrations.config.js
63
66
  export default {
64
67
  spaceId: 'default-space',
65
68
  $development: { spaceId: 'dev-space' },
66
- $production: { spaceId: 'prod-space' }
67
- }
69
+ $production: { spaceId: 'prod-space' },
70
+ };
68
71
  ```
69
72
 
70
73
  You can specify any config file path using the `--config <path/to/config>` command line argument. Multiple config files can be used for different environments or spaces in your project.
@@ -276,14 +279,22 @@ module.exports = withHelpers(async (migration, context, helpers) => {
276
279
 
277
280
  // Add or remove embedded or linked content types for a rich text field without knowing all the allowed content types
278
281
  // The possible node types are 'entry-hyperlink', 'embedded-entry-block' and 'embedded-entry-inline'.
279
- await helpers.validation.richText.addNodeContentTypeValues('contentTypeId', 'fieldId', 'embedded-entry-block', ['a-content-type']);
280
- await helpers.validation.richText.removeNodeContentTypeValues('contentTypeId', 'fieldId', 'embedded-entry-inline', ['a-content-type']);
281
- await helpers.validation.richText.modifyNodeContentTypeValues('contentTypeId', 'fieldId', 'entry-hyperlink', (existing) => {
282
- const result = existing.filter((value) => value.startsWith('t-')); // filter out content types that not start with 't-'
283
- result.push('t-article'); // and add one
284
- return result; // possible duplicate values are removed afterwards
285
- });
286
-
282
+ await helpers.validation.richText.addNodeContentTypeValues('contentTypeId', 'fieldId', 'embedded-entry-block', [
283
+ 'a-content-type',
284
+ ]);
285
+ await helpers.validation.richText.removeNodeContentTypeValues('contentTypeId', 'fieldId', 'embedded-entry-inline', [
286
+ 'a-content-type',
287
+ ]);
288
+ await helpers.validation.richText.modifyNodeContentTypeValues(
289
+ 'contentTypeId',
290
+ 'fieldId',
291
+ 'entry-hyperlink',
292
+ (existing) => {
293
+ const result = existing.filter((value) => value.startsWith('t-')); // filter out content types that not start with 't-'
294
+ result.push('t-article'); // and add one
295
+ return result; // possible duplicate values are removed afterwards
296
+ },
297
+ );
287
298
  });
288
299
  ```
289
300