1.0.8 • Published 7 years ago
movejs v1.0.8
movejs
Rename/Move CJS module(s) and update all affected requires
- 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
Installation
$ npm install -g movejsUsage
$ movejs sourcePath destPathsourcePath 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 destPathProgramatical API
movejs
Move/rename single module file or directory of modules
var mv = require('movejs');
mv(sourcePath, destPath).done(function () {
// Module(s) successfully moved
});movejs/module
Move/rename single module file
var mvModule = require('movejs/module');
mvModule(sourcePath, destPath).done(function () {
// Module successfully moved
});movejs/directory
Move/rename directory of modules
var mvDir = require('movejs/directory');
mvDir(sourcePath, destPath).done(function () {
// Modules successfully moved
});Tests 
$ npm test