1 #! /usr/bin/env nix-shell
2 #! nix-shell -i bash -p gnused nix nodejs prefetch-npm-deps wget
5 pushd "$(dirname "${BASH_SOURCE[0]}")"
7 version
=$
(npm view @vue
/language-server version
)
8 tarball
="language-server-$version.tgz"
9 url
="https://registry.npmjs.org/@vue/language-server/-/$tarball"
11 if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then
12 echo "Already up to date!"
16 sed -i 's#version = "[^"]*"#version = "'"$version"'"#' package.nix
18 sha256
=$
(nix-prefetch-url
"$url")
19 src_hash
=$
(nix-hash
--to-sri --type sha256
"$sha256")
20 sed -i 's#hash = "[^"]*"#hash = "'"$src_hash"'"#' package.nix
22 rm -f package-lock.json package.json
*.tgz
24 tar xf
"$tarball" --strip-components=1 package
/package.json
25 npm i
--package-lock-only --ignore-scripts
26 npm_hash
=$
(prefetch-npm-deps package-lock.json
)
27 sed -i 's#npmDepsHash = "[^"]*"#npmDepsHash = "'"$npm_hash"'"#' package.nix
28 rm -f package.json
*.tgz