Skip to content

Commit

Permalink
[TRELLO-2429] Monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
charlescd committed Jul 24, 2024
1 parent 39fc436 commit bd1b4bb
Show file tree
Hide file tree
Showing 32 changed files with 147 additions and 35 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build, format & test workflow

on:
push:
paths-ignore:
- 'website/**'
- 'mobile-tools/**'

jobs:
# This workflow contains a single job called "greet"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be
# executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.9.0
registry-url: https://registry.npmjs.org/
- run: yarn install --immutable
- run: yarn workspaces foreach --all checkformat
- run: yarn workspaces foreach --all build
- run: yarn workspaces foreach --all test
29 changes: 29 additions & 0 deletions .github/workflows/build-mobiles-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: [Mobile-tools] Build, format & test workflow

on:
push:
paths:
- 'mobile-tools/**'

defaults:
run:
working-directory: ./mobile-tools

jobs:
# This workflow contains a single job called "greet"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be
# executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.9.0
registry-url: https://registry.npmjs.org/
- run: yarn install --immutable
- run: yarn checkformat
- run: yarn build
- run: yarn test
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Build, format & test workflow
name: [Website] Build, format & test workflow

on: [push]
on:
push:
paths:
- 'website/**'

defaults:
run:
working-directory: ./website

jobs:
# This workflow contains a single job called "greet"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/gen-satisfaction-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ on:
workflow_dispatch: # can be triggered manually on github
schedule:
- cron: '0 4 * * 2,5' # At 04:00 on Tuesday and Friday.

defaults:
run:
working-directory: ./website

jobs:
main-job:
runs-on: ubuntu-latest
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/generate-actus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Generate feed as Json

on:
workflow_dispatch: # can be triggered manually on github
schedule:
- cron: '0 8 * * *'

env:
DGCCRF_RSS_URL: ${{ vars.DGCCRF_RSS_URL }}

defaults:
run:
working-directory: ./mobile-tools

jobs:
main-job:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.CHARLES_GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: yarn.lock
- run: node --version
- run: yarn --version
- run: yarn install --immutable
- run: yarn generate-feed
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Auto commit with fresh dgccrf feed
11 changes: 9 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Integration tests
name: [Website] Integration tests

on: [push]
on:
push:
paths:
- 'website/**'

defaults:
run:
working-directory: ./website

env:
NEXT_PUBLIC_SHOW_DEMO_CATEGORY: true
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/sanitize-anomalies-filenames.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
on:
workflow_dispatch: # can be triggered manually on github
push:
paths:
- 'shared/**'
branches:
- main # will trigger when pushing something on main

defaults:
run:
working-directory: ./shared

jobs:
main-job:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion mobile-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"shared": "workspace:^"
},
"scripts": {
"beforebuild": "yarn shared:generate-minimized-anomalies",
"beforebuild": "yarn shared:generate-json && yarn shared:generate-minimized-anomalies",
"test": "jest",
"build": "yarn beforebuild && tsc",
"start": "node build/index.js",
Expand Down
7 changes: 0 additions & 7 deletions website/.yarnrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion website/src/components_feature/Arborescence.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {useSearchParams} from 'next/navigation'
import {ReactNode, useEffect, useState} from 'react'
import {useForm} from 'react-hook-form'
import {allVisibleAnomalies, instanceOfAnomaly, instanceOfSubcategoryWithInfoWall} from '../anomalies/Anomalies'
import {CategoryNode, DetailInput, DetailInputType, StandardSubcategory, SubcategoryWithInfoWall} from '../anomalies/Anomaly'
import {CategoryNode, DetailInput, DetailInputType, StandardSubcategory, SubcategoryWithInfoWall} from 'shared/anomalies/Anomaly'
import {useI18n} from '../i18n/I18n'
import {fnSwitch} from '../utils/FnSwitch'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ReportDraft2} from '@/model/ReportDraft2'
import {useState} from 'react'
import {CompanyKind} from '../../anomalies/Anomaly'
import {CompanyKind} from 'shared/anomalies/Anomaly'
import {CompanyIdentificationDispatch} from '../reportFlow/Company/Company'

