node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป



Build Status npm install

replace requires across your codebase


npm install -g jsmv


so you can do jsmv old-module.js new-module.js to replace all requires for old-module.js to new-module.js. it will even take care of making sure all of your relative paths are correct!

or even jsmv modules/my-request.js request to replace any require for modules/my-request.js with the actual request module.


jsmv [options] [from] [to]

options are:

  • --from, -f <modulename> Find files that require <modulename>
  • --to, -t <modulename> Rename all matches to <modulename>
  • --require, -R <name> Look for name vs. require
  • --dir, -d <dir> Search javascript files in <dir> (default CWD)
  • --file, -F <file> Only search <file> for relevant modules
  • --recurse, -r Recurse into subdirectories
  • --force In the event of a deep-require, replace the module anyway
  • --forceFull For deep-requires, replace the whole require with [to]
  • --version, -v Print current version
  • --help, -h This thing

if --from and --to are not explicitly declared, the first two non-flag command line options will be used in their place respectively.