Skip to content

Commit

Permalink
remove testing readme, update uninstall and refactor env vars in inst…
Browse files Browse the repository at this point in the history
…all script
  • Loading branch information
svetlanabrennan committed Aug 30, 2024
1 parent f5e1b0c commit b69583c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 115 deletions.
9 changes: 3 additions & 6 deletions cloud-tooling/azure-site-extension/Content/install.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Define paths
# Define the path to the node_modules directory and the package to check
$extensionModulesPath = "$PSScriptRoot\node_modules"
$appRootPath = "$env:HOME\site\wwwroot"
$userModulesPath = "$appRootPath\node_modules"

# Define the path to the node_modules directory and the package to check
$UserNodeModulesPath = "$env:HOME"
$packageName = "newrelic"

WriteToInstallLog "Explicitly adding node to path"
Expand All @@ -20,7 +17,7 @@ function Check-Version {
WriteToInstallLog "Checking installed version..."

# Get installed version using npm list
$installedVersionOutput = & npm ls $packageName --prefix $UserNodeModulesPath | Select-String -Pattern "$packageName@(\S+)"
$installedVersionOutput = & npm ls $packageName --prefix "$env:HOME" | Select-String -Pattern "$packageName@(\S+)"

if ($installedVersionOutput) {
$UserVersion = $installedVersionOutput.Matches.Groups[1].Value
Expand Down Expand Up @@ -94,7 +91,7 @@ function Copy-NodeModules {

# Install node agent using npm
WriteToInstallLog "Executing npm install newrelic@latest"
npm install --prefix "$env:HOME\site\wwwroot" newrelic
npm install --prefix $appRootPath newrelic

# Check if the installation was successful
if ($LASTEXITCODE -ne 0) {
Expand Down
15 changes: 13 additions & 2 deletions cloud-tooling/azure-site-extension/Content/uninstall.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
:: Copyright 2024 New Relic Corporation. All rights reserved.
:: SPDX-License-Identifier: Apache-2.0

SET NEW_RELIC_FOLDER="%HOME%\node_modules/newrelic"
SET NEW_RELIC_FOLDER="%HOME%\site\wwwroot\node_modules\newrelic"
IF EXIST %NEW_RELIC_FOLDER% (
npm uninstall newrelic
echo Uninstalling newrelic...
cd "%HOME%\site\wwwroot"
call npm uninstall newrelic --save
rmdir /s /q "%HOME%\site\wwwroot\node_modules\@newrelic"
IF %ERRORLEVEL% NEQ 0 (
echo Failed to uninstall newrelic
exit /b 1
) ELSE (
echo Successfully uninstalled newrelic
)
) ELSE (
echo newrelic package not found in node_modules
)
107 changes: 0 additions & 107 deletions cloud-tooling/azure-site-extension/README.md

This file was deleted.

0 comments on commit b69583c

Please # to comment.