Browse Source

Added WebApp project

master
Youen Toupin 2 years ago
parent
commit
8bdd34412f
  1. 4
      WebApp/.gitignore
  2. 11
      WebApp/.project
  3. 23
      WebApp/package.json
  4. 4
      WebApp/src/app.ts
  5. 8
      WebApp/src/index.html
  6. 7
      WebApp/src/main-page.tsx
  7. 12
      WebApp/tsconfig.json
  8. 42
      WebApp/webpack.config.js

4
WebApp/.gitignore vendored

@ -0,0 +1,4 @@
node_modules
package-lock.json
www

11
WebApp/.project

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WebApp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

23
WebApp/package.json

@ -0,0 +1,23 @@
{
"name": "vehicle-monitor-webapp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack --mode development --watch",
"build": "webpack --mode production"
},
"author": "Youen Toupin",
"license": "AGPL-3.0",
"dependencies": {
"mithril": "^2.0.4"
},
"devDependencies": {
"@types/mithril": "^2.0.9",
"html-webpack-plugin": "^5.5.0",
"ts-loader": "^9.2.8",
"typescript": "^4.6.2",
"webpack": "^5.70.0",
"webpack-cli": "^4.9.2"
}
}

4
WebApp/src/app.ts

@ -0,0 +1,4 @@
import m from 'mithril';
import MainPage from './main-page';
m.mount(document.body, MainPage);

8
WebApp/src/index.html

@ -0,0 +1,8 @@
<!DOCTYPE HTML>
<head>
<meta charset="UTF-8"/>
<title>Ordinateur de bord</title>
</head>
<body>
<p>Chargement...</p>
</body>

7
WebApp/src/main-page.tsx

@ -0,0 +1,7 @@
import m from 'mithril';
export default class MainPage {
view() {
return <p>Hello, world!</p>
}
}

12
WebApp/tsconfig.json

@ -0,0 +1,12 @@
{
"compilerOptions": {
"noImplicitAny": true,
"module": "CommonJS",
"esModuleInterop": true,
"target": "es5",
"jsx": "react",
"jsxFactory": "m",
"allowJs": true,
"moduleResolution": "node"
}
}

42
WebApp/webpack.config.js

@ -0,0 +1,42 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/app.ts',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, './www/'),
clean: true,
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
hash: true
})
],
optimization: {
moduleIds: 'deterministic',
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
},
};
Loading…
Cancel
Save