@jungvonmatt/contentful-migrations 6.2.5 → 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/cli.js CHANGED
@@ -2,19 +2,37 @@
2
2
 
3
3
  /* eslint-disable no-console */
4
4
  /* eslint-env node */
5
- const fs = require('fs-extra');
6
- const path = require('path');
7
- const pc = require('picocolors');
8
- const { Command } = require('commander');
5
+ const fs = require("fs-extra");
6
+ const path = require("path");
7
+ const pc = require("picocolors");
8
+ const { Command } = require("commander");
9
9
 
10
- const { initializeContentModel, migrateToContentStorage, migrateToTagStorage } = require('./lib/backend');
11
- const { createMigration, runMigrations, fetchMigration, executeMigration } = require('./lib/migration');
12
- const { versionDelete, versionAdd } = require('./lib/version');
13
- const { transferContent } = require('./lib/content');
14
- const { createOfflineDocs } = require('./lib/doc');
15
- const { createEnvironment, removeEnvironment, resetEnvironment } = require('./lib/environment');
16
- const { getConfig, confirm, STORAGE_CONTENT, STORAGE_TAG } = require('./lib/config');
17
- const pkg = require('./package.json');
10
+ const {
11
+ initializeContentModel,
12
+ migrateToContentStorage,
13
+ migrateToTagStorage,
14
+ } = require("./lib/backend");
15
+ const {
16
+ createMigration,
17
+ runMigrations,
18
+ fetchMigration,
19
+ executeMigration,
20
+ } = require("./lib/migration");
21
+ const { versionDelete, versionAdd } = require("./lib/version");
22
+ const { transferContent } = require("./lib/content");
23
+ const { createOfflineDocs } = require("./lib/doc");
24
+ const {
25
+ createEnvironment,
26
+ removeEnvironment,
27
+ resetEnvironment,
28
+ } = require("./lib/environment");
29
+ const {
30
+ getConfig,
31
+ confirm,
32
+ STORAGE_CONTENT,
33
+ STORAGE_TAG,
34
+ } = require("./lib/config");
35
+ const pkg = require("./package.json");
18
36
 
19
37
  const parseArgs = (cmd) => {
20
38
  const { parent = {} } = cmd || {};
@@ -37,9 +55,9 @@ const parseArgs = (cmd) => {
37
55
  const errorHandler = (error, log) => {
38
56
  if (log) {
39
57
  const { errors, message } = error;
40
- console.error(pc.red('\nError:'), message);
58
+ console.error(pc.red("\nError:"), message);
41
59
  (errors || []).forEach((err) => {
42
- console.error(pc.red('Error:'), err.message);
60
+ console.error(pc.red("Error:"), err.message);
43
61
  });
44
62
  }
45
63
  process.exit(1);
@@ -56,28 +74,31 @@ const program = new Command();
56
74
 
57
75
  program.version(pkg.version);
58
76
  program
59
- .command('init')
60
- .option('-s, --space-id <space-id>', 'Contentful space id')
61
- .option('--host <host>', 'Management API host')
62
- .option('--config <path/to/config>', 'Config file path (disables auto detect)')
63
- .option('--cwd <directory>', 'Working directory. Defaults to process.cwd()')
64
- .description('Initialize contentful-migrations')
77
+ .command("init")
78
+ .option("-s, --space-id <space-id>", "Contentful space id")
79
+ .option("--host <host>", "Management API host")
80
+ .option(
81
+ "--config <path/to/config>",
82
+ "Config file path (disables auto detect)",
83
+ )
84
+ .option("--cwd <directory>", "Working directory. Defaults to process.cwd()")
85
+ .description("Initialize contentful-migrations")
65
86
  .action(
66
87
  actionRunner(async (cmd) => {
67
88
  const config = await getConfig(
68
89
  parseArgs(cmd || {}),
69
90
  [],
70
91
  [
71
- 'managementToken',
72
- 'host',
73
- 'organizationId',
74
- 'spaceId',
75
- 'environmentId',
76
- 'storage',
77
- 'fieldId',
78
- 'migrationContentTypeId',
79
- 'directory',
80
- ]
92
+ "managementToken",
93
+ "host",
94
+ "organizationId",
95
+ "spaceId",
96
+ "environmentId",
97
+ "storage",
98
+ "fieldId",
99
+ "migrationContentTypeId",
100
+ "directory",
101
+ ],
81
102
  );
82
103
 
83
104
  if (config.storage === STORAGE_CONTENT) {
@@ -88,12 +109,22 @@ program
88
109
  await migrateToTagStorage(config);
89
110
  }
90
111
 
91
- const storeConfig = await confirm({ message: 'Do you want to store the configuration?' });
112
+ const storeConfig = await confirm({
113
+ message: "Do you want to store the configuration?",
114
+ });
92
115
 
93
116
  if (storeConfig) {
94
117
  // only store relevant config values without management token
95
118
  // management token should not be stored inside the project
96
- const { host, spaceId, environmentId, storage, fieldId, migrationContentTypeId, directory } = config;
119
+ const {
120
+ host,
121
+ spaceId,
122
+ environmentId,
123
+ storage,
124
+ fieldId,
125
+ migrationContentTypeId,
126
+ directory,
127
+ } = config;
97
128
 
98
129
  const data = {
99
130
  host,
@@ -101,200 +132,275 @@ program
101
132
  environmentId,
102
133
  directory,
103
134
  storage,
104
- ...(storage === STORAGE_CONTENT ? { migrationContentTypeId } : { fieldId }),
135
+ ...(storage === STORAGE_CONTENT
136
+ ? { migrationContentTypeId }
137
+ : { fieldId }),
105
138
  };
106
139
 
107
140
  // try to store in package.json
108
- const { pkgUp } = await import('pkg-up');
109
- const localPkg = await pkgUp();
141
+ const { packageUp } = await import("package-up");
142
+ const localPkg = await packageUp();
110
143
  if (localPkg) {
111
144
  const packageJson = await fs.readJson(localPkg);
112
- data.directory = path.relative(path.dirname(localPkg), data.directory);
145
+ data.directory = path.relative(
146
+ path.dirname(localPkg),
147
+ data.directory,
148
+ );
113
149
  packageJson.migrations = data;
114
150
  await fs.outputJson(localPkg, packageJson, { spaces: 2 });
115
151
  } else {
116
152
  // store in .migrationsrc if no package.json is available
117
153
  const cwd = cmd.cwd ? path.resolve(cmd.cwd) : process.cwd();
118
154
  data.directory = path.relative(cwd, data.directory);
119
- await fs.outputJson(path.join(cwd, '.migrationsrc.json'), data, { spaces: 2 });
155
+ await fs.outputJson(path.join(cwd, ".migrationsrc.json"), data, {
156
+ spaces: 2,
157
+ });
120
158
  }
121
159
  }
122
- })
160
+ }),
123
161
  );
124
162
 
125
163
  program
126
- .command('fetch')
127
- .option('-s, --space-id <space-id>', 'Contentful space id')
128
- .option('-e, --environment-id <environment-id>', 'Change the Contentful environment')
129
- .option('-c, --content-type <content-type...>', 'Specify content-types')
130
- .option('-p, --path <path/to/migrations>', 'Change the path where the migrations are saved')
131
- .option('-v, --verbose', 'Verbosity')
132
- .option('--host <host>', 'Management API host')
133
- .option('--config <path/to/config>', 'Config file path (disables auto detect)')
134
- .option('--cwd <directory>', 'Working directory. Defaults to process.cwd()')
135
- .description('Generate a new Contentful migration from content type')
164
+ .command("fetch")
165
+ .option("-s, --space-id <space-id>", "Contentful space id")
166
+ .option(
167
+ "-e, --environment-id <environment-id>",
168
+ "Change the Contentful environment",
169
+ )
170
+ .option("-c, --content-type <content-type...>", "Specify content-types")
171
+ .option(
172
+ "-p, --path <path/to/migrations>",
173
+ "Change the path where the migrations are saved",
174
+ )
175
+ .option("-v, --verbose", "Verbosity")
176
+ .option("--host <host>", "Management API host")
177
+ .option(
178
+ "--config <path/to/config>",
179
+ "Config file path (disables auto detect)",
180
+ )
181
+ .option("--cwd <directory>", "Working directory. Defaults to process.cwd()")
182
+ .description("Generate a new Contentful migration from content type")
136
183
  .action(
137
184
  actionRunner(async (cmd) => {
138
185
  const config = await getConfig(parseArgs(cmd || {}), [
139
- 'managementToken',
140
- 'spaceId',
141
- 'environmentId',
142
- 'directory',
186
+ "managementToken",
187
+ "spaceId",
188
+ "environmentId",
189
+ "directory",
143
190
  ]);
144
191
 
145
192
  await fetchMigration({ ...config, contentType: cmd.contentType });
146
- })
193
+ }),
147
194
  );
148
195
 
