Skip to content

Commit

Permalink
Bump yarn to v4.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rauboti committed May 15, 2024
1 parent b2e3292 commit 0c7f4a3
Show file tree
Hide file tree
Showing 7 changed files with 18,474 additions and 13,050 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI
on: [push, pull_request]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_CLIENT_ID }}
AWS_DEFAULT_REGION: 'eu-west-1'
AWS_DEFAULT_REGION: "eu-west-1"
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_CLIENT_SECRET }}
NDLA_AWS_ECR_REPO: ${{ secrets.NDLA_AWS_ECR_REPO }}
CI_RELEASE_ROLE: ${{ secrets.CI_RELEASE_ROLE }}
Expand All @@ -16,35 +16,39 @@ env:
GH_PR_SHA: ${{ github.event.pull_request.head.sha }}
jobs:
unit_tests:
name: 'Unit tests'
name: "Unit tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20.13.1'
- name: 'Login to ECR repo'
run:
RES=$(aws sts assume-role --role-arn $CI_RELEASE_ROLE --role-session-name github-actions-ecr-login)
node-version: "20.13.1"
- name: "Login to ECR repo"
run: RES=$(aws sts assume-role --role-arn $CI_RELEASE_ROLE --role-session-name github-actions-ecr-login)
AWS_ACCESS_KEY_ID=$(echo $RES | jq -r .Credentials.AccessKeyId)
AWS_SECRET_ACCESS_KEY=$(echo $RES | jq -r .Credentials.SecretAccessKey)
AWS_SESSION_TOKEN=$(echo $RES | jq -r .Credentials.SessionToken)
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin $NDLA_AWS_ECR_REPO
- name: 'Login to dockerhub'
- name: "Login to dockerhub"
run: echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USERNAME --password-stdin
- name: "Enable yarn v4"
run: |
corepack enable
yarn set version 4.2.2
- uses: actions/cache@v3
with:
path: |
**/node_modules
.eslintcache
.yarn/cache
~/.npm
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: 'Install'
run: yarn install --frozen-lockfile
- name: 'Check-all'
- name: "Install"
run: yarn install --immutable
- name: "Check-all"
run: yarn check-all
- name: 'Build'
- name: "Build"
run: yarn build
- name: 'Deploy vercel build'
- name: "Deploy vercel build"
run: yarn ndla-scripts vercel-github
continue-on-error: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ scripts/.cache/
.vscode
.env
.vercel
/.yarn/
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ ENV HOME=/home/app
ENV APP_PATH=$HOME/listing-frontend

# Copy necessary files for installing dependencies
COPY yarn.lock package.json $APP_PATH/
COPY yarn.lock package.json .yarnrc.yml $APP_PATH/

# Enable yarn
RUN corepack enable

# Run yarn before src copy to enable better layer caching
WORKDIR $APP_PATH
RUN mkdir -p $APP_PATH/build && yarn
RUN mkdir -p $APP_PATH/build && yarn install --immutable

# Copy necessary source files for server and client build
COPY .babelrc postcss.config.js tsconfig.json $APP_PATH/
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
"graphql": "^15.5.0",
"helmet": "^4.2.0",
"i18next": "^21.9.2",
"node-fetch": "^2.6.7",
"lodash": "^4.17.21",
"node-fetch": "^2.6.7",
"process": "^0.11.10",
"query-string": "^6.10.1",
"react": "^17.0.2",
Expand All @@ -140,5 +140,6 @@
},
"homepage": "https://github.com/NDLANO/listing-frontend",
"author": "ndla@knowit.no",
"license": "GPL-3.0"
"license": "GPL-3.0",
"packageManager": "yarn@4.2.2"
}
5 changes: 4 additions & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import chalk from "chalk";
import { rmSync } from "fs";
import { rmSync, copyFile } from "fs";
import { resolve } from "path";
import webpack, { Stats, StatsCompilation, Configuration, StatsError } from "webpack";
import getConfig from "../webpack/getConfig";
Expand Down Expand Up @@ -61,6 +61,9 @@ const main = async () => {
rmSync(resolve("./build"), { recursive: true, force: true });
await build(clientConfig, "client");
await build(serverConfig, "server");
await copyFile(resolve("build/assets.json"), resolve("build/public/static/assets.json"), (err) => {
if (err) throw err;
});
};

const compile = (
Expand Down
Loading

0 comments on commit 0c7f4a3

Please sign in to comment.