interface PlaygroundCompanyProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
DetailInputTextarea,
DetailInputTimeslot,
DetailInputType,
} from '../../anomalies/Anomaly'
} from 'shared/anomalies/Anomaly'
import {useI18n} from '../../i18n/I18n'
import {AppLang, AppLangs} from '../../i18n/localization/AppLangs'
import {DetailInputValue} from '../../model/CreatedReport'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {useBarcodeSearch} from '@/hooks/barcode'
import {BarcodeProduct} from '@/model/BarcodeProduct'
import {ReportDraft2} from '@/model/ReportDraft2'
import {useState} from 'react'
import {SpecificProductCompanyKind, SpecificWebsiteCompanyKind} from '../../../anomalies/Anomaly'
import {SpecificProductCompanyKind, SpecificWebsiteCompanyKind} from 'shared/anomalies/Anomaly'
import {CompanyDraft, CompanySearchResult} from '../../../model/Company'
import {DeepPartial} from '../../../utils/utils'
import {useReportFlowContext} from '../ReportFlowContext'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {BtnNextSubmit} from '@/components_simple/buttons/Buttons'
import {ScAutocompletePostcode} from '@/components_simple/formInputs/ScAutocompletePostcode'
import {useI18n} from '@/i18n/I18n'
import {Controller, useForm} from 'react-hook-form'
import {CompanyKind} from '../../../anomalies/Anomaly'
import {CompanyKind} from 'shared/anomalies/Anomaly'
import {ScAlert} from '../../../components_simple/ScAlert'
import {fnSwitch} from '../../../utils/FnSwitch'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {ScAutocompletePostcode} from '@/components_simple/formInputs/ScAutocompl
import {ScTextInput} from '@/components_simple/formInputs/ScTextInput'
import {useI18n} from '@/i18n/I18n'
import {Controller, useForm} from 'react-hook-form'
import {CompanyKind} from '../../../anomalies/Anomaly'
import {CompanyKind} from 'shared/anomalies/Anomaly'
import {ScAlert} from '../../../components_simple/ScAlert'
import {Country} from '../../../model/Country'
import {fnSwitch} from '../../../utils/FnSwitch'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {useQuery} from '@tanstack/react-query'
import Link from 'next/link'
import {ReactNode, useEffect, useRef, useState} from 'react'
import {useForm} from 'react-hook-form'
import {SpecificWebsiteCompanyKind} from '../../../anomalies/Anomaly'
import {SpecificWebsiteCompanyKind} from 'shared/anomalies/Anomaly'
import {SiretExtractorClient} from '../../../clients/SiretExtractorClient'
import {CompanySearchResult} from '../../../model/Company'
import {Country} from '../../../model/Country'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Animate} from '@/components_simple/Animate'
import {ScAlert} from '@/components_simple/ScAlert'
import {useI18n} from '@/i18n/I18n'
import {ReactNode, useState} from 'react'
import {CompanyKind} from '../../../anomalies/Anomaly'
import {CompanyKind} from 'shared/anomalies/Anomaly'
import {ScRadioButtons} from '../../../components_simple/formInputs/ScRadioButtons'

