Giter VIP home page Giter VIP logo

bulk-decaffeinate's People

Contributors

alangpierce avatar dependabot-preview[bot] avatar eventualbuddha avatar greenkeeperio-bot avatar olleolleolle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bulk-decaffeinate's Issues

You have modifications to your git worktree.

The tool keeps saying:
"You have modifications to your git worktree.
Please revert or commit them before running convert."

But my git work tree is clean. I even delete my .git folder once and the tool still complained.

I think I manually deleted the files created when I run command 'check' and that left the tool in a bad state but is incredibly annoying. Do you know an easy way to fix it? Thanks.

Convert can't find coffee file

I was able to get check to run successfully but after running convert I get this output:

Generating the first commit: "decaffeinate: Rename componentclassmap.coffee and 194 other files from .coffee to .js"...
fatal: pathspec '/my-project/src/scripts/node_modules/Viewer/index.coffee' did not match any files

Error: fatal: pathspec '/my-project/src/scripts/node_modules/Viewer/index.coffee' did not match any files

    at /usr/local/lib/node_modules/bulk-decaffeinate/node_modules/simple-git/promise.js:21:26
    at Git.<anonymous> (/usr/local/lib/node_modules/bulk-decaffeinate/node_modules/simple-git/src/git.js:1169:18)
    at Git.<anonymous> (/usr/local/lib/node_modules/bulk-decaffeinate/node_modules/simple-git/src/git.js:1243:21)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

It seems to be trying to find index.coffee but only index.original.coffee exists, hence the error

Cannot find module mz/fs

I'm about to begin the transition of 1923 CoffeeScript files to TypeScript(yup, that's going to be fun) and already ran into a bug :D It does sound like a decaffeinate bug, but seeing as it was run with bulk-decaffeinate I just suspect that it's something to do with bulk-decaffeinate. Has you experienced anything like that @alangpierce ? Have removed all globally installed packages and re-installed so it doesn't seem like stale modules.

from decaffeinate-errors.log

cof.coffee
module.js:557
    throw err;
    ^

Error: Cannot find module 'mz/fs'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/mads/.nvm/versions/node/v9.3.0/lib/node_modules/decaffeinate/dist/cli.js:5:12)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/mads/.nvm/versions/node/v9.3.0/lib/node_modules/decaffeinate/dist/index.js:25:13)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/mads/.nvm/versions/node/v9.3.0/lib/node_modules/decaffeinate/bin/decaffeinate:3:1)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:618:3

Windows: "'.' is not recognized as an internal or external command, operable program or batch file."

Attempting to run bulk-caffeinate check on Windows causes every file to fail with this error:

'.' is not recognized as an internal or external command, operable program or batch file.

I tested this using both Windows Command Prompt and Git Bash.

Looks like the tool assumes the OS always uses forward-slash directory separators.

Rather than using hardcoded paths, I suggest all paths are constructed using "path.join()".

The path.join() method joins all given path segments together using the platform specific separator as a delimiter, then normalizes the resulting path.

So, the existing code:

nodeModulesPath = './node_modules/.bin/' + binaryName;

... becomes:

nodeModulesPath = path.join('.', 'node_modules', '.bin', binaryName);

Package Status

What is the package status?

It seems this repository isn't updated for a long time. Many dependency PRs are open. I posted an issue 22 days ago, but I didn't get any responce.

Should I just use normal decaffeinate?

#265

Windows support

  • Code doesn't run inside powershell
PS C:\Users\yahyaaba\Documents\GitHub\atom-julia-client\lib_src> bulk-decaffeinate check
decaffeinate binary not found on the PATH or in node_modules.
Run "npm install -g decaffeinate"? [Y/n]
Installing decaffeinate globally...
events.js:187
     throw er; // Unhandled 'error' event
     ^

Error: spawn /bin/sh ENOENT
   at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
   at onErrorNT (internal/child_process.js:456:16)
   at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
   at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
   at onErrorNT (internal/child_process.js:456:16)
   at processTicksAndRejections (internal/process/task_queues.js:80:21) {
 errno: -4058,
 code: 'ENOENT',
 syscall: 'spawn /bin/sh',
 path: '/bin/sh',
 spawnargs: [ '-c', 'npm install -g decaffeinate' ]
}

Although decaffeniate is installed.

  • Using bash, JScodeshift fails
