Comparing version 0.6.0 to 0.7.0
@@ -1,59 +0,63 @@ | ||
(function() { | ||
var pairSettings, path, singleSettings, spawn; | ||
var path = require('path') | ||
var spawn = require('child_process').spawn | ||
path = require('path'); | ||
var pairSettings = ['version-string'] | ||
var singleSettings = ['file-version', 'product-version', 'icon'] | ||
spawn = require('child_process').spawn; | ||
module.exports = function (exe, options, callback) { | ||
var rcedit = path.resolve(__dirname, '..', 'bin', 'rcedit.exe') | ||
var args = [exe] | ||
pairSettings = ['version-string']; | ||
singleSettings = ['file-version', 'product-version', 'icon']; | ||
module.exports = function(exe, options, callback) { | ||
var args, child, error, key, name, rcedit, stderr, value, _i, _j, _len, _len1, _ref; | ||
rcedit = path.resolve(__dirname, '..', 'bin', 'rcedit.exe'); | ||
args = [exe]; | ||
for (_i = 0, _len = pairSettings.length; _i < _len; _i++) { | ||
name = pairSettings[_i]; | ||
if (options[name] != null) { | ||
_ref = options[name]; | ||
for (key in _ref) { | ||
value = _ref[key]; | ||
args.push("--set-" + name); | ||
args.push(key); | ||
args.push(value); | ||
} | ||
pairSettings.forEach(function (name) { | ||
if (options[name] != null) { | ||
for (var key in options[name]) { | ||
var value = options[name][key] | ||
args.push('--set-' + name) | ||
args.push(key) | ||
args.push(value) | ||
} | ||
} | ||
for (_j = 0, _len1 = singleSettings.length; _j < _len1; _j++) { | ||
name = singleSettings[_j]; | ||
if (options[name] != null) { | ||
args.push("--set-" + name); | ||
args.push(options[name]); | ||
} | ||
}) | ||
singleSettings.forEach(function (name) { | ||
if (options[name] != null) { | ||
args.push('--set-' + name) | ||
args.push(options[name]) | ||
} | ||
if (process.platform !== "win32") { | ||
args.unshift(rcedit); | ||
rcedit = "wine"; | ||
}) | ||
var spawnOptions = {} | ||
spawnOptions.env = Object.create(process.env) | ||
if (process.platform !== 'win32') { | ||
args.unshift(rcedit) | ||
rcedit = 'wine' | ||
// Supress fixme: stderr log messages | ||
spawnOptions.env.WINEDEBUG = '-all' | ||
} | ||
var child = spawn(rcedit, args, spawnOptions) | ||
var stderr = '' | ||
var error = null | ||
child.on('error', function (err) { | ||
if (error == null) error = err | ||
}) | ||
child.stderr.on('data', function (data) { | ||
stderr += data | ||
}) | ||
child.on('close', function (code) { | ||
if (error != null) { | ||
callback(error) | ||
} else if (code === 0) { | ||
callback() | ||
} else { | ||
var message = 'rcedit.exe failed with exit code ' + code | ||
stderr = stderr.trim() | ||
if (stderr) message += '. ' + stderr | ||
callback(new Error(message)) | ||
} | ||
child = spawn(rcedit, args); | ||
stderr = ''; | ||
error = null; | ||
child.on('error', function(err) { | ||
return error != null ? error : error = err; | ||
}); | ||
child.stderr.on('data', function(data) { | ||
return stderr += data; | ||
}); | ||
return child.on('close', function(code) { | ||
if (error != null) { | ||
return callback(error); | ||
} else if (code === 0) { | ||
return callback(null); | ||
} else { | ||
return callback(stderr); | ||
} | ||
}); | ||
}; | ||
}).call(this); | ||
}) | ||
} |
{ | ||
"name": "rcedit", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Node module to edit resources of exe", | ||
"main": "lib/rcedit.js", | ||
"scripts": { | ||
"prepublish": "grunt prepublish" | ||
"test": "mocha test/*.js && npm run lint", | ||
"lint": "standard" | ||
}, | ||
@@ -16,15 +17,9 @@ "repository": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://github.com/atom/node-nslog/raw/master/LICENSE.md" | ||
} | ||
], | ||
"license": "MIT", | ||
"devDependencies": { | ||
"grunt-contrib-coffee": "~0.7.0", | ||
"grunt-cli": "~0.1.8", | ||
"grunt": "~0.4.1", | ||
"grunt-shell": "~0.2.2", | ||
"grunt-coffeelint": "0.0.6" | ||
"mocha": "^3.0.2", | ||
"rcinfo": "^0.1.3", | ||
"standard": "^7.1.2", | ||
"temp": "^0.8.3" | ||
} | ||
} |
@@ -1,3 +0,4 @@ | ||
# node-rcedit | ||
# node-rcedit [![Travis Build Status](https://travis-ci.org/electron/node-rcedit.svg?branch=master)](https://travis-ci.org/electron/node-rcedit) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/515pyecj579vuqe8/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/node-rcedit/branch/master) | ||
Node module to edit resources of Windows executables. | ||
@@ -9,8 +10,8 @@ | ||
* Run `npm install` | ||
* Run `grunt` to compile the CoffeeScript code | ||
* Run `npm test` to run the tests | ||
## Docs | ||
```coffeescript | ||
rcedit = require 'rcedit' | ||
```js | ||
var rcedit = require('rcedit') | ||
``` | ||
@@ -17,0 +18,0 @@ On platforms other than Windows, you will need to have [Wine](http://winehq.org) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
865522
4
34
1
3