Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Replace yarn with npm in the pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
CMeeg committed Nov 19, 2021
1 parent 8428619 commit 9967d39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
14 changes: 7 additions & 7 deletions .azure/azure-pipelines.yml
Expand Up @@ -139,19 +139,19 @@ stages:
- task: Cache@2
displayName: 'Cache node_modules'
inputs:
key: node_modules | $(Agent.OS) | package.json | yarn.lock
key: node_modules | $(Agent.OS) | package.json | package-lock.json
path: '$(System.DefaultWorkingDirectory)/node_modules'
continueOnError: true

- task: Cache@2
displayName: 'Cache .next/cache'
inputs:
key: next | $(Agent.OS) | package.json | yarn.lock
key: next | $(Agent.OS) | package.json | package-lock.json
path: '$(System.DefaultWorkingDirectory)/.next/cache'
continueOnError: true

- pwsh: yarn --frozen-lockfile --network-timeout=100000
displayName: 'yarn install'
- pwsh: npm install
displayName: 'npm install'

# Use the app settings output from the ARM deployment to set environment variables that are required for our Next app build
- task: AzureCLI@2
Expand All @@ -164,8 +164,8 @@ stages:
$webAppSettings = (az deployment group show -n "$(DeploymentName)" -g $(AzureResourceGroup) --query properties.outputs.webAppSettings.value | ConvertFrom-Json -AsHashtable)
foreach ($setting in $webAppSettings.GetEnumerator()) { $key=$setting.Key; $value=$setting.Value; Write-Output("##vso[task.setvariable variable=${key};]${value}") }
- pwsh: yarn build
displayName: 'yarn build'
- pwsh: npm run build
displayName: 'npm run build'

# `node_modules` are not included in the build artifact - they will be installed on the server by a post-deployment script
- task: CopyFiles@2
Expand All @@ -177,8 +177,8 @@ stages:
public/**
next.config.js
package.json
package-lock.json
server.js
yarn.lock
TargetFolder: '$(DistDirectory)'

# These files are required by the app service to run the Next app under IIS, and include the post-deployment script mentioned in the previous task
Expand Down
13 changes: 4 additions & 9 deletions .azure/web-app/deploy.cmd
Expand Up @@ -2,7 +2,7 @@

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.9
:: Version: 1.0.17
:: ----------------------

:: Prerequisites
Expand Down Expand Up @@ -97,15 +97,10 @@ IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
:: 2. Select node version
call :SelectNodeVersion

:: 3. Install Yarn
echo Verifying Yarn Install.
call :ExecuteCmd !NPM_CMD! install yarn -g

:: 4. Install Yarn packages
echo Installing Yarn Packages.
:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
pushd "%DEPLOYMENT_TARGET%"
call :ExecuteCmd C:\local\AppData\npm\yarn install --frozen-lockfile --production --network-timeout=100000
call :ExecuteCmd !NPM_CMD! install --production
IF !ERRORLEVEL! NEQ 0 goto error
popd
)
Expand Down Expand Up @@ -135,4 +130,4 @@ exit /b 1

:end
endlocal
echo Finished successfully.
echo Finished successfully.

0 comments on commit 9967d39

Please sign in to comment.