New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cjs-rename

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cjs-rename - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

32

bin/cjs-rename.js

@@ -57,21 +57,27 @@ #!/usr/bin/env node

if (app.files.length === 0) return;
console.log('\nMoving:');
app.files.forEach(function (file) {
var from = Path.relative(cwd, file.from);
var to = Path.relative(cwd, file.to);
console.log('-', BLUE + from, RESET + '>' + BLUE, to, RESET);
var files = app.files.filter(function (file) {
return file.move;
});
if (app.changes.length === 0) return;
console.log('\nFixing:');
if (files.length) {
console.log('\nMoving:');
app.changes.forEach(function (change) {
var path = Path.relative(cwd, change.path);
console.log('- [' + change.count + ']' + BLUE, path, RESET);
});
files.forEach(function (file) {
var from = Path.relative(cwd, file.from);
var to = Path.relative(cwd, file.to);
console.log('-', BLUE + from, RESET + '>' + BLUE, to, RESET);
});
}
if (app.changes.length) {
console.log('\nFixing:');
app.changes.forEach(function (change) {
var path = Path.relative(cwd, change.path);
console.log('- [' + change.count + ']' + BLUE, path, RESET);
});
}
});
}

@@ -108,3 +108,4 @@ 'use strict';

}).return(this.files).map(function (file) {
return move(file.from, file.to);
if (file.move)
return move(file.from, file.to);
});

@@ -111,0 +112,0 @@ };

@@ -90,7 +90,11 @@ /*

scan.path = function (options) {
return xtnd.map(options.input, function (path) {
var paths = xtnd.map(options.input, function (path) {
var from = Path.extension.match(options.from, path);
var to = Path.extension.match(options.to, from);
if (path === from) return { from: path, to: to };
if (path === from) return { from: path, to: to, move: true };
});
if (! paths.length) {
paths.push({ from: options.from, to: options.to, move: false });
}
return paths;
};

@@ -127,3 +131,4 @@

from: path,
to: Path.join(folder, to)
to: Path.join(folder, to),
move: true
};

@@ -130,0 +135,0 @@ }

{
"name": "cjs-rename",
"version": "0.0.7",
"version": "0.0.8",
"description": "Rename a CJS file thing",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -228,2 +228,7 @@ # cjs-rename

### 0.0.8
- Add support for moving files that do not exist (e.g. fixing a file that has
already been moved).
### 0.0.7

@@ -230,0 +235,0 @@

@@ -37,4 +37,4 @@ 'use strict';

var expected = [
{ from: '/pass.js', to: '/done.js' },
{ from: '/pass.coffee', to: '/done.coffee' }
{ from: '/pass.js', to: '/done.js', move: true },
{ from: '/pass.coffee', to: '/done.coffee', move: true }
];

@@ -55,3 +55,3 @@

var expected = [
{ from: '/pass.js', to: '/done.js' }
{ from: '/pass.js', to: '/done.js', move: true }
];

@@ -72,4 +72,4 @@

var expected = [
{ from: '/pass.js', to: '/done.js', },
{ from: '/pass.coffee', to: '/done.js', }
{ from: '/pass.js', to: '/done.js', move: true },
{ from: '/pass.coffee', to: '/done.js', move: true }
];

@@ -90,3 +90,3 @@

var expected = [
{ from: '/folder/pass.js', to: '/folder/done.js' }
{ from: '/folder/pass.js', to: '/folder/done.js', move: true }
];

@@ -98,2 +98,17 @@

it('should match files that do not exist', function () {
var options = {
from: '/missing.js',
to: '/done.js'
};
var expected = [
{ from: '/missing.js', to: '/done.js', move: false }
];
testPath(options, expected);
});
});

@@ -117,5 +132,5 @@

var expected = [
{ from: '/pass.js', to: '/done.js' },
{ from: '/pass.coffee', to: '/done.coffee' },
{ from: '/folder/pass.js', to: '/folder/done.js' }
{ from: '/pass.js', to: '/done.js', move: true },
{ from: '/pass.coffee', to: '/done.coffee', move: true },
{ from: '/folder/pass.js', to: '/folder/done.js', move: true }
];

@@ -136,4 +151,4 @@

var expected = [
{ from: '/pass.js', to: '/done.js' },
{ from: '/folder/pass.js', to: '/folder/done.js' }
{ from: '/pass.js', to: '/done.js', move: true },
{ from: '/folder/pass.js', to: '/folder/done.js', move: true }
];

@@ -154,5 +169,5 @@

var expected = [
{ from: '/pass.js', to: '/done.js' },
{ from: '/pass.coffee', to: '/done.js' },
{ from: '/folder/pass.js', to: '/folder/done.js' }
{ from: '/pass.js', to: '/done.js', move: true },
{ from: '/pass.coffee', to: '/done.js', move: true },
{ from: '/folder/pass.js', to: '/folder/done.js', move: true }
];

@@ -173,4 +188,4 @@

var expected = [
{ from: '/pass.js', to: '/done.js' },
{ from: '/folder/pass.js', to: '/folder/done.js' }
{ from: '/pass.js', to: '/done.js', move: true },
{ from: '/folder/pass.js', to: '/folder/done.js', move: true }
];

@@ -177,0 +192,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc