From f505618104413049b5f7d9bd94286b06fa9ab6ac Mon Sep 17 00:00:00 2001 From: Stivenjs Date: Wed, 4 Jun 2025 22:32:31 -0500 Subject: [PATCH] chore(amplify): add Node version management and npm installation in preBuild phase This commit enhances the amplify.yml configuration by adding Node version management and npm installation commands in the preBuild phase for both backend and frontend. Additionally, it updates the package.json to include a prepare script for husky, improving the build setup. --- amplify.yml | 12 +++++++++++- package.json | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/amplify.yml b/amplify.yml index e69489b5..e7337a9f 100644 --- a/amplify.yml +++ b/amplify.yml @@ -1,12 +1,22 @@ version: 1 backend: phases: + preBuild: + commands: + - nvm install 22 + - nvm use 22 build: commands: - npm ci --cache .npm --prefer-offline - npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID + frontend: phases: + preBuild: + commands: + - nvm use 22 + - npm ci + build: commands: - npm run build @@ -18,4 +28,4 @@ frontend: paths: - .next/cache/**/* - .npm/**/* - - node_modules/**/* \ No newline at end of file + - node_modules/**/* diff --git a/package.json b/package.json index 30fdfa58..5afdbe72 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "build": "next build", "start": "next start", "lint": "next lint", + "prepare": "husky", "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage"