(force)
| 12 | const jscodeshiftExecutable = require.resolve('.bin/jscodeshift'); |
| 13 | |
| 14 | function checkGitStatus(force) { |
| 15 | let clean = false; |
| 16 | let errorMessage = 'Unable to determine if git directory is clean'; |
| 17 | try { |
| 18 | clean = isGitClean.sync(process.cwd()); |
| 19 | errorMessage = 'Git directory is not clean'; |
| 20 | } catch (err) { |
| 21 | if (err && err.stderr && err.stderr.indexOf('Not a git repository') >= 0) { |
| 22 | clean = true; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | if (!clean) { |
| 27 | if (force) { |
| 28 | console.log(`WARNING: ${errorMessage}. Forcibly continuing.`); |
| 29 | } else { |
| 30 | console.log('Thank you for using react-codemods!'); |
| 31 | console.log( |
| 32 | chalk.yellow( |
| 33 | '\nBut before we continue, please stash or commit your git changes.' |
| 34 | ) |
| 35 | ); |
| 36 | console.log( |
| 37 | '\nYou may use the --force flag to override this safety check.' |
| 38 | ); |
| 39 | process.exit(1); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | function runTransform({ files, flags, parser, transformer, answers }) { |
| 45 | const transformerPath = path.join(transformerDirectory, `${transformer}.js`); |
no outgoing calls
no test coverage detected