Skip to content
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
13 changes: 13 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Browsers that we support

[production]
>0.2% and supports es6-class
not dead
not op_mini all
not chrome < 51
not safari < 10

[development]
last 1 chrome version
last 1 firefox version
last 1 safari version
9 changes: 4 additions & 5 deletions .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
EXTEND_ESLINT=true
REACT_APP_DEBUG_REQUESTS=false
REACT_APP_DEBUG_AGGRID=false
VITE_DEBUG_REQUESTS=false
VITE_DEBUG_AGGRID=false

REACT_APP_API_GATEWAY=/api/gateway
REACT_APP_WS_GATEWAY=/ws/gateway
VITE_API_GATEWAY=/api/gateway
VITE_WS_GATEWAY=/ws/gateway
15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"root": true,
"extends": [
"react-app",
"plugin:prettier/recommended"
],
"ignorePatterns": [
// node_modules is implicitly always ignored
"build"
],
"rules": {
"prettier/prettier": "warn",
"curly": "error"
}
}
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ jobs:
- name: Install and Build
run: |
npm install
npm run-script build
npm run-script test
npm run lint
npm run test
npm run build

- name: Build and publish Docker image - Main
if: github.ref == 'refs/heads/main'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# webstorm
/.idea

# vscode
/.vscode

# misc
.env.local
.env.development.local
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ FROM bitnami/apache:2.4.55-debian-11-r3@sha256:bbe50190eb3bbf3be6f61318004480b32
USER root
COPY app-httpd.conf /opt/bitnami/apache/conf/bitnami/bitnami.conf
COPY build /opt/bitnami/apache/htdocs/gridadmin
RUN sed -i -e 's;<base href="\./"/>;<base href="<!--#echo var="BASE" -->"/>;' /opt/bitnami/apache/htdocs/gridadmin/index.html
RUN sed -i -e 's;<base href="/" />;<base href="<!--#echo var="BASE" -->" />;' /opt/bitnami/apache/htdocs/gridadmin/index.html
USER 1001
8 changes: 8 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
"@babel/preset-env",
["@babel/preset-react", { "runtime": "automatic" }],
"@babel/preset-typescript",
"babel-preset-vite"
]
}
5 changes: 3 additions & 2 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
<!DOCTYPE html>
<html lang="en" translate="no">
<head>
<base href="%PUBLIC_URL%/" />
<base href="/" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="google" content="notranslate" />
<link rel="icon" href="favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<title>GridAdminApp</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import type { Config } from 'jest';

const config: Config = {
testEnvironment: 'jsdom',
moduleNameMapper: {
'^.+\\.svg\\?react$': 'jest-svg-transformer',
'^.+\\.(css|less|scss)$': 'identity-obj-proxy',
},
// if need to test with AG Grid, see https://www.ag-grid.com/react-data-grid/testing/
transformIgnorePatterns: ['node_modules/(?!@gridsuite/commons-ui)'], // transform from ESM
moduleDirectories: ['node_modules', 'src'], // to allow absolute path from ./src
setupFiles: ['<rootDir>/jest.setup.ts'],
};

export default config;
11 changes: 11 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { TextEncoder, TextDecoder } from 'util';

// fix for ReferenceError: TextDecoder / TextEncoder is not defined
Object.assign(global, { TextDecoder, TextEncoder });
Loading