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

front: switch package type to module #10671

Merged
merged 7 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion front/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
"devDependencies": ["**/*.spec.ts", "**/__tests__/**"]
}
],
"import/no-unresolved": [2, { "commonjs": true, "amd": true }],
"jsx-a11y/click-events-have-key-events": "off",
"linebreak-style": ["error", "unix"],
"no-await-in-loop": "off",
Expand Down
239 changes: 203 additions & 36 deletions front/package-lock.json

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

4 changes: 2 additions & 2 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "osrd",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"@ag-media/react-pdf-table": "^2.0.1",
"@nivo/core": "^0.88.0",
Expand Down Expand Up @@ -106,7 +107,6 @@
"@types/d3": "^7.4.3",
"@types/lodash": "^4.17.15",
"@types/node": "^22",
"@types/pdf-parse": "^1.1.4",
"@types/react": "^18.2.53",
"@types/react-dom": "^18.2.18",
"@types/react-modal": "^3.16.3",
Expand All @@ -133,7 +133,7 @@
"json-key-path-list": "^2.0.3",
"license-checker-rseidelsohn": "^4.4.2",
"openapi-types": "^12.1.3",
"pdf-parse": "^1.1.1",
"pdfjs-dist": "^4.10.38",
"prettier": "^3.4.2",
"sass": "^1.83.4",
"ts-node": "^10.9.2",
Expand Down
8 changes: 4 additions & 4 deletions front/scripts/generate-types.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/sh
if ! npx @rtk-query/codegen-openapi src/config/openapi-editoast-config.ts; then
echo "npx @rtk-query/codegen-openapi src/config/openapi-editoast-config.ts command failed. Exit the script"
if ! npx @rtk-query/codegen-openapi src/config/openapi-editoast-config.cts; then
echo "npx @rtk-query/codegen-openapi src/config/openapi-editoast-config.cts command failed. Exit the script"
exit 1
fi
npx eslint --fix src/common/api/generatedEditoastApi.ts --no-ignore
if ! npx @rtk-query/codegen-openapi src/config/openapi-gateway-config.ts; then
echo "npx @rtk-query/codegen-openapi src/config/openapi-gateway-config.ts command failed. Exit the script"
if ! npx @rtk-query/codegen-openapi src/config/openapi-gateway-config.cts; then
echo "npx @rtk-query/codegen-openapi src/config/openapi-gateway-config.cts command failed. Exit the script"
exit 1
fi
npx eslint --fix src/common/api/osrdGatewayApi.ts --no-ignore
6 changes: 3 additions & 3 deletions front/scripts/i18n-api-errors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs';
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
Expand Down Expand Up @@ -30,7 +30,7 @@ async function checkI18N(error: any): Promise<string[]> {
);

// Init the i18n system
const i18nData = require(i18n_error_path);
const i18nData = JSON.parse(fs.readFileSync(new URL(i18n_error_path, import.meta.url), 'utf8'));
const i18n = await i18next.createInstance(
{
lng: 'fr',
Expand All @@ -55,7 +55,7 @@ async function checkI18N(error: any): Promise<string[]> {
}
},
},
noop
() => {}
);

// Generate the error message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ const config: ConfigFile = {
],
};

export default config;
exports.default = config;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const config: ConfigFile = {
tag: true,
};

export default config;
exports.default = config;
7 changes: 4 additions & 3 deletions front/tests/001-home-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { expect } from '@playwright/test';

import test from './logging-fixture';
import HomePage from './pages/home-page-model';
import { getTranslations } from './utils';
import enTranslations from '../public/locales/en/home/home.json';
import frTranslations from '../public/locales/fr/home/home.json';
import { getTranslations, readJsonFile } from './utils';

const enTranslations = readJsonFile('public/locales/en/home/home.json');
const frTranslations = readJsonFile('public/locales/fr/home/home.json');

test.describe('Home page OSRD', () => {
let homePage: HomePage;
Expand Down
5 changes: 3 additions & 2 deletions front/tests/002-project-management.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import type { Project } from 'common/api/osrdEditoastApi';

import projectData from './assets/operationStudies/project.json';
import test from './logging-fixture';
import ProjectPage from './pages/project-page-model';
import { generateUniqueName } from './utils';
import { generateUniqueName, readJsonFile } from './utils';
import { createProject } from './utils/setup-utils';
import { deleteProject } from './utils/teardown-utils';

const projectData = readJsonFile('tests/assets/operationStudies/project.json');

test.describe('Validate the Operational Study Project workflow', () => {
let project: Project;
let projectPage: ProjectPage;
Expand Down
Loading
Loading