From ceff285ff533a31047a601ea9830be3619bdc136 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 26 Mar 2025 14:05:44 +0000 Subject: [PATCH] fix(setup): Update setup script to install only net-snmp dependency and create a minimal package-lock.json for better dependency control. --- changelog.md | 7 +++++++ setup.sh | 38 +++++++++++++++++++++++++++++++------- ts/00_commitinfo_data.ts | 2 +- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/changelog.md b/changelog.md index 1e1f0ec..e9d2561 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2025-03-26 - 2.6.3 - fix(setup) +Update setup script to install only net-snmp dependency and create a minimal package-lock.json for better dependency control. + +- Removed full production dependency install in favor of installing only net-snmp@3.20.0 +- Added verification step to confirm net-snmp installation +- Generate a minimal package-lock.json if one does not exist + ## 2025-03-26 - 2.6.2 - fix(setup/readme) Improve force update instructions and dependency installation process in setup.sh and readme.md diff --git a/setup.sh b/setup.sh index d5b533e..3ddb31c 100644 --- a/setup.sh +++ b/setup.sh @@ -248,20 +248,44 @@ export PATH="$NODE_BIN_DIR:$PATH" echo "Removing existing node_modules directory..." rm -rf "$SCRIPT_DIR/node_modules" -# Install production dependencies -echo "Installing production dependencies..." +# Install ONLY the net-snmp production dependency +echo "Installing ONLY net-snmp production dependency..." echo "Using Node.js binary from: $NODE_BIN_DIR" echo "Node version: $(node --version)" echo "NPM version: $(npm --version)" -npm --prefix "$SCRIPT_DIR" install --omit=dev --no-audit --no-fund +# Install just net-snmp directly, don't rely on package.json +npm --prefix "$SCRIPT_DIR" install --no-save net-snmp@3.20.0 --no-audit --no-fund -if [ $? -ne 0 ]; then - echo "Error: Failed to install dependencies. NUPST may not function correctly." +# Verify only net-snmp is installed +echo "Verifying only net-snmp is installed in node_modules..." +find "$SCRIPT_DIR/node_modules" -maxdepth 1 -type d | sort + +INSTALL_STATUS=$? +if [ $INSTALL_STATUS -ne 0 ]; then + echo "Error: Failed to install net-snmp dependency. NUPST may not function correctly." echo "You can try to install dependencies manually by running:" - echo "cd $SCRIPT_DIR && npm install --omit=dev" + echo "cd $SCRIPT_DIR && npm install net-snmp@3.20.0" else - echo "Dependencies installed successfully." + echo "net-snmp dependency installed successfully." + + # Create minimal package-lock.json if it doesn't exist + if [ ! -f "$SCRIPT_DIR/package-lock.json" ]; then + echo "Creating minimal package-lock.json..." + echo '{ + "name": "@serve.zone/nupst", + "version": "2.6.2", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "net-snmp": "3.20.0" + } + } + } +}' > "$SCRIPT_DIR/package-lock.json" + fi fi # Restore the original PATH diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 1412c40..a16e6bf 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/nupst', - version: '2.6.2', + version: '2.6.3', description: 'Node.js UPS Shutdown Tool for SNMP-enabled UPS devices' }