149
196
  program
150
- .command('generate')
151
- .option('-s, --space-id <space-id>', 'Contentful space id')
152
- .option('-e, --environment-id <environment-id>', 'Change the Contentful environment')
153
- .option('-p, --path <path/to/migrations>', 'Change the path where the migrations are saved')
154
- .option('-v, --verbose', 'Verbosity')
155
- .option('--host <host>', 'Management API host')
156
- .option('--config <path/to/config>', 'Config file path (disables auto detect)')
157
- .option('--cwd <directory>', 'Working directory. Defaults to process.cwd()')
158
- .description('Generate a new Contentful migration')
197
+ .command("generate")
198
+ .option("-s, --space-id <space-id>", "Contentful space id")
199
+ .option(
200
+ "-e, --environment-id <environment-id>",
201
+ "Change the Contentful environment",
202
+ )
203
+ .option(
204
+ "-p, --path <path/to/migrations>",
205
+ "Change the path where the migrations are saved",
206
+ )
207
+ .option("-v, --verbose", "Verbosity")
208
+ .option("--host <host>", "Management API host")
209
+ .option(
210
+ "--config <path/to/config>",
211
+ "Config file path (disables auto detect)",
212
+ )
213
+ .option("--cwd <directory>", "Working directory. Defaults to process.cwd()")
214
+ .description("Generate a new Contentful migration")
159
215
  .action(
160
216
  actionRunner(async (cmd) => {
161
217
  const config = await getConfig(parseArgs(cmd || {}), [
162
- 'managementToken',
163
- 'spaceId',
164
- 'environmentId',
165
- 'directory',
218
+ "managementToken",
219
+ "spaceId",
220
+ "environmentId",
221
+ "directory",
166
222
  ]);
167
223
  await createMigration(config);
168
- })
224
+ }),
169
225
  );
170
226
 
171
227
  program
172
- .command('migrate')
173
- .option('-s, --space-id <space-id>', 'Contentful space id')
174
- .option('-e, --environment-id <environment-id>', 'Change the Contentful environment')
175
- .option('-p, --path <path/to/migrations>', 'Change the path where the migrations are stored')
176
- .option('-v, --verbose', 'Verbosity')
177
- .option('-y, --yes', 'Assume "yes" as answer to all prompts and run non-interactively.')
178
- .option('--host <host>', 'Management API host')
179
- .option('--config <path/to/config>', 'Config file path (disables auto detect)')
180
- .option('--cwd <directory>', 'Working directory. Defaults to process.cwd()')
181
- .option('--bail', 'Abort execution after first failed migration (default: true)', true)
182
- .option('--no-bail', 'Ignore failed migrations')
183
- .description('Execute all unexecuted migrations available.')
228
+ .command("migrate")
229
+ .option("-s, --space-id <space-id>", "Contentful space id")
230
+ .option(
231
+ "-e, --environment-id <environment-id>",
232
+ "Change the Contentful environment",
233
+ )
234
+ .option(
235
+ "-p, --path <path/to/migrations>",
236
+ "Change the path where the migrations are stored",
237
+ )
238
+ .option("-v, --verbose", "Verbosity")
239
+ .option(
240
+ "-y, --yes",
241
+ 'Assume "yes" as answer to all prompts and run non-interactively.',
242
+ )
243
+ .option("--host <host>", "Management API host")
244
+ .option(
245
+ "--config <path/to/config>",
246
+ "Config file path (disables auto detect)",
247
+ )
248
+ .option("--cwd <directory>", "Working directory. Defaults to process.cwd()")
249
+ .option(
250
+ "--bail",
251
+ "Abort execution after first failed migration (default: true)",
252
+ true,
253
+ )
254
+ .option("--no-bail", "Ignore failed migrations")
255
+ .description("Execute all unexecuted migrations available.")
184
256
  .action(
185
257
  actionRunner(async (cmd) => {
186
258
  const config = await getConfig(parseArgs(cmd || {}), [
187
- 'managementToken',
188
- 'spaceId',
189
- 'environmentId',
190
- 'storage',
191
- 'fieldId',
192
- 'migrationContentTypeId',
193
- 'directory',
259
+ "managementToken",
260
+ "spaceId",
261
+ "environmentId",
262
+ "storage",
263
+ "fieldId",
264
+ "migrationContentTypeId",
265
+ "directory",
194
266
  ]);
195
267
 
196
268
  const { missingStorageModel } = config;
197
269
  if (missingStorageModel) {
198
- console.error(pc.red('\nError:'), `Missing migration content type. Run ${pc.cyan('npx migrations init')}`);
270
+ console.error(
271
+ pc.red("\nError:"),
272
+ `Missing migration content type. Run ${pc.cyan("npx migrations init")}`,
273
+ );
199
274
  process.exit(1);
200
275
  }
201
276
 
202
277
  await runMigrations(config);
203
- }, false)
278
+ }, false),
204
279
  );
