Skip to content
Snippets Groups Projects
Verified Commit 72894eb6 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: update node

parent b7caf17d
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ tests: ...@@ -30,7 +30,7 @@ tests:
untracked: true untracked: true
key: key:
files: files:
- pnpm-lock.yaml - package
paths: paths:
- node_modules/ - node_modules/
rules: rules:
...@@ -47,7 +47,7 @@ web-tests: ...@@ -47,7 +47,7 @@ web-tests:
untracked: true untracked: true
key: key:
files: files:
- pnpm-lock.yaml - package-lock.json
paths: paths:
- node_modules/ - node_modules/
artifacts: artifacts:
......
...@@ -65,6 +65,9 @@ ...@@ -65,6 +65,9 @@
in { in {
packages = rec { packages = rec {
monster = pkgs'.callPackage ./nix/packages/monster.nix {inherit self pkgs';}; monster = pkgs'.callPackage ./nix/packages/monster.nix {inherit self pkgs';};
nodeModule = pkgs'.callPackage ./nix/packages/node-module.nix {inherit pkgs';};
default = monster; default = monster;
}; };
......
{
pkgs',
system,
...
}: let
releaseInfo = import ../config/release.nix;
src = ../..;
# Read the package-lock.json as a Nix attrset
packageLock = builtins.fromJSON (builtins.readFile (src + "/package-lock.json"));
# Helper function to safely get attributes
getAttr = attr: def: set:
if builtins.hasAttr attr set
then builtins.getAttr attr set
else def;
# Create an array of all (meaningful) dependencies
deps =
builtins.attrValues (removeAttrs packageLock.packages [""])
++ builtins.attrValues (removeAttrs (getAttr "dependencies" {} packageLock) [""]);
# Turn each dependency into a fetchurl call
fetchTarball = p:
pkgs'.fetchurl {
url = p.resolved;
hash = p.integrity;
};
tarballs = map fetchTarball deps;
# Write a file with the list of tarballs
tarballsFile = pkgs'.writeTextFile {
name = "tarballs";
text = builtins.concatStringsSep "\n" (map (x: x.outPath) tarballs);
};
stdenv = pkgs'.stdenv;
in
stdenv.mkDerivation {
inherit src;
name = "node-module";
version = releaseInfo.version;
buildPhase = ''
#!${pkgs'.bash}/bin/bash
source ${pkgs'.common}/bin/common
mkdir -p $out/
cd $out
cp -r $src/package.json .
cp -r $src/package-lock.json .
export HOME=$PWD/.home
export npm_config_cache=$PWD/.npm
export npm_config_offline=true
total_cores=$(nproc)
half_cores=$((total_cores / 2))
echo "Total cores: $total_cores"
if [ $half_cores -lt 1 ]; then
half_cores=1
fi
printf "will cite\n" | parallel --citation
nice -n 10 parallel -j $half_cores -a ${tarballsFile} npm cache add "{}" || {
echo "Failed to cache some packages"
exit 1
}
sleep 1
nice -n 10 npm ci --verbose --prefer-offline --no-audit --progress=true --loglevel=error || {
echo "Retrying npm ci without cache"
sleep 5
nice -n 10 npm ci --verbose --prefer-offline --no-audit --progress=true --loglevel=error || {
echo "Failed to install dependencies"
exit 1
}
}
'';
buildInputs = with pkgs'; [projectNodeJS getent strace coreutils bash rsync parallel findutils];
system = system;
}
...@@ -10,7 +10,7 @@ in ...@@ -10,7 +10,7 @@ in
echo_step "Installing dependencies" echo_step "Installing dependencies"
if ! ${pkgs'.findutils}/bin/find . -type d -name node_modules -prune -o -type f -name package.json -print | ${pkgs'.findutils}/bin/xargs -I {} sh -c "cd $(dirname {}); ${pkgs'.projectCorepack}/bin/pnpm install" if ! ${pkgs'.findutils}/bin/find . -type d -name node_modules -prune -o -type f -name package.json -print | ${pkgs'.findutils}/bin/xargs -I {} sh -c "cd $(dirname {}); ${pkgs'.projectCorepack}/bin/npm install"
then then
echo_error "Failed to install dependencies" echo_error "Failed to install dependencies"
echo_hint "Check the error message and try again" echo_hint "Check the error message and try again"
......
...@@ -14,7 +14,7 @@ pkgs'.writeShellScriptBin "run-ci-tests" '' ...@@ -14,7 +14,7 @@ pkgs'.writeShellScriptBin "run-ci-tests" ''
TEST_CASES_PATH="''${CI_PROJECT_DIR}/test/cases/" TEST_CASES_PATH="''${CI_PROJECT_DIR}/test/cases/"
if ! pnpm install if ! npm install
then then
echo "Failed to install dependencies" echo "Failed to install dependencies"
exit 1 exit 1
......
...@@ -14,7 +14,7 @@ pkgs'.writeShellScriptBin "run-ci-web-tests" '' ...@@ -14,7 +14,7 @@ pkgs'.writeShellScriptBin "run-ci-web-tests" ''
TEST_CASES_PATH="''${CI_PROJECT_DIR}/test/web/" TEST_CASES_PATH="''${CI_PROJECT_DIR}/test/web/"
if ! ${pkgs'.projectCorepack}/bin/pnpm install if ! ${pkgs'.projectCorepack}/bin/npm install
then then
echo "Failed to install dependencies" echo "Failed to install dependencies"
exit 1 exit 1
......
...@@ -23,7 +23,7 @@ in ...@@ -23,7 +23,7 @@ in
export VERSION=${releaseInfo.version} export VERSION=${releaseInfo.version}
export COMMIT=${releaseInfo.commit} export COMMIT=${releaseInfo.commit}
export PNPX_BIN=${pkgs'.nodePackages.pnpm}/bin/pnpx export PNPX_BIN=${pkgs'.nodePackages.npm}/bin/npx
export NODE_BIN=${pkgs'.projectNodeJS}/bin/node export NODE_BIN=${pkgs'.projectNodeJS}/bin/node
export LOCALHOST_CERTS_DIR=${pkgs'.alvineDevCerts} export LOCALHOST_CERTS_DIR=${pkgs'.alvineDevCerts}
......
...@@ -19,7 +19,7 @@ in ...@@ -19,7 +19,7 @@ in
echo_step "Installing dependencies (node)" echo_step "Installing dependencies (node)"
if ! ${pkgs'.findutils}/bin/find . -type d -name node_modules -prune -o -type f -name package.json -print | ${pkgs'.findutils}/bin/xargs -I {} sh -c "cd $(dirname {}); ${pkgs'.projectCorepack}/bin/pnpm install" if ! ${pkgs'.findutils}/bin/find . -type d -name node_modules -prune -o -type f -name package.json -print | ${pkgs'.findutils}/bin/xargs -I {} sh -c "cd $(dirname {}); ${pkgs'.projectCorepack}/bin/npm install"
then then
echo_error "Failed to install dependencies" echo_error "Failed to install dependencies"
echo_hint "Check the error message and try again" echo_hint "Check the error message and try again"
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -96,13 +96,5 @@ ...@@ -96,13 +96,5 @@
"vite-plugin-mock": "^3.0.2", "vite-plugin-mock": "^3.0.2",
"vite-plugin-terminal": "^1.2.0", "vite-plugin-terminal": "^1.2.0",
"ws": "^8.18.0" "ws": "^8.18.0"
},
"packageManager": "pnpm@10.1.0+sha512.c89847b0667ddab50396bbbd008a2a43cf3b581efd59cf5d9aa8923ea1fb4b8106c041d540d08acb095037594d73ebc51e1ec89ee40c88b30b8a66c0fae0ac1b",
"pnpm": {
"onlyBuiltDependencies": [
"esbuild",
"@biomejs/biome",
"puppeteer"
]
} }
} }
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment