deluan / contentful-migrate

🐎 Schema migration tooling for Contentful, with state management
https://www.contentful.com/blog/2018/09/13/content-model-changes-scale-telus-cms-as-code/
MIT License
60 stars 37 forks source link

ctf-migrate bootstrap: Scripts generation contents is undefined #52

Closed shennyg closed 4 years ago

shennyg commented 4 years ago

When running ctf-migrate bootstrap I see "Scripts generation : successful" output but when I open any file in the migrations dir the contents is "undefined".

The remainder of the script writes the contentful migration state via the API.

Is there a way to increase verbosity or enable debug logging?

deluan commented 4 years ago

This seems like a bogus eslint version.

Is ctf-migrate installed globally? If yes, try installing it as a devDependency of your project and invoke it with npx

If you still have issues, please attach the whole output of the ctf-migrate bootstrap command here, together with npm --versions info

Is there a way to increase verbosity or enable debug logging?

No, unfortunately currently there's no way to do this.

shennyg commented 4 years ago

ctf-migrate was installed globally. I installed eslint and contentful-migrate as a devDependency, reran the eslint init script and then had success running via npx. Running without npx

npm install eslint contentful-migrate --save-dev
./node_modules/.bin/eslint --init
npx ctf-migrate bootstrap [...]

Thank you very much for the tool and support @deluan!

FYI running without npx gives me this output:

$ctf-migrate bootstrap [...]
⚠️   Do you want to generate initial migration state for ALL content types? y/N: y
🚨  What you are about to do is destructive!
    It will mutate all migration state for every content type in space [...]
⚠️   Are you sure you want to proceed? y/N: y
  Migrations folder : deleted
  🚨  Failed to perform bootstrap : Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react'
Require stack:
- /usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config/plugins.js
- /usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config.js
- /usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/cli-engine.js
- /usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/api.js
- /usr/local/lib/node_modules/contentful-migrate/lib/bootstrap/jsonToScript.js
- /usr/local/lib/node_modules/contentful-migrate/lib/bootstrap/generateScripts.js
- /usr/local/lib/node_modules/contentful-migrate/lib/bootstrap.js
- /usr/local/lib/node_modules/contentful-migrate/bin/commands/bootstrap.js
- /usr/local/lib/node_modules/contentful-migrate/node_modules/yargs/index.js
- /usr/local/lib/node_modules/contentful-migrate/bin/ctf-migrate
Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react'
Require stack:
- /usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config/plugins.js
- /usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config.js
- /usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/cli-engine.js
- /usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/api.js
- /usr/local/lib/node_modules/contentful-migrate/lib/bootstrap/jsonToScript.js
- /usr/local/lib/node_modules/contentful-migrate/lib/bootstrap/generateScripts.js
- /usr/local/lib/node_modules/contentful-migrate/lib/bootstrap.js
- /usr/local/lib/node_modules/contentful-migrate/bin/commands/bootstrap.js
- /usr/local/lib/node_modules/contentful-migrate/node_modules/yargs/index.js
- /usr/local/lib/node_modules/contentful-migrate/bin/ctf-migrate
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.resolve (internal/modules/cjs/helpers.js:80:19)
    at Plugins.load (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config/plugins.js:106:29)
    at Array.forEach (<anonymous>)
    at Plugins.loadAll (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config/plugins.js:166:21)
    at loadFromDisk (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config/config-file.js:501:35)
    at Object.load (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config/config-file.js:559:20)
    at Config.getLocalConfigHierarchy (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config.js:227:44)
    at Config.getConfigHierarchy (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config.js:179:43)
    at Config.getConfigVector (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config.js:286:21)
    at Config.getConfig (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config.js:329:29)
    at processText (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/cli-engine.js:163:33)
    at CLIEngine.executeOnText (/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/cli-engine.js:620:17)
    at jsonToScript (/usr/local/lib/node_modules/contentful-migrate/lib/bootstrap/jsonToScript.js:70:17)
    at /usr/local/lib/node_modules/contentful-migrate/lib/bootstrap/generateScripts.js:30:11
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config/plugins.js',
    '/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/config.js',
    '/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/cli-engine.js',
    '/usr/local/lib/node_modules/contentful-migrate/node_modules/eslint/lib/api.js',
    '/usr/local/lib/node_modules/contentful-migrate/lib/bootstrap/jsonToScript.js',
    '/usr/local/lib/node_modules/contentful-migrate/lib/bootstrap/generateScripts.js',
    '/usr/local/lib/node_modules/contentful-migrate/lib/bootstrap.js',
    '/usr/local/lib/node_modules/contentful-migrate/bin/commands/bootstrap.js',
    '/usr/local/lib/node_modules/contentful-migrate/node_modules/yargs/index.js',
    '/usr/local/lib/node_modules/contentful-migrate/bin/ctf-migrate'
  ],
  messageTemplate: 'plugin-missing',
  messageData: { pluginName: 'eslint-plugin-react' }
}
$ npm --versions
{
  'cpg': '0.1.0',
  npm: '6.12.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  llhttp: '1.1.4',
  modules: '72',
  napi: '5',
  nghttp2: '1.39.2',
  node: '12.13.0',
  openssl: '1.1.1d',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.32.0',
  v8: '7.7.299.13-node.12',
  zlib: '1.2.11'
}