205
280
 
206
281
  program
207
- .command('execute <file>')
208
- .option('-s, --space-id <space-id>', 'Contentful space id')
209
- .option('-e, --environment-id <environment-id>', 'Change the Contentful environment')
210
- .option('-v, --verbose', 'Verbosity')
211
- .option('-y, --yes', 'Assume "yes" as answer to all prompts and run non-interactively.')
212
- .option('--host <host>', 'Management API host')
213
- .option('--config <path/to/config>', 'Config file path (disables auto detect)')
214
- .option('--cwd <directory>', 'Working directory. Defaults to process.cwd()')
215
- .description('Execute a single migration.')
282
+ .command("execute <file>")
283
+ .option("-s, --space-id <space-id>", "Contentful space id")
284
+ .option(
285
+ "-e, --environment-id <environment-id>",
286
+ "Change the Contentful environment",
287
+ )
288
+ .option("-v, --verbose", "Verbosity")
289
+ .option(
290
+ "-y, --yes",
291
+ 'Assume "yes" as answer to all prompts and run non-interactively.',
292
+ )
293
+ .option("--host <host>", "Management API host")
294
+ .option(
295
+ "--config <path/to/config>",
296
+ "Config file path (disables auto detect)",
297
+ )
298
+ .option("--cwd <directory>", "Working directory. Defaults to process.cwd()")
299
+ .description("Execute a single migration.")
216
300
  .action(
217
301
  actionRunner(async (file, options) => {
218
302
  const config = await getConfig(parseArgs(options || {}), [
219
- 'managementToken',
220
- 'spaceId',
221
- 'environmentId',
222
- 'storage',
223
- 'fieldId',
224
- 'migrationContentTypeId',
225
- 'directory',
303
+ "managementToken",
304
+ "spaceId",
305
+ "environmentId",
306
+ "storage",
307
+ "fieldId",
308
+ "migrationContentTypeId",
309
+ "directory",
226
310
  ]);
227
311
 
228
312
  const { missingStorageModel } = config;
229
313
  if (missingStorageModel) {
230
- console.error(pc.red('\nError:'), `Missing migration content type. Run ${pc.cyan('npx migrations init')}`);
314
+ console.error(
315
+ pc.red("\nError:"),
316
+ `Missing migration content type. Run ${pc.cyan("npx migrations init")}`,
317
+ );
231
318
  process.exit(1);
232
319
  }
233
320
  await executeMigration(path.resolve(file), config);
234
- }, false)
321
+ }, false),
235
322
  );
236
323
 
237
324
  program
238
- .command('version <file>')
239
- .option('-s, --space-id <space-id>', 'Contentful space id')
240
- .option('-e, --environment-id <environment-id>', 'Change the Contentful environment')
241
- .option('-v, --verbose', 'Verbosity')
242
- .option('--host <host>', 'Management API host')
243
- .option('--config <path/to/config>', 'Config file path (disables auto detect)')
244
- .option('--add', 'Mark migration as migrated')
245
- .option('--remove', 'Delete migration entry in Contentful')
246
- .option('--cwd <directory>', 'Working directory. Defaults to process.cwd()')
247
- .description('Manually mark a migration as migrated or not. (Only available with the Content-model storage)')
325
+ .command("version <file>")
326
+ .option("-s, --space-id <space-id>", "Contentful space id")
327
+ .option(
328
+ "-e, --environment-id <environment-id>",
329
+ "Change the Contentful environment",
330
+ )
331
+ .option("-v, --verbose", "Verbosity")
332
+ .option("--host <host>", "Management API host")
333
+ .option(
334
+ "--config <path/to/config>",
335
+ "Config file path (disables auto detect)",
336
+ )
337
+ .option("--add", "Mark migration as migrated")
338
+ .option("--remove", "Delete migration entry in Contentful")
339
+ .option("--cwd <directory>", "Working directory. Defaults to process.cwd()")
340
+ .description(
341
+ "Manually mark a migration as migrated or not. (Only available with the Content-model storage)",
342
+ )
248
343
  .action(
249
344
  actionRunner(async (file, options) => {
250
345
  const { remove, add } = options;
251
346
  const config = await getConfig(parseArgs(options || {}), [
252
- 'managementToken',
253
- 'spaceId',
254
- 'environmentId',
255
- 'storage',
256
- 'fieldId',
257
- 'migrationContentTypeId',
258
- 'directory',
347
+ "managementToken",
348
+ "spaceId",
349
+ "environmentId",
350
+ "storage",
351
+ "fieldId",
352
+ "migrationContentTypeId",
353
+ "directory",
259
354
  ]);
260
355
 
261
356
  const { missingStorageModel } = config;
262
357
  if (missingStorageModel) {
263
- console.error(pc.red('\nError:'), `Missing migration content type. Run ${pc.cyan('npx migrations init')}`);
358
+ console.error(
359
+ pc.red("\nError:"),
360
+ `Missing migration content type. Run ${pc.cyan("npx migrations init")}`,
361
+ );
264
362
  process.exit(1);
265
363
  }
266
364
 
267
365
  const { storage } = config || {};
268
366
  if (storage === STORAGE_TAG) {
269
- throw new Error('The version command is not available for the "tag" storage');
367
+ throw new Error(
368
+ 'The version command is not available for the "tag" storage',
369
+ );
270
370
  }
271
371
  if (remove) {
272
372
  await versionDelete(file, config);
273
373
  } else if (add) {
274
374
  await versionAdd(file, config);
275
375
  }
276
- }, true)
376
+ }, true),
277
377
  );
