Skip to content

Commit

Permalink
Merge branch 'staging' of github.com:Vizzuality/fora into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
martintomas committed Dec 14, 2024
2 parents 5fff784 + bdd53e4 commit 3393a81
Show file tree
Hide file tree
Showing 68 changed files with 9,770 additions and 20,521 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/client_ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,35 @@ env:
jobs:
tests:
name: Run client tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
defaults:
run:
working-directory: client

steps:
- name: Checkout️
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use Node.js 16.14
uses: actions/setup-node@v3
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: '16.14'
node-version-file: client/.nvmrc

- name: Install node modules
working-directory: client
run: yarn install
- uses: pnpm/action-setup@v4
with:
package_json_file: client/package.json
#
- name: Install dependencies
run: pnpm install

- name: Run tests
working-directory: client
run: yarn test
run: pnpm test

deploy:
name: Deploy client app
# if: (github.head_ref || github.ref_name) == 'main' || (github.head_ref || github.ref_name) == 'staging'
if: (github.head_ref || github.ref_name) == 'staging'
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: tests

steps:
Expand Down
5 changes: 1 addition & 4 deletions client/.env.default
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
NEXTAUTH_SECRET=
NEXTAUTH_URL=http://localhost:$PORT

# API Url. Depending on the environment we will use different urls. It can be the same for the storybook and for the project.
# API Url. Depending on the environment we will use different urls.
NEXT_PUBLIC_API_URL=https://staging.fora.dev-vizzuality.com/sub-path/backend/api/v1
NEXT_PUBLIC_API_URL_FAKE=https://jsonplaceholder.typicode.com
STORYBOOK_API_URL=$NEXT_PUBLIC_API_URL
STORYBOOK_API_URL_FAKE=$NEXT_PUBLIC_API_URL_FAKE

# Google Analytics tracking ID. If you're working with an Google Analytics 4 property, you have a Measurement ID instead of a Tracking ID.
NEXT_PUBLIC_GA_TRACKING_ID=UA-000000-2
Expand Down
1 change: 0 additions & 1 deletion client/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
/node_modules
/cypress
/public
/storybook-static
16 changes: 3 additions & 13 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
Expand All @@ -40,17 +38,9 @@ yarn-error.log*
/cypress/screenshots
/cypress/videos

# Yarn
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions

.pnp.*

# typescript
tsconfig.tsbuildinfo

# storybook
/storybook-static/
*.tsbuildinfo
next-env.d.ts
2 changes: 1 addition & 1 deletion client/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.14
v22.11.0
109 changes: 0 additions & 109 deletions client/.storybook/main.js

This file was deleted.

6 changes: 0 additions & 6 deletions client/.storybook/manager.js

This file was deleted.

15 changes: 0 additions & 15 deletions client/.storybook/preview-head.html

This file was deleted.

34 changes: 0 additions & 34 deletions client/.storybook/preview.js

This file was deleted.

768 changes: 0 additions & 768 deletions client/.yarn/releases/yarn-3.1.1.cjs

This file was deleted.

3 changes: 0 additions & 3 deletions client/.yarnrc.yml

This file was deleted.

27 changes: 19 additions & 8 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
# Install dependencies only when needed
FROM node:16.14-alpine3.15 AS deps
FROM node:22.11.0-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat git
#RUN apk add --no-cache libc6-compat git

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

WORKDIR /app
COPY .yarn ./.yarn
COPY package.json yarn.lock .yarnrc.yml ./
RUN yarn install --immutable
RUN corepack enable

#COPY .yarn ./.yarn
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --prod --frozen-lockfile
#RUN yarn install --immutable


# If using npm with a `package-lock.json` comment out above and use below instead
# COPY package.json package-lock.json ./
# RUN npm ci

# Rebuild the source code only when needed
FROM node:16.14-alpine3.15 AS builder
FROM node:22.11.0-alpine AS builder
WORKDIR /app
RUN corepack enable

COPY . .
COPY --from=deps /app/node_modules ./node_modules

Expand All @@ -22,10 +32,11 @@ COPY --from=deps /app/node_modules ./node_modules
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1

RUN yarn build
RUN pnpm build

# Production image, copy all the files and run next
FROM node:16.14-alpine3.15 AS runner
FROM node:22.11.0-alpine AS runner
RUN corepack enable
WORKDIR /app

ENV NODE_ENV production
Expand Down
16 changes: 7 additions & 9 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ This is a project template which could be used to the creation of new projects.
- [Cypress](https://www.cypress.io/) as testing client
- git workflow and hooks
- editorconfig and code style based on [Airbnb](https://github.com/airbnb/javascript)
- [Storybook](https://storybook.js.org/) also available and configured

## Getting Started

Expand Down Expand Up @@ -83,14 +82,13 @@ Here's a step by step guide on how to address vulnerabilities found in productio
## Env variables


| Variable name | Description | Default value |
|-------------------------|-------------------------------------------------------------------------|------------------------------------:|
| NEXTAUTH_SECRET | Key used to encrypt the NextAuth.js JWT, and to hash email verification tokens. Do not forget to add a secret. NextAuth can handle without it in development mode, but it won't in production! [https://next-auth.js.org/configuration/options#secret](https://next-auth.js.org/configuration/options#secret) | |
| NEXTAUTH_URL | Needed by the next-auth library for [handling auth requests and callbacks](https://next-auth.js.org/configuration/options#nextauth_url). Set the environment variable to the canonical URL of your site. Not needed in Vercel deploys. | |
| NEXT_PUBLIC_API_URL | URL of the API. | https://jsonplaceholder.typicode.com |
| STORYBOOK_API_URL | URL of the API for storybook. | |
| NEXT_PUBLIC_GA_TRACKING_ID | Google Analytics tracking ID. If you're working with an Google Analytics 4 property, you have a Measurement ID instead of a Tracking ID. | |
| NEXT_PUBLIC_BASE_PATH | As this project should live in a subpath of a domain, we need to specify a basePath inside the next.config.js. You may think this variable must be without the NEXT_PUBLIC but it also affects the images urls. That's why we need it at build and run time. We MUST leave it as an empty string for Vercel and local environments = "" [https://nextjs.org/docs/api-reference/next.config.js/basepath](https://nextjs.org/docs/api-reference/next.config.js/basepath) | |
| Variable name | Description | Default value |
|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------:|
| NEXTAUTH_SECRET | Key used to encrypt the NextAuth.js JWT, and to hash email verification tokens. Do not forget to add a secret. NextAuth can handle without it in development mode, but it won't in production! [https://next-auth.js.org/configuration/options#secret](https://next-auth.js.org/configuration/options#secret) | |
| NEXTAUTH_URL | Needed by the next-auth library for [handling auth requests and callbacks](https://next-auth.js.org/configuration/options#nextauth_url). Set the environment variable to the canonical URL of your site. Not needed in Vercel deploys. | |
| NEXT_PUBLIC_API_URL | URL of the API. | https://jsonplaceholder.typicode.com |
| NEXT_PUBLIC_GA_TRACKING_ID | Google Analytics tracking ID. If you're working with an Google Analytics 4 property, you have a Measurement ID instead of a Tracking ID. | |
| NEXT_PUBLIC_BASE_PATH | As this project should live in a subpath of a domain, we need to specify a basePath inside the next.config.js. You may think this variable must be without the NEXT_PUBLIC but it also affects the images urls. That's why we need it at build and run time. We MUST leave it as an empty string for Vercel and local environments = "" [https://nextjs.org/docs/pages/api-reference/next-config-js/basePath](https://nextjs.org/docs/pages/api-reference/next-config-js/basePath) | |



Expand Down
9 changes: 0 additions & 9 deletions client/docs/authentication.stories.mdx

This file was deleted.

8 changes: 0 additions & 8 deletions client/docs/deploy.stories.mdx

This file was deleted.

8 changes: 0 additions & 8 deletions client/docs/fetching.stories.mdx

This file was deleted.

Loading

0 comments on commit 3393a81

Please sign in to comment.