const identificationMethods = ['byNameAndPostalCode', 'byName', 'byIdentifier', 'iCannot']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {Button} from '@codegouvfr/react-dsfr/Button'
import {useQuery} from '@tanstack/react-query'
import {useState} from 'react'
import {Controller, useForm} from 'react-hook-form'
import {SocialNetwork, socialNetworks} from '../../../anomalies/Anomaly'
import {SocialNetwork, socialNetworks} from 'shared/anomalies/Anomaly'
import {Animate} from '../../../components_simple/Animate'
import {SocialNetworkRow} from '../../../components_simple/SocialNetworkRow'
import {ScRadioButtons} from '../../../components_simple/formInputs/ScRadioButtons'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {fnSwitch} from '@/utils/FnSwitch'
import {last} from '@/utils/lodashNamedExport'
import {useEffect, useMemo, useState} from 'react'
import {useForm} from 'react-hook-form'
import {DetailInput, ReportTag, StandardSubcategory} from '../../../anomalies/Anomaly'
import {DetailInput, ReportTag, StandardSubcategory} from 'shared/anomalies/Anomaly'
import {ConsumerWish, TransmissionStatus} from '../../../model/ReportDraft'
import {FileOrigin, UploadedFile} from '../../../model/UploadedFile'
import {useReportFlowContext} from '../ReportFlowContext'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {useI18n} from '@/i18n/I18n'
import {DetailInputValues2} from '@/model/ReportDraft2'
import {dateToIsoFormatWithoutTime, isDateInRange} from '@/utils/utils'
import {Control, Controller, FieldErrors, UseFormRegister, UseFormWatch} from 'react-hook-form'
import {DetailInput, DetailInputType} from '../../../anomalies/Anomaly'
import {DetailInput, DetailInputType} from 'shared/anomalies/Anomaly'
import {ScCheckbox} from '../../../components_simple/formInputs/ScCheckbox'
import {ScRadioButtons} from '../../../components_simple/formInputs/ScRadioButtons'
import {getOptionsFromInput, getPlaceholderFromInput} from './DetailInputsUtils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {getSubcategories, hasStep0, hasSubcategoryIndexes} from '@/feature/repor
import {ReportDraft2} from '@/model/ReportDraft2'
import {last} from '@/utils/lodashNamedExport'
import {instanceOfSubcategoryWithInputs} from '../../../anomalies/Anomalies'
import {DetailInput, DetailInputType} from '../../../anomalies/Anomaly'
import {DetailInput, DetailInputType} from 'shared/anomalies/Anomaly'
import {AppLang, AppLangs} from '../../../i18n/localization/AppLangs'

export class DraftReportDefaultInputs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {dummyStepNavigation} from '@/components_feature/playgroundComponents/Pla
import {ReportDraft2} from '@/model/ReportDraft2'
import {AccessReportFlow, fireEvent, render, ScRenderResult} from '@/test/test-utils'
import '@testing-library/jest-dom'
import {Anomaly} from '../../../anomalies/Anomaly'
import {Anomaly} from 'shared/anomalies/Anomaly'
import {fnSwitch} from '../../../utils/FnSwitch'
import {Problem} from './Problem'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {ConsumerWish} from '@/model/ReportDraft'
import {ReportDraft2} from '@/model/ReportDraft2'
import {useEffect, useMemo} from 'react'
import {instanceOfSubcategoryWithInfoWall} from '../../../anomalies/Anomalies'
import {Anomaly, CompanyKind, ReportTag, Subcategory} from '../../../anomalies/Anomaly'
import {Anomaly, CompanyKind, ReportTag, Subcategory} from 'shared/anomalies/Anomaly'
import {AppLang} from '../../../i18n/localization/AppLangs'
import {useReportFlowContext} from '../ReportFlowContext'
import {ProblemConsumerWishInformation} from './ProblemConsumerWishInformation'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {last} from '@/utils/lodashNamedExport'
import Button from '@codegouvfr/react-dsfr/Button'
import {useMutation} from '@tanstack/react-query'
import {useEffect, useState} from 'react'
import {Anomaly, InfoWall, Subcategory} from '../../../anomalies/Anomaly'
import {Anomaly, InfoWall, Subcategory} from 'shared/anomalies/Anomaly'
import {LinkBackToHome} from '../../../components_simple/LinkBackToHome'