Searching for files that may need to have updated imports... (8 workers)
55/55
Finished in 0 seconds (Time: 2020-03-15T04:05:57-05:00)
Fixing any imports across the whole codebase...
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: spawn /bin/sh ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn /bin/sh',
  path: '/bin/sh',
  spawnargs: [
    '-c',
    '      jscodeshift --parser flow -t 
  • Using bash, ESLint fails

Output .ts files

How about an option that renames the .js files to .ts when doing the conversion? That way we wouldn't have to do yet another commit to change the files to TypeScript A more generic approach could be to allow users to specify the filetype that should be outputted. :)

Not skipping eslint step gracefully when config is missing

It looks like the code makes an attempt to gracefully skip the eslint step when a configuration is not found: https://github.com/decaffeinate/bulk-decaffeinate/blob/master/src/modernize/runEslintFix.js#L37

In practice, I'm receiving this output:

Running eslint --fix on all files...

Error while running eslint:

It seems like all the conversion is done, but it confused me at first and made me think the decaffeinate process had errored out prematurely.

I'm running on Mac OS X 10.12.6, Node 6.11.2, and eslint 4.5.0 (installed globally, not installed in project being decaffeinated).

detect extension-less CoffeeScript scripts

The decaffeinate-examples fork of hubot still has bin/hubot as CoffeeScript because bulk-decaffeinate doesn't find it. We could pretty easily look in all extension-less files (maybe that are executable?) and look for a shebang line like this: #!/usr/bin/env coffee.

`bulk-decaffeinate check` throws error

> bulk-decaffeinate check
TypeError: Cannot read property 'split' of null
    at getTrackedFiles$ (/Users/dave/n/lib/node_modules/bulk-decaffeinate/dist/bulk-decaffeinate.js:977:19)
    at tryCatch (/Users/dave/n/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/Users/dave/n/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/dave/n/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:117:21)
    at tryCatch (/Users/dave/n/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:65:40)
    at invoke (/Users/dave/n/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:155:20)
    at /Users/dave/n/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:165:13
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)

Tried on Node.js 4, 6, 7 and 8, received the same error. MacOS 10.12.3.

Converting too many files? [spawn E2BIG]

Error stack trace:

