Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"url": "https://github.com/nodenv/node-build-prerelease/issues"
},
"files": [
"script",
"share"
],
"directories": {
"test": "./test"
"test": "test"
},
"scripts": {
"postinstall": "script/postinstall",
"posttest": "npm run lint",
"lint": "git ls-files bin script **/*.*sh | xargs shellcheck",
"verify-definitions": "scripty",
Expand Down
24 changes: 24 additions & 0 deletions script/postinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

installed_by_name() {
local pattern='"remain":\["'${npm_package_name-}

[[ ${npm_config_argv-} =~ $pattern ]]
}

if [ -n "${npm_config_argv-}" ] && ! installed_by_name; then
exit
fi

cat <<-MSG
====================
${npm_package_name-} caveats:

For \`node-build\`/\`nodenv install\` to pick up definitions provided by this plugin,
ensure '$PWD/share/node-build' exists in NODE_BUILD_DEFINITIONS.
export NODE_BUILD_DEFINITIONS="$PWD/share/node-build"
====================
MSG