interface Props {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {instanceOfSubcategoryWithInfoWall} from '@/anomalies/Anomalies'
import {lastFromArray, notUndefined} from '@/utils/utils'
import {Anomaly, Subcategory} from '../../../anomalies/Anomaly'
import {Anomaly, Subcategory} from 'shared/anomalies/Anomaly'

export function computeSelectedSubcategoriesData(anomaly: Anomaly, selectedSubCategories: Subcategory[]) {
const tagsFromSelected = selectedSubCategories.flatMap(_ => _.tags ?? [])
Expand Down
2 changes: 1 addition & 1 deletion website/src/components_simple/AnomaliesGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {buildLinkStartReport} from '@/core/pagesDefinitions'
import Image from 'next/image'
import Link from 'next/link'
import {Anomaly} from '../anomalies/Anomaly'
import {Anomaly} from 'shared/anomalies/Anomaly'
import {useReportFlowContext} from '../components_feature/reportFlow/ReportFlowContext'
import {useI18n} from '../i18n/I18n'

Expand Down
2 changes: 1 addition & 1 deletion website/src/components_simple/SearchAnomalies.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {Anomaly} from '../anomalies/Anomaly'
import {Anomaly} from 'shared/anomalies/Anomaly'
import {useI18n} from '../i18n/I18n'
import {AppLangs} from '../i18n/localization/AppLangs'
import {AnomaliesGrid} from './AnomaliesGrid'
Expand Down
2 changes: 1 addition & 1 deletion website/src/components_simple/SocialNetworkRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Image from 'next/image'
import {SocialNetwork} from '../anomalies/Anomaly'
import {SocialNetwork} from 'shared/anomalies/Anomaly'
import {useI18n} from '../i18n/I18n'

const socialNetworkIcon = (socialNetwork: SocialNetwork) => {
Expand Down
2 changes: 1 addition & 1 deletion website/src/model/ReportDraft.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {toApiInfluencer} from '@/feature/reportDraftUtils'
import {SocialNetwork} from '../anomalies/Anomaly'
import {SocialNetwork} from 'shared/anomalies/Anomaly'
import {Fixture} from '../test/fixture'

describe('ReportDraft.toApi', () => {
Expand Down
2 changes: 1 addition & 1 deletion website/src/model/ReportDraft2.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {isDateInput} from '@/components_feature/reportFlow/Details/DetailInputsUtils'
import {isSpecifyInputName, SpecifyFormUtils} from '@/components_feature/reportFlow/Details/Details'
import {getDraftReportInputs} from '@/components_feature/reportFlow/Details/draftReportInputs'
import {DetailInput, DetailInputType} from '../anomalies/Anomaly'
import {DetailInput, DetailInputType} from 'shared/anomalies/Anomaly'
import {AppLang} from '../i18n/localization/AppLangs'
import {DeepPartial, isoToFrenchFormat, notNull} from '../utils/utils'
import {Address} from './Address'
Expand Down
2 changes: 1 addition & 1 deletion website/src/reusablePages/faireUnSignalementPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {LimitedWidthPageContainer} from '@/components_simple/PageContainers'
import {appConfig} from '@/core/appConfig'
import {ReactNode} from 'react'
import {Anomaly} from '../anomalies/Anomaly'
import {Anomaly} from 'shared/anomalies/Anomaly'
import {ReportFlowStepper} from '@/components_feature/reportFlow/reportFlowStepper/ReportFlowStepper'

export const FaireUnSignalementPage = ({anomaly, isWebView}: {anomaly: Anomaly; isWebView: boolean}) => {
Expand Down
2 changes: 1 addition & 1 deletion website/src/test/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {allAnomalies} from '@/anomalies/Anomalies'
import {AppLang} from '@/i18n/localization/AppLangs'
import {BarcodeProduct} from '@/model/BarcodeProduct'
import {getIndexForStep, ReportStep, reportSteps} from '@/model/ReportStep'
import {InfoWall, reportTags, socialNetworks, Subcategory} from '../anomalies/Anomaly'
import {InfoWall, reportTags, socialNetworks, Subcategory} from 'shared/anomalies/Anomaly'
import {Address, ApiAddress} from '../model/Address'
import {CompanyDraft, CompanySearchResult, WebsiteCompanySearchResult} from '../model/Company'
import {CreatedReport} from '../model/CreatedReport'
Expand Down

0 comments on commit bd1b4bb

Please sign in to comment.