Switch to new package format
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
||||
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
||||
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
||||
|
||||
#
|
||||
# Source script mostly copied from Arch Linux
|
||||
#
|
||||
|
||||
# The build function is executed in the source directory
|
||||
# This function is used to compile the source code
|
||||
build() {
|
||||
node scripts/resetdeps.js
|
||||
}
|
||||
|
||||
# The check function is executed in the source directory
|
||||
# This function is used to run tests to verify the package has been compiled correctly
|
||||
check() {
|
||||
# Windows shims test failure
|
||||
mv test/bin/windows-shims.js{,.bak}
|
||||
node . run test --ignore-scripts -- --no-coverage
|
||||
mv test/bin/windows-shims.js{.bak,}
|
||||
}
|
||||
|
||||
# The package function is executed in the source directory
|
||||
# This function is used to move the compiled files into the output directory
|
||||
package() {
|
||||
mod_dir=/usr/lib/node_modules/npm
|
||||
|
||||
install -d "$BPM_OUTPUT"/usr/share/{bash-completion/completions,licenses/npm}
|
||||
ln -s "$mod_dir"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/npm/LICENSE
|
||||
|
||||
node . install -g --prefix="${BPM_OUTPUT}/usr" "$(node . pack --ignore-scripts | tail -1)"
|
||||
node . completion > "$BPM_OUTPUT"/usr/share/bash-completion/completions/npm
|
||||
echo 'globalconfig=/etc/npmrc' > "$BPM_OUTPUT"/$mod_dir/npmrc
|
||||
|
||||
cd "$BPM_OUTPUT"/"$mod_dir"
|
||||
# Remove superfluous scripts
|
||||
rm -r {bin/{node-gyp-bin,np{m,x}{,.{cmd,ps1}}},node_modules/.bin}
|
||||
|
||||
# Experimental dedup
|
||||
rm -r node_modules/{node-gyp,nopt,semver}
|
||||
}
|
||||
Reference in New Issue
Block a user