Verifying that decaffeinate can successfully convert these files...
2204/2204
Backing up files to .original.coffee...
2204/2204
Renaming files from .coffee to .js...
2204/2204
Generating the first commit: "decaffeinate: Rename admin-roles-page.coffee and 2203 other files from .coffee to .js"...
{ Error: spawn E2BIG
    at exports._errnoException (util.js:1018:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at Object.exports.spawn (child_process.js:378:9)
    at Git._schedule (/Users/juanca/workspace/xyz/node_modules/simple-git/src/git.js:1270:42)
    at Git._run (/Users/juanca/workspace/xyz/node_modules/simple-git/src/git.js:1252:12)
    at Git._rm (/Users/juanca/workspace/xyz/node_modules/simple-git/src/git.js:1215:19)
    at Git.rm (/Users/juanca/workspace/xyz/node_modules/simple-git/src/git.js:917:19)
    at /Users/juanca/workspace/xyz/node_modules/simple-git/promise.js:28:21
    at /Users/juanca/workspace/xyz/node_modules/simple-git/promise.js:18:17 code: 'E2BIG', errno: 'E2BIG', syscall: 'spawn' }

I figure I can bulk convert directories. But wanted to give y'all a heads up on this particular use-case.

Cannot read property 'messages' of undefined

When I try to bulk-decaffeinate some files, I get this error:

Running eslint --fix on all files..
TypeError: Cannot read property 'messages' of undefined
at runEslint$ (/usr/local/lib/node_modules/bulk-decaffeinate/dist/bulk-decaffeinate.js:2590:38)
at tryCatch (/usr/local/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:117:21)
at tryCatch (/usr/local/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:65:40)
at invoke (/usr/local/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:155:20)
at /usr/local/lib/node_modules/bulk-decaffeinate/node_modules/regenerator-runtime/runtime.js:165:13

Tried with both latest version of eslint and 4.0 rc, no happens both times.
Will update if I get any more info on it

startTime.preciseDiff is not a function

Issue started in 1a26aa7

➜  dredd git:(master) bulk-decaffeinate check
Doing a dry run of decaffeinate on 97 files... (8 workers)
97/97
TypeError: startTime.preciseDiff is not a function
    at runWithProgressBar$ (/Users/xo/.config/yarn/global/node_modules/bulk-decaffeinate/dist/bulk-decaffeinate.js:1543:51)
    at tryCatch (/Users/xo/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/Users/xo/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/xo/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:117:21)
    at tryCatch (/Users/xo/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:65:40)
    at invoke (/Users/xo/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:155:20)
    at /Users/xo/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:165:13
    at <anonymous>

should allow config file location to be specified

Afaict, there's currently no cli option that allows a config file that lives outside of the current directory to be specified. Having such an option would allow people to have a central config file specifying how they want to decaffeinate without having to copy it into each location that's being decaffeinated.

bulk-decaffeinate view-errors uploads code?

It wasn't clear from running the readme but it looks like running view-errors sends a GET request with your failed code to the main decaffeinate project's repl. I mistakenly thought it was local repl.

This seems problematic for commercial code.

Fatal Git Error

Hi,

My project is tracked by git. The coffee files are already in that repo. I do not understand why I get the following fatal git error. Any help is highly appreciated.

$ bulk-decaffeinate --config Dashboard.Web/bulk-decaffeinate.config.js -f Dashboard.Web/Scripts/config/RenameTablesCtrl.coffee convert
Verifying that decaffeinate can successfully convert these files...
1/1
Backing up files to .original.coffee...
1/1
Renaming files from .coffee to .js...
1/1
Generating the first commit: "decaffeinate: Rename RenameTablesCtrl.coffee from .coffee to .js"...
fatal: C:\project\Dashboard.Web\Scripts\config\RenameTablesCtrl.coffee: 'C:\project\Dashboard.Web\Scripts\config\RenameTablesCtrl.coffee' is outside repository

Error: fatal: C:\project\Dashboard.Web\Scripts\config\RenameTablesCtrl.coffee: 'C:\project\Dashboard.Web\Scripts\config\RenameTablesCtrl.coffee' is outside repository

    at C:\Users\rsappidi\AppData\Roaming\npm\node_modules\bulk-decaffeinate\node_modules\simple-git\promise.js:21:26
    at Git.<anonymous> (C:\Users\rsappidi\AppData\Roaming\npm\node_modules\bulk-decaffeinate\node_modules\simple-git\src\git.js:1195:18)
    at Git.<anonymous> (C:\Users\rsappidi\AppData\Roaming\npm\node_modules\bulk-decaffeinate\node_modules\simple-git\src\git.js:1272:21)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Thanks

Installation fails

I cannot install bulk-decaffeinate on my machine. Using nvm with node 6.9.1, macOS 10.12.2. Tried with npm and yarn.

What's wrong here?

➜ npm install -g bulk-decaffeinate
/Users/hpurmann/.nvm/versions/node/v6.9.1/bin/bulk-decaffeinate -> /Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/bin/bulk-decaffeinate

> [email protected] install /Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit
> node lifecycleScripts/preinstall && node lifecycleScripts/install

[nodegit] Running pre-install script
[nodegit] Configuring libssh2.
{ Error: Command failed: /Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/openssl/openssl
/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/missing: Unknown `--is-lightweight' option
Try `/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: No crypto library found!
Try --with-libssl-prefix=PATH
 or --with-libgcrypt-prefix=PATH
 or --with-wincng on Windows

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/openssl/openssl' }
/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/missing: Unknown `--is-lightweight' option
Try `/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: No crypto library found!
Try --with-libssl-prefix=PATH
 or --with-libgcrypt-prefix=PATH
 or --with-wincng on Windows

[nodegit] ERROR - Could not finish preinstall
{ Error: Command failed: /Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/openssl/openssl
/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/missing: Unknown `--is-lightweight' option
Try `/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: No crypto library found!
Try --with-libssl-prefix=PATH
 or --with-libgcrypt-prefix=PATH
 or --with-wincng on Windows

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/Users/hpurmann/.nvm/versions/node/v6.9.1/lib/node_modules/bulk-decaffeinate/node_modules/nodegit/vendor/openssl/openssl' }
/Users/hpurmann/.nvm/versions/node/v6.9.1/lib
└── (empty)

npm ERR! Darwin 16.3.0
npm ERR! argv "/Users/hpurmann/.nvm/versions/node/v6.9.1/bin/node" "/Users/hpurmann/.nvm/versions/node/v6.9.1/bin/npm" "install" "-g" "bulk-decaffeinate"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node lifecycleScripts/preinstall && node lifecycleScripts/install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nodegit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node lifecycleScripts/preinstall && node lifecycleScripts/install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs nodegit
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls nodegit
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/hpurmann/dev/actano/rplan/npm-debug.log
npm ERR! code 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.