mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Catch module load errors in build/post-install.js.
Former-commit-id: 6671d4925749d8b4d6da9ddd732bc7f436b6740d
This commit is contained in:
@@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
/** Load Node modules */
|
/** Load Node modules */
|
||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
https = require('https'),
|
path = require('path');
|
||||||
path = require('path'),
|
|
||||||
tar = require('../vendor/tar/tar.js'),
|
|
||||||
zlib = require('zlib');
|
|
||||||
|
|
||||||
/** The path of the directory that is the base of the repository */
|
/** The path of the directory that is the base of the repository */
|
||||||
var basePath = fs.realpathSync(path.join(__dirname, '..'));
|
var basePath = fs.realpathSync(path.join(__dirname, '..'));
|
||||||
@@ -88,7 +85,7 @@
|
|||||||
var decompressor = zlib.createUnzip(),
|
var decompressor = zlib.createUnzip(),
|
||||||
parser = new tar.Extract({ 'path': path });
|
parser = new tar.Extract({ 'path': path });
|
||||||
|
|
||||||
decompressor.on('error', callback)
|
decompressor.on('error', callback);
|
||||||
parser.on('end', callback).on('error', callback);
|
parser.on('end', callback).on('error', callback);
|
||||||
response.pipe(decompressor).pipe(parser);
|
response.pipe(decompressor).pipe(parser);
|
||||||
})
|
})
|
||||||
@@ -98,22 +95,41 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
if (process.env.npm_config_global === 'true') {
|
if (process.env.npm_config_global === 'true') {
|
||||||
// download the Closure Compiler
|
// catch module load errors
|
||||||
getDependency({
|
try {
|
||||||
'title': 'the Closure Compiler',
|
var https = require('https'),
|
||||||
'id': closureId,
|
tar = require('../vendor/tar/tar.js'),
|
||||||
'path': vendorPath,
|
zlib = require('zlib');
|
||||||
'onComplete': function() {
|
|
||||||
// download UglifyJS
|
// download the Closure Compiler
|
||||||
getDependency({
|
getDependency({
|
||||||
'title': 'UglifyJS',
|
'title': 'the Closure Compiler',
|
||||||
'id': uglifyId,
|
'id': closureId,
|
||||||
'path': vendorPath,
|
'path': vendorPath,
|
||||||
'onComplete': function() {
|
'onComplete': function() {
|
||||||
process.exit();
|
// download UglifyJS
|
||||||
}
|
getDependency({
|
||||||
});
|
'title': 'UglifyJS',
|
||||||
}
|
'id': uglifyId,
|
||||||
});
|
'path': vendorPath,
|
||||||
|
'onComplete': function() {
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch(e) {
|
||||||
|
console.log([
|
||||||
|
'Oops! There was a problem installing dependencies required by the Lo-Dash',
|
||||||
|
'command-line executable. To manually install UglifyJS and the Closure Compiler',
|
||||||
|
'run:',
|
||||||
|
'',
|
||||||
|
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + closureId + " | tar xvz -C '" + vendorPath + "'",
|
||||||
|
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + uglifyId + " | tar xvz -C '" + vendorPath + "'",
|
||||||
|
''
|
||||||
|
].join('\n'));
|
||||||
|
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
|
|||||||
Reference in New Issue
Block a user