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

Commit

Permalink
Fix handling of build flag and empty env
Browse files Browse the repository at this point in the history
`./scripts/build.js --libsass_ext=auto` resets `libsass_*` whereas it should not.
This patch drops the env vars that have not been set at all.
  • Loading branch information
kapouer authored Aug 12, 2019
1 parent 2513e6a commit e55d2a2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ function afterBuild(options) {
*/

function build(options) {
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose'].concat(
['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].map(function(subject) {
return ['--', subject, '=', process.env[subject.toUpperCase()] || ''].join('');
})).concat(options.args);
var libargs = [];
['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].forEach(function(subject) {
var env = process.env[subject.toUpperCase()];
if (env != null) libargs.push(['--', subject, '=', env].join(''));
});
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose']
.concat(libargs)
.concat(options.args);

console.log('Building:', [process.execPath].concat(args).join(' '));

Expand Down

0 comments on commit e55d2a2

Please sign in to comment.