278
378
 
279
379
  program
280
- .command('environment <environment-id>')
281
- .option('-s, --space-id <space-id>', 'Contentful space id')
282
- .option('-v, --verbose', 'Verbosity')
283
- .option('--host <host>', 'Management API host')
284
- .option('--config <path/to/config>', 'Config file path (disables auto detect)')
285
- .option('--create', 'Create new contentful environment')
286
- .option('--remove', 'Delete contentful environment')
287
- .option('--reset', 'Reset contentful environment')
288
- .option('--source-environment-id <environment-id>', 'Set the source environment to clone new environment from')
289
- .option('--cwd <directory>', 'Working directory. Defaults to process.cwd()')
290
- .description('Add or remove a contentful environment for migrations')
380
+ .command("environment <environment-id>")
381
+ .option("-s, --space-id <space-id>", "Contentful space id")
382
+ .option("-v, --verbose", "Verbosity")
383
+ .option("--host <host>", "Management API host")
384
+ .option(
385
+ "--config <path/to/config>",
386
+ "Config file path (disables auto detect)",
387
+ )
388
+ .option("--create", "Create new contentful environment")
389
+ .option("--remove", "Delete contentful environment")
390
+ .option("--reset", "Reset contentful environment")
391
+ .option(
392
+ "--source-environment-id <environment-id>",
393
+ "Set the source environment to clone new environment from",
394
+ )
395
+ .option("--cwd <directory>", "Working directory. Defaults to process.cwd()")
396
+ .description("Add or remove a contentful environment for migrations")
291
397
  .action(
292
398
  actionRunner(async (environmentId, options) => {
293
399
  const { remove, create, reset } = options;
294
- const config = await getConfig(parseArgs({ ...(options || {}), environmentId }), [
295
- 'managementToken',
296
- 'spaceId',
297
- 'environmentId',
400
+ const config = await getConfig(parseArgs({ ...options, environmentId }), [
401
+ "managementToken",
402
+ "spaceId",
403
+ "environmentId",
298
404
  ]);
299
405
 
300
406
  if (create) {
@@ -308,54 +414,91 @@ program
308
414
  if (reset) {
309
415
  return resetEnvironment(environmentId, config);
310
416
  }
311
- }, true)
417
+ }, true),
312
418
  );
313
419
 
314
420
  program
315
- .command('doc')
316
- .option('-s, --space-id <space-id>', 'Contentful space id')
317
- .option('-e, --environment-id <environment-id>', 'Change the Contentful environment')
318
- .option('-p, --path <path/to/docs>', 'Change the path where the docs are stored')
319
- .option('-v, --verbose', 'Verbosity')
320
- .option('-t, --template <path/to/template>', 'Use custom template for docs')
321
- .option('--host <host>', 'Management API host')
322
- .option('--config <path/to/config>', 'Config file path (disables auto detect)')
323
- .option('--extension <file-extension>', 'Use custom file extension (default is `md`)')
324
- .option('--cwd <directory>', 'Working directory. Defaults to process.cwd()')
325
- .description('Generate offline docs from content-types')
421
+ .command("doc")
422
+ .option("-s, --space-id <space-id>", "Contentful space id")
423
+ .option(
424
+ "-e, --environment-id <environment-id>",
425
+ "Change the Contentful environment",
426
+ )
427
+ .option(
428
+ "-p, --path <path/to/docs>",
429
+ "Change the path where the docs are stored",
430
+ )
431
+ .option("-v, --verbose", "Verbosity")
432
+ .option("-t, --template <path/to/template>", "Use custom template for docs")
433
+ .option("--host <host>", "Management API host")
434
+ .option(
435
+ "--config <path/to/config>",
436
+ "Config file path (disables auto detect)",
437
+ )
438
+ .option(
439
+ "--extension <file-extension>",
440
+ "Use custom file extension (default is `md`)",
441
+ )
442
+ .option("--cwd <directory>", "Working directory. Defaults to process.cwd()")
443
+ .description("Generate offline docs from content-types")
326
444
  .action(
327
445
  actionRunner(async (cmd) => {
328
- const config = await getConfig(parseArgs(cmd || {}), ['managementToken', 'spaceId', 'environmentId']);
446
+ const config = await getConfig(parseArgs(cmd || {}), [
447
+ "managementToken",
448
+ "spaceId",
449
+ "environmentId",
450
+ ]);
329
451
  await createOfflineDocs(config);
330
- }, true)
452
+ }, true),
331
453
  );
332
454
 
333
455
  program
334
- .command('content')
335
- .requiredOption('--source-environment-id <environment-id>', 'Set the Contentful source environment (from)')
336
- .requiredOption('--dest-environment-id <environment-id>', 'Set the Contentful destination environment (to)')
337
- .option('-s, --space-id <space-id>', 'Contentful space id')
338
- .option('-c, --content-type <content-type>', 'Specify content-type')
339
- .option('-v, --verbose', 'Verbosity')
340
- .option('-y, --yes', 'Assume "yes" as answer to all prompts and run non-interactively.')
341
- .option('--host <host>', 'Management API host')
342
- .option('--config <path/to/config>', 'Config file path (disables auto detect)')
343
- .option('--diff', 'Manually choose skip/overwrite for every conflict')
344
- .option('--force', 'No manual diffing. Overwrites all conflicting entries/assets')
345
- .description('Transfer content from source environment to destination environment')
346
- .option('--cwd <directory>', 'Working directory. Defaults to process.cwd()')
456
+ .command("content")
457
+ .requiredOption(
458
+ "--source-environment-id <environment-id>",
459
+ "Set the Contentful source environment (from)",
460
+ )
461
+ .requiredOption(
462
+ "--dest-environment-id <environment-id>",
463
+ "Set the Contentful destination environment (to)",
464
+ )
465
+ .option("-s, --space-id <space-id>", "Contentful space id")
466
+ .option("-c, --content-type <content-type>", "Specify content-type")
467
+ .option("-v, --verbose", "Verbosity")
468
+ .option(
469
+ "-y, --yes",
470
+ 'Assume "yes" as answer to all prompts and run non-interactively.',
471
+ )
472
+ .option("--host <host>", "Management API host")
473
+ .option(
474
+ "--config <path/to/config>",
475
+ "Config file path (disables auto detect)",
476
+ )
477
+ .option("--diff", "Manually choose skip/overwrite for every conflict")
478
+ .option(
479
+ "--force",
480
+ "No manual diffing. Overwrites all conflicting entries/assets",
481
+ )
482
+ .description(
483
+ "Transfer content from source environment to destination environment",
484
+ )
485
+ .option("--cwd <directory>", "Working directory. Defaults to process.cwd()")
347
486
  .action(
348
487
  actionRunner(async (cmd) => {
349
- const config = await getConfig(parseArgs(cmd || {}), ['managementToken', 'spaceId', 'storage']);
488
+ const config = await getConfig(parseArgs(cmd || {}), [
489
+ "managementToken",
490
+ "spaceId",
491
+ "storage",
492
+ ]);
350
493
 
351
494
  // run migrations on destination environment
352
495
  await transferContent({
353
496
  ...config,
354
- contentType: cmd.contentType || '',
497
+ contentType: cmd.contentType || "",
355
498
  forceOverwrite: cmd.force || false,
356
499
  diffConflicts: cmd.diff || false,
357
500
  });
358
- })
501
+ }),
359
502
  );
360
503
 
361
504
  program.parse(process.argv);