feat: add self-contained offline development resources
This commit is contained in:
@@ -24,6 +24,8 @@ esac
|
||||
archive_name="node-v${NODE_VERSION}-${platform}-${arch}.${archive_ext}"
|
||||
archive_path="$runtime_root/downloads/$archive_name"
|
||||
runtime_dir="$runtime_root/node-v${NODE_VERSION}-${platform}-${arch}"
|
||||
resource_home="${WEB_FREECAD_RESOURCE_LIBRARY:-${HOME}/resource-library/web-freecad-bitbybit}"
|
||||
resource_archive="$resource_home/toolchains/node/$archive_name"
|
||||
|
||||
if [ -x "$runtime_dir/bin/node" ] && [ "$($runtime_dir/bin/node --version)" = "v$NODE_VERSION" ]; then
|
||||
printf '%s\n' "$runtime_dir"
|
||||
@@ -41,6 +43,15 @@ if [ -e "$archive_path" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -e "$archive_path" ] && [ -e "$resource_archive" ]; then
|
||||
cp "$resource_archive" "$archive_path"
|
||||
fi
|
||||
|
||||
if [ ! -e "$archive_path" ] && { [ "${WEB_FREECAD_OFFLINE:-0}" = "1" ] || [ "${npm_config_offline:-false}" = "true" ]; }; then
|
||||
echo "Pinned Node archive is unavailable in the offline resource library: $resource_archive" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -e "$archive_path" ]; then
|
||||
temp_archive="$archive_path.part"
|
||||
rm -f "$temp_archive"
|
||||
|
||||
Reference in New Issue
Block a user