Sorry, the diff of this file is not supported yet
+43
-2
| var cSpawn = require('child_process').spawn; | ||
| var os = require('os').type(); | ||
| module.exports = spawn; | ||
| exports = module.exports = spawn; | ||
| function spawn(command, args, options) { | ||
| if (os === 'Windows_NT') { | ||
| if (os === 'Windows_NT') { | ||
| if (command === 'rm') { | ||
| command = 'rmdir'; | ||
| if (args[0] === '-rf' || args[0] == '-fr') { | ||
| args[0] = '/q'; | ||
| args.unshift('/s'); | ||
| } | ||
| if (args[0] === '-f') { | ||
| args[0] = '/q'; | ||
| } | ||
| if (args[0] === '-r') { | ||
| args[0] = '/s'; | ||
| } | ||
| } | ||
| args = args || []; | ||
@@ -48,2 +61,30 @@ options = options || {}; | ||
| return out; | ||
| } | ||
| var fs = require('fs'); | ||
| var join = require('path').join; | ||
| exports.transformDir = transformDir; | ||
| function transformDir(dirname, options) { | ||
| options = options || {}; | ||
| var dir = fs.readdirSync(dirname); | ||
| dir.forEach(function (child) { | ||
| if (fs.statSync(join(dirname, child)).isDirectory()) { | ||
| if (child !== 'node_modules' && child !== '.git') { | ||
| transformDir(join(dirname, child), options); | ||
| } | ||
| } else { | ||
| transform(join(dirname, child), options); | ||
| } | ||
| }); | ||
| } | ||
| exports.transform = transform; | ||
| function transform(file, options) { | ||
| options = options || {}; | ||
| var content = fs.readFileSync(file, 'utf8').toString(); | ||
| if (/\r\n/g.test(content)) { | ||
| console.warn('converting ' + file); | ||
| if (!options.preview) fs.writeFileSync(file, content.replace(/\r\n/g, '\n'), 'utf8'); | ||
| } | ||
| } |
+9
-2
| { | ||
| "name": "win-fork", | ||
| "version": "1.0.2", | ||
| "version": "1.1.0", | ||
| "description": "Spawn for node.js but in a way that works regardless of which OS you're using", | ||
@@ -12,6 +12,13 @@ "main": "index.js", | ||
| "win-spawn": "./bin/win-spawn", | ||
| "win-fork": "./bin/win-spawn" | ||
| "win-fork": "./bin/win-spawn", | ||
| "win-line-endings": "./bin/win-line-endings" | ||
| }, | ||
| "devDependencies": { | ||
| "win-spawn": "*" | ||
| }, | ||
| "scripts": { | ||
| "prepublish": "win-line-endings" | ||
| }, | ||
| "author": "ForbesLindesay", | ||
| "license": "BSD" | ||
| } |
+10
-0
@@ -20,2 +20,12 @@ # win-spawn | ||
| You can also transform all the line endings in a directory from `\r\n` to `\n` just by running: | ||
| $ win-line-endings | ||
| You can preview the changes by running: | ||
| $ win-line-endings -p | ||
| It will ignore `node_modules` and `.git` by default, but is not clever enough to recognise binary files yet. | ||
| ### API | ||
@@ -22,0 +32,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
4729
49.79%6
20%79
92.68%39
34.48%1
Infinity%3
50%