Skip to content

Commit

Permalink
building npm: Yell if you try to package npm@3 with npm@2
Browse files Browse the repository at this point in the history
npm@2's packager can't handle npm@3's bundled node_modules, so
you either have to use a version that we've built for you (eg
one published to the registry) or use the one that you're building.
  • Loading branch information
iarna committed Jun 26, 2015
1 parent 2da0ce8 commit 231a582
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
"tap": "tap --timeout 240 test/tap/*.js",
"test-all": "npm run test-legacy && npm test",
"preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true",
"prepublish": "node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc",
"prepublish": "bash scripts/installable.sh && node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc",
"dumpconf": "env | grep npm | sort | uniq"
},
"license": "Artistic-2.0"
Expand Down
13 changes: 13 additions & 0 deletions scripts/installable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
npmver=$(perl -E "say q{$npm_config_user_agent} =~ m{/(\S+)}")

if semver -r ^3.0.0-0 $npmver > /dev/null; then
echo "Packaging with $npmver"
else
echo "Packaging or installing npm@$npm_package_version with npm@$npmver is impossible." 1>&2
echo "Please install npm@^3.0.0-0 from the registry and use that or run your command with" 1>&2
echo "this version of npm with:" 1>&2
npmargs=$(node -e "a=$npm_config_argv; console.log(a.original.join(' '))")
echo " $npm_node_execpath $PWD $npmargs" 1>&2
exit 1
fi

0 comments on commit 231a582

Please sign in to comment.