2020-04-24 23:36:52 +00:00
|
|
|
{ yarn2nix-moretea
|
2021-10-04 12:37:57 +00:00
|
|
|
, fetchFromGitHub, applyPatches
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
yarn2nix-moretea.mkYarnPackage rec {
|
2021-08-05 21:33:18 +00:00
|
|
|
pname = "gotify-ui";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
yarnNix = ./yarndeps.nix;
|
|
|
|
|
2020-05-03 17:38:23 +00:00
|
|
|
version = import ./version.nix;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-04 12:37:57 +00:00
|
|
|
src_all = applyPatches {
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gotify";
|
|
|
|
repo = "server";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = import ./source-sha.nix;
|
|
|
|
};
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace ui/yarn.lock \
|
|
|
|
--replace \
|
|
|
|
"https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001237.tgz" \
|
|
|
|
"https___registry.npmjs.org_caniuse_lite___caniuse_lite_1.0.30001237.tgz"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
src = "${src_all}/ui";
|
|
|
|
|
|
|
|
buildPhase = ''
|
2021-10-04 12:37:57 +00:00
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
export WRITABLE_NODE_MODULES="$(pwd)/tmp"
|
2022-09-30 11:47:45 +00:00
|
|
|
export NODE_OPTIONS=--openssl-legacy-provider
|
2021-10-04 12:37:57 +00:00
|
|
|
mkdir -p "$WRITABLE_NODE_MODULES"
|
|
|
|
|
|
|
|
# react-scripts requires a writable node_modules/.cache, so we have to copy the symlink's contents back
|
|
|
|
# into `node_modules/`.
|
|
|
|
# See https://github.com/facebook/create-react-app/issues/11263
|
|
|
|
cd deps/gotify-ui
|
|
|
|
node_modules="$(readlink node_modules)"
|
|
|
|
rm node_modules
|
|
|
|
mkdir -p "$WRITABLE_NODE_MODULES"/.cache
|
|
|
|
cp -r $node_modules/* "$WRITABLE_NODE_MODULES"
|
|
|
|
|
|
|
|
# In `node_modules/.bin` are relative symlinks that would be broken after copying them over,
|
|
|
|
# so we take care of them here.
|
|
|
|
mkdir -p "$WRITABLE_NODE_MODULES"/.bin
|
|
|
|
for x in "$node_modules"/.bin/*; do
|
|
|
|
ln -sfv "$node_modules"/.bin/"$(readlink "$x")" "$WRITABLE_NODE_MODULES"/.bin/"$(basename "$x")"
|
|
|
|
done
|
|
|
|
|
|
|
|
ln -sfv "$WRITABLE_NODE_MODULES" node_modules
|
|
|
|
cd ../..
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
yarn build
|
2021-10-04 12:37:57 +00:00
|
|
|
|
|
|
|
cd deps/gotify-ui
|
|
|
|
rm -rf node_modules
|
|
|
|
ln -sf $node_modules node_modules
|
|
|
|
cd ../..
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
}
|