Skip to content

Commit

Permalink
chore: upgrade to yarn 4 (#2827)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Clément Janin <clement.janin@cds-snc.ca>
  • Loading branch information
bryan-robitaille and craigzour authored Nov 8, 2023
1 parent 37ab229 commit bf7ea6c
Show file tree
Hide file tree
Showing 24 changed files with 17,859 additions and 15,203 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/scripts/forms-dev-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ set -ex
###################################################################

cd /src
yarn install --production=false
yarn install
8 changes: 6 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ jobs:
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 18

- name: Yarn update to V4
run: corepack enable && yarn set version berry

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand All @@ -59,7 +63,7 @@ jobs:
linux-yarn-
- name: "Install dependencies"
run: yarn install:all
run: yarn workspace gcforms install

- name: Cypress Tests
uses: cypress-io/github-action@d79d2d530a66e641eb4a5f227e13bc985c60b964 # v4.2.2
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ jobs:
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 18

- name: Yarn update to V4
run: corepack enable && yarn set version berry

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand All @@ -28,7 +31,7 @@ jobs:
linux-yarn-
- name: "Install dependencies"
run: yarn install:all
run: yarn workspace gcforms install

env:
CI: TRUE
Expand All @@ -47,9 +50,12 @@ jobs:
with:
node-version: 18

- name: Yarn update to V4
run: corepack enable && yarn set version berry

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand All @@ -60,7 +66,7 @@ jobs:
linux-yarn-
- name: "Install dependencies"
run: yarn install:all --prefer-offline
run: yarn workspace gcforms install
env:
CI: TRUE
- name: Test Code Linting on Pull Request
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ jobs:
with:
node-version: 18

- name: Yarn update to V4
run: corepack enable && yarn set version berry

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand All @@ -27,7 +30,7 @@ jobs:
linux-yarn-
- name: "Install dependencies"
run: yarn install:all
run: yarn workspace gcforms install

- name: Jest Tests
run: yarn test
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ typings/
# Optional npm cache directory
.npm

# Yarn caches and logs
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Optional eslint cache
.eslintcache

Expand Down Expand Up @@ -88,6 +97,7 @@ package-lock.json

# VS Code Settings untracking
.vscode/settings.json
.vscode/extensions.json

# Utils retrieval output
responses.csv
893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.1.cjs
30 changes: 14 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
FROM node:18
FROM node:18 as build
ENV NODE_ENV=production

COPY . /src
WORKDIR /src


ARG COGNITO_REGION="ca-central-1"
ARG COGNITO_APP_CLIENT_ID
ARG COGNITO_USER_POOL_ID

ARG INDEX_SITE="false"
ENV INDEX_SITE=$INDEX_SITE

RUN yarn install --silent --production=false
RUN corepack enable && yarn set version berry
RUN yarn workspace gcforms install --immutable --silent
RUN yarn build
RUN yarn install --production

FROM node:18
RUN yarn workspaces focus gcforms --production

COPY flag_initialization /src
WORKDIR /src
RUN yarn install --silent

FROM node:18
FROM node:18 as final
LABEL maintainer="-"

ENV NODE_ENV=production

ARG COGNITO_REGION="ca-central-1"
ENV COGNITO_REGION=$COGNITO_REGION

Expand All @@ -39,17 +35,19 @@ ENV INDEX_SITE=$INDEX_SITE

WORKDIR /src

COPY package.json yarn.lock ./
# Update to latest yarn version
RUN corepack enable && yarn set version berry

COPY --from=0 /src/node_modules ./node_modules
COPY --from=0 /src/.next ./.next
COPY package.json yarn.lock ./
COPY --from=build /src/node_modules ./node_modules
COPY flag_initialization ./flag_initialization
RUN yarn workspace flag_initialization install
COPY --from=build /src/.next ./.next
COPY public ./public
COPY next.config.js .
COPY next-i18next.config.js .
COPY prisma ./prisma
COPY form-builder-templates ./form-builder-templates
COPY flag_initialization ./flag_initialization
COPY --from=1 /src/node_modules ./flag_initialization/node_modules


ENV PORT 3000
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.pr
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ ARG COGNITO_USER_POOL_ID

ARG INDEX_SITE="false"
ENV INDEX_SITE=$INDEX_SITE

RUN yarn install --silent --production=false
RUN corepack enable && yarn set version berry
RUN yarn workspace gcforms install
RUN yarn build
RUN yarn install --production

FROM node:18 as final
LABEL maintainer="-"
Expand Down Expand Up @@ -51,7 +50,8 @@ COPY public ./public
COPY prisma ./prisma
COPY form-builder-templates ./form-builder-templates
COPY bin/pr-review-entrypoint.sh ./entrypoint.sh

# Update to latest yarn version
RUN corepack enable && yarn set version berry
# Required by the entrypoint.sh to load the SSM ParameterStore environment variables
RUN apt-get update && apt-get install -y awscli

Expand Down
3 changes: 2 additions & 1 deletion components/form-builder/app/ConfirmDelete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const ConfirmDelete = ({
if (result && "error" in result) {
if (
result.error.response?.status === 405 &&
result.error.response?.data.error === "Found unprocessed submissions"
(result.error.response?.data as Record<string, unknown> | undefined)?.error ===
"Found unprocessed submissions"
) {
toast.error(t("formDeletedResponsesExist"));
return;
Expand Down
11 changes: 6 additions & 5 deletions flag_initialization/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "forms-flags-migrations",
"name": "flag_initialization",
"version": "0.1.0",
"description": "Initiates the Feature Flags between application versions",
"main": "index.js",
"private": true,
"scripts": {
"initialize": "node index.js"
"initialize": "yarn node index.js"
},
"keywords": [],
"author": "Bryan Robitaille",
"dependencies": {
"dotenv": "^16.0.1",
"ioredis": "^5.2.3"
}
"dotenv": "16.0.1",
"ioredis": "5.2.3"
},
"packageManager": "yarn@4.0.1"
}
77 changes: 0 additions & 77 deletions flag_initialization/yarn.lock

This file was deleted.

Loading

0 comments on commit bf7ea6c

Please sign in to comment.