Skip to content

Commit

Permalink
Cleanup unused WDS deps and config (#23155)
Browse files Browse the repository at this point in the history
* Cleanup unused WDS deps and config

* fix
  • Loading branch information
MindFreeze authored Dec 6, 2024
1 parent 7a12fd2 commit af04927
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 144 deletions.
3 changes: 0 additions & 3 deletions build-scripts/env.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ const paths = require("./paths.cjs");
const isTrue = (value) => value === "1" || value?.toLowerCase() === "true";

module.exports = {
useWDS() {
return isTrue(process.env.WDS);
},
isProdBuild() {
return (
process.env.NODE_ENV === "production" || module.exports.isStatsBuild()
Expand Down
3 changes: 1 addition & 2 deletions build-scripts/gulp/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "./gen-icons-json.js";
import "./locale-data.js";
import "./service-worker.js";
import "./translations.js";
import "./wds.js";
import "./rspack.js";

gulp.task(
Expand All @@ -26,7 +25,7 @@ gulp.task(
"build-locale-data"
),
"copy-static-app",
env.useWDS() ? "wds-watch-app" : "rspack-watch-app"
"rspack-watch-app"
)
);

Expand Down
22 changes: 4 additions & 18 deletions build-scripts/gulp/entry-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { minify } from "html-minifier-terser";
import template from "lodash.template";
import { dirname, extname, resolve } from "node:path";
import { htmlMinifierOptions, terserOptions } from "../bundle.cjs";
import env from "../env.cjs";
import paths from "../paths.cjs";

// macOS companion app has no way to obtain the Safari version used by WKWebView,
Expand Down Expand Up @@ -56,7 +55,6 @@ const getCommonTemplateVars = () => {
{ ignorePatch: true, allowHigherVersions: true }
);
return {
useWDS: env.useWDS(),
modernRegex: compileRegex(browserRegexes.concat(haMacOSRegex)).toString(),
};
};
Expand Down Expand Up @@ -92,13 +90,11 @@ const minifyHtml = (content, ext) => {
};

// Function to generate a dev task for each project's configuration
// Note Currently WDS paths are hard-coded to only work for app
const genPagesDevTask =
(
pageEntries,
inputRoot,
outputRoot,
useWDS = false,
inputSub = "src/html",
publicRoot = ""
) =>
Expand All @@ -109,17 +105,13 @@ const genPagesDevTask =
resolve(inputRoot, inputSub, `${page}.template`),
{
...commonVars,
latestEntryJS: entries.map((entry) =>
useWDS
? `http://localhost:8000/src/entrypoints/${entry}.ts`
: `${publicRoot}/frontend_latest/${entry}.js`
latestEntryJS: entries.map(
(entry) => `${publicRoot}/frontend_latest/${entry}.js`
),
es5EntryJS: entries.map(
(entry) => `${publicRoot}/frontend_es5/${entry}.js`
),
latestCustomPanelJS: useWDS
? "http://localhost:8000/src/entrypoints/custom-panel.ts"
: `${publicRoot}/frontend_latest/custom-panel.js`,
latestCustomPanelJS: `${publicRoot}/frontend_latest/custom-panel.js`,
es5CustomPanelJS: `${publicRoot}/frontend_es5/custom-panel.js`,
}
);
Expand Down Expand Up @@ -176,12 +168,7 @@ const APP_PAGE_ENTRIES = {

gulp.task(
"gen-pages-app-dev",
genPagesDevTask(
APP_PAGE_ENTRIES,
paths.polymer_dir,
paths.app_output_root,
env.useWDS()
)
genPagesDevTask(APP_PAGE_ENTRIES, paths.polymer_dir, paths.app_output_root)
);

gulp.task(
Expand Down Expand Up @@ -287,7 +274,6 @@ gulp.task(
HASSIO_PAGE_ENTRIES,
paths.hassio_dir,
paths.hassio_output_root,
undefined,
"src",
paths.hassio_publicPath
)
Expand Down
10 changes: 0 additions & 10 deletions build-scripts/gulp/wds.js

This file was deleted.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,10 @@
"@babel/preset-env": "7.26.0",
"@babel/preset-typescript": "7.26.0",
"@bundle-stats/plugin-webpack-filter": "4.17.0",
"@koa/cors": "5.0.0",
"@lokalise/node-api": "12.8.0",
"@octokit/auth-oauth-device": "7.1.1",
"@octokit/plugin-retry": "7.1.2",
"@octokit/rest": "21.0.2",
"@open-wc/dev-server-hmr": "0.1.4",
"@rsdoctor/rspack-plugin": "0.4.10",
"@rspack/cli": "1.1.4",
"@rspack/core": "1.1.4",
Expand Down Expand Up @@ -233,7 +231,6 @@
"systemjs": "6.15.1",
"tar": "7.4.3",
"terser-webpack-plugin": "5.3.10",
"transform-async-modules-webpack-plugin": "1.1.1",
"ts-lit-plugin": "2.0.2",
"typescript": "5.7.2",
"vitest": "2.1.8",
Expand Down
6 changes: 0 additions & 6 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@
"description": "Group date-fns with dependent timezone package",
"groupName": "date-fns",
"matchPackageNames": ["date-fns", "date-fns-tz"]
},
{
"description": "Group and temporarily disable WDS packages",
"groupName": "Web Dev Server",
"enabled": false,
"matchPackageNames": ["@web/dev-server{/,}**"]
}
]
}
6 changes: 2 additions & 4 deletions src/html/_header.html.template
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<meta charset="utf-8" />
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<link rel="icon" href="/static/icons/favicon.ico" />
<% if (!useWDS) { %>
<% for (const entry of latestEntryJS) { %>
<link rel="modulepreload" href="<%= entry %>" crossorigin="use-credentials" />
<% } %>
<% for (const entry of latestEntryJS) { %>
<link rel="modulepreload" href="<%= entry %>" crossorigin="use-credentials" />
<% } %>
2 changes: 1 addition & 1 deletion src/html/_script_loader.html.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script <% if (!useWDS) { %>crossorigin="use-credentials"<% } %>>
<script crossorigin="use-credentials">
if (isModern) {
<% for (const entry of latestEntryJS) { %>
import("<%= entry %>");
Expand Down
2 changes: 1 addition & 1 deletion src/html/index.html.template
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<home-assistant></home-assistant>
<%= renderTemplate("_js_base.html.template") %>
<%= renderTemplate("_preload_roboto.html.template") %>
<script <% if (!useWDS) { %>crossorigin="use-credentials"<% } %>>
<script crossorigin="use-credentials">
if (isModern) {
<% for (const entry of latestEntryJS) { %>
import("<%= entry %>");
Expand Down
Loading

0 comments on commit af04927

Please sign in to comment.