Skip to content

Commit

Permalink
fixup! fixup! front: switch from yarn to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohh committed Nov 19, 2024
1 parent 4ef8616 commit fe429c1
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 35 deletions.
2 changes: 1 addition & 1 deletion front/docker/Dockerfile.nginx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /app

# Build dependencies
COPY package.json package-lock.json /app/
RUN npm install --frozen-lockfile --legacy-peer-deps
RUN npm install --frozen-lockfile

# Generate the licenses file and build
COPY . /app
Expand Down
114 changes: 89 additions & 25 deletions front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"viewport-mercator-project": "^7.0.4"
},
"devDependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
"@import-meta-env/prepare": "^0.1.13",
"@import-meta-env/unplugin": "^0.5.1",
"@playwright/test": "^1.41.2",
Expand All @@ -110,8 +111,8 @@
"@types/chroma-js": "^2.4.3",
"@types/d3": "^7.4.3",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.14.202",
"@types/node": "^22",
"@types/lodash": "^4.17.13",
"@types/node": "^22.9.0",
"@types/react": "^18.2.53",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-dom": "^18.2.18",
Expand Down Expand Up @@ -140,6 +141,8 @@
"i18next-fs-backend": "^2.3.1",
"json-key-path-list": "^2.0.3",
"license-checker-rseidelsohn": "^4.4.2",
"oazapfts": "osrd-project/oazapfts#master",
"openapi-types": "^12.1.3",
"prettier": "^3.2.5",
"sass": "^1.70.0",
"ts-node": "^10.9.2",
Expand All @@ -155,11 +158,17 @@
"optionalDependencies": {
"@rollup/rollup-linux-arm64-gnu": "^4.23.0"
},
"resolutions": {
"react-error-overlay": "6.0.9",
"@nivo/line": "^0.80.0",
"@nivo/core": "^0.80.0",
"oazapfts": "osrd-project/oazapfts#master"
},
"overrides": {
"react-error-overlay": "6.0.9",
"@nivo/line": "^0.80.0",
"@nivo/core": "^0.80.0",
"oazapfts": "anisometropie/oazapfts#master"
"oazapfts": "osrd-project/oazapfts#master"
},
"scripts": {
"compile": "tsc -b",
Expand Down
13 changes: 8 additions & 5 deletions front/scripts/i18n-api-errors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import SwaggerParser from '@apidevtools/swagger-parser';
import i18next from 'i18next';
import { noop } from 'lodash';
import type { OpenAPI } from 'openapi-types';

// relative the project's root
const openapi_path = '../editoast/openapi.yaml';
Expand Down Expand Up @@ -65,19 +66,21 @@ async function checkI18N(error: any): Promise<string[]> {

async function run() {
try {
const api = await SwaggerParser.validate(openapi_path);
const api: OpenAPI.Document = await SwaggerParser.validate(openapi_path);

if (!('openapi' in api)) throw new Error('Expected an OpenAPI schema');

// Do some checks on the generic error
if (!api.components.schemas.EditoastError)
throw new Error(`"EditoastError" can't be found in "components > schemas"`);
if (!api.components.schemas.EditoastError.oneOf)
const EditoastError = api?.components?.schemas?.EditoastError;
if (!EditoastError) throw new Error(`"EditoastError" can't be found in "components > schemas"`);
if (!('oneOf' in EditoastError) || !EditoastError.oneOf)
throw new Error(`Expected "EditoastError" to be a "oneOf" object`);

// Check i18n for all errors
const errors = (
await Promise.all(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
api.components.schemas.EditoastError.oneOf.map((error: any) => checkI18N(error))
EditoastError.oneOf.map((error: any) => checkI18N(error))
)
).flat();

Expand Down
2 changes: 1 addition & 1 deletion front/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"suppressExcessPropertyErrors": false,
"suppressImplicitAnyIndexErrors": false,
"typeRoots": ["node_modules/@types"],
"types": ["vite/client"],
"types": ["vite/client", "node"],
"target": "ESNext",
"verbatimModuleSyntax": true
}
Expand Down

0 comments on commit fe429c1

Please sign in to comment.