Replace bundler with webpack

This commit is contained in:
andig 2021-01-03 23:34:13 +01:00
parent 8db09e8160
commit 7591a50e0b
10 changed files with 20817 additions and 23742 deletions

View file

@ -1,8 +1,20 @@
{
"start_url": "../#",
"start_url": "../",
"name": "EV Charge Controller",
"short_name": "EV Charge Controller",
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
"display": "standalone",
"icons": [
{
"src": "android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

View file

@ -19,10 +19,6 @@
<meta name="theme-color" content="#ffffff" />
<title>evcc</title>
<!-- CSS -->
<link href="../node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="./css/app.css" rel="stylesheet" />
</head>
<body>
<script>
@ -50,6 +46,5 @@
</div>
</div>
</footer>
<script src="js/app.js"></script>
</body>
</html>

View file

@ -1,3 +1,5 @@
import "../css/app.css";
import "bootstrap/dist/css/bootstrap.min.css";
import "popper.js";
import "bootstrap";
import Vue from "vue";

View file

@ -10,7 +10,7 @@ const routes = [
{ path: "/config", component: Config },
];
module.exports = new VueRouter({
export default new VueRouter({
routes,
linkExactActiveClass: "active", // Bootstrap <nav>
});

View file

@ -33,4 +33,4 @@ const store = {
},
};
module.exports = store;
export default store;

10512
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,25 +3,23 @@
"description": "",
"main": "index.js",
"scripts": {
"dev": "rimraf dist; parcel watch assets/* --public-url /dist/",
"build": "rimraf dist; parcel build assets/* --public-url /dist/",
"dev": "vue-cli-service build --watch --mode=development",
"build": "vue-cli-service build",
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "prettier assets --write && eslint assets/**/*.js assets/**/*.vue --fix",
"storybook": "start-storybook -p 6006 -s assets,node_modules/jquery/dist,node_modules/popper.js/dist,node_modules/bootstrap/dist",
"build-storybook": "build-storybook",
"fix-audit": "npm-force-resolutions"
"storybook": "start-storybook -p 6006 -s assets,node_modules/bootstrap/dist",
"build-storybook": "build-storybook"
},
"author": "",
"author": "naltatis & andig",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.12.9",
"@storybook/addon-actions": "^6.1.10",
"@storybook/addon-essentials": "^6.1.10",
"@storybook/addon-links": "^6.1.10",
"@storybook/vue": "^6.1.10",
"@vue/component-compiler-utils": "^3.2.0",
"@vue/cli-service": "^4.5.9",
"@vue/eslint-config-standard": "^5.1.2",
"babel-loader": "^8.2.2",
"eslint": "^7.14.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
@ -30,11 +28,7 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-vue": "^7.1.0",
"npm-force-resolutions": "0.0.3",
"parcel-bundler": "^1.12.4",
"prettier": "^2.2.0",
"rimraf": "^3.0.2",
"vue-loader": "^15.9.5",
"vue-template-compiler": "^2.6.12"
},
"engines": {

File diff suppressed because it is too large Load diff

View file

@ -344,7 +344,11 @@ func NewHTTPd(url string, site core.SiteAPI, hub *SocketHub, cache *util.Cache)
if useLocalAssets {
distDir = http.Dir("./dist")
}
static.PathPrefix("/dist/").Handler(http.StripPrefix("/dist/", http.FileServer(distDir)))
for _, public := range []string{"css", "js", "ico"} {
static.PathPrefix(fmt.Sprintf("/%s/", public)).Handler(
http.Handler(http.FileServer(distDir)),
)
}
// api
api := router.PathPrefix("/api").Subrouter()

12
vue.config.js Normal file
View file

@ -0,0 +1,12 @@
const CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = {
pages: {
index: { entry: "./assets/js/app.js", template: "./assets/index.html", title: "evcc" },
},
outputDir: "./dist",
publicPath: "./",
configureWebpack: {
plugins: [new CopyWebpackPlugin([{ from: "assets/ico/", to: "ico" }])],
},
};