- Package root is intelligently detected
- Content of eventual node_modules (external dependencies) folder is not affected
- All files as ignored by .gitignore rules are not touched (it is assumed they're most likely generated files, which will automatically be fixed by regeneration).
Constraints:
- Moved module must reside in some package
otherwise root of a system is perceived as a root of a package, and operation is aborted (to not proceed with whole system files search for affected modules) - Modules can be moved only within a scope of same package. For obvious reasons move across different packages will fail
$ npm install -g movejs
$ movejs sourcePath destPath
sourcePath can be either module file path or directory path. destPath must not be taken.
Verbose logging of underlying operations is possible with additional setting of DEBUG variable:
$ DEBUG=movejs movejs sourcePath destPath
Move/rename single module file or directory of modules
var mv = require("movejs");
mv(sourcePath, destPath).done(function () {
// Module(s) successfully moved
});Move/rename single module file
var mvModule = require("movejs/module");
mvModule(sourcePath, destPath).done(function () {
// Module successfully moved
});Move/rename directory of modules
var mvDir = require("movejs/directory");
mvDir(sourcePath, destPath).done(function () {
// Modules successfully moved
});$ npm test