mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
includes new Rhino jar that strips hashbangs before execution: https://github.com/jsdoc3/rhino/commit/95487737
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
|
|
var jsdocPath = path.resolve( path.join(__dirname, '..') );
|
|
var symlinkSrc = path.join( jsdocPath, 'lib', 'jsdoc' );
|
|
var symlinkDest = path.join( jsdocPath, 'node_modules', 'jsdoc' );
|
|
|
|
fs.lstat(symlinkDest, function(err, stats) {
|
|
// if the path exists, make sure it looks okay
|
|
if (!err) {
|
|
if ( stats.isSymbolicLink() ) {
|
|
// this is what we want
|
|
}
|
|
else if ( stats.isDirectory() ) {
|
|
console.warn('The path %s should be a symbolic link to %s rather than a standalone ' +
|
|
'directory. You may need to resolve this issue so that JSDoc can work correctly.',
|
|
symlinkDest, symlinkSrc);
|
|
}
|
|
|
|
process.exit(0);
|
|
}
|
|
else {
|
|
fs.symlink(symlinkSrc, symlinkDest, function(err) {
|
|
if (err) {
|
|
console.error('Unable to create a symbolic link from %s to %s: %s', symlinkSrc,
|
|
symlinkDest, err);
|
|
process.exit(1);
|
|
}
|
|
|
|
process.exit(0);
|
|
});
|
|
}
|
|
});
|