Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
build: Don't clobber symlinked npm
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jun 5, 2012
1 parent 4f6882e commit cc36cc5
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions tools/installer.js
Expand Up @@ -126,12 +126,23 @@ if (cmd === 'install') {

// Install npm (eventually)
if (variables.node_install_npm) {
copy('deps/npm', 'lib/node_modules/npm');
queue.push('ln -sf ../lib/node_modules/npm/bin/npm-cli.js ' +
path.join(dest_dir, node_prefix, 'bin/npm'));
queue.push([shebang, '#!' + path.join(node_prefix, 'bin/node'),
path.join(dest_dir, node_prefix,
'lib/node_modules/npm/bin/npm-cli.js')]);
// Frequently, in development, the installed npm is a symbolic
// link to the development folder, and so installing this is
// a bit annoying. If it's a symlink, skip it.
var isSymlink = false;
try {
var st = fs.lstatSync(path.resolve(node_prefix, 'lib/node_modules/npm'));
isSymlink = st.isSymbolicLink();
} catch (e) {}

if (!isSymlink) {
copy('deps/npm', 'lib/node_modules/npm');
queue.push('ln -sf ../lib/node_modules/npm/bin/npm-cli.js ' +
path.join(dest_dir, node_prefix, 'bin/npm'));
queue.push([shebang, '#!' + path.join(node_prefix, 'bin/node'),
path.join(dest_dir, node_prefix,
'lib/node_modules/npm/bin/npm-cli.js')]);
}
}
} else {
remove([
Expand Down

0 comments on commit cc36cc5

Please sign in to comment.