sb-mig 6.1.0-beta.3 → 6.1.1-beta.1

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,11 +1,11 @@
1
1
  <p align="center">
2
2
  <img width="250" height="250" src="./sb-mig-logo.png" alt="Logo" />
3
3
  </p>
4
- If you've found an issue or you have feature request - <a href="https://github.com/marckraw/sb-mig/issues/new">open an issue</a> or look if it was <a href="https://github.com/sb-mig/sb-mig/issues/">already created</a>.
4
+ If you've found an issue or you have feature request - <a href="https://github.com/sb-mig/sb-mig/issues/new">open an issue</a> or look if it was <a href="https://github.com/sb-mig/sb-mig/issues/">already created</a>.
5
5
  <br />
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/sb-mig.svg)](https://www.npmjs.com/package/sb-mig)
8
- [![npm](https://img.shields.io/npm/dt/sb-mig.svg)](ttps://img.shields.io/npm/dt/sb-mig.svg)
8
+ [![npm](https://img.shields.io/npm/dt/sb-mig.svg)](https://www.npmjs.com/package/sb-mig)
9
9
  [![GitHub issues](https://img.shields.io/github/issues/sb-mig/sb-mig.svg?style=flat-square&v=1)](https://github.com/sb-mig/sb-mig/issues?q=is%3Aopen+is%3Aissue)
10
10
  ![npm](https://img.shields.io/npms-io/maintenance-score/sb-mig)
11
11
 
@@ -15,6 +15,29 @@ If you've found an issue or you have feature request - <a href="https://github.c
15
15
  | ---- | ------------ |
16
16
  | Node | 22.x.x or >=24.x.x |
17
17
 
18
+ # 6.x.x version released!
19
+
20
+ ## Important Updates
21
+
22
+ - New migration publication model for stories. `sb-mig migrate content` now supports `--publicationMode preserve-layers`, `--publicationMode collapse-draft`, and `--publicationMode save-only`.
23
+ - Default migration behavior is now built around preserving Storyblok publication state where possible, including dirty published stories with separate draft/current and published layers.
24
+ - New language-aware publication support through `--publicationLanguages` and reusable language publish-state maps.
25
+ - New read-only inspection commands:
26
+ - `sb-mig language-publish-state`
27
+ - `sb-mig published-layer-export`
28
+ - `sb-mig story-versions`
29
+ - Migration runs now write better operational artifacts, including dry-run output, publication plans, published-layer summaries, and JSONL run logs.
30
+ - Programmatic asset helpers are now exposed for creating local-file assets and updating existing asset metadata.
31
+ - Windows path handling, selected component syncs, schema precompile imports, query parameter encoding, and SSOT/default content type handling were hardened.
32
+
33
+ ## Breaking changes
34
+
35
+ - Node 20 is no longer supported. Supported runtimes are Node 22 and Node 24 or newer.
36
+ - The old migration publish flags were replaced:
37
+ - `--publish` is now `--publicationMode`
38
+ - `--publishLanguages` is now `--publicationLanguages`
39
+ - `--preservePublishedLayer` is now `--publicationMode preserve-layers`
40
+
18
41
  # 5.x.x version released!
19
42
 
20
43
  ## Important Updates
@@ -58,6 +81,8 @@ Do not hesitate to get in touch if you encounter any issues or require further c
58
81
  - [Basics](#basics)
59
82
  - [Syncing components](#syncing-components)
60
83
  - [Syncing datasources](#syncing-datasources)
84
+ - [Migrating content](#migrating-content)
85
+ - [Inspecting publication state](#inspecting-publication-state)
61
86
  - [Presets support](#presets-support)
62
87
  - [Development](#development)
63
88
  - [Roadmap](#roadmap)
@@ -232,6 +257,103 @@ stories from a space or from a file.
232
257
  sb-mig migrate content --all --from 12345 --to 12345 --migration itemsToContent
233
258
  ```
234
259
 
260
+ You can run multiple migration configs in order:
261
+
262
+ ```bash
263
+ sb-mig migrate content --all \
264
+ --from 12345 \
265
+ --to 12345 \
266
+ --migration migration-a \
267
+ --migration migration-b \
268
+ --migration migration-c
269
+ ```
270
+
271
+ ### Publication modes
272
+
273
+ Storyblok stories can have separate draft/current and published layers. In 6.x, `sb-mig` makes this explicit with `--publicationMode`.
274
+
275
+ `preserve-layers` is the default. Use it when you want migrated stories to keep the source publication shape: draft-only stories stay draft-only, clean published stories stay published, and dirty published stories keep separate migrated draft/current and published layers. This mode currently requires migrating from a Storyblok space to the same Storyblok space.
276
+
277
+ ```bash
278
+ sb-mig migrate content --all \
279
+ --from 12345 \
280
+ --to 12345 \
281
+ --migration itemsToContent \
282
+ --publicationMode preserve-layers \
283
+ --yes
284
+ ```
285
+
286
+ `collapse-draft` publishes changed stories and can collapse draft/current changes into the published result. Use this when the target should end up with the migrated content published.
287
+
288
+ ```bash
289
+ sb-mig migrate content --all \
290
+ --from 12345 \
291
+ --to 12345 \
292
+ --migration itemsToContent \
293
+ --publicationMode collapse-draft \
294
+ --publicationLanguages all \
295
+ --yes
296
+ ```
297
+
298
+ `save-only` updates draft/current JSON without publishing any languages.
299
+
300
+ ```bash
301
+ sb-mig migrate content --all \
302
+ --from 12345 \
303
+ --to 12345 \
304
+ --migration itemsToContent \
305
+ --publicationMode save-only \
306
+ --yes
307
+ ```
308
+
309
+ Use `--publicationLanguages` with `default`, `all`, or a comma-separated list of Storyblok language codes:
310
+
311
+ ```bash
312
+ sb-mig migrate content --all \
313
+ --from 12345 \
314
+ --to 12345 \
315
+ --migration itemsToContent \
316
+ --publicationMode collapse-draft \
317
+ --publicationLanguages default,fr,de \
318
+ --yes
319
+ ```
320
+
321
+ When `--publicationMode` publishes languages, `sb-mig` can build the language publish-state map automatically. For bigger or more sensitive runs, generate the map first and pass it back with `--languagePublishStatePath`:
322
+
323
+ ```bash
324
+ sb-mig language-publish-state \
325
+ --from 12345 \
326
+ --startsWith blog/ \
327
+ --languages all \
328
+ --fileName blog-prod
329
+
330
+ sb-mig migrate content --all \
331
+ --from 12345 \
332
+ --to 12345 \
333
+ --migration itemsToContent \
334
+ --publicationMode preserve-layers \
335
+ --publicationLanguages all \
336
+ --languagePublishStatePath sbmig/language-publish-state/blog-prod.json \
337
+ --yes
338
+ ```
339
+
340
+ ### Migration artifacts
341
+
342
+ Migrations write JSON artifacts under `sbmig/migrations` by default. Use `--dry-run` to preview the selected stories, transformed output, publication plan, and write summary without making Storyblok API writes.
343
+
344
+ ```bash
345
+ sb-mig migrate content --all \
346
+ --from 12345 \
347
+ --to 12345 \
348
+ --migration itemsToContent \
349
+ --publicationMode preserve-layers \
350
+ --publicationLanguages all \
351
+ --dry-run \
352
+ --fileName blog-v6-check
353
+ ```
354
+
355
+ 6.x also writes JSONL migration run logs for easier auditing and post-run debugging. When published layers are involved, additional published-layer input/output and summary files are written.
356
+
235
357
  ### Extending migration component scope
236
358
 
237
359
  Migration files export a mapper keyed by component name. By default, `sb-mig`
@@ -266,6 +388,35 @@ This runs `colorPickerModeValues` for the normal Backpack keys and also for the
266
388
  two wrapper component names by aliasing them onto the existing `sb-button` and
267
389
  `sb-section` migration handlers.
268
390
 
391
+ ## Inspecting publication state
392
+
393
+ These commands are read-only against Storyblok and are useful before a migration run.
394
+
395
+ Build a language publish-state map:
396
+
397
+ ```bash
398
+ sb-mig language-publish-state \
399
+ --from 12345 \
400
+ --startsWith about/ \
401
+ --languages all \
402
+ --fileName about-prod
403
+ ```
404
+
405
+ Export draft/current and latest published story layers:
406
+
407
+ ```bash
408
+ sb-mig published-layer-export \
409
+ --from 12345 \
410
+ --startsWith about/ \
411
+ --fileName about-layer-check
412
+ ```
413
+
414
+ Inspect raw Storyblok story versions for a single story:
415
+
416
+ ```bash
417
+ sb-mig story-versions --from 12345 --withSlug about/contact --raw
418
+ ```
419
+
269
420
  You can also sync your `datasources`.
270
421
 
271
422
  Add `datasourceExt: "your-own-extension",` to your `storyblok.config.js`. If u will not add it, will be used default one (`sb.datasource.js`)
@@ -1,14 +1,14 @@
1
- export declare const mainDescription = "\n USAGE\n $ sb-mig [command]\n \n COMMANDS\n sync Synchronize components, datasources, roles, stories, assets with Storyblok space.\n discover Discover components, migration configs and write to file or stdout.\n backup Command for backing up anything related to Storyblok\n migrate Migrate content from space to space, or from file to space.\n language-publish-state\n Build a read-only Storyblok story language publish-state map.\n story-versions\n Inspect raw Management API story version history for one story.\n published-layer-export\n Export draft/current and published story layers as JSON.\n debug Output extra debugging information\n help This screen\n \n Examples\n $ sb-mig sync components --all\n $ sb-mig debug \n";
2
- export declare const storyVersionsDescription = "\n Usage\n $ sb-mig story-versions --from [spaceId] --storyId [storyId]\n $ sb-mig story-versions --from [spaceId] --withSlug [full_slug]\n\n Description\n Read Storyblok Management API story_versions for a single story.\n This command is read-only and is meant for inspecting version status values and content shape.\n\n FLAGS\n --from - Source space ID to inspect\n --storyId - Story ID to inspect\n --withSlug - Story full_slug to resolve to a story ID\n --showContent - Include version content from Storyblok. Default: true\n --page - Versions page. Default: 1\n --perPage - Versions per page. Default: 25\n --raw - Print the raw Storyblok API response instead of the compact summary\n --outputPath - Optional file path for JSON output\n\n EXAMPLES\n $ sb-mig story-versions --from 12345 --storyId 98765\n $ sb-mig story-versions --from 12345 --withSlug tours/europe --raw --outputPath sbmig/story-versions/tours-europe.raw.json\n";
3
- export declare const publishedLayerExportDescription = "\n Usage\n $ sb-mig published-layer-export --from [spaceId] --all\n $ sb-mig published-layer-export --from [spaceId] --storyId [storyId]\n $ sb-mig published-layer-export --from [spaceId] --withSlug [full_slug]\n $ sb-mig published-layer-export --from [spaceId] --startsWith [prefix]\n\n Description\n Read selected Management API stories and their latest published Story Versions API content.\n This command is read-only against Storyblok. It writes JSON files for inspecting draft/current and published layers before changing migrate behavior.\n\n FLAGS\n --from - Source space ID to inspect\n --all - Export all non-folder stories\n --storyId - Story ID to export. Can be repeated.\n --withSlug - Exact story full_slug to export. Can be repeated.\n --startsWith - Filter stories by starts_with prefix\n --fileName - Stable output base name\n --outputPath - Output directory. Default: sbmig/published-layer-export\n --versionsPerPage - Story versions per page. Default: 25\n --maxVersionPages - Maximum Story Versions API pages to inspect per story. Default: 4\n\n OUTPUT\n <name>---draft-current-full.json\n <name>---published-layer-full.json\n <name>---dual-layer-summary.json\n\n EXAMPLES\n $ sb-mig published-layer-export --from 12345 --withSlug translation-migration-testing/test-1/contact-us\n $ sb-mig published-layer-export --from 12345 --storyId 178888427520390\n $ sb-mig published-layer-export --from 12345 --startsWith translation-migration-testing --fileName translation-test\n";
4
- export declare const languagePublishStateDescription = "\n Usage\n $ sb-mig language-publish-state --from [spaceId]\n\n Description\n Read stories from a source Storyblok space and write a JSON map of default and translated language publication states.\n This command is read-only against Storyblok. It uses Management API for story listing and default-language state, and Delivery API for translated language published/draft comparisons.\n\n FLAGS\n --from - Source space ID to inspect\n --accessToken - Optional source space Delivery API access token override. Falls back to configured accessToken.\n --languages - Languages to inspect: all, default,fr,de. Default: all\n --withSlug - Exact story full_slug to inspect. Can be repeated.\n --startsWith - Filter stories by starts_with prefix\n --fileName - Stable output base name under sbmig/language-publish-state\n --outputPath - Explicit output path for the generated JSON file\n\n EXAMPLES\n $ sb-mig language-publish-state --from 12345 --startsWith about-ef --languages all --fileName about-ef-prod\n $ sb-mig language-publish-state --from 12345 --accessToken xxx --withSlug about-ef/testimonials --languages default,fr\n";
5
- export declare const syncDescription = "\n Usage\n $ sb-mig sync [components|roles|datasources|plugins|content] [space separated file names] or --all\n \n Description\n Synchronize components, roles, datasources, plugins, content with Storyblok space.\n \n COMMANDS\n components - sync components\n roles - sync roles\n datasources - sync datasources\n plugins - sync plugins\n content - sync content (stories, assets) - ! right now destructive, it will move content from 1 space to another, completelly overwriting it\n \n FLAGS\n --all - Sync all components, roles, datasources [components, roles, datasources]\n --presets - Pass it, if u want to sync also with presets (will take longer) [components only]\n --dry-run - Preview planned changes without making writes [components, roles, datasources, plugins, content]\n \n --yes - Skip ask for confirmation (dangerous, but useful in CI/CD) [content only]\n --from - Space ID from which you want to sync content [content only]\n --to - Space ID to which you want to sync content [content only]\n --syncDirection [fromSpaceToFile|fromFileToSpace|fromSpaceToSpace|fromAWStoSpace] \n - Sync direction (from, to) [content only]\n \n EXAMPLES\n $ sb-mig sync components --all\n $ sb-mig sync components --all --dry-run\n $ sb-mig sync components --all --presets\n $ sb-mig sync components accordion accordion-item\n $ sb-mig sync components accordion accordion-item --presets\n \n $ sb-mig sync roles --all\n $ sb-mig sync roles --all --dry-run\n \n $ sb-mig sync datasources --all\n $ sb-mig sync datasources --all --dry-run\n \n $ sb-mig sync plugins my-awesome-plugin - (you have to be in catalog which has ./dist/export.js file with compiled plugin)\n \n $ sb-mig sync content --all --from 12345 --to 12345\n $ sb-mig sync content --stories --from 12345 --to 12345\n $ sb-mig sync content --assets --from 12345 --to 12345\n";
6
- export declare const copyDescription = "\n Usage\n $ sb-mig copy\n \n Description\n Copy stuff\n \n COMMANDS\n ?\n \n FLAGS\n ?\n \n EXAMPLES\n $ sb-mig copy ?\n";
7
- export declare const migrateDescription = "\n Usage\n $ sb-mig migrate [content] [space separated file names] or --all --from [spaceId] --to [spaceId] --migration [migration-config-filename]\n $ sb-mig migrate content --all --migration migration-a --migration migration-b --migration migration-c\n \n Description\n Migrate content from space to space, or from file to space. It's potentially dangerous command, so it will ask for confirmation.\n Use with care.\n \n COMMANDS\n content - migrate content \n \n FLAGS\n --from - Space ID from which you want to migrate / or file name if passed '--migrate-from file'\n --fromFilePath - Direct path to stories JSON file when using '--migrate-from file'\n --to - Space ID to which you want to migrate\n --migrate-from - Migrate from (space, file) default: space\n --migration - File name of migration file (without extension). Can be repeated for ordered pipeline in content migration.\n --migrationComponentAlias - Add extra component aliases for a migration. Repeatable. Format: <migration>:<source>=<alias1>,<alias2>\n --migrationComponents - Override the exact component scope for a migration. Repeatable. Format: <migration>:<component1>,<component2>\n --withSlug - Filter stories by full slug (can be repeated)\n --startsWith - Filter stories by starts_with prefix\n --yes - Skip ask for confirmation (dangerous, but useful in CI/CD)\n --dry-run - Preview what would be migrated without making any API changes\n --publicationMode - How migrate content should preserve Storyblok publication state. Values: preserve-layers, collapse-draft, save-only. Default: preserve-layers. [content only]\n --publicationLanguages - Language scope to inspect and preserve when publicationMode publishes stories. Values: default, all, or comma-separated Storyblok language codes. Default: all. [content only]\n --languagePublishStatePath - Optional JSON file generated by 'language-publish-state'. When omitted, migrate builds the language publish-state map automatically for the selected stories. [content only]\n --fileName - Stable base name for migration output files (disables timestamp suffix for migration artifacts)\n\n EXAMPLES\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration migration-a --migration migration-b --migration migration-c\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration colorPickerModeValues --migrationComponentAlias colorPickerModeValues:sb-button=sb-open-drift-button\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration colorPickerModeValues --migrationComponentAlias colorPickerModeValues:sb-section=sb-tour-page-section --migrationComponents colorPickerModeValues:sb-section,sb-tour-page-section\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --withSlug blog/home --withSlug docs/getting-started\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --startsWith blog/\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode preserve-layers --yes\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode collapse-draft --publicationLanguages all --yes\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode preserve-layers --publicationLanguages all --dry-run\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode preserve-layers --publicationLanguages all --languagePublishStatePath sbmig/language-publish-state/prod-language-state.json --yes\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode collapse-draft --publicationLanguages default,fr,de --yes\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration v3toV4AllMigrations --dry-run --fileName brand-hub-v3-v4-run\n $ sb-mig migrate content --all --migrate-from file --from file-with-stories --to 12345 --migration file-with-migration\n $ sb-mig migrate content --all --migrate-from file --fromFilePath sbmig/migrations/dry-run--123---story-to-migrate__2026-2-9_20-51.json --to 12345 --migration migration-a --migration migration-b\n $ sb-mig migrate content my-component-1 my-component-2 --from 12345 --to 12345 --migration file-with-migration\n $ sb-mig migrate content my-component-1 my-component-2 --migrate-from file --from file-with-stories --to 12345 --migration file-with-migration \n";
8
- export declare const revertDescription = "\n Usage\n $ sb-mig revert [content] --migration\n \n Description\n Revert content migration\n \n COMMANDS\n content - revert content migration \n \n FLAGS\n --migration - ???\n --yes - Skip ask for confirmation (dangerous, but useful in CI/CD) \n \n EXAMPLES\n $ sb-mig revert content --migration \n";
9
- export declare const discoverDescription = "\n Usage\n $ sb-mig discover [components|migrations] --all --write\n\n Description\n Discover all components or migration configs and write to file or stdout\n\n COMMANDS\n components - discover components\n migrations - discover migration config files\n\n FLAGS\n --all - Discover all components or migration configs\n --write - Write to file\n\n EXAMPLES\n $ sb-mig discover components --all\n $ sb-mig discover components --all --write\n $ sb-mig discover migrations --all\n";
10
- export declare const migrationsDescription = "\n Usage\n $ sb-mig migrations recognize\n \n Description\n Recognize migrations you need to apply\n \n COMMANDS\n recognize - recognize migrations\n \n FLAGS \n \n EXAMPLES\n $ sb-mig migrations recognize\n\n";
11
- export declare const removeDescription = "\n Usage\n $ sb-mig remove [components|roles|datasources] [space separated file names] or --all \n \n Description\n Remove components or roles with Storyblok space.\n \n COMMANDS\n components - remove components\n roles - remove roles\n datasources - remove datasources\n \n FLAGS\n --all - Remove all components \n \n EXAMPLES\n $ sb-mig remove components --all\n $ sb-mig remove components accordion accordion-item\n $ sb-mig remove roles --all\n $ sb-mig remove datasources --all\n";
12
- export declare const backupDescription = "\n Usage\n $ sb-mig backup [components|component-groups|roles|datasources|presets|component-presets] component-name or --all\n Description\n Command for backing up anything related to Storyblok\n \n COMMANDS\n components - backup components\n component-groups - backup component-groups\n roles - backup components\n datasources - backup components\n presets - backup presets\n component-presets - backup component presets\n plugins - backup plugins\n stories - backup stories (only --all)\n\n \n FLAGS\n --all - Backup all \n \n EXAMPLES\n $ sb-mig backup components --all\n $ sb-mig backup components accordion \n $ sb-mig backup datasources --all\n $ sb-mig backup roles admin\n $ sb-mig backup plugins --all\n $ sb-mig backup plugins my-awesome-plugin\n $ sb-mig backup stories --all\n";
13
- export declare const debugDescription = "\n Usage\n $ sb-mig debug\n Description\n Output extra debugging information\n";
14
- export declare const initDescription = "\n Usage\n $ sb-mig init\n Description\n Init and update your project\n";
1
+ export declare const mainDescription = "\n USAGE\n $ sb-mig [command]\n\n COMMANDS\n sync Synchronize components, roles, datasources, plugins, stories, and assets.\n copy Copy Storyblok stories or folders between spaces.\n discover Discover local components and migration config files.\n backup Back up Storyblok resources to local JSON files.\n migrate Run story or preset data migrations.\n language-publish-state Build a read-only story language publish-state map.\n story-versions Inspect raw Management API story version history for one story.\n published-layer-export Export draft/current and published story layers as JSON.\n remove Remove components or stories from a Storyblok space.\n revert Restore stories from a local story backup file.\n migrations Recognize migration commands to run for a package upgrade.\n init Initialize project Storyblok environment settings.\n debug Output extra debugging information.\n help Show this screen.\n\n EXAMPLES\n $ sb-mig sync components --all\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --dry-run\n $ sb-mig copy stories --sourceSpace 12345 --targetSpace 67890 --what folder/* --where target-folder\n";
2
+ export declare const storyVersionsDescription = "\n USAGE\n $ sb-mig story-versions --from [spaceId] --storyId [storyId]\n $ sb-mig story-versions --from [spaceId] --withSlug [full_slug]\n\n DESCRIPTION\n Read Storyblok Management API story_versions for a single story.\n This command is read-only and is meant for inspecting version status values and content shape.\n\n FLAGS\n --from Source space ID to inspect. Required.\n --storyId Story ID to inspect. Required unless --withSlug is passed.\n --withSlug Story full_slug to resolve to a story ID. Required unless --storyId is passed.\n --showContent Include version content from Storyblok. Default: true.\n --page Versions page. Default: 1.\n --perPage Versions per page. Default: 25.\n --raw Print the raw Storyblok API response instead of the compact summary.\n --outputPath Optional file path for JSON output.\n\n SIDE EFFECTS\n Read-only against Storyblok. Writes a local JSON file only when --outputPath is passed.\n\n EXAMPLES\n $ sb-mig story-versions --from 12345 --storyId 98765\n $ sb-mig story-versions --from 12345 --withSlug tours/europe --raw --outputPath sbmig/story-versions/tours-europe.raw.json\n";
3
+ export declare const publishedLayerExportDescription = "\n USAGE\n $ sb-mig published-layer-export --from [spaceId] --all\n $ sb-mig published-layer-export --from [spaceId] --storyId [storyId]\n $ sb-mig published-layer-export --from [spaceId] --withSlug [full_slug]\n $ sb-mig published-layer-export --from [spaceId] --startsWith [prefix]\n\n DESCRIPTION\n Read selected Management API stories and their latest published Story Versions API content.\n This command is read-only against Storyblok. It writes JSON files for inspecting draft/current and published layers before changing migrate behavior.\n\n FLAGS\n --from Source space ID to inspect. Required.\n --all Export all non-folder stories.\n --storyId Story ID to export. Can be repeated.\n --withSlug Exact story full_slug to export. Can be repeated.\n --startsWith Filter stories by starts_with prefix.\n --fileName Stable output base name.\n --outputPath Output directory. Default: sbmig/published-layer-export.\n --versionsPerPage Story versions per page. Default: 25.\n --maxVersionPages Maximum Story Versions API pages to inspect per story. Default: 4.\n\n OUTPUT\n <name>---draft-current-full.json\n <name>---published-layer-full.json\n <name>---dual-layer-summary.json\n\n SIDE EFFECTS\n Read-only against Storyblok. Always writes local JSON export files.\n\n EXAMPLES\n $ sb-mig published-layer-export --from 12345 --withSlug translation-migration-testing/test-1/contact-us\n $ sb-mig published-layer-export --from 12345 --storyId 178888427520390\n $ sb-mig published-layer-export --from 12345 --startsWith translation-migration-testing --fileName translation-test\n";
4
+ export declare const languagePublishStateDescription = "\n USAGE\n $ sb-mig language-publish-state --from [spaceId]\n\n DESCRIPTION\n Read stories from a source Storyblok space and write a JSON map of default and translated language publication states.\n This command is read-only against Storyblok. It uses Management API for story listing and default-language state, and Delivery API for translated language published/draft comparisons.\n\n FLAGS\n --from Source space ID to inspect. Required.\n --accessToken Optional source space Delivery API access token override. Falls back to configured accessToken.\n --languages Languages to inspect: all, default,fr,de. Default: all.\n --withSlug Exact story full_slug to inspect. Can be repeated.\n --startsWith Filter stories by starts_with prefix.\n --fileName Stable output base name under sbmig/language-publish-state.\n --outputPath Explicit output path for the generated JSON file.\n\n SIDE EFFECTS\n Read-only against Storyblok. Writes a local JSON publish-state map.\n\n EXAMPLES\n $ sb-mig language-publish-state --from 12345 --startsWith about-ef --languages all --fileName about-ef-prod\n $ sb-mig language-publish-state --from 12345 --accessToken xxx --withSlug about-ef/testimonials --languages default,fr\n";
5
+ export declare const syncDescription = "\n USAGE\n $ sb-mig sync components [component-name ...] | --all [--presets] [--ssot] [--dry-run]\n $ sb-mig sync roles [role-name ...] | --all [--dry-run]\n $ sb-mig sync datasources [datasource-name ...] | --all [--dry-run]\n $ sb-mig sync plugins [plugin-name ...] [--dry-run]\n $ sb-mig sync content (--all | --stories | --assets) --from [spaceId] --to [spaceId-or-file] --syncDirection [direction]\n\n DESCRIPTION\n Synchronize components, roles, datasources, plugins, stories, and assets with Storyblok.\n\n COMMANDS\n components Sync local component schema files to Storyblok.\n roles Sync local role schema files to Storyblok.\n datasources Sync local datasource schema files to Storyblok.\n plugins Sync a provided plugin. Run from a plugin folder with ./dist/export.js.\n content Sync stories and/or assets between spaces, local files, or AWS content hub data.\n\n FLAGS\n --all Sync all supported resources for the selected command.\n --stories Sync only stories. [content only]\n --assets Sync only assets. [content only]\n --presets Also sync component presets and set default presets. [components only]\n --ssot Single Source of Truth mode. Removes GUI-only components and replaces them with code versions. [components only]\n --packageName External package name used when resolving provided components. [components only]\n --dry-run Preview planned changes without making writes. [components, roles, datasources, plugins, content]\n --yes Skip confirmation prompts. [components --ssot, destructive content sync]\n --from Source space ID or local story file name, depending on --syncDirection. [content only]\n --to Target space ID or local output file name, depending on --syncDirection. [content only]\n --syncDirection Sync direction. Values: fromSpaceToFile, fromFileToSpace, fromSpaceToSpace, fromAWSToSpace. [content only]\n\n SIDE EFFECTS\n components, roles, datasources, and plugins write to Storyblok unless --dry-run is passed.\n content with fromSpaceToSpace or fromFileToSpace can delete all target stories before recreating them.\n content with fromSpaceToFile writes local story and asset backup files.\n\n GOTCHAS\n --syncDirection is required for content sync.\n fromFileToSpace is implemented for stories, but assets log that it is not implemented.\n fromAWSToSpace is implemented for stories. Assets log that unsupported directions are not implemented.\n --ssot is destructive for components and prompts unless --yes is passed.\n\n EXAMPLES\n $ sb-mig sync components --all\n $ sb-mig sync components --all --dry-run\n $ sb-mig sync components --all --presets\n $ sb-mig sync components --all --ssot --yes\n $ sb-mig sync components accordion accordion-item --presets\n\n $ sb-mig sync roles --all\n $ sb-mig sync roles admin editor --dry-run\n\n $ sb-mig sync datasources --all\n $ sb-mig sync datasources countries cities --dry-run\n\n $ sb-mig sync plugins my-awesome-plugin\n\n $ sb-mig sync content --all --from 12345 --to 67890 --syncDirection fromSpaceToSpace --yes\n $ sb-mig sync content --stories --from 12345 --to all-stories-backup --syncDirection fromSpaceToFile\n $ sb-mig sync content --stories --from all-stories-backup --to 67890 --syncDirection fromFileToSpace --dry-run\n $ sb-mig sync content --stories --from 12345 --to 67890 --syncDirection fromAWSToSpace\n";
6
+ export declare const copyDescription = "\n USAGE\n $ sb-mig copy stories --sourceSpace [spaceId] --targetSpace [spaceId] --what [full_slug] --where [target_folder_full_slug]\n $ sb-mig copy stories --sourceSpace [spaceId] --targetSpace [spaceId] --what [folder_full_slug]\n $ sb-mig copy stories --sourceSpace [spaceId] --targetSpace [spaceId] --what [folder_full_slug]/* --where [target_folder_full_slug]\n\n DESCRIPTION\n Copy Storyblok stories or folders from one space to a folder in another space.\n\n COMMANDS\n stories Copy one story, one folder with its root, or a folder's children recursively.\n\n FLAGS\n --sourceSpace Source Storyblok space ID. Falls back to configured spaceId.\n --targetSpace Target Storyblok space ID. Falls back to configured spaceId.\n --what Source story or folder full_slug. Use folder/* to copy a folder's children without the folder root.\n --where Target folder full_slug where copied stories are attached.\n\n SIDE EFFECTS\n Writes copied stories into the target Storyblok space.\n\n GOTCHAS\n --what must resolve to an existing source story or folder.\n --where must resolve to an existing target folder.\n folder/* requires the source path before /* to be a folder.\n Copy currently logs internal strategy details while it runs.\n\n EXAMPLES\n $ sb-mig copy stories --sourceSpace 12345 --targetSpace 67890 --what blog/post-1 --where imported\n $ sb-mig copy stories --sourceSpace 12345 --targetSpace 67890 --what blog --where imported\n $ sb-mig copy stories --sourceSpace 12345 --targetSpace 67890 --what blog/* --where imported\n";
7
+ export declare const migrateDescription = "\n USAGE\n $ sb-mig migrate content [component-name ...] --from [spaceId] --to [spaceId] --migration [migration-config]\n $ sb-mig migrate content --all --from [spaceId] --to [spaceId] --migration [migration-config]\n $ sb-mig migrate presets --all --from [spaceId-or-file] --to [spaceId] --migration [migration-config]\n\n DESCRIPTION\n Migrate story content or presets using local migration config files.\n This is a potentially destructive command. It prompts for confirmation unless --yes or --dry-run is passed.\n\n COMMANDS\n content Migrate story content for all components or provided component names.\n presets Migrate presets. Supports --all and exactly one --migration value.\n\n FLAGS\n --from Source space ID, or local file name when --migrate-from file is used.\n --fromFilePath Direct path to stories or presets JSON when using --migrate-from file.\n --to Target Storyblok space ID.\n --migrate-from Migrate from space or file. Default: space.\n --migration Migration file name without extension. Can be repeated for ordered content pipelines. Presets support exactly one.\n --migrationComponentAlias\n Add extra component aliases for a migration. Repeatable. Format: <migration>:<source>=<alias1>,<alias2>.\n --migrationComponents\n Override the exact component scope for a migration. Repeatable. Format: <migration>:<component1>,<component2>.\n --withSlug Filter stories by full_slug. Can be repeated. [content only]\n --startsWith Filter stories by starts_with prefix. [content only]\n --yes Skip confirmation prompts.\n --dry-run Preview what would be migrated without making API changes.\n --publicationMode How migrate content should preserve Storyblok publication state. Values: preserve-layers, collapse-draft, save-only. Default: preserve-layers. [content only]\n --publicationLanguages\n Language scope to inspect and preserve when publicationMode publishes stories. Values: default, all, or comma-separated Storyblok language codes. Default: all. [content only]\n --languagePublishStatePath\n Optional JSON file generated by language-publish-state. When omitted, migrate builds the map automatically for selected stories. [content only]\n --fileName Stable base name for migration output files.\n\n SIDE EFFECTS\n content writes migrated stories to Storyblok unless --dry-run is passed.\n content creates a story backup before provided-component migrations unless --dry-run is passed.\n presets backs up all remote presets before writing migrated presets unless --dry-run is passed.\n\n GOTCHAS\n At least one --migration value is required.\n preserve-layers currently requires --migrate-from space and requires --from and --to to be the same Storyblok space.\n --publicationLanguages cannot be used with --publicationMode save-only.\n --languagePublishStatePath cannot be used with --publicationMode save-only.\n --publicationMode, --publicationLanguages, and --languagePublishStatePath are only supported for migrate content, not migrate presets.\n Legacy flags --publish, --publishLanguages, and --preservePublishedLayer are rejected. Use --publicationMode and --publicationLanguages instead.\n\n EXAMPLES\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --dry-run\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration migration-a --migration migration-b --migration migration-c --yes\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration colorPickerModeValues --migrationComponentAlias colorPickerModeValues:sb-button=sb-open-drift-button\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration colorPickerModeValues --migrationComponents colorPickerModeValues:sb-section,sb-tour-page-section\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --withSlug blog/home --withSlug docs/getting-started\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --startsWith blog/\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode preserve-layers --yes\n $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode collapse-draft --publicationLanguages default,fr,de --yes\n $ sb-mig migrate content --all --migrate-from file --from file-with-stories --to 12345 --migration file-with-migration\n $ sb-mig migrate content --all --migrate-from file --fromFilePath sbmig/migrations/dry-run--123---story-to-migrate.json --to 12345 --migration migration-a --migration migration-b\n $ sb-mig migrate content my-component-1 my-component-2 --from 12345 --to 12345 --migration file-with-migration\n $ sb-mig migrate presets --all --from 12345 --to 12345 --migration preset-migration --dry-run\n $ sb-mig migrate presets --all --migrate-from file --fromFilePath sbmig/presets/presets-backup.json --to 12345 --migration preset-migration\n";
8
+ export declare const revertDescription = "\n USAGE\n $ sb-mig revert content --from [stories-file-name] --to [spaceId] [--yes]\n\n DESCRIPTION\n Restore stories from a local story backup file into a Storyblok space.\n\n COMMANDS\n content Revert content by updating target stories from a local story backup.\n\n FLAGS\n --from Local story backup file name to discover and load.\n --to Target Storyblok space ID to update.\n --yes Skip confirmation prompt.\n\n SIDE EFFECTS\n Writes stories to the target Storyblok space.\n Creates a target-space story backup before restoring.\n Restored stories are updated with publish: false.\n\n GOTCHAS\n This command restores local story files directly and does not run migration configs.\n The --from value is resolved as a local story file name, not a source space ID.\n\n EXAMPLES\n $ sb-mig revert content --from 12345--backup-before-migration --to 12345\n $ sb-mig revert content --from prod-stories-backup --to 12345 --yes\n";
9
+ export declare const discoverDescription = "\n USAGE\n $ sb-mig discover components --all [--write] [--file file-name]\n $ sb-mig discover migrations --all\n\n DESCRIPTION\n Discover local and external component schema files or migration config files.\n\n COMMANDS\n components Discover component schema files.\n migrations Discover migration config files.\n\n FLAGS\n --all Discover all components or migration config files.\n --write Write discovered component names to a local file. [components only]\n --file Output file name when --write is passed. [components only]\n\n SIDE EFFECTS\n Read-only unless --write is passed.\n --write creates or overwrites a local component list file.\n\n EXAMPLES\n $ sb-mig discover components --all\n $ sb-mig discover components --all --write\n $ sb-mig discover components --all --write --file all-components\n $ sb-mig discover migrations --all\n";
10
+ export declare const migrationsDescription = "\n USAGE\n $ sb-mig migrations recognize --from [version] [--to version]\n\n DESCRIPTION\n Recognize migration commands to run for a package upgrade by comparing an old version with a target version.\n\n COMMANDS\n recognize Print recommended story and preset migration commands.\n\n FLAGS\n --from Previous package version. Required.\n --to Target package version. Optional. Falls back to the installed @ef-global/backpack dependency version.\n\n SIDE EFFECTS\n Reads local applied-backpack-migrations.json when present.\n Reads local package.json when --to is omitted.\n Does not write files or call Storyblok.\n\n EXAMPLES\n $ sb-mig migrations recognize --from 3.4.0\n $ sb-mig migrations recognize --from 3.4.0 --to 4.0.0\n";
11
+ export declare const removeDescription = "\n USAGE\n $ sb-mig remove components [component-name ...] | --all\n $ sb-mig remove story --all --from [spaceId]\n\n DESCRIPTION\n Remove components or all stories from a Storyblok space.\n\n COMMANDS\n components Remove all or provided components from Storyblok.\n story Remove all stories from a Storyblok space.\n roles Not implemented; currently logs a warning only.\n datasources Not implemented; currently logs a warning only.\n\n FLAGS\n --all Remove all resources for the selected command.\n --from Target space ID when removing stories. [story only]\n\n SIDE EFFECTS\n components writes deletes to Storyblok.\n story --all --from deletes all stories from the provided Storyblok space.\n\n GOTCHAS\n roles and datasources are currently no-op commands.\n story removal is destructive and does not prompt for confirmation.\n\n EXAMPLES\n $ sb-mig remove components --all\n $ sb-mig remove components accordion accordion-item\n $ sb-mig remove story --all --from 12345\n";
12
+ export declare const backupDescription = "\n USAGE\n $ sb-mig backup components [component-name] | --all\n $ sb-mig backup component-groups [group-name] | --all\n $ sb-mig backup roles [role-name] | --all\n $ sb-mig backup datasources [datasource-name] | --all\n $ sb-mig backup presets [preset-id] | --all\n $ sb-mig backup component-presets [component-name] | --all [--metadata]\n $ sb-mig backup plugins [plugin-name] | --all\n $ sb-mig backup stories --all\n\n DESCRIPTION\n Back up Storyblok resources to local JSON files.\n\n COMMANDS\n components Back up components.\n component-groups Back up component groups.\n roles Back up roles.\n datasources Back up datasources.\n presets Back up presets.\n component-presets Back up presets attached to components.\n plugins Back up plugins.\n stories Back up all stories from the configured space.\n\n FLAGS\n --all Back up all resources for the selected command.\n --metadata Include selected package.json metadata in component-presets --all output.\n\n SIDE EFFECTS\n Reads from Storyblok and writes local JSON backup files.\n\n EXAMPLES\n $ sb-mig backup components --all\n $ sb-mig backup components accordion\n $ sb-mig backup component-groups hero-group\n $ sb-mig backup datasources --all\n $ sb-mig backup roles admin\n $ sb-mig backup presets --all\n $ sb-mig backup component-presets accordion --metadata\n $ sb-mig backup plugins --all\n $ sb-mig backup plugins my-awesome-plugin\n $ sb-mig backup stories --all\n";
13
+ export declare const debugDescription = "\n USAGE\n $ sb-mig debug\n\n DESCRIPTION\n Output extra debugging information about resolved Storyblok config, sb-mig version, dependency versions, and package module type.\n\n SIDE EFFECTS\n Reads local config and package metadata. Does not call Storyblok.\n";
14
+ export declare const initDescription = "\n USAGE\n $ sb-mig init project --spaceId [spaceId] --oauthToken [token] --region [eu|us|cn] [--gtmToken token]\n\n DESCRIPTION\n Initialize project Storyblok environment settings.\n\n COMMANDS\n project Create a local .env file and update the Storyblok space preview domain.\n\n FLAGS\n --spaceId Storyblok space ID. Required.\n --oauthToken Storyblok Management API OAuth token. Required.\n --region Storyblok region. Values: eu, us, cn. Required.\n --gtmToken Optional Google Tag Manager token. Defaults to put-your-gtm-token-here.\n\n SIDE EFFECTS\n Writes a local .env file.\n Calls Storyblok Management API to read the space and update the space preview domain.\n\n EXAMPLES\n $ sb-mig init project --spaceId 12345 --oauthToken xxx --region eu\n $ sb-mig init project --spaceId 12345 --oauthToken xxx --region us --gtmToken GTM-XXXX\n";
@@ -1,320 +1,453 @@
1
1
  export const mainDescription = `
2
2
  USAGE
3
3
  $ sb-mig [command]
4
-
4
+
5
5
  COMMANDS
6
- sync Synchronize components, datasources, roles, stories, assets with Storyblok space.
7
- discover Discover components, migration configs and write to file or stdout.
8
- backup Command for backing up anything related to Storyblok
9
- migrate Migrate content from space to space, or from file to space.
10
- language-publish-state
11
- Build a read-only Storyblok story language publish-state map.
12
- story-versions
13
- Inspect raw Management API story version history for one story.
14
- published-layer-export
15
- Export draft/current and published story layers as JSON.
16
- debug Output extra debugging information
17
- help This screen
18
-
19
- Examples
6
+ sync Synchronize components, roles, datasources, plugins, stories, and assets.
7
+ copy Copy Storyblok stories or folders between spaces.
8
+ discover Discover local components and migration config files.
9
+ backup Back up Storyblok resources to local JSON files.
10
+ migrate Run story or preset data migrations.
11
+ language-publish-state Build a read-only story language publish-state map.
12
+ story-versions Inspect raw Management API story version history for one story.
13
+ published-layer-export Export draft/current and published story layers as JSON.
14
+ remove Remove components or stories from a Storyblok space.
15
+ revert Restore stories from a local story backup file.
16
+ migrations Recognize migration commands to run for a package upgrade.
17
+ init Initialize project Storyblok environment settings.
18
+ debug Output extra debugging information.
19
+ help Show this screen.
20
+
21
+ EXAMPLES
20
22
  $ sb-mig sync components --all
21
- $ sb-mig debug
23
+ $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --dry-run
24
+ $ sb-mig copy stories --sourceSpace 12345 --targetSpace 67890 --what folder/* --where target-folder
22
25
  `;
23
26
  export const storyVersionsDescription = `
24
- Usage
27
+ USAGE
25
28
  $ sb-mig story-versions --from [spaceId] --storyId [storyId]
26
29
  $ sb-mig story-versions --from [spaceId] --withSlug [full_slug]
27
30
 
28
- Description
31
+ DESCRIPTION
29
32
  Read Storyblok Management API story_versions for a single story.
30
33
  This command is read-only and is meant for inspecting version status values and content shape.
31
34
 
32
35
  FLAGS
33
- --from - Source space ID to inspect
34
- --storyId - Story ID to inspect
35
- --withSlug - Story full_slug to resolve to a story ID
36
- --showContent - Include version content from Storyblok. Default: true
37
- --page - Versions page. Default: 1
38
- --perPage - Versions per page. Default: 25
39
- --raw - Print the raw Storyblok API response instead of the compact summary
40
- --outputPath - Optional file path for JSON output
36
+ --from Source space ID to inspect. Required.
37
+ --storyId Story ID to inspect. Required unless --withSlug is passed.
38
+ --withSlug Story full_slug to resolve to a story ID. Required unless --storyId is passed.
39
+ --showContent Include version content from Storyblok. Default: true.
40
+ --page Versions page. Default: 1.
41
+ --perPage Versions per page. Default: 25.
42
+ --raw Print the raw Storyblok API response instead of the compact summary.
43
+ --outputPath Optional file path for JSON output.
44
+
45
+ SIDE EFFECTS
46
+ Read-only against Storyblok. Writes a local JSON file only when --outputPath is passed.
41
47
 
42
48
  EXAMPLES
43
49
  $ sb-mig story-versions --from 12345 --storyId 98765
44
50
  $ sb-mig story-versions --from 12345 --withSlug tours/europe --raw --outputPath sbmig/story-versions/tours-europe.raw.json
45
51
  `;
46
52
  export const publishedLayerExportDescription = `
47
- Usage
53
+ USAGE
48
54
  $ sb-mig published-layer-export --from [spaceId] --all
49
55
  $ sb-mig published-layer-export --from [spaceId] --storyId [storyId]
50
56
  $ sb-mig published-layer-export --from [spaceId] --withSlug [full_slug]
51
57
  $ sb-mig published-layer-export --from [spaceId] --startsWith [prefix]
52
58
 
53
- Description
59
+ DESCRIPTION
54
60
  Read selected Management API stories and their latest published Story Versions API content.
55
61
  This command is read-only against Storyblok. It writes JSON files for inspecting draft/current and published layers before changing migrate behavior.
56
62
 
57
63
  FLAGS
58
- --from - Source space ID to inspect
59
- --all - Export all non-folder stories
60
- --storyId - Story ID to export. Can be repeated.
61
- --withSlug - Exact story full_slug to export. Can be repeated.
62
- --startsWith - Filter stories by starts_with prefix
63
- --fileName - Stable output base name
64
- --outputPath - Output directory. Default: sbmig/published-layer-export
65
- --versionsPerPage - Story versions per page. Default: 25
66
- --maxVersionPages - Maximum Story Versions API pages to inspect per story. Default: 4
64
+ --from Source space ID to inspect. Required.
65
+ --all Export all non-folder stories.
66
+ --storyId Story ID to export. Can be repeated.
67
+ --withSlug Exact story full_slug to export. Can be repeated.
68
+ --startsWith Filter stories by starts_with prefix.
69
+ --fileName Stable output base name.
70
+ --outputPath Output directory. Default: sbmig/published-layer-export.
71
+ --versionsPerPage Story versions per page. Default: 25.
72
+ --maxVersionPages Maximum Story Versions API pages to inspect per story. Default: 4.
67
73
 
68
74
  OUTPUT
69
75
  <name>---draft-current-full.json
70
76
  <name>---published-layer-full.json
71
77
  <name>---dual-layer-summary.json
72
78
 
79
+ SIDE EFFECTS
80
+ Read-only against Storyblok. Always writes local JSON export files.
81
+
73
82
  EXAMPLES
74
83
  $ sb-mig published-layer-export --from 12345 --withSlug translation-migration-testing/test-1/contact-us
75
84
  $ sb-mig published-layer-export --from 12345 --storyId 178888427520390
76
85
  $ sb-mig published-layer-export --from 12345 --startsWith translation-migration-testing --fileName translation-test
77
86
  `;
78
87
  export const languagePublishStateDescription = `
79
- Usage
88
+ USAGE
80
89
  $ sb-mig language-publish-state --from [spaceId]
81
90
 
82
- Description
91
+ DESCRIPTION
83
92
  Read stories from a source Storyblok space and write a JSON map of default and translated language publication states.
84
93
  This command is read-only against Storyblok. It uses Management API for story listing and default-language state, and Delivery API for translated language published/draft comparisons.
85
94
 
86
95
  FLAGS
87
- --from - Source space ID to inspect
88
- --accessToken - Optional source space Delivery API access token override. Falls back to configured accessToken.
89
- --languages - Languages to inspect: all, default,fr,de. Default: all
90
- --withSlug - Exact story full_slug to inspect. Can be repeated.
91
- --startsWith - Filter stories by starts_with prefix
92
- --fileName - Stable output base name under sbmig/language-publish-state
93
- --outputPath - Explicit output path for the generated JSON file
96
+ --from Source space ID to inspect. Required.
97
+ --accessToken Optional source space Delivery API access token override. Falls back to configured accessToken.
98
+ --languages Languages to inspect: all, default,fr,de. Default: all.
99
+ --withSlug Exact story full_slug to inspect. Can be repeated.
100
+ --startsWith Filter stories by starts_with prefix.
101
+ --fileName Stable output base name under sbmig/language-publish-state.
102
+ --outputPath Explicit output path for the generated JSON file.
103
+
104
+ SIDE EFFECTS
105
+ Read-only against Storyblok. Writes a local JSON publish-state map.
94
106
 
95
107
  EXAMPLES
96
108
  $ sb-mig language-publish-state --from 12345 --startsWith about-ef --languages all --fileName about-ef-prod
97
109
  $ sb-mig language-publish-state --from 12345 --accessToken xxx --withSlug about-ef/testimonials --languages default,fr
98
110
  `;
99
111
  export const syncDescription = `
100
- Usage
101
- $ sb-mig sync [components|roles|datasources|plugins|content] [space separated file names] or --all
102
-
103
- Description
104
- Synchronize components, roles, datasources, plugins, content with Storyblok space.
105
-
112
+ USAGE
113
+ $ sb-mig sync components [component-name ...] | --all [--presets] [--ssot] [--dry-run]
114
+ $ sb-mig sync roles [role-name ...] | --all [--dry-run]
115
+ $ sb-mig sync datasources [datasource-name ...] | --all [--dry-run]
116
+ $ sb-mig sync plugins [plugin-name ...] [--dry-run]
117
+ $ sb-mig sync content (--all | --stories | --assets) --from [spaceId] --to [spaceId-or-file] --syncDirection [direction]
118
+
119
+ DESCRIPTION
120
+ Synchronize components, roles, datasources, plugins, stories, and assets with Storyblok.
121
+
106
122
  COMMANDS
107
- components - sync components
108
- roles - sync roles
109
- datasources - sync datasources
110
- plugins - sync plugins
111
- content - sync content (stories, assets) - ! right now destructive, it will move content from 1 space to another, completelly overwriting it
112
-
123
+ components Sync local component schema files to Storyblok.
124
+ roles Sync local role schema files to Storyblok.
125
+ datasources Sync local datasource schema files to Storyblok.
126
+ plugins Sync a provided plugin. Run from a plugin folder with ./dist/export.js.
127
+ content Sync stories and/or assets between spaces, local files, or AWS content hub data.
128
+
113
129
  FLAGS
114
- --all - Sync all components, roles, datasources [components, roles, datasources]
115
- --presets - Pass it, if u want to sync also with presets (will take longer) [components only]
116
- --dry-run - Preview planned changes without making writes [components, roles, datasources, plugins, content]
117
-
118
- --yes - Skip ask for confirmation (dangerous, but useful in CI/CD) [content only]
119
- --from - Space ID from which you want to sync content [content only]
120
- --to - Space ID to which you want to sync content [content only]
121
- --syncDirection [fromSpaceToFile|fromFileToSpace|fromSpaceToSpace|fromAWStoSpace]
122
- - Sync direction (from, to) [content only]
123
-
130
+ --all Sync all supported resources for the selected command.
131
+ --stories Sync only stories. [content only]
132
+ --assets Sync only assets. [content only]
133
+ --presets Also sync component presets and set default presets. [components only]
134
+ --ssot Single Source of Truth mode. Removes GUI-only components and replaces them with code versions. [components only]
135
+ --packageName External package name used when resolving provided components. [components only]
136
+ --dry-run Preview planned changes without making writes. [components, roles, datasources, plugins, content]
137
+ --yes Skip confirmation prompts. [components --ssot, destructive content sync]
138
+ --from Source space ID or local story file name, depending on --syncDirection. [content only]
139
+ --to Target space ID or local output file name, depending on --syncDirection. [content only]
140
+ --syncDirection Sync direction. Values: fromSpaceToFile, fromFileToSpace, fromSpaceToSpace, fromAWSToSpace. [content only]
141
+
142
+ SIDE EFFECTS
143
+ components, roles, datasources, and plugins write to Storyblok unless --dry-run is passed.
144
+ content with fromSpaceToSpace or fromFileToSpace can delete all target stories before recreating them.
145
+ content with fromSpaceToFile writes local story and asset backup files.
146
+
147
+ GOTCHAS
148
+ --syncDirection is required for content sync.
149
+ fromFileToSpace is implemented for stories, but assets log that it is not implemented.
150
+ fromAWSToSpace is implemented for stories. Assets log that unsupported directions are not implemented.
151
+ --ssot is destructive for components and prompts unless --yes is passed.
152
+
124
153
  EXAMPLES
125
154
  $ sb-mig sync components --all
126
155
  $ sb-mig sync components --all --dry-run
127
156
  $ sb-mig sync components --all --presets
128
- $ sb-mig sync components accordion accordion-item
157
+ $ sb-mig sync components --all --ssot --yes
129
158
  $ sb-mig sync components accordion accordion-item --presets
130
-
159
+
131
160
  $ sb-mig sync roles --all
132
- $ sb-mig sync roles --all --dry-run
133
-
161
+ $ sb-mig sync roles admin editor --dry-run
162
+
134
163
  $ sb-mig sync datasources --all
135
- $ sb-mig sync datasources --all --dry-run
136
-
137
- $ sb-mig sync plugins my-awesome-plugin - (you have to be in catalog which has ./dist/export.js file with compiled plugin)
138
-
139
- $ sb-mig sync content --all --from 12345 --to 12345
140
- $ sb-mig sync content --stories --from 12345 --to 12345
141
- $ sb-mig sync content --assets --from 12345 --to 12345
164
+ $ sb-mig sync datasources countries cities --dry-run
165
+
166
+ $ sb-mig sync plugins my-awesome-plugin
167
+
168
+ $ sb-mig sync content --all --from 12345 --to 67890 --syncDirection fromSpaceToSpace --yes
169
+ $ sb-mig sync content --stories --from 12345 --to all-stories-backup --syncDirection fromSpaceToFile
170
+ $ sb-mig sync content --stories --from all-stories-backup --to 67890 --syncDirection fromFileToSpace --dry-run
171
+ $ sb-mig sync content --stories --from 12345 --to 67890 --syncDirection fromAWSToSpace
142
172
  `;
143
173
  export const copyDescription = `
144
- Usage
145
- $ sb-mig copy
146
-
147
- Description
148
- Copy stuff
149
-
174
+ USAGE
175
+ $ sb-mig copy stories --sourceSpace [spaceId] --targetSpace [spaceId] --what [full_slug] --where [target_folder_full_slug]
176
+ $ sb-mig copy stories --sourceSpace [spaceId] --targetSpace [spaceId] --what [folder_full_slug]
177
+ $ sb-mig copy stories --sourceSpace [spaceId] --targetSpace [spaceId] --what [folder_full_slug]/* --where [target_folder_full_slug]
178
+
179
+ DESCRIPTION
180
+ Copy Storyblok stories or folders from one space to a folder in another space.
181
+
150
182
  COMMANDS
151
- ?
152
-
183
+ stories Copy one story, one folder with its root, or a folder's children recursively.
184
+
153
185
  FLAGS
154
- ?
155
-
186
+ --sourceSpace Source Storyblok space ID. Falls back to configured spaceId.
187
+ --targetSpace Target Storyblok space ID. Falls back to configured spaceId.
188
+ --what Source story or folder full_slug. Use folder/* to copy a folder's children without the folder root.
189
+ --where Target folder full_slug where copied stories are attached.
190
+
191
+ SIDE EFFECTS
192
+ Writes copied stories into the target Storyblok space.
193
+
194
+ GOTCHAS
195
+ --what must resolve to an existing source story or folder.
196
+ --where must resolve to an existing target folder.
197
+ folder/* requires the source path before /* to be a folder.
198
+ Copy currently logs internal strategy details while it runs.
199
+
156
200
  EXAMPLES
157
- $ sb-mig copy ?
201
+ $ sb-mig copy stories --sourceSpace 12345 --targetSpace 67890 --what blog/post-1 --where imported
202
+ $ sb-mig copy stories --sourceSpace 12345 --targetSpace 67890 --what blog --where imported
203
+ $ sb-mig copy stories --sourceSpace 12345 --targetSpace 67890 --what blog/* --where imported
158
204
  `;
159
205
  export const migrateDescription = `
160
- Usage
161
- $ sb-mig migrate [content] [space separated file names] or --all --from [spaceId] --to [spaceId] --migration [migration-config-filename]
162
- $ sb-mig migrate content --all --migration migration-a --migration migration-b --migration migration-c
163
-
164
- Description
165
- Migrate content from space to space, or from file to space. It's potentially dangerous command, so it will ask for confirmation.
166
- Use with care.
167
-
206
+ USAGE
207
+ $ sb-mig migrate content [component-name ...] --from [spaceId] --to [spaceId] --migration [migration-config]
208
+ $ sb-mig migrate content --all --from [spaceId] --to [spaceId] --migration [migration-config]
209
+ $ sb-mig migrate presets --all --from [spaceId-or-file] --to [spaceId] --migration [migration-config]
210
+
211
+ DESCRIPTION
212
+ Migrate story content or presets using local migration config files.
213
+ This is a potentially destructive command. It prompts for confirmation unless --yes or --dry-run is passed.
214
+
168
215
  COMMANDS
169
- content - migrate content
170
-
216
+ content Migrate story content for all components or provided component names.
217
+ presets Migrate presets. Supports --all and exactly one --migration value.
218
+
171
219
  FLAGS
172
- --from - Space ID from which you want to migrate / or file name if passed '--migrate-from file'
173
- --fromFilePath - Direct path to stories JSON file when using '--migrate-from file'
174
- --to - Space ID to which you want to migrate
175
- --migrate-from - Migrate from (space, file) default: space
176
- --migration - File name of migration file (without extension). Can be repeated for ordered pipeline in content migration.
177
- --migrationComponentAlias - Add extra component aliases for a migration. Repeatable. Format: <migration>:<source>=<alias1>,<alias2>
178
- --migrationComponents - Override the exact component scope for a migration. Repeatable. Format: <migration>:<component1>,<component2>
179
- --withSlug - Filter stories by full slug (can be repeated)
180
- --startsWith - Filter stories by starts_with prefix
181
- --yes - Skip ask for confirmation (dangerous, but useful in CI/CD)
182
- --dry-run - Preview what would be migrated without making any API changes
183
- --publicationMode - How migrate content should preserve Storyblok publication state. Values: preserve-layers, collapse-draft, save-only. Default: preserve-layers. [content only]
184
- --publicationLanguages - Language scope to inspect and preserve when publicationMode publishes stories. Values: default, all, or comma-separated Storyblok language codes. Default: all. [content only]
185
- --languagePublishStatePath - Optional JSON file generated by 'language-publish-state'. When omitted, migrate builds the language publish-state map automatically for the selected stories. [content only]
186
- --fileName - Stable base name for migration output files (disables timestamp suffix for migration artifacts)
220
+ --from Source space ID, or local file name when --migrate-from file is used.
221
+ --fromFilePath Direct path to stories or presets JSON when using --migrate-from file.
222
+ --to Target Storyblok space ID.
223
+ --migrate-from Migrate from space or file. Default: space.
224
+ --migration Migration file name without extension. Can be repeated for ordered content pipelines. Presets support exactly one.
225
+ --migrationComponentAlias
226
+ Add extra component aliases for a migration. Repeatable. Format: <migration>:<source>=<alias1>,<alias2>.
227
+ --migrationComponents
228
+ Override the exact component scope for a migration. Repeatable. Format: <migration>:<component1>,<component2>.
229
+ --withSlug Filter stories by full_slug. Can be repeated. [content only]
230
+ --startsWith Filter stories by starts_with prefix. [content only]
231
+ --yes Skip confirmation prompts.
232
+ --dry-run Preview what would be migrated without making API changes.
233
+ --publicationMode How migrate content should preserve Storyblok publication state. Values: preserve-layers, collapse-draft, save-only. Default: preserve-layers. [content only]
234
+ --publicationLanguages
235
+ Language scope to inspect and preserve when publicationMode publishes stories. Values: default, all, or comma-separated Storyblok language codes. Default: all. [content only]
236
+ --languagePublishStatePath
237
+ Optional JSON file generated by language-publish-state. When omitted, migrate builds the map automatically for selected stories. [content only]
238
+ --fileName Stable base name for migration output files.
239
+
240
+ SIDE EFFECTS
241
+ content writes migrated stories to Storyblok unless --dry-run is passed.
242
+ content creates a story backup before provided-component migrations unless --dry-run is passed.
243
+ presets backs up all remote presets before writing migrated presets unless --dry-run is passed.
244
+
245
+ GOTCHAS
246
+ At least one --migration value is required.
247
+ preserve-layers currently requires --migrate-from space and requires --from and --to to be the same Storyblok space.
248
+ --publicationLanguages cannot be used with --publicationMode save-only.
249
+ --languagePublishStatePath cannot be used with --publicationMode save-only.
250
+ --publicationMode, --publicationLanguages, and --languagePublishStatePath are only supported for migrate content, not migrate presets.
251
+ Legacy flags --publish, --publishLanguages, and --preservePublishedLayer are rejected. Use --publicationMode and --publicationLanguages instead.
187
252
 
188
253
  EXAMPLES
189
- $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration
190
- $ sb-mig migrate content --all --from 12345 --to 12345 --migration migration-a --migration migration-b --migration migration-c
254
+ $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --dry-run
255
+ $ sb-mig migrate content --all --from 12345 --to 12345 --migration migration-a --migration migration-b --migration migration-c --yes
191
256
  $ sb-mig migrate content --all --from 12345 --to 12345 --migration colorPickerModeValues --migrationComponentAlias colorPickerModeValues:sb-button=sb-open-drift-button
192
- $ sb-mig migrate content --all --from 12345 --to 12345 --migration colorPickerModeValues --migrationComponentAlias colorPickerModeValues:sb-section=sb-tour-page-section --migrationComponents colorPickerModeValues:sb-section,sb-tour-page-section
257
+ $ sb-mig migrate content --all --from 12345 --to 12345 --migration colorPickerModeValues --migrationComponents colorPickerModeValues:sb-section,sb-tour-page-section
193
258
  $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --withSlug blog/home --withSlug docs/getting-started
194
259
  $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --startsWith blog/
195
260
  $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode preserve-layers --yes
196
- $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode collapse-draft --publicationLanguages all --yes
197
- $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode preserve-layers --publicationLanguages all --dry-run
198
- $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode preserve-layers --publicationLanguages all --languagePublishStatePath sbmig/language-publish-state/prod-language-state.json --yes
199
261
  $ sb-mig migrate content --all --from 12345 --to 12345 --migration file-with-migration --publicationMode collapse-draft --publicationLanguages default,fr,de --yes
200
- $ sb-mig migrate content --all --from 12345 --to 12345 --migration v3toV4AllMigrations --dry-run --fileName brand-hub-v3-v4-run
201
262
  $ sb-mig migrate content --all --migrate-from file --from file-with-stories --to 12345 --migration file-with-migration
202
- $ sb-mig migrate content --all --migrate-from file --fromFilePath sbmig/migrations/dry-run--123---story-to-migrate__2026-2-9_20-51.json --to 12345 --migration migration-a --migration migration-b
263
+ $ sb-mig migrate content --all --migrate-from file --fromFilePath sbmig/migrations/dry-run--123---story-to-migrate.json --to 12345 --migration migration-a --migration migration-b
203
264
  $ sb-mig migrate content my-component-1 my-component-2 --from 12345 --to 12345 --migration file-with-migration
204
- $ sb-mig migrate content my-component-1 my-component-2 --migrate-from file --from file-with-stories --to 12345 --migration file-with-migration
265
+ $ sb-mig migrate presets --all --from 12345 --to 12345 --migration preset-migration --dry-run
266
+ $ sb-mig migrate presets --all --migrate-from file --fromFilePath sbmig/presets/presets-backup.json --to 12345 --migration preset-migration
205
267
  `;
206
268
  export const revertDescription = `
207
- Usage
208
- $ sb-mig revert [content] --migration
209
-
210
- Description
211
- Revert content migration
212
-
269
+ USAGE
270
+ $ sb-mig revert content --from [stories-file-name] --to [spaceId] [--yes]
271
+
272
+ DESCRIPTION
273
+ Restore stories from a local story backup file into a Storyblok space.
274
+
213
275
  COMMANDS
214
- content - revert content migration
215
-
276
+ content Revert content by updating target stories from a local story backup.
277
+
216
278
  FLAGS
217
- --migration - ???
218
- --yes - Skip ask for confirmation (dangerous, but useful in CI/CD)
219
-
279
+ --from Local story backup file name to discover and load.
280
+ --to Target Storyblok space ID to update.
281
+ --yes Skip confirmation prompt.
282
+
283
+ SIDE EFFECTS
284
+ Writes stories to the target Storyblok space.
285
+ Creates a target-space story backup before restoring.
286
+ Restored stories are updated with publish: false.
287
+
288
+ GOTCHAS
289
+ This command restores local story files directly and does not run migration configs.
290
+ The --from value is resolved as a local story file name, not a source space ID.
291
+
220
292
  EXAMPLES
221
- $ sb-mig revert content --migration
293
+ $ sb-mig revert content --from 12345--backup-before-migration --to 12345
294
+ $ sb-mig revert content --from prod-stories-backup --to 12345 --yes
222
295
  `;
223
296
  export const discoverDescription = `
224
- Usage
225
- $ sb-mig discover [components|migrations] --all --write
297
+ USAGE
298
+ $ sb-mig discover components --all [--write] [--file file-name]
299
+ $ sb-mig discover migrations --all
226
300
 
227
- Description
228
- Discover all components or migration configs and write to file or stdout
301
+ DESCRIPTION
302
+ Discover local and external component schema files or migration config files.
229
303
 
230
304
  COMMANDS
231
- components - discover components
232
- migrations - discover migration config files
305
+ components Discover component schema files.
306
+ migrations Discover migration config files.
233
307
 
234
308
  FLAGS
235
- --all - Discover all components or migration configs
236
- --write - Write to file
309
+ --all Discover all components or migration config files.
310
+ --write Write discovered component names to a local file. [components only]
311
+ --file Output file name when --write is passed. [components only]
312
+
313
+ SIDE EFFECTS
314
+ Read-only unless --write is passed.
315
+ --write creates or overwrites a local component list file.
237
316
 
238
317
  EXAMPLES
239
318
  $ sb-mig discover components --all
240
319
  $ sb-mig discover components --all --write
320
+ $ sb-mig discover components --all --write --file all-components
241
321
  $ sb-mig discover migrations --all
242
322
  `;
243
323
  export const migrationsDescription = `
244
- Usage
245
- $ sb-mig migrations recognize
246
-
247
- Description
248
- Recognize migrations you need to apply
249
-
324
+ USAGE
325
+ $ sb-mig migrations recognize --from [version] [--to version]
326
+
327
+ DESCRIPTION
328
+ Recognize migration commands to run for a package upgrade by comparing an old version with a target version.
329
+
250
330
  COMMANDS
251
- recognize - recognize migrations
252
-
253
- FLAGS
254
-
255
- EXAMPLES
256
- $ sb-mig migrations recognize
331
+ recognize Print recommended story and preset migration commands.
332
+
333
+ FLAGS
334
+ --from Previous package version. Required.
335
+ --to Target package version. Optional. Falls back to the installed @ef-global/backpack dependency version.
257
336
 
337
+ SIDE EFFECTS
338
+ Reads local applied-backpack-migrations.json when present.
339
+ Reads local package.json when --to is omitted.
340
+ Does not write files or call Storyblok.
341
+
342
+ EXAMPLES
343
+ $ sb-mig migrations recognize --from 3.4.0
344
+ $ sb-mig migrations recognize --from 3.4.0 --to 4.0.0
258
345
  `;
259
346
  export const removeDescription = `
260
- Usage
261
- $ sb-mig remove [components|roles|datasources] [space separated file names] or --all
262
-
263
- Description
264
- Remove components or roles with Storyblok space.
265
-
347
+ USAGE
348
+ $ sb-mig remove components [component-name ...] | --all
349
+ $ sb-mig remove story --all --from [spaceId]
350
+
351
+ DESCRIPTION
352
+ Remove components or all stories from a Storyblok space.
353
+
266
354
  COMMANDS
267
- components - remove components
268
- roles - remove roles
269
- datasources - remove datasources
270
-
355
+ components Remove all or provided components from Storyblok.
356
+ story Remove all stories from a Storyblok space.
357
+ roles Not implemented; currently logs a warning only.
358
+ datasources Not implemented; currently logs a warning only.
359
+
271
360
  FLAGS
272
- --all - Remove all components
273
-
361
+ --all Remove all resources for the selected command.
362
+ --from Target space ID when removing stories. [story only]
363
+
364
+ SIDE EFFECTS
365
+ components writes deletes to Storyblok.
366
+ story --all --from deletes all stories from the provided Storyblok space.
367
+
368
+ GOTCHAS
369
+ roles and datasources are currently no-op commands.
370
+ story removal is destructive and does not prompt for confirmation.
371
+
274
372
  EXAMPLES
275
373
  $ sb-mig remove components --all
276
374
  $ sb-mig remove components accordion accordion-item
277
- $ sb-mig remove roles --all
278
- $ sb-mig remove datasources --all
375
+ $ sb-mig remove story --all --from 12345
279
376
  `;
280
377
  export const backupDescription = `
281
- Usage
282
- $ sb-mig backup [components|component-groups|roles|datasources|presets|component-presets] component-name or --all
283
- Description
284
- Command for backing up anything related to Storyblok
285
-
378
+ USAGE
379
+ $ sb-mig backup components [component-name] | --all
380
+ $ sb-mig backup component-groups [group-name] | --all
381
+ $ sb-mig backup roles [role-name] | --all
382
+ $ sb-mig backup datasources [datasource-name] | --all
383
+ $ sb-mig backup presets [preset-id] | --all
384
+ $ sb-mig backup component-presets [component-name] | --all [--metadata]
385
+ $ sb-mig backup plugins [plugin-name] | --all
386
+ $ sb-mig backup stories --all
387
+
388
+ DESCRIPTION
389
+ Back up Storyblok resources to local JSON files.
390
+
286
391
  COMMANDS
287
- components - backup components
288
- component-groups - backup component-groups
289
- roles - backup components
290
- datasources - backup components
291
- presets - backup presets
292
- component-presets - backup component presets
293
- plugins - backup plugins
294
- stories - backup stories (only --all)
295
-
296
-
392
+ components Back up components.
393
+ component-groups Back up component groups.
394
+ roles Back up roles.
395
+ datasources Back up datasources.
396
+ presets Back up presets.
397
+ component-presets Back up presets attached to components.
398
+ plugins Back up plugins.
399
+ stories Back up all stories from the configured space.
400
+
297
401
  FLAGS
298
- --all - Backup all
299
-
402
+ --all Back up all resources for the selected command.
403
+ --metadata Include selected package.json metadata in component-presets --all output.
404
+
405
+ SIDE EFFECTS
406
+ Reads from Storyblok and writes local JSON backup files.
407
+
300
408
  EXAMPLES
301
409
  $ sb-mig backup components --all
302
- $ sb-mig backup components accordion
410
+ $ sb-mig backup components accordion
411
+ $ sb-mig backup component-groups hero-group
303
412
  $ sb-mig backup datasources --all
304
413
  $ sb-mig backup roles admin
414
+ $ sb-mig backup presets --all
415
+ $ sb-mig backup component-presets accordion --metadata
305
416
  $ sb-mig backup plugins --all
306
417
  $ sb-mig backup plugins my-awesome-plugin
307
418
  $ sb-mig backup stories --all
308
419
  `;
309
420
  export const debugDescription = `
310
- Usage
421
+ USAGE
311
422
  $ sb-mig debug
312
- Description
313
- Output extra debugging information
423
+
424
+ DESCRIPTION
425
+ Output extra debugging information about resolved Storyblok config, sb-mig version, dependency versions, and package module type.
426
+
427
+ SIDE EFFECTS
428
+ Reads local config and package metadata. Does not call Storyblok.
314
429
  `;
315
430
  export const initDescription = `
316
- Usage
317
- $ sb-mig init
318
- Description
319
- Init and update your project
431
+ USAGE
432
+ $ sb-mig init project --spaceId [spaceId] --oauthToken [token] --region [eu|us|cn] [--gtmToken token]
433
+
434
+ DESCRIPTION
435
+ Initialize project Storyblok environment settings.
436
+
437
+ COMMANDS
438
+ project Create a local .env file and update the Storyblok space preview domain.
439
+
440
+ FLAGS
441
+ --spaceId Storyblok space ID. Required.
442
+ --oauthToken Storyblok Management API OAuth token. Required.
443
+ --region Storyblok region. Values: eu, us, cn. Required.
444
+ --gtmToken Optional Google Tag Manager token. Defaults to put-your-gtm-token-here.
445
+
446
+ SIDE EFFECTS
447
+ Writes a local .env file.
448
+ Calls Storyblok Management API to read the space and update the space preview domain.
449
+
450
+ EXAMPLES
451
+ $ sb-mig init project --spaceId 12345 --oauthToken xxx --region eu
452
+ $ sb-mig init project --spaceId 12345 --oauthToken xxx --region us --gtmToken GTM-XXXX
320
453
  `;
package/dist/cli/index.js CHANGED
@@ -1,35 +1,22 @@
1
1
  #! /usr/bin/env node
2
2
  import meow from "meow";
3
3
  import { backupDescription, debugDescription, mainDescription, syncDescription, removeDescription, initDescription, discoverDescription, migrateDescription, languagePublishStateDescription, storyVersionsDescription, publishedLayerExportDescription, revertDescription, migrationsDescription, copyDescription, } from "./cli-descriptions.js";
4
- import { backup } from "./commands/backup.js";
5
- import { copyCommand } from "./commands/copy.js";
6
- import { debug } from "./commands/debug.js";
7
- import { discover } from "./commands/discover.js";
8
- import { init } from "./commands/init.js";
9
- import { languagePublishState } from "./commands/language-publish-state.js";
10
- import { migrate } from "./commands/migrate.js";
11
- import { migrations } from "./commands/migrations.js";
12
- import { publishedLayerExport } from "./commands/published-layer-export.js";
13
- import { remove } from "./commands/remove.js";
14
- import { revert } from "./commands/revert.js";
15
- import { storyVersions } from "./commands/story-versions.js";
16
- import { sync } from "./commands/sync.js";
17
- import { testCommand } from "./commands/test.js";
18
4
  import { pipe, prop } from "./utils/cli-utils.js";
19
5
  const app = () => ({
20
6
  cli: meow(mainDescription, {
21
7
  importMeta: import.meta,
22
8
  booleanDefault: undefined,
23
9
  }),
24
- action: (cli) => cli.showHelp(),
10
+ action: (cli) => cli.showHelp(0),
25
11
  });
26
12
  app.sync = () => ({
27
13
  cli: meow(syncDescription, {
28
14
  importMeta: import.meta,
29
15
  booleanDefault: undefined,
30
16
  }),
31
- action: (cli) => {
32
- sync(cli);
17
+ action: async (cli) => {
18
+ const { sync } = await import("./commands/sync.js");
19
+ await sync(cli);
33
20
  },
34
21
  });
35
22
  app.copy = () => ({
@@ -37,8 +24,9 @@ app.copy = () => ({
37
24
  importMeta: import.meta,
38
25
  booleanDefault: undefined,
39
26
  }),
40
- action: (cli) => {
41
- copyCommand(cli);
27
+ action: async (cli) => {
28
+ const { copyCommand } = await import("./commands/copy.js");
29
+ await copyCommand(cli);
42
30
  },
43
31
  });
44
32
  app.migrate = () => ({
@@ -97,8 +85,9 @@ app.migrate = () => ({
97
85
  },
98
86
  },
99
87
  }),
100
- action: (cli) => {
101
- migrate(cli);
88
+ action: async (cli) => {
89
+ const { migrate } = await import("./commands/migrate.js");
90
+ await migrate(cli);
102
91
  },
103
92
  });
104
93
  app["language-publish-state"] = () => ({
@@ -131,7 +120,10 @@ app["language-publish-state"] = () => ({
131
120
  },
132
121
  },
133
122
  }),
134
- action: (cli) => languagePublishState(cli),
123
+ action: async (cli) => {
124
+ const { languagePublishState } = await import("./commands/language-publish-state.js");
125
+ await languagePublishState(cli);
126
+ },
135
127
  });
136
128
  app["story-versions"] = () => ({
137
129
  cli: meow(storyVersionsDescription, {
@@ -168,7 +160,10 @@ app["story-versions"] = () => ({
168
160
  },
169
161
  },
170
162
  }),
171
- action: (cli) => storyVersions(cli),
163
+ action: async (cli) => {
164
+ const { storyVersions } = await import("./commands/story-versions.js");
165
+ await storyVersions(cli);
166
+ },
172
167
  });
173
168
  app["published-layer-export"] = () => ({
174
169
  cli: meow(publishedLayerExportDescription, {
@@ -209,15 +204,19 @@ app["published-layer-export"] = () => ({
209
204
  },
210
205
  },
211
206
  }),
212
- action: (cli) => publishedLayerExport(cli),
207
+ action: async (cli) => {
208
+ const { publishedLayerExport } = await import("./commands/published-layer-export.js");
209
+ await publishedLayerExport(cli);
210
+ },
213
211
  });
214
212
  app.revert = () => ({
215
213
  cli: meow(revertDescription, {
216
214
  importMeta: import.meta,
217
215
  booleanDefault: undefined,
218
216
  }),
219
- action: (cli) => {
220
- revert(cli);
217
+ action: async (cli) => {
218
+ const { revert } = await import("./commands/revert.js");
219
+ await revert(cli);
221
220
  },
222
221
  });
223
222
  app.discover = () => ({
@@ -225,8 +224,9 @@ app.discover = () => ({
225
224
  importMeta: import.meta,
226
225
  booleanDefault: undefined,
227
226
  }),
228
- action: (cli) => {
229
- discover(cli);
227
+ action: async (cli) => {
228
+ const { discover } = await import("./commands/discover.js");
229
+ await discover(cli);
230
230
  },
231
231
  });
232
232
  app.migrations = () => ({
@@ -234,8 +234,9 @@ app.migrations = () => ({
234
234
  importMeta: import.meta,
235
235
  booleanDefault: undefined,
236
236
  }),
237
- action: (cli) => {
238
- migrations(cli);
237
+ action: async (cli) => {
238
+ const { migrations } = await import("./commands/migrations.js");
239
+ await migrations(cli);
239
240
  },
240
241
  });
241
242
  app.remove = () => ({
@@ -243,8 +244,9 @@ app.remove = () => ({
243
244
  importMeta: import.meta,
244
245
  booleanDefault: undefined,
245
246
  }),
246
- action: (cli) => {
247
- remove(cli);
247
+ action: async (cli) => {
248
+ const { remove } = await import("./commands/remove.js");
249
+ await remove(cli);
248
250
  },
249
251
  });
250
252
  app.backup = () => ({
@@ -252,8 +254,9 @@ app.backup = () => ({
252
254
  importMeta: import.meta,
253
255
  booleanDefault: undefined,
254
256
  }),
255
- action: (cli) => {
256
- backup(cli);
257
+ action: async (cli) => {
258
+ const { backup } = await import("./commands/backup.js");
259
+ await backup(cli);
257
260
  },
258
261
  });
259
262
  app.debug = () => ({
@@ -261,8 +264,9 @@ app.debug = () => ({
261
264
  importMeta: import.meta,
262
265
  booleanDefault: undefined,
263
266
  }),
264
- action: () => {
265
- debug();
267
+ action: async () => {
268
+ const { debug } = await import("./commands/debug.js");
269
+ await debug();
266
270
  },
267
271
  });
268
272
  app.init = () => ({
@@ -270,8 +274,9 @@ app.init = () => ({
270
274
  importMeta: import.meta,
271
275
  booleanDefault: undefined,
272
276
  }),
273
- action: (cli) => {
274
- init(cli);
277
+ action: async (cli) => {
278
+ const { init } = await import("./commands/init.js");
279
+ await init(cli);
275
280
  },
276
281
  });
277
282
  app.test = () => ({
@@ -279,18 +284,19 @@ app.test = () => ({
279
284
  importMeta: import.meta,
280
285
  booleanDefault: undefined,
281
286
  }),
282
- action: (cli) => {
283
- testCommand(cli);
287
+ action: async (cli) => {
288
+ const { testCommand } = await import("./commands/test.js");
289
+ await testCommand(cli);
284
290
  },
285
291
  });
286
292
  const getSubcommand = (cliObject, level) => pipe(prop("input"), prop(level), (name) => prop(name)(cliObject))(prop("cli")(cliObject()));
287
- const cli = (cliObject, level = 0) => {
293
+ const cli = async (cliObject, level = 0) => {
288
294
  const { cli: nextCli, action } = cliObject();
289
295
  const subCommand = getSubcommand(cliObject, level);
290
296
  return subCommand
291
- ? cli(subCommand, level + 1)
297
+ ? await cli(subCommand, level + 1)
292
298
  : nextCli.flags.help
293
- ? nextCli.showHelp()
294
- : action(nextCli);
299
+ ? nextCli.showHelp(0)
300
+ : await action(nextCli);
295
301
  };
296
- cli(app);
302
+ await cli(app);
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import dotenv from "dotenv";
3
3
  import { pkg } from "../utils/pkg.js";
4
4
  import { defaultConfig, getStoryblokConfigContent, SCHEMA } from "./helper.js";
5
- dotenv.config();
5
+ dotenv.config({ quiet: true });
6
6
  export { SCHEMA };
7
7
  const filePath = path.resolve(process.cwd(), "storyblok.config");
8
8
  const customConfig = await getStoryblokConfigContent({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sb-mig",
3
- "version": "6.1.0-beta.3",
3
+ "version": "6.1.1-beta.1",
4
4
  "description": "CLI to rule the world. (and handle stuff related to Storyblok CMS)",
5
5
  "author": "Marcin Krawczyk <marckraw@icloud.com>",
6
6
  "license": "MIT",