Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Test fixes and node-gyp version bump
Browse files Browse the repository at this point in the history
* Fixed a test case to work with node-chakracore
* Bump the required node-gyp version which removes dependency of looking for
node-gyp for node-chakracore
  • Loading branch information
kunalspathak committed Jun 28, 2017
1 parent d19aa55 commit 5021dff
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
22 changes: 20 additions & 2 deletions lib/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ function getHumanNodeVersion(abi) {
}
}

/**
* Get the friendly name of the Javascript engine that Node environment being run
* is using
*
* @param {string} engine - Javascript engine value - `v8` or `chakracore`
* @return {Object} Returns same engine name or false if unmatched
*
* @api public
*/
function getHumanJsEngine(engine) {
switch (engine) {
case 'v8': return 'v8';
case 'chakracore': return 'chakracore';
default: return false;
}
}

/**
* Get a human readable description of where node-sass is running to support
* user error reporting when something goes wrong
Expand All @@ -94,8 +111,9 @@ function getHumanEnvironment(env) {
platform = getHumanPlatform(parts[0]),
arch = getHumanArchitecture(parts[1]),
runtime = getHumanNodeVersion(parts[2]);

if (parts.length !== 3) {
jsEngine = getHumanJsEngine(parts[3]);

if (parts.length !== 3 && !(parts.length === 4 && jsEngine !== 'undefined')) {
return 'Unknown environment (' + binding + ')';
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"meow": "^3.7.0",
"mkdirp": "^0.5.1",
"nan": "^2.3.2",
"node-gyp": "^3.3.1",
"node-gyp": "^3.6.0",
"npmlog": "^4.0.0",
"request": "^2.79.0",
"sass-graph": "^2.2.4",
Expand Down
22 changes: 0 additions & 22 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,6 @@ function build(options) {
* @api private
*/
function resolveNodeGyp() {
if (process.jsEngine === 'chakracore') {
// For node-chakracore, check if node-gyp is in the path.
// If yes, use it instead of using node-gyp directly from
// node_modules because the one in node_modules is not
// compatible with node-chakracore.
var nodePath = path.dirname(process.execPath);
var nodeGypName = process.platform === 'win32' ? 'node-gyp.cmd' : 'node-gyp';
var delim = process.platform === 'win32' ? ';' : ':';
var globalNodeGypBin = process.env.Path.split(delim).filter(function(envPath) {
return envPath.startsWith(nodePath) &&
envPath.endsWith('node-gyp-bin') &&
fs.existsSync(path.resolve(envPath, nodeGypName));
});

if (globalNodeGypBin.length !== 0) {
return { exeName: 'node-gyp', args: [] };
}

console.error('node-gyp incompatible with node-chakracore! Please use node-gyp installed with node-chakracore.');
process.exit(1);
}

var localNodeGypBin = require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js'));

return {
Expand Down

0 comments on commit 5021dff

Please sign in to comment.