Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 1a5d3d9

Browse files
authored
Merge pull request #118 from swarmion/feat/add-frontend-shared
2 parents 60da777 + 79d8862 commit 1a5d3d9

25 files changed

+289
-4
lines changed

commonConfiguration/babel.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const defaultPlugins = [
99
'module-resolver',
1010
{
1111
root: ['./src'],
12-
extensions: ['.ts'],
12+
extensions: ['.ts', '.tsx'],
1313
},
1414
],
1515
'@babel/plugin-transform-runtime',
@@ -34,14 +34,14 @@ const presetsForCJS = [
3434
...defaultPresets,
3535
];
3636

37-
module.exports = (plugins = []) => {
37+
module.exports = (plugins = [], presets = []) => {
3838
return {
3939
env: {
4040
cjs: {
41-
presets: presetsForCJS,
41+
presets: [...presets, ...presetsForCJS],
4242
},
4343
esm: {
44-
presets: presetsForESM,
44+
presets: [...presets, ...presetsForESM],
4545
},
4646
},
4747
ignore: defaultIgnores,

frontend/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@react-hookz/web": "^13.1.0",
3030
"@reduxjs/toolkit": "^1.8.0",
3131
"@swarmion-starter/configuration": "1.0.0",
32+
"@swarmion-starter/frontend-shared": "1.0.0",
3233
"@swarmion-starter/users-contracts": "1.0.0",
3334
"axios": "0.26.1",
3435
"react": "^17.0.2",

frontend/app/src/AppRoutes.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { BrowserRouter, Route, Routes } from 'react-router-dom';
22

3+
import { NotFound } from '@swarmion-starter/frontend-shared';
4+
35
import { Home } from 'pages';
46

57
export enum RoutePaths {
@@ -10,6 +12,7 @@ const AppRoutes = (): JSX.Element => (
1012
<BrowserRouter>
1113
<Routes>
1214
<Route path={RoutePaths.HOME_PAGE} element={<Home />} />
15+
<Route path="*" element={<NotFound />} />
1316
</Routes>
1417
</BrowserRouter>
1518
);

frontend/app/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"types": ["vite-plugin-svgr/client"]
1818
},
1919
"references": [
20+
{ "path": "../shared/tsconfig.build.json" },
2021
{ "path": "../../packages/configuration/tsconfig.build.json" },
2122
{ "path": "../../contracts/users-contracts/tsconfig.build.json" }
2223
],

frontend/app/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@ export default defineConfig(({ mode }) => {
2424
return {
2525
define: envWithProcessPrefix,
2626
plugins,
27+
resolve: {
28+
alias: {
29+
'react/jsx-runtime': 'react/jsx-runtime.js',
30+
},
31+
},
2732
};
2833
});

frontend/shared/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

frontend/shared/.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const generateImportOrderRule = require('../../commonConfiguration/generateImportOrderRule');
2+
3+
module.exports = {
4+
rules: generateImportOrderRule(__dirname),
5+
parserOptions: {
6+
project: ['./tsconfig.json'],
7+
tsconfigRootDir: __dirname,
8+
},
9+
};

frontend/shared/.lintstagedrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const baseConfig = require('../../.lintstagedrc');
2+
module.exports = baseConfig;

frontend/shared/.vscode

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../commonConfiguration/.vscode

frontend/shared/babel.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const commonBabelConfig = require('../../commonConfiguration/babel.config');
2+
3+
const presets = [
4+
[
5+
'@babel/preset-react',
6+
{
7+
runtime: 'automatic',
8+
},
9+
],
10+
];
11+
12+
module.exports = commonBabelConfig([], presets);

0 commit comments

Comments
 (0)