Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json2
-rw-r--r--scripts/installable.sh13
2 files changed, 14 insertions, 1 deletions
diff --git a/package.json b/package.json
index 6838c2938..e959f48fd 100644
--- a/package.json
+++ b/package.json
@@ -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"
diff --git a/scripts/installable.sh b/scripts/installable.sh
new file mode 100644
index 000000000..1d5a90c29
--- /dev/null
+++ b/scripts/installable.sh
@@ -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