How to use the contentful-migration/built/bin/lib/render-migration.renderPlan function in contentful-migration

To help you get started, we’ve selected a few contentful-migration examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deluan / contentful-migrate / lib / run.js View on Github external
process.exit(1)
  }
  // const migrationName = path.basename(argv.filePath, '.js');
  // const errorsFile = path.join(process.cwd(), `errors-${migrationName}-${Date.now()}.log`);
  const errorsFile = path.join(process.cwd(), `errors-${Date.now()}.log`)
  const { batches } = parseResult
  if (parseResult.hasValidationErrors()) {
    renderMigration.renderValidationErrors(batches)
    process.exit(1)
  }
  if (parseResult.hasRuntimeErrors()) {
    renderMigration.renderRuntimeErrors(batches, errorsFile)
    await writeErrorsToLog.default(parseResult.getRuntimeErrors(), errorsFile)
    process.exit(1)
  }
  await renderMigration.renderPlan(batches)
  const serverErrorsWritten = []
  const tasks = batches.map((batch) => {
    return {
      title: batch.intent.toPlanMessage().heading,
      task: () => new Listr([
        {
          title: 'Making requests',
          task: async (_ctx, task) => {
            // TODO: We wanted to make this an async interator
            // So we should not inspect the length but have a property for that
            const numRequests = batch.requests.length
            const requestErrors = []
            let requestsDone = 0
            for (const request of batch.requests) {
              requestsDone += 1