Skip to content

Commit 8ec7716

Browse files
authored
Merge pull request #4 from nodenv/postinstall
Print caveats on npm-postinstall
2 parents 4d1b6e2 + 69a0245 commit 8ec7716

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
"bugs": {
1313
"url": "https://github.com/nodenv/node-build-jxcore/issues"
1414
},
15+
"directories": {
16+
"test": "test"
17+
},
1518
"files": [
19+
"script",
1620
"share"
1721
],
18-
"directories": {
19-
"test": "./test"
20-
},
2122
"scripts": {
23+
"postinstall": "script/postinstall",
2224
"posttest": "npm run lint",
2325
"lint": "git ls-files bin script **/*.*sh | xargs shellcheck",
2426
"verify-definitions": "scripty",

script/postinstall

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
IFS=$'\n\t'
5+
6+
installed_by_name() {
7+
local pattern='"remain":\["'${npm_package_name-}
8+
9+
[[ ${npm_config_argv-} =~ $pattern ]]
10+
}
11+
12+
if [ -n "${npm_config_argv-}" ] && ! installed_by_name; then
13+
exit
14+
fi
15+
16+
cat <<-MSG
17+
====================
18+
${npm_package_name-} caveats:
19+
20+
For \`node-build\`/\`nodenv install\` to pick up definitions provided by this plugin,
21+
ensure '$PWD/share/node-build' exists in NODE_BUILD_DEFINITIONS.
22+
export NODE_BUILD_DEFINITIONS="$PWD/share/node-build"
23+
====================
24+
MSG

0 commit comments

Comments
 (0)