forked from sass/node-sass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Instead of providing the binaries with the package, it'll only download the needed binary for the users system. * Will only build if the tests fail. * Move `build.js` into scripts since it's not part of the actual API. * Move binaries to `vendor` folder to keep it separate from the rest of the code. Fixes sass#504.
- Loading branch information
Showing
6 changed files
with
87 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
*.log | ||
.DS_Store | ||
.sass-cache | ||
bin | ||
!bin/node-sass | ||
build | ||
lib-cov | ||
node_modules | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
var fs = require('fs'), | ||
path = require('path'), | ||
Download = require('download'), | ||
status = require('download-status'); | ||
|
||
/** | ||
* Check if binaries exists | ||
* | ||
* @api private | ||
*/ | ||
|
||
function exists() { | ||
var v8 = 'v8-' + /[0-9]+\.[0-9]+/.exec(process.versions.v8)[0]; | ||
var name = process.platform + '-' + process.arch + '-' + v8; | ||
|
||
fs.exists(path.join(__dirname, '..', 'vendor', name), function (exists) { | ||
if (exists) { | ||
return; | ||
} | ||
|
||
fetch(name); | ||
}); | ||
} | ||
|
||
/** | ||
* Fetch binaries | ||
* | ||
* @param {String} name | ||
* @api private | ||
*/ | ||
|
||
function fetch(name) { | ||
var download = new Download({ | ||
extract: true, | ||
mode: '777', | ||
strip: 1 | ||
}); | ||
|
||
var url = [ | ||
'https://github.com/sass/node-sass-binaries/raw/master/', | ||
name + '/binding.node' | ||
].join(''); | ||
|
||
download.get(url); | ||
download.dest(path.join(__dirname, '..', 'vendor', name)); | ||
download.use(status()); | ||
|
||
download.run(function(err) { | ||
if (err) { | ||
console.error(err.message); | ||
return; | ||
} | ||
|
||
console.log('Binary installed in ' + download.dest()); | ||
}); | ||
} | ||
|
||
/** | ||
* Skip if CI | ||
*/ | ||
|
||
if (process.env.CI || process.env.APPVEYOR) { | ||
console.log('Skipping downloading binaries on CI builds'); | ||
return; | ||
} | ||
|
||
/** | ||
* Run | ||
*/ | ||
|
||
exists(); |
This file was deleted.
Oops, something went wrong.