Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TG-1074 Implement src folder pattern #76

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
74887bb
TG-1060 Upgrade images
Jan 10, 2024
9565231
Configure healthcheck endpoint rewrite path
trottomv Jan 10, 2024
f95636b
Update debian images version and improve cypress docker envs
Jan 10, 2024
84bc941
Fix README typo
trottomv Jan 10, 2024
7232aea
Merge pull request #61 from 20tab/fix/readme-typo
trottomv Jan 10, 2024
5878353
Fix import
trottomv Jan 10, 2024
0296d5a
Add healthcheck tests
trottomv Jan 10, 2024
804c03a
Merge pull request #59 from 20tab/feature/1024-docker-images-upgrade
lucaspinosi Jan 10, 2024
37c27b8
Merge pull request #60 from 20tab/feature/964-expose-healthcheck-endp…
trottomv Jan 10, 2024
3b3b15f
TG-1012 Upgrade to Python 3.12 (#50)
niccolomineo Jan 10, 2024
655ba48
TG-1051 Upgrade dependencies
Jan 11, 2024
dce2186
TG-1051 Change pact version
Jan 11, 2024
4a8d2b1
Restore project name
Jan 11, 2024
98b346c
Set the dependencies version as those used in the last project
Jan 12, 2024
1f067c7
Fix e2e package.json script
Jan 12, 2024
a76200a
Restore package.json scripts
Jan 12, 2024
8edd13b
Merge pull request #62 from 20tab/feature/1022-dependencies-upgrade
lucaspinosi Jan 12, 2024
bcdf7c5
TG-1051 Upgrade cypress and fix package.json scripts
Jan 12, 2024
b489f6b
Restore project name
Jan 12, 2024
176c1b9
Merge branch 'main' of github.com:20tab/nextjs-continuous-delivery in…
trottomv Jan 15, 2024
268ba3d
TG-1051 Update package.lock
Jan 15, 2024
d655066
TG-1051 Upgrade pact dependency
Jan 15, 2024
d93196f
Restore project name
Jan 15, 2024
611a186
Move all project core files into a src folder
Jan 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from '@jest/globals'
import { screen } from '@testing-library/react'
import React from 'react'

import { Navbar } from '@/components/Navbar'
import { Navbar } from '@/src/components/Navbar'
import { renderWithWrappers } from '@/__tests__/functions'

const setup = () => renderWithWrappers(<Navbar />)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { screen, fireEvent } from '@testing-library/react'
import React from 'react'

import { renderWithWrappers } from '@/__tests__/functions'
import { ThemeSwitch } from '@/components/ThemeSwitch'
import { ThemeSwitch } from '@/src/components/ThemeSwitch'

const setup = () => renderWithWrappers(<ThemeSwitch />)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from '@jest/globals'
import { screen } from '@testing-library/react'
import React from 'react'

import { Button } from '@/components/commons/Button'
import { Button } from '@/src/components/commons/Button'
import { renderWithWrappers } from '@/__tests__/functions'

const solidSetup = () => renderWithWrappers(<Button />)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from '@jest/globals'
import { screen } from '@testing-library/react'
import React from 'react'

import { Input, InputWithErrors } from '@/components/commons/Input'
import { Input, InputWithErrors } from '@/src/components/commons/Input'
import { renderWithWrappers } from '@/__tests__/functions'

describe('Input components', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { screen } from '@testing-library/react'
import React from 'react'

import { renderWithWrappers } from '@/__tests__/functions'
import { H1, H2, H3, H4, Text } from '@/components/commons/Typography'
import { H1, H2, H3, H4, Text } from '@/src/components/commons/Typography'

describe('Titles', () => {
describe('H1', () => {
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_dirname}}/__tests__/functions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { render } from '@testing-library/react'
import { ThemeProvider } from 'styled-components'
import React from 'react'

import themes from '@/styles/themes'
import store from '@/store'
import themes from '@/src/styles/themes'
import store from '@/src/store'

import type { ReactElement } from 'react'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { pactWith } from 'jest-pact/dist/v3'
import { HTTPMethod } from '@/__tests__/pact/utils'
import pactConfig from '@/__tests__/pact/pact.config'

import { axios, withApiOptions } from '@/utils/api/axios'
import { axios, withApiOptions } from '@/src/utils/api/axios'

const healthCheck = withApiOptions<{ status: string }>(({ baseUrl }) => {
return axios.get(`${baseUrl}/api/health/`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
context('Health check endpoint', () => {
describe('Service health endpoint', () => {
it('returns a 204 status', () => {
cy.request('/{{ cookiecutter.service_slug }}/health').then(response => {
cy.request('/frontend/health').then(response => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restore previous with to cookiecutter value

Suggested change
cy.request('/frontend/health').then(response => {
cy.request('/{{ cookiecutter.service_slug }}/health').then(response => {

expect(response.status).to.equal(204)
expect(response.body).to.be.empty
})
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_dirname}}/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NextResponse } from 'next/server'

import type { NextRequest } from 'next/server'
import type { RequestCookies } from 'next/dist/server/web/spec-extension/cookies'
import { Theme } from '@/models/Utils'
import { Theme } from '@/src/models/Utils'

const isLanguageSet = (cookies: RequestCookies) => {
return cookies.get('NEXT_LOCALE')
Expand Down
5 changes: 2 additions & 3 deletions {{cookiecutter.project_dirname}}/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"ci:contract-test": "npx jest pact/contracts --testEnvironment=node --color --detectOpenHandles --passWithNoTests",
"ci:unit-test": "npx jest --color --silent --detectOpenHandles --testPathIgnorePatterns=pact/contracts --coverage --coverageDirectory ./coverage/tests --ci --reporters=default --reporters=jest-junit",
"e2e": "CYPRESS_BASE_URL=https://localhost:3000 cypress open",
"e2e": "CYPRESS_BASE_URL=https://localhost:8443 cypress open",
"lint": "next lint",
"pact": "npx jest pact/contracts --testEnvironment=node --detectOpenHandles",
"start": "node server.js",
Expand Down Expand Up @@ -64,7 +63,7 @@
"webpack": "^5.88.2"
},
"optionalDependencies": {
"@pact-foundation/pact": "^10.3.1",
"cypress": "^12.3.0"
"@pact-foundation/pact": "^11.0.2",
"cypress": "^12.17.4"
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import styled from 'styled-components'

import { ThemeSwitch } from '@/components/ThemeSwitch'
import { ThemeSwitch } from '@/src/components/ThemeSwitch'
import Image from 'next/image'
import { useAppSelector } from '@/store'
import { useAppSelector } from '@/src/store'

const Navbar = () => {
const theme = useAppSelector(state => state.utils.theme)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React, { useMemo } from 'react'
import styled from 'styled-components'
import nookies from 'nookies'

import { Theme } from '@/models/Utils'
import { changeTheme } from '@/store/utilsSlice'
import { useAppDispatch, useAppSelector } from '@/store'
import { Theme } from '@/src/models/Utils'
import { changeTheme } from '@/src/store/utilsSlice'
import { useAppDispatch, useAppSelector } from '@/src/store'

const ThemeSwitch = () => {
const dispatch = useAppDispatch()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { parseCookies } from 'nookies'
import { ThemeProvider } from 'styled-components'
import React, { useEffect } from 'react'

import { changeTheme } from '@/store/utilsSlice'
import { GlobalStyle } from '@/styles/GlobalStyle'
import { Navbar } from '@/components/Navbar'
import { useAppDispatch, useAppSelector } from '@/store'
import themes from '@/styles/themes'
import { changeTheme } from '@/src/store/utilsSlice'
import { GlobalStyle } from '@/src/styles/GlobalStyle'
import { Navbar } from '@/src/components/Navbar'
import { useAppDispatch, useAppSelector } from '@/src/store'
import themes from '@/src/styles/themes'

type Props = {
children: React.ReactNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Provider } from 'react-redux'
import Head from 'next/head'
import React from 'react'

import store from '@/store'
import store from '@/src/store'

import Layout from '@/components/layout/Base'
import Layout from '@/src/components/layout/Base'

import type { AppProps } from 'next/app'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import styled from 'styled-components'

import { H1 } from '@/components/commons/Typography'
import { H1 } from '@/src/components/commons/Typography'

import type { NextPage } from 'next'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { configureStore } from '@reduxjs/toolkit'
import { useDispatch, useSelector } from 'react-redux'

import reducers from '@/store/reducers'
import reducers from '@/src/store/reducers'

import type { Action } from 'redux'
import type { ThunkAction } from '@reduxjs/toolkit'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import utils from '@/store/utilsSlice'
import utils from '@/src/store/utilsSlice'

const reducers = {
utils
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createSlice } from '@reduxjs/toolkit'

import { Theme } from '@/models/Utils'
import { Theme } from '@/src/models/Utils'

interface UtilsState {
theme: Theme
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { theme as lightTheme } from '@/styles/themes/light'
import { theme as lightTheme } from '@/src/styles/themes/light'

import type { DefaultTheme } from 'styled-components'

Expand Down
10 changes: 10 additions & 0 deletions {{cookiecutter.project_dirname}}/src/styles/themes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Theme } from '@/src/models/Utils'
import { theme as light } from '@/src/styles/themes/light'
import { theme as dark } from '@/src/styles/themes/dark'

const theme = {
[Theme.light]: light,
[Theme.dark]: dark
}

export default theme
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { axios, withApiOptions } from '@/utils/api/axios'
import type * as T from '@/models/Api'
import { axios, withApiOptions } from '@/src/utils/api/axios'
import type * as T from '@/src/models/Api'

export const login = withApiOptions<T.LoginResponse, [T.LoginRequest]>(
({ baseUrl }, body) => {
Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.project_dirname}}/src/utils/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@/src/utils/api/auth'
10 changes: 0 additions & 10 deletions {{cookiecutter.project_dirname}}/styles/themes/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion {{cookiecutter.project_dirname}}/utils/api/index.ts

This file was deleted.

57 changes: 29 additions & 28 deletions {{cookiecutter.project_dirname}}/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@pact-foundation/pact-core@^13.13.3":
"@pact-foundation/pact-core@^13.13.5":
version "13.15.0"
resolved "https://registry.yarnpkg.com/@pact-foundation/pact-core/-/pact-core-13.15.0.tgz#a2a0b42cf5b9175abf9054a9a1b8f04c7c31dbc4"
integrity sha512-xI4CSG7pFRyRvuiFW9enlAkmy2CcnFDBfdhRssqwEsEYdF0lJ+L+CMTkixy+nOBLLvVnaG71evZu+ibtXBt5/Q==
Expand All @@ -768,12 +768,12 @@
underscore "1.12.1"
unixify "1.0.0"

"@pact-foundation/pact@^10.3.1":
version "10.4.1"
resolved "https://registry.yarnpkg.com/@pact-foundation/pact/-/pact-10.4.1.tgz#5931209045427b472a6bf9b9b7cc95069b73f263"
integrity sha512-L+i8V4m+p8HnMvkx2pKJAeITNmpyO2E+e8Ds90eJG9ud3h/h4jRyR0FTJGcz53QJcvi1PBubxAJCb9y4esqbeA==
"@pact-foundation/pact@^11.0.2":
version "11.0.2"
resolved "https://registry.yarnpkg.com/@pact-foundation/pact/-/pact-11.0.2.tgz#cc091a3e9d97c952b6c0e67bdee49be0418b9d2a"
integrity sha512-ki2pV4ZMOOPTi+vFlsODlvaLFfPxwtNFuFWyZjD9yyftwrbAlneuBSKQALyHJpY6Nmr2YU76dwWNmsWiFXwVCw==
dependencies:
"@pact-foundation/pact-core" "^13.13.3"
"@pact-foundation/pact-core" "^13.13.5"
"@types/express" "^4.17.11"
axios "^0.27.2"
body-parser "^1.20.0"
Expand Down Expand Up @@ -1219,16 +1219,16 @@
integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==

"@types/node@*", "@types/node@^20.5.3":
version "20.11.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.0.tgz#8e0b99e70c0c1ade1a86c4a282f7b7ef87c9552f"
integrity sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==
version "20.11.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.2.tgz#39cea3fe02fbbc2f80ed283e94e1d24f2d3856fb"
integrity sha512-cZShBaVa+UO1LjWWBPmWRR4+/eY/JR/UIEcDlVsw3okjWEu+rB7/mH6X3B/L+qJVHDLjk9QW/y2upp9wp1yDXA==
dependencies:
undici-types "~5.26.4"

"@types/node@^16.18.39":
version "16.18.70"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.70.tgz#d4c819be1e9f8b69a794d6f2fd929d9ff76f6d4b"
integrity sha512-8eIk20G5VVVQNZNouHjLA2b8utE2NvGybLjMaF4lyhA9uhGwnmXF8o+icdXKGSQSNANJewXva/sFUoZLwAaYAg==
version "16.18.71"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.71.tgz#305a955ab99353d4b8a9e9b6b6682ed6cbc186cc"
integrity sha512-ARO+458bNJQeNEFuPyT6W+q9ULotmsQzhV3XABsFSxEvRMUYENcBsNAHWYPlahU+UHa5gCVwyKT1Z3f1Wwr26Q==

"@types/prop-types@*":
version "15.7.11"
Expand Down Expand Up @@ -1263,9 +1263,9 @@
redux "^4.0.0"

"@types/react@*", "@types/react@^18.2.21":
version "18.2.47"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.47.tgz#85074b27ab563df01fbc3f68dc64bf7050b0af40"
integrity sha512-xquNkkOirwyCgoClNk85BjP+aqnIS+ckAJ8i37gAbDs14jfW/J23f2GItAf33oiUPQnqNMALiFeoM9Y5mbjpVQ==
version "18.2.48"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.48.tgz#11df5664642d0bd879c1f58bc1d37205b064e8f1"
integrity sha512-qboRCl6Ie70DQQG9hhNREz81jqC1cs9EVNcjQ1AU+jH6NFfSAhVVbrrY/+nSF+Bsk4AOwm9Qa61InvMCyV+H3w==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
Expand Down Expand Up @@ -2444,7 +2444,7 @@ csstype@^3.0.2:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==

cypress@^12.3.0:
cypress@^12.17.4:
version "12.17.4"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.17.4.tgz#b4dadf41673058493fa0d2362faa3da1f6ae2e6c"
integrity sha512-gAN8Pmns9MA5eCDFSDJXWKUpaL3IDd89N9TtIupjYnzLSmlpVr+ZR+vb4U/qaMp+lB6tBvAmt7504c3Z4RU5KQ==
Expand Down Expand Up @@ -2702,9 +2702,9 @@ [email protected]:
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==

electron-to-chromium@^1.4.601:
version "1.4.629"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.629.tgz#9cbffe1b08a5627b6a25118360f7fd3965416caf"
integrity sha512-5UUkr3k3CZ/k+9Sw7vaaIMyOzMC0XbPyprKI3n0tbKDqkzTDOjK4izm7DxlkueRMim6ZZQ1ja9F7hoFVplHihA==
version "1.4.630"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.630.tgz#1d9f4169653784997bec98975e11a2c05214ce39"
integrity sha512-osHqhtjojpCsACVnuD11xO5g9xaCyw7Qqn/C2KParkMv42i8jrJJgx3g7mkHfpxwhy9MnOJr8+pKOdZ7qzgizg==

emittery@^0.13.1:
version "0.13.1"
Expand Down Expand Up @@ -3805,7 +3805,7 @@ has-flag@^4.0.0:
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==

has-property-descriptors@^1.0.0:
has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340"
integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==
Expand Down Expand Up @@ -5655,9 +5655,9 @@ prettier-linter-helpers@^1.0.0:
fast-diff "^1.1.2"

prettier@^3.0.2:
version "3.2.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.0.tgz#aedf3dfb42c00ee4eda533c1380f7d9624f768b8"
integrity sha512-/vBUecTGaPlRVwyZVROVC58bYIScqaoEJzZmzQXXrZOzqn0TwWz0EnOozOlFO/YAImRnb7XsKpTCd3m1SjS2Ww==
version "3.2.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.2.tgz#96e580f7ca9c96090ad054616c0c4597e2844b65"
integrity sha512-HTByuKZzw7utPiDO523Tt2pLtEyK7OibUD9suEJQrPUCYQqrHr74GGX6VidMrovbf/I50mPqr8j/II6oBAuc5A==

pretty-bytes@^5.6.0:
version "5.6.0"
Expand Down Expand Up @@ -6220,14 +6220,15 @@ set-cookie-parser@^2.4.6:
integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==

set-function-length@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed"
integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==
version "1.2.0"
resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.0.tgz#2f81dc6c16c7059bda5ab7c82c11f03a515ed8e1"
integrity sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==
dependencies:
define-data-property "^1.1.1"
get-intrinsic "^1.2.1"
function-bind "^1.1.2"
get-intrinsic "^1.2.2"
gopd "^1.0.1"
has-property-descriptors "^1.0.0"
has-property-descriptors "^1.0.1"

set-function-name@^2.0.0, set-function-name@^2.0.1:
version "2.0.1"
Expand Down