From 1b67a6f358c16b1bb0cc4e3e914b2574f775572c Mon Sep 17 00:00:00 2001 From: Wendelin Date: Wed, 28 May 2025 14:50:25 +0200 Subject: [PATCH] Use tsx to run gulp --- .github/workflows/cast_deployment.yaml | 4 +- .github/workflows/ci.yaml | 8 +- .github/workflows/demo_deployment.yaml | 4 +- .github/workflows/design_deployment.yaml | 2 +- .github/workflows/design_preview.yaml | 2 +- ...ll-plugin.js => custom-polyfill-plugin.ts} | 2 +- build-scripts/bundle.ts | 4 +- build-scripts/gulp/app.ts | 97 +++-- build-scripts/gulp/cast.ts | 65 +-- build-scripts/gulp/clean.ts | 58 +-- build-scripts/gulp/compress.ts | 29 +- build-scripts/gulp/demo.ts | 87 ++-- build-scripts/gulp/download-translations.ts | 62 ++- build-scripts/gulp/entry-html.ts | 149 +++---- .../gulp/fetch-nightly-translations.ts | 19 +- build-scripts/gulp/gallery.ts | 110 ++--- build-scripts/gulp/gather-static.ts | 74 ++-- build-scripts/gulp/gen-icons-json.ts | 11 +- build-scripts/gulp/hassio.ts | 80 ++-- build-scripts/gulp/index.ts | 59 ++- build-scripts/gulp/landing-page.ts | 77 ++-- build-scripts/gulp/locale-data.ts | 10 +- build-scripts/gulp/rspack.ts | 77 ++-- build-scripts/gulp/service-worker.ts | 10 +- build-scripts/gulp/translations.ts | 49 +-- build-scripts/runTask.ts | 42 ++ cast/script/build_cast | 2 +- cast/script/develop_cast | 2 +- demo/script/build_demo | 2 +- demo/script/develop_demo | 2 +- demo/script/size_stats | 2 +- gallery/script/build_gallery | 2 +- gallery/script/develop_gallery | 2 +- gulpfile.ts | 4 - hassio/script/build_hassio | 2 +- hassio/script/develop | 2 +- landing-page/script/build_landing_page | 2 +- landing-page/script/develop | 2 +- package.json | 5 +- script/build_frontend | 2 +- script/develop | 2 +- script/setup_translations | 2 +- script/size_stats | 2 +- script/translations_download | 2 +- tsconfig.json | 3 - yarn.lock | 375 +++++++----------- 46 files changed, 754 insertions(+), 856 deletions(-) rename build-scripts/babel-plugins/{custom-polyfill-plugin.js => custom-polyfill-plugin.ts} (99%) create mode 100644 build-scripts/runTask.ts delete mode 100644 gulpfile.ts diff --git a/.github/workflows/cast_deployment.yaml b/.github/workflows/cast_deployment.yaml index 74b260089e..0851d45f7f 100644 --- a/.github/workflows/cast_deployment.yaml +++ b/.github/workflows/cast_deployment.yaml @@ -35,7 +35,7 @@ jobs: run: yarn install --immutable - name: Build Cast - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp build-cast + run: yarn run-task build-cast env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -70,7 +70,7 @@ jobs: run: yarn install --immutable - name: Build Cast - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp build-cast + run: yarn run-task build-cast env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3afeef4ffd..97a198111c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,7 +35,7 @@ jobs: - name: Check for duplicate dependencies run: yarn dedupe --check - name: Build resources - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages + run: yarn run-task gen-icons-json build-translations build-locale-data gather-gallery-pages - name: Setup lint cache uses: actions/cache@v4.2.3 with: @@ -67,7 +67,7 @@ jobs: - name: Install dependencies run: yarn install --immutable - name: Build resources - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data + run: yarn run-task gen-icons-json build-translations build-locale-data - name: Run Tests run: yarn run test build: @@ -85,7 +85,7 @@ jobs: - name: Install dependencies run: yarn install --immutable - name: Build Application - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp build-app + run: yarn run-task build-app env: IS_TEST: "true" - name: Upload bundle stats @@ -109,7 +109,7 @@ jobs: - name: Install dependencies run: yarn install --immutable - name: Build Application - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp build-hassio + run: yarn run-task build-hassio env: IS_TEST: "true" - name: Upload bundle stats diff --git a/.github/workflows/demo_deployment.yaml b/.github/workflows/demo_deployment.yaml index 5d9d08dccb..da0dc086aa 100644 --- a/.github/workflows/demo_deployment.yaml +++ b/.github/workflows/demo_deployment.yaml @@ -36,7 +36,7 @@ jobs: run: yarn install --immutable - name: Build Demo - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp build-demo + run: yarn run-task build-demo env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -71,7 +71,7 @@ jobs: run: yarn install --immutable - name: Build Demo - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp build-demo + run: yarn run-task build-demo env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/design_deployment.yaml b/.github/workflows/design_deployment.yaml index 64c6a7969b..d8cddfd0d9 100644 --- a/.github/workflows/design_deployment.yaml +++ b/.github/workflows/design_deployment.yaml @@ -28,7 +28,7 @@ jobs: run: yarn install --immutable - name: Build Gallery - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp build-gallery + run: yarn run-task build-gallery env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/design_preview.yaml b/.github/workflows/design_preview.yaml index b5c30f83c5..cde9680905 100644 --- a/.github/workflows/design_preview.yaml +++ b/.github/workflows/design_preview.yaml @@ -33,7 +33,7 @@ jobs: run: yarn install --immutable - name: Build Gallery - run: node --import ./ts-node-register.js ./node_modules/.bin/gulp build-gallery + run: yarn run-task build-gallery env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build-scripts/babel-plugins/custom-polyfill-plugin.js b/build-scripts/babel-plugins/custom-polyfill-plugin.ts similarity index 99% rename from build-scripts/babel-plugins/custom-polyfill-plugin.js rename to build-scripts/babel-plugins/custom-polyfill-plugin.ts index 2a86470b52..49fe36f458 100644 --- a/build-scripts/babel-plugins/custom-polyfill-plugin.js +++ b/build-scripts/babel-plugins/custom-polyfill-plugin.ts @@ -1,6 +1,6 @@ import defineProvider from "@babel/helper-define-polyfill-provider"; import { join } from "node:path"; -import paths from "../paths.cjs"; +import paths from "../paths"; const POLYFILL_DIR = join(paths.root_dir, "src/resources/polyfills"); diff --git a/build-scripts/bundle.ts b/build-scripts/bundle.ts index dd5246b837..9031f17455 100644 --- a/build-scripts/bundle.ts +++ b/build-scripts/bundle.ts @@ -1,7 +1,7 @@ import path from "node:path"; import packageJson from "../package.json" assert { type: "json" }; -import paths, { dirname } from "./paths.ts"; import { version } from "./env.ts"; +import paths, { dirname } from "./paths.ts"; const dependencies = packageJson.dependencies; @@ -164,7 +164,7 @@ export const babelOptions = ({ // themselves to prevent self-injection. plugins: [ [ - path.join(BABEL_PLUGINS, "custom-polyfill-plugin.js"), + path.join(BABEL_PLUGINS, "custom-polyfill-plugin.ts"), { method: "usage-global" }, ], ], diff --git a/build-scripts/gulp/app.ts b/build-scripts/gulp/app.ts index e310a5151f..328491f357 100644 --- a/build-scripts/gulp/app.ts +++ b/build-scripts/gulp/app.ts @@ -1,57 +1,54 @@ -import { parallel, series, task } from "gulp"; +import { parallel, series } from "gulp"; import { isStatsBuild, isTestBuild } from "../env.ts"; -import "./clean.ts"; -import "./compress.ts"; -import "./entry-html.ts"; -import "./gather-static.ts"; -import "./gen-icons-json.ts"; -import "./locale-data.ts"; -import "./rspack.ts"; -import "./service-worker.ts"; -import "./translations.ts"; +import { clean } from "./clean.ts"; +import { compressApp } from "./compress.ts"; +import { genPagesAppDev, genPagesAppProd } from "./entry-html.ts"; +import { copyStaticApp } from "./gather-static.ts"; +import { genIconsJson } from "./gen-icons-json.ts"; +import { buildLocaleData } from "./locale-data.ts"; +import { rspackProdApp, rspackWatchApp } from "./rspack.ts"; +import { + genServiceWorkerAppDev, + genServiceWorkerAppProd, +} from "./service-worker.ts"; +import { buildTranslations } from "./translations.ts"; -task( - "develop-app", - series( - async () => { - process.env.NODE_ENV = "development"; - }, - "clean", - parallel( - "gen-service-worker-app-dev", - "gen-icons-json", - "gen-pages-app-dev", - "build-translations", - "build-locale-data" - ), - "copy-static-app", - "rspack-watch-app" - ) +// develop-app +export const developApp = series( + async () => { + process.env.NODE_ENV = "development"; + }, + clean, + parallel( + genServiceWorkerAppDev, + genIconsJson, + genPagesAppDev, + buildTranslations, + buildLocaleData + ), + copyStaticApp, + rspackWatchApp ); -task( - "build-app", - series( - async () => { - process.env.NODE_ENV = "production"; - }, - "clean", - parallel("gen-icons-json", "build-translations", "build-locale-data"), - "copy-static-app", - "rspack-prod-app", - parallel("gen-pages-app-prod", "gen-service-worker-app-prod"), - // Don't compress running tests - ...(isTestBuild() || isStatsBuild() ? [] : ["compress-app"]) - ) +// build-app +export const buildApp = series( + async () => { + process.env.NODE_ENV = "production"; + }, + clean, + parallel(genIconsJson, buildTranslations, buildLocaleData), + copyStaticApp, + rspackProdApp, + parallel(genPagesAppProd, genServiceWorkerAppProd), + // Don't compress running tests + ...(isTestBuild() || isStatsBuild() ? [] : [compressApp]) ); -task( - "analyze-app", - series( - async () => { - process.env.STATS = "1"; - }, - "clean", - "rspack-prod-app" - ) +// analyze-app +export const analyzeApp = series( + async () => { + process.env.STATS = "1"; + }, + clean, + rspackProdApp ); diff --git a/build-scripts/gulp/cast.ts b/build-scripts/gulp/cast.ts index 85ce284b65..9d1b9db31d 100644 --- a/build-scripts/gulp/cast.ts +++ b/build-scripts/gulp/cast.ts @@ -1,37 +1,38 @@ -import { parallel, series, task } from "gulp"; -import "./clean.ts"; -import "./entry-html.ts"; -import "./gather-static.ts"; -import "./rspack.ts"; +import { parallel, series } from "gulp"; +import { cleanCast } from "./clean.ts"; +import { genPagesCastDev, genPagesCastProd } from "./entry-html.ts"; +import { copyStaticCast } from "./gather-static.ts"; +import { genIconsJson } from "./gen-icons-json.ts"; +import { buildLocaleData } from "./locale-data.ts"; +import { rspackDevServerCast, rspackProdCast } from "./rspack.ts"; import "./service-worker.ts"; -import "./translations.ts"; +import { + buildTranslations, + translationsEnableMergeBackend, +} from "./translations.ts"; -task( - "develop-cast", - series( - async () => { - process.env.NODE_ENV = "development"; - }, - "clean-cast", - "translations-enable-merge-backend", - parallel("gen-icons-json", "build-translations", "build-locale-data"), - "copy-static-cast", - "gen-pages-cast-dev", - "rspack-dev-server-cast" - ) +// develop-cast +export const developCast = series( + async () => { + process.env.NODE_ENV = "development"; + }, + cleanCast, + translationsEnableMergeBackend, + parallel(genIconsJson, buildTranslations, buildLocaleData), + copyStaticCast, + genPagesCastDev, + rspackDevServerCast ); -task( - "build-cast", - series( - async () => { - process.env.NODE_ENV = "production"; - }, - "clean-cast", - "translations-enable-merge-backend", - parallel("gen-icons-json", "build-translations", "build-locale-data"), - "copy-static-cast", - "rspack-prod-cast", - "gen-pages-cast-prod" - ) +// build-cast +export const buildCast = series( + async () => { + process.env.NODE_ENV = "production"; + }, + cleanCast, + translationsEnableMergeBackend, + parallel(genIconsJson, buildTranslations, buildLocaleData), + copyStaticCast, + rspackProdCast, + genPagesCastProd ); diff --git a/build-scripts/gulp/clean.ts b/build-scripts/gulp/clean.ts index 5ad4308dc5..3eea7f3f30 100644 --- a/build-scripts/gulp/clean.ts +++ b/build-scripts/gulp/clean.ts @@ -1,51 +1,31 @@ import { deleteSync } from "del"; -import { parallel, task } from "gulp"; +import { parallel } from "gulp"; import paths from "../paths.ts"; -import "./translations.ts"; +import { cleanTranslations } from "./translations.ts"; -task( - "clean", - parallel("clean-translations", async () => - deleteSync([paths.app_output_root, paths.build_dir]) - ) +export const clean = parallel(cleanTranslations, async () => + deleteSync([paths.app_output_root, paths.build_dir]) ); -task( - "clean-demo", - parallel("clean-translations", async () => - deleteSync([paths.demo_output_root, paths.build_dir]) - ) +export const cleanDemo = parallel(cleanTranslations, async () => + deleteSync([paths.demo_output_root, paths.build_dir]) ); -task( - "clean-cast", - parallel("clean-translations", async () => - deleteSync([paths.cast_output_root, paths.build_dir]) - ) +export const cleanCast = parallel(cleanTranslations, async () => + deleteSync([paths.cast_output_root, paths.build_dir]) ); -task("clean-hassio", async () => - deleteSync([paths.hassio_output_root, paths.build_dir]) +export const cleanHassio = async () => + deleteSync([paths.hassio_output_root, paths.build_dir]); + +export const cleanGallery = parallel(cleanTranslations, async () => + deleteSync([paths.gallery_output_root, paths.gallery_build, paths.build_dir]) ); -task( - "clean-gallery", - parallel("clean-translations", async () => - deleteSync([ - paths.gallery_output_root, - paths.gallery_build, - paths.build_dir, - ]) - ) -); - -task( - "clean-landing-page", - parallel("clean-translations", async () => - deleteSync([ - paths.landingPage_output_root, - paths.landingPage_build, - paths.build_dir, - ]) - ) +export const cleanLandingPage = parallel(cleanTranslations, async () => + deleteSync([ + paths.landingPage_output_root, + paths.landingPage_build, + paths.build_dir, + ]) ); diff --git a/build-scripts/gulp/compress.ts b/build-scripts/gulp/compress.ts index 5f440c5c1e..a91c576fd6 100644 --- a/build-scripts/gulp/compress.ts +++ b/build-scripts/gulp/compress.ts @@ -1,6 +1,6 @@ // Tasks to compress -import { dest, parallel, src, task } from "gulp"; +import { dest, parallel, src } from "gulp"; import brotli from "gulp-brotli"; import zopfli from "gulp-zopfli-green"; import { constants } from "node:zlib"; @@ -64,21 +64,16 @@ const compressHassioOtherBrotli = () => const compressHassioOtherZopfli = () => compressOther(paths.hassio_output_root, paths.hassio_output_latest, "zopfli"); -task( - "compress-app", - parallel( - compressAppModernBrotli, - compressAppOtherBrotli, - compressAppModernZopfli, - compressAppOtherZopfli - ) +export const compressApp = parallel( + compressAppModernBrotli, + compressAppOtherBrotli, + compressAppModernZopfli, + compressAppOtherZopfli ); -task( - "compress-hassio", - parallel( - compressHassioModernBrotli, - compressHassioOtherBrotli, - compressHassioModernZopfli, - compressHassioOtherZopfli - ) + +export const compressHassio = parallel( + compressHassioModernBrotli, + compressHassioOtherBrotli, + compressHassioModernZopfli, + compressHassioOtherZopfli ); diff --git a/build-scripts/gulp/demo.ts b/build-scripts/gulp/demo.ts index 3e87f81892..bafe71c112 100644 --- a/build-scripts/gulp/demo.ts +++ b/build-scripts/gulp/demo.ts @@ -1,54 +1,47 @@ -import { parallel, series, task } from "gulp"; -import "./clean.ts"; -import "./entry-html.ts"; -import "./gather-static.ts"; -import "./gen-icons-json.ts"; -import "./rspack.ts"; +import { parallel, series } from "gulp"; +import { clean, cleanDemo } from "./clean.ts"; +import { genPagesDemoDev, genPagesDemoProd } from "./entry-html.ts"; +import { copyStaticDemo } from "./gather-static.ts"; +import { genIconsJson } from "./gen-icons-json.ts"; +import { buildLocaleData } from "./locale-data.ts"; +import { rspackDevServerDemo, rspackProdDemo } from "./rspack.ts"; import "./service-worker.ts"; -import "./translations.ts"; +import { + buildTranslations, + translationsEnableMergeBackend, +} from "./translations.ts"; -task( - "develop-demo", - series( - async function setEnv() { - process.env.NODE_ENV = "development"; - }, - "clean-demo", - "translations-enable-merge-backend", - parallel( - "gen-icons-json", - "gen-pages-demo-dev", - "build-translations", - "build-locale-data" - ), - "copy-static-demo", - "rspack-dev-server-demo" - ) +// develop-demo +export const developDemo = series( + async function setEnv() { + process.env.NODE_ENV = "development"; + }, + cleanDemo, + translationsEnableMergeBackend, + parallel(genIconsJson, genPagesDemoDev, buildTranslations, buildLocaleData), + copyStaticDemo, + rspackDevServerDemo ); -task( - "build-demo", - series( - async function setEnv() { - process.env.NODE_ENV = "production"; - }, - "clean-demo", - // Cast needs to be backwards compatible and older HA has no translations - "translations-enable-merge-backend", - parallel("gen-icons-json", "build-translations", "build-locale-data"), - "copy-static-demo", - "rspack-prod-demo", - "gen-pages-demo-prod" - ) +// build-demo +export const buildDemo = series( + async function setEnv() { + process.env.NODE_ENV = "production"; + }, + cleanDemo, + // Cast needs to be backwards compatible and older HA has no translations + translationsEnableMergeBackend, + parallel(genIconsJson, buildTranslations, buildLocaleData), + copyStaticDemo, + rspackProdDemo, + genPagesDemoProd ); -task( - "analyze-demo", - series( - async function setEnv() { - process.env.STATS = "1"; - }, - "clean", - "rspack-prod-demo" - ) +// analyze-demo +export const analyzeDemo = series( + async function setEnv() { + process.env.STATS = "1"; + }, + clean, + rspackProdDemo ); diff --git a/build-scripts/gulp/download-translations.ts b/build-scripts/gulp/download-translations.ts index e09a37d72d..f1274560a6 100644 --- a/build-scripts/gulp/download-translations.ts +++ b/build-scripts/gulp/download-translations.ts @@ -1,9 +1,9 @@ import { LokaliseApi } from "@lokalise/node-api"; -import fs from "node:fs/promises"; -import { dest, series, src, task } from "gulp"; +import { dest, series, src } from "gulp"; import transform from "gulp-json-transform"; import JSZip from "jszip"; import mapStream from "map-stream"; +import fs from "node:fs/promises"; import path from "node:path"; const inDir = "translations"; @@ -12,11 +12,14 @@ const inDirBackend = `${inDir}/backend`; const srcMeta = "src/translations/translationMetadata.json"; const encoding = "utf8"; -function hasHtml(data) { - return /<\S*>/i.test(data); -} +const hasHtml = (data) => /<\S*>/i.test(data); -function recursiveCheckHasHtml(file, data, errors: string[], recKey?: string) { +const recursiveCheckHasHtml = ( + file, + data, + errors: string[], + recKey?: string +) => { Object.keys(data).forEach(function (key) { if (typeof data[key] === "object") { const nextRecKey = recKey ? `${recKey}.${key}` : key; @@ -25,9 +28,9 @@ function recursiveCheckHasHtml(file, data, errors: string[], recKey?: string) { errors.push(`HTML found in ${file.path} at key ${recKey}.${key}`); } }); -} +}; -function checkHtml() { +const checkHtml = () => { const errors = []; return mapStream(function (file, cb) { @@ -44,9 +47,9 @@ function checkHtml() { } cb(error, file); }); -} +}; -function convertBackendTranslations(data, _file) { +const convertBackendTranslationsTransform = (data, _file) => { const output = { component: {} }; if (!data.component) { return output; @@ -62,21 +65,19 @@ function convertBackendTranslations(data, _file) { }); }); return output; -} +}; -task("convert-backend-translations", function () { - return src([`${inDirBackend}/*.json`]) - .pipe(transform((data, file) => convertBackendTranslations(data, file))) +const convertBackendTranslations = () => + src([`${inDirBackend}/*.json`]) + .pipe( + transform((data, file) => convertBackendTranslationsTransform(data, file)) + ) .pipe(dest(inDirBackend)); -}); -task("check-translations-html", function () { - return src([`${inDirFrontend}/*.json`, `${inDirBackend}/*.json`]).pipe( - checkHtml() - ); -}); +const checkTranslationsHtml = () => + src([`${inDirFrontend}/*.json`, `${inDirBackend}/*.json`]).pipe(checkHtml()); -task("check-all-files-exist", async function () { +const checkAllFilesExist = async () => { const file = await fs.readFile(srcMeta, { encoding }); const meta = JSON.parse(file); const writings: Promise[] = []; @@ -91,14 +92,14 @@ task("check-all-files-exist", async function () { ); }); await Promise.allSettled(writings); -}); +}; const lokaliseProjects = { backend: "130246255a974bd3b5e8a1.51616605", frontend: "3420425759f6d6d241f598.13594006", }; -task("fetch-lokalise", async function () { +const fetchLokalise = async () => { let apiKey; try { apiKey = @@ -167,14 +168,11 @@ task("fetch-lokalise", async function () { }) ) ); -}); +}; -task( - "download-translations", - series( - "fetch-lokalise", - "convert-backend-translations", - "check-translations-html", - "check-all-files-exist" - ) +export const downloadTranslations = series( + fetchLokalise, + convertBackendTranslations, + checkTranslationsHtml, + checkAllFilesExist ); diff --git a/build-scripts/gulp/entry-html.ts b/build-scripts/gulp/entry-html.ts index 40e93a70d4..e02dc8f2d1 100644 --- a/build-scripts/gulp/entry-html.ts +++ b/build-scripts/gulp/entry-html.ts @@ -6,7 +6,6 @@ import { getPreUserAgentRegexes, } from "browserslist-useragent-regexp"; import fs from "fs-extra"; -import { task } from "gulp"; import { minify } from "html-minifier-terser"; import template from "lodash.template"; import { dirname, extname, resolve } from "node:path"; @@ -171,20 +170,18 @@ const APP_PAGE_ENTRIES = { "index.html": ["core", "app"], }; -task( - "gen-pages-app-dev", - genPagesDevTask(APP_PAGE_ENTRIES, paths.root_dir, paths.app_output_root) +export const genPagesAppDev = genPagesDevTask( + APP_PAGE_ENTRIES, + paths.root_dir, + paths.app_output_root ); -task( - "gen-pages-app-prod", - genPagesProdTask( - APP_PAGE_ENTRIES, - paths.root_dir, - paths.app_output_root, - paths.app_output_latest, - paths.app_output_es5 - ) +export const genPagesAppProd = genPagesProdTask( + APP_PAGE_ENTRIES, + paths.root_dir, + paths.app_output_root, + paths.app_output_latest, + paths.app_output_es5 ); const CAST_PAGE_ENTRIES = { @@ -194,104 +191,82 @@ const CAST_PAGE_ENTRIES = { "receiver.html": ["receiver"], }; -task( - "gen-pages-cast-dev", - genPagesDevTask(CAST_PAGE_ENTRIES, paths.cast_dir, paths.cast_output_root) +export const genPagesCastDev = genPagesDevTask( + CAST_PAGE_ENTRIES, + paths.cast_dir, + paths.cast_output_root ); -task( - "gen-pages-cast-prod", - genPagesProdTask( - CAST_PAGE_ENTRIES, - paths.cast_dir, - paths.cast_output_root, - paths.cast_output_latest, - paths.cast_output_es5 - ) +export const genPagesCastProd = genPagesProdTask( + CAST_PAGE_ENTRIES, + paths.cast_dir, + paths.cast_output_root, + paths.cast_output_latest, + paths.cast_output_es5 ); const DEMO_PAGE_ENTRIES = { "index.html": ["main"] }; -task( - "gen-pages-demo-dev", - genPagesDevTask(DEMO_PAGE_ENTRIES, paths.demo_dir, paths.demo_output_root) +export const genPagesDemoDev = genPagesDevTask( + DEMO_PAGE_ENTRIES, + paths.demo_dir, + paths.demo_output_root ); -task( - "gen-pages-demo-prod", - genPagesProdTask( - DEMO_PAGE_ENTRIES, - paths.demo_dir, - paths.demo_output_root, - paths.demo_output_latest, - paths.demo_output_es5 - ) +export const genPagesDemoProd = genPagesProdTask( + DEMO_PAGE_ENTRIES, + paths.demo_dir, + paths.demo_output_root, + paths.demo_output_latest, + paths.demo_output_es5 ); const GALLERY_PAGE_ENTRIES = { "index.html": ["entrypoint"] }; -task( - "gen-pages-gallery-dev", - genPagesDevTask( - GALLERY_PAGE_ENTRIES, - paths.gallery_dir, - paths.gallery_output_root - ) +export const genPagesGalleryDev = genPagesDevTask( + GALLERY_PAGE_ENTRIES, + paths.gallery_dir, + paths.gallery_output_root ); -task( - "gen-pages-gallery-prod", - genPagesProdTask( - GALLERY_PAGE_ENTRIES, - paths.gallery_dir, - paths.gallery_output_root, - paths.gallery_output_latest - ) +export const genPagesGalleryProd = genPagesProdTask( + GALLERY_PAGE_ENTRIES, + paths.gallery_dir, + paths.gallery_output_root, + paths.gallery_output_latest ); const LANDING_PAGE_PAGE_ENTRIES = { "index.html": ["entrypoint"] }; -task( - "gen-pages-landing-page-dev", - genPagesDevTask( - LANDING_PAGE_PAGE_ENTRIES, - paths.landingPage_dir, - paths.landingPage_output_root - ) +export const genPagesLandingPageDev = genPagesDevTask( + LANDING_PAGE_PAGE_ENTRIES, + paths.landingPage_dir, + paths.landingPage_output_root ); -task( - "gen-pages-landing-page-prod", - genPagesProdTask( - LANDING_PAGE_PAGE_ENTRIES, - paths.landingPage_dir, - paths.landingPage_output_root, - paths.landingPage_output_latest, - paths.landingPage_output_es5 - ) +export const genPagesLandingPageProd = genPagesProdTask( + LANDING_PAGE_PAGE_ENTRIES, + paths.landingPage_dir, + paths.landingPage_output_root, + paths.landingPage_output_latest, + paths.landingPage_output_es5 ); const HASSIO_PAGE_ENTRIES = { "entrypoint.js": ["entrypoint"] }; -task( - "gen-pages-hassio-dev", - genPagesDevTask( - HASSIO_PAGE_ENTRIES, - paths.hassio_dir, - paths.hassio_output_root, - "src", - paths.hassio_publicPath - ) +export const genPagesHassioDev = genPagesDevTask( + HASSIO_PAGE_ENTRIES, + paths.hassio_dir, + paths.hassio_output_root, + "src", + paths.hassio_publicPath ); -task( - "gen-pages-hassio-prod", - genPagesProdTask( - HASSIO_PAGE_ENTRIES, - paths.hassio_dir, - paths.hassio_output_root, - paths.hassio_output_latest, - paths.hassio_output_es5, - "src" - ) +export const genPagesHassioProd = genPagesProdTask( + HASSIO_PAGE_ENTRIES, + paths.hassio_dir, + paths.hassio_output_root, + paths.hassio_output_latest, + paths.hassio_output_es5, + "src" ); diff --git a/build-scripts/gulp/fetch-nightly-translations.ts b/build-scripts/gulp/fetch-nightly-translations.ts index d28011cba4..d4dbbf7c24 100644 --- a/build-scripts/gulp/fetch-nightly-translations.ts +++ b/build-scripts/gulp/fetch-nightly-translations.ts @@ -4,9 +4,9 @@ import { createOAuthDeviceAuth } from "@octokit/auth-oauth-device"; import { retry } from "@octokit/plugin-retry"; import { Octokit } from "@octokit/rest"; import { deleteAsync } from "del"; -import { mkdir, readFile, writeFile } from "node:fs/promises"; -import { series, task } from "gulp"; +import { series } from "gulp"; import jszip from "jszip"; +import { mkdir, readFile, writeFile } from "node:fs/promises"; import path from "node:path"; import process from "node:process"; import { extract } from "tar"; @@ -22,12 +22,13 @@ const TOKEN_FILE = path.posix.join(EXTRACT_DIR, "token.json"); const ARTIFACT_FILE = path.posix.join(EXTRACT_DIR, "artifact.json"); let allowTokenSetup = false; -task("allow-setup-fetch-nightly-translations", (done) => { + +export const allowSetupFetchNightlyTranslations = (done) => { allowTokenSetup = true; done(); -}); +}; -task("fetch-nightly-translations", async function () { +export const fetchNightlyTranslations = async () => { // Skip all when environment flag is set (assumes translations are already in place) if (process.env?.SKIP_FETCH_NIGHTLY_TRANSLATIONS) { console.log("Skipping fetch due to environment signal"); @@ -161,9 +162,9 @@ task("fetch-nightly-translations", async function () { await new Promise((resolve, reject) => { extractStream.on("close", resolve).on("error", reject); }); -}); +}; -task( - "setup-and-fetch-nightly-translations", - series("allow-setup-fetch-nightly-translations", "fetch-nightly-translations") +export const setupAndFetchNightlyTranslations = series( + allowSetupFetchNightlyTranslations, + fetchNightlyTranslations ); diff --git a/build-scripts/gulp/gallery.ts b/build-scripts/gulp/gallery.ts index 78f6807403..a633c74207 100644 --- a/build-scripts/gulp/gallery.ts +++ b/build-scripts/gulp/gallery.ts @@ -1,19 +1,23 @@ -import fs from "node:fs"; import { glob } from "glob"; -import { parallel, series, task, watch } from "gulp"; +import { parallel, series, watch } from "gulp"; import yaml from "js-yaml"; import { marked } from "marked"; +import fs from "node:fs"; import path from "node:path"; import paths from "../paths.ts"; -import "./clean.ts"; -import "./entry-html.ts"; -import "./gather-static.ts"; -import "./gen-icons-json.ts"; -import "./rspack.ts"; -import "./service-worker.ts"; -import "./translations.ts"; +import { cleanGallery } from "./clean.ts"; +import { genPagesGalleryDev, genPagesGalleryProd } from "./entry-html.ts"; +import { copyStaticGallery } from "./gather-static.ts"; +import { genIconsJson } from "./gen-icons-json.ts"; +import { buildLocaleData } from "./locale-data.ts"; +import { rspackDevServerGallery, rspackProdGallery } from "./rspack.ts"; +import { + buildTranslations, + translationsEnableMergeBackend, +} from "./translations.ts"; -task("gather-gallery-pages", async function gatherPages() { +// gather-gallery-pages +export const gatherGalleryPages = async function gatherPages() { const pageDir = path.resolve(paths.gallery_dir, "src/pages"); const files = await glob(path.resolve(pageDir, "**/*")); @@ -144,52 +148,48 @@ task("gather-gallery-pages", async function gatherPages() { content, "utf-8" ); -}); +}; -task( - "develop-gallery", - series( - async function setEnv() { - process.env.NODE_ENV = "development"; - }, - "clean-gallery", - "translations-enable-merge-backend", - parallel( - "gen-icons-json", - "build-translations", - "build-locale-data", - "gather-gallery-pages" - ), - "copy-static-gallery", - "gen-pages-gallery-dev", - parallel("rspack-dev-server-gallery", async function watchMarkdownFiles() { - watch( - [ - path.resolve(paths.gallery_dir, "src/pages/**/*.markdown"), - path.resolve(paths.gallery_dir, "sidebar.js"), - ], - series("gather-gallery-pages") - ); - }) - ) +// develop-gallery +export const developGallery = series( + async function setEnv() { + process.env.NODE_ENV = "development"; + }, + cleanGallery, + translationsEnableMergeBackend, + parallel( + genIconsJson, + buildTranslations, + buildLocaleData, + gatherGalleryPages + ), + copyStaticGallery, + genPagesGalleryDev, + parallel(rspackDevServerGallery, async function watchMarkdownFiles() { + watch( + [ + path.resolve(paths.gallery_dir, "src/pages/**/*.markdown"), + path.resolve(paths.gallery_dir, "sidebar.js"), + ], + series(gatherGalleryPages) + ); + }) ); -task( - "build-gallery", - series( - async function setEnv() { - process.env.NODE_ENV = "production"; - }, - "clean-gallery", - "translations-enable-merge-backend", - parallel( - "gen-icons-json", - "build-translations", - "build-locale-data", - "gather-gallery-pages" - ), - "copy-static-gallery", - "rspack-prod-gallery", - "gen-pages-gallery-prod" - ) +// build-gallery +export const buildGallery = series( + async function setEnv() { + process.env.NODE_ENV = "production"; + }, + cleanGallery, + translationsEnableMergeBackend, + parallel( + genIconsJson, + buildTranslations, + buildLocaleData, + gatherGalleryPages + ), + copyStaticGallery, + rspackProdGallery, + genPagesGalleryProd ); diff --git a/build-scripts/gulp/gather-static.ts b/build-scripts/gulp/gather-static.ts index 32c4cf5faa..acb8c46861 100644 --- a/build-scripts/gulp/gather-static.ts +++ b/build-scripts/gulp/gather-static.ts @@ -1,7 +1,6 @@ // Gulp task to gather all static files. import fs from "fs-extra"; -import { task } from "gulp"; import path from "node:path"; import paths from "../paths.ts"; @@ -17,7 +16,7 @@ const genStaticPath = (...parts) => path.resolve(staticDir, ...parts); -function copyTranslations(staticDir) { +const copyTranslations = (staticDir) => { const staticPath = genStaticPath(staticDir); // Translation output @@ -25,23 +24,23 @@ function copyTranslations(staticDir) { polyPath("build/translations/output"), staticPath("translations") ); -} +}; -function copyLocaleData(staticDir) { +const copyLocaleData = (staticDir) => { const staticPath = genStaticPath(staticDir); // Locale data output fs.copySync(polyPath("build/locale-data"), staticPath("locale-data")); -} +}; -function copyMdiIcons(staticDir) { +const copyMdiIcons = (staticDir) => { const staticPath = genStaticPath(staticDir); // MDI icons output fs.copySync(polyPath("build/mdi"), staticPath("mdi")); -} +}; -function copyPolyfills(staticDir) { +const copyPolyfills = (staticDir) => { const staticPath = genStaticPath(staticDir); // For custom panels using ES5 builds that don't use Babel 7+ @@ -70,9 +69,9 @@ function copyPolyfills(staticDir) { npmPath("dialog-polyfill/dialog-polyfill.css"), staticPath("polyfills/") ); -} +}; -function copyFonts(staticDir) { +const copyFonts = (staticDir) => { const staticPath = genStaticPath(staticDir); // Local fonts fs.copySync( @@ -82,14 +81,14 @@ function copyFonts(staticDir) { filter: (src) => !src.includes(".") || src.endsWith(".woff2"), } ); -} +}; -function copyQrScannerWorker(staticDir) { +const copyQrScannerWorker = (staticDir) => { const staticPath = genStaticPath(staticDir); copyFileDir(npmPath("qr-scanner/qr-scanner-worker.min.js"), staticPath("js")); -} +}; -function copyMapPanel(staticDir) { +const copyMapPanel = (staticDir) => { const staticPath = genStaticPath(staticDir); copyFileDir( npmPath("leaflet/dist/leaflet.css"), @@ -103,43 +102,38 @@ function copyMapPanel(staticDir) { npmPath("leaflet/dist/images"), staticPath("images/leaflet/images/") ); -} +}; -function copyZXingWasm(staticDir) { +const copyZXingWasm = (staticDir) => { const staticPath = genStaticPath(staticDir); copyFileDir( npmPath("zxing-wasm/dist/reader/zxing_reader.wasm"), staticPath("js") ); -} +}; -task("copy-locale-data", async () => { - const staticDir = paths.app_output_static; - copyLocaleData(staticDir); -}); - -task("copy-translations-app", async () => { +export const copyTranslationsApp = async () => { const staticDir = paths.app_output_static; copyTranslations(staticDir); -}); +}; -task("copy-translations-supervisor", async () => { +export const copyTranslationsSupervisor = async () => { const staticDir = paths.hassio_output_static; copyTranslations(staticDir); -}); +}; -task("copy-translations-landing-page", async () => { +export const copyTranslationsLandingPage = async () => { const staticDir = paths.landingPage_output_static; copyTranslations(staticDir); -}); +}; -task("copy-static-supervisor", async () => { +export const copyStaticSupervisor = async () => { const staticDir = paths.hassio_output_static; copyLocaleData(staticDir); copyFonts(staticDir); -}); +}; -task("copy-static-app", async () => { +export const copyStaticApp = async () => { const staticDir = paths.app_output_static; // Basic static files fs.copySync(polyPath("public"), paths.app_output_root); @@ -155,9 +149,9 @@ task("copy-static-app", async () => { // Qr Scanner assets copyZXingWasm(staticDir); copyQrScannerWorker(staticDir); -}); +}; -task("copy-static-demo", async () => { +export const copyStaticDemo = async () => { // Copy app static files fs.copySync( polyPath("public/static"), @@ -171,9 +165,9 @@ task("copy-static-demo", async () => { copyTranslations(paths.demo_output_static); copyLocaleData(paths.demo_output_static); copyMdiIcons(paths.demo_output_static); -}); +}; -task("copy-static-cast", async () => { +export const copyStaticCast = async () => { // Copy app static files fs.copySync(polyPath("public/static"), paths.cast_output_static); // Copy cast static files @@ -184,9 +178,9 @@ task("copy-static-cast", async () => { copyTranslations(paths.cast_output_static); copyLocaleData(paths.cast_output_static); copyMdiIcons(paths.cast_output_static); -}); +}; -task("copy-static-gallery", async () => { +export const copyStaticGallery = async () => { // Copy app static files fs.copySync(polyPath("public/static"), paths.gallery_output_static); // Copy gallery static files @@ -200,9 +194,9 @@ task("copy-static-gallery", async () => { copyTranslations(paths.gallery_output_static); copyLocaleData(paths.gallery_output_static); copyMdiIcons(paths.gallery_output_static); -}); +}; -task("copy-static-landing-page", async () => { +export const copyStaticLandingPage = async () => { // Copy landing-page static files fs.copySync( path.resolve(paths.landingPage_dir, "public"), @@ -211,4 +205,4 @@ task("copy-static-landing-page", async () => { copyFonts(paths.landingPage_output_static); copyTranslations(paths.landingPage_output_static); -}); +}; diff --git a/build-scripts/gulp/gen-icons-json.ts b/build-scripts/gulp/gen-icons-json.ts index 1d1f63a24c..c3a751857f 100644 --- a/build-scripts/gulp/gen-icons-json.ts +++ b/build-scripts/gulp/gen-icons-json.ts @@ -1,7 +1,6 @@ import fs from "node:fs"; -import { task } from "gulp"; -import hash from "object-hash"; import path from "node:path"; +import hash from "object-hash"; import paths from "../paths.ts"; const ICON_PACKAGE_PATH = path.resolve("node_modules/@mdi/svg/"); @@ -97,7 +96,7 @@ const findDifferentiator = (curString, prevString) => { throw new Error(`Cannot find differentiator; ${curString}; ${prevString}`); }; -task("gen-icons-json", (done) => { +export const genIconsJson = (done) => { const meta = getMeta(); const metaAndRemoved = addRemovedMeta(meta); @@ -153,13 +152,13 @@ task("gen-icons-json", (done) => { ); done(); -}); +}; -task("gen-dummy-icons-json", (done) => { +export const genDummyIconsJson = (done) => { if (!fs.existsSync(OUTPUT_DIR)) { fs.mkdirSync(OUTPUT_DIR, { recursive: true }); } fs.writeFileSync(path.resolve(OUTPUT_DIR, "iconList.json"), "[]"); done(); -}); +}; diff --git a/build-scripts/gulp/hassio.ts b/build-scripts/gulp/hassio.ts index c0acd0229f..d64794a8e1 100644 --- a/build-scripts/gulp/hassio.ts +++ b/build-scripts/gulp/hassio.ts @@ -1,45 +1,45 @@ -import { series, task } from "gulp"; +import { series } from "gulp"; import { isTestBuild } from "../env.ts"; -import "./clean.ts"; -import "./compress.ts"; -import "./entry-html.ts"; -import "./gather-static.ts"; -import "./gen-icons-json.ts"; -import "./rspack.ts"; -import "./translations.ts"; +import { cleanHassio } from "./clean.ts"; +import { compressHassio } from "./compress.ts"; +import { genPagesHassioDev, genPagesHassioProd } from "./entry-html.ts"; +import { + copyStaticSupervisor, + copyTranslationsSupervisor, +} from "./gather-static.ts"; +import { genDummyIconsJson } from "./gen-icons-json.ts"; +import { buildLocaleData } from "./locale-data.ts"; +import { rspackProdHassio, rspackWatchHassio } from "./rspack.ts"; +import { buildSupervisorTranslations } from "./translations.ts"; -task( - "develop-hassio", - series( - async function setEnv() { - process.env.NODE_ENV = "development"; - }, - "clean-hassio", - "gen-dummy-icons-json", - "gen-pages-hassio-dev", - "build-supervisor-translations", - "copy-translations-supervisor", - "build-locale-data", - "copy-static-supervisor", - "rspack-watch-hassio" - ) +// develop-hassio +export const developHassio = series( + async function setEnv() { + process.env.NODE_ENV = "development"; + }, + cleanHassio, + genDummyIconsJson, + genPagesHassioDev, + buildSupervisorTranslations, + copyTranslationsSupervisor, + buildLocaleData, + copyStaticSupervisor, + rspackWatchHassio ); -task( - "build-hassio", - series( - async function setEnv() { - process.env.NODE_ENV = "production"; - }, - "clean-hassio", - "gen-dummy-icons-json", - "build-supervisor-translations", - "copy-translations-supervisor", - "build-locale-data", - "copy-static-supervisor", - "rspack-prod-hassio", - "gen-pages-hassio-prod", - ...// Don't compress running tests - (isTestBuild() ? [] : ["compress-hassio"]) - ) +// build-hassio +export const buildHassio = series( + async function setEnv() { + process.env.NODE_ENV = "production"; + }, + cleanHassio, + genDummyIconsJson, + buildSupervisorTranslations, + copyTranslationsSupervisor, + buildLocaleData, + copyStaticSupervisor, + rspackProdHassio, + genPagesHassioProd, + ...// Don't compress running tests + (isTestBuild() ? [] : [compressHassio]) ); diff --git a/build-scripts/gulp/index.ts b/build-scripts/gulp/index.ts index e480c8fe46..12f38177a0 100644 --- a/build-scripts/gulp/index.ts +++ b/build-scripts/gulp/index.ts @@ -1,17 +1,42 @@ -import "./app.ts"; -import "./cast.ts"; -import "./clean.ts"; -import "./compress.ts"; -import "./demo.ts"; -import "./download-translations.ts"; -import "./entry-html.ts"; -import "./fetch-nightly-translations.ts"; -import "./gallery.ts"; -import "./gather-static.ts"; -import "./gen-icons-json.ts"; -import "./hassio.ts"; -import "./landing-page.ts"; -import "./locale-data.ts"; -import "./rspack.ts"; -import "./service-worker.ts"; -import "./translations.ts"; +import { analyzeApp, buildApp, developApp } from "./app"; +import { buildCast, developCast } from "./cast"; +import { analyzeDemo, buildDemo, developDemo } from "./demo"; +import { downloadTranslations } from "./download-translations"; +import { setupAndFetchNightlyTranslations } from "./fetch-nightly-translations"; +import { buildGallery, developGallery, gatherGalleryPages } from "./gallery"; +import { genIconsJson } from "./gen-icons-json"; +import { buildHassio, developHassio } from "./hassio"; +import { buildLandingPage, developLandingPage } from "./landing-page"; +import { buildLocaleData } from "./locale-data"; +import { buildTranslations } from "./translations"; + +export default { + "develop-app": developApp, + "build-app": buildApp, + "analyze-app": analyzeApp, + + "develop-cast": developCast, + "build-cast": buildCast, + + "develop-demo": developDemo, + "build-demo": buildDemo, + "analyze-demo": analyzeDemo, + + "develop-gallery": developGallery, + "build-gallery": buildGallery, + "gather-gallery-pages": gatherGalleryPages, + + "develop-hassio": developHassio, + "build-hassio": buildHassio, + + "develop-landing-page": developLandingPage, + "build-landing-page": buildLandingPage, + + "setup-and-fetch-nightly-translations": setupAndFetchNightlyTranslations, + "download-translations": downloadTranslations, + "build-translations": buildTranslations, + + "gen-icons-json": genIconsJson, + + "build-locale-data": buildLocaleData, +}; diff --git a/build-scripts/gulp/landing-page.ts b/build-scripts/gulp/landing-page.ts index e9ccc0af82..3b777de6b2 100644 --- a/build-scripts/gulp/landing-page.ts +++ b/build-scripts/gulp/landing-page.ts @@ -1,41 +1,46 @@ -import { series, task } from "gulp"; -import "./clean.ts"; +import { series } from "gulp"; +import { cleanLandingPage } from "./clean.ts"; import "./compress.ts"; -import "./entry-html.ts"; -import "./gather-static.ts"; -import "./gen-icons-json.ts"; -import "./rspack.ts"; -import "./translations.ts"; +import { + genPagesLandingPageDev, + genPagesLandingPageProd, +} from "./entry-html.ts"; +import { + copyStaticLandingPage, + copyTranslationsLandingPage, +} from "./gather-static.ts"; +import { buildLocaleData } from "./locale-data.ts"; +import { rspackProdLandingPage, rspackWatchLandingPage } from "./rspack.ts"; +import { + buildLandingPageTranslations, + translationsEnableMergeBackend, +} from "./translations.ts"; -task( - "develop-landing-page", - series( - async function setEnv() { - process.env.NODE_ENV = "development"; - }, - "clean-landing-page", - "translations-enable-merge-backend", - "build-landing-page-translations", - "copy-translations-landing-page", - "build-locale-data", - "copy-static-landing-page", - "gen-pages-landing-page-dev", - "rspack-watch-landing-page" - ) +// develop-landing-page +export const developLandingPage = series( + async function setEnv() { + process.env.NODE_ENV = "development"; + }, + cleanLandingPage, + translationsEnableMergeBackend, + buildLandingPageTranslations, + copyTranslationsLandingPage, + buildLocaleData, + copyStaticLandingPage, + genPagesLandingPageDev, + rspackWatchLandingPage ); -task( - "build-landing-page", - series( - async function setEnv() { - process.env.NODE_ENV = "production"; - }, - "clean-landing-page", - "build-landing-page-translations", - "copy-translations-landing-page", - "build-locale-data", - "copy-static-landing-page", - "rspack-prod-landing-page", - "gen-pages-landing-page-prod" - ) +// build-landing-page +export const buildLandingPage = series( + async function setEnv() { + process.env.NODE_ENV = "production"; + }, + cleanLandingPage, + buildLandingPageTranslations, + copyTranslationsLandingPage, + buildLocaleData, + copyStaticLandingPage, + rspackProdLandingPage, + genPagesLandingPageProd ); diff --git a/build-scripts/gulp/locale-data.ts b/build-scripts/gulp/locale-data.ts index f88bc4e5f6..88cc5cc984 100755 --- a/build-scripts/gulp/locale-data.ts +++ b/build-scripts/gulp/locale-data.ts @@ -1,6 +1,6 @@ import { deleteSync } from "del"; +import { series } from "gulp"; import { mkdir, readFile, writeFile } from "node:fs/promises"; -import { series, task } from "gulp"; import { join, resolve } from "node:path"; import paths from "../paths.ts"; @@ -54,9 +54,9 @@ const convertToJSON = async ( await writeFile(join(outDir, `${pkg}/${lang}.json`), localeData); }; -task("clean-locale-data", async () => deleteSync([outDir])); +const cleanLocaleData = async () => deleteSync([outDir]); -task("create-locale-data", async () => { +const createLocaleData = async () => { const translationMeta = JSON.parse( await readFile( resolve(paths.translations_src, "translationMetadata.json"), @@ -81,6 +81,6 @@ task("create-locale-data", async () => { ) ); await Promise.all(conversions); -}); +}; -task("build-locale-data", series("clean-locale-data", "create-locale-data")); +export const buildLocaleData = series(cleanLocaleData, createLocaleData); diff --git a/build-scripts/gulp/rspack.ts b/build-scripts/gulp/rspack.ts index 4b15924494..dbf0882c63 100644 --- a/build-scripts/gulp/rspack.ts +++ b/build-scripts/gulp/rspack.ts @@ -3,9 +3,10 @@ import rspack from "@rspack/core"; import { RspackDevServer } from "@rspack/dev-server"; import log from "fancy-log"; +import { series, watch } from "gulp"; import fs from "node:fs"; -import { task, watch, series } from "gulp"; import path from "node:path"; +import { isDevContainer, isStatsBuild, isTestBuild } from "../env.ts"; import paths from "../paths.ts"; import { createAppConfig, @@ -15,7 +16,16 @@ import { createHassioConfig, createLandingPageConfig, } from "../rspack.ts"; -import { isDevContainer, isStatsBuild, isTestBuild } from "../env.ts"; +import { + copyTranslationsApp, + copyTranslationsLandingPage, + copyTranslationsSupervisor, +} from "./gather-static.ts"; +import { + buildLandingPageTranslations, + buildSupervisorTranslations, + buildTranslations, +} from "./translations.ts"; const bothBuilds = (createConfigFunc, params) => [ createConfigFunc({ ...params, latestBuild: true }), @@ -105,7 +115,7 @@ const prodBuild = (conf) => ); }); -task("rspack-watch-app", () => { +export const rspackWatchApp = () => { // This command will run forever because we don't close compiler rspack( process.env.ES5 @@ -114,40 +124,37 @@ task("rspack-watch-app", () => { ).watch({ poll: isWsl }, doneHandler()); watch( path.join(paths.translations_src, "en.json"), - series("build-translations", "copy-translations-app") + series(buildTranslations, copyTranslationsApp) ); -}); +}; -task("rspack-prod-app", () => +export const rspackProdApp = () => prodBuild( bothBuilds(createAppConfig, { isProdBuild: true, isStatsBuild: isStatsBuild(), isTestBuild: isTestBuild(), }) - ) -); + ); -task("rspack-dev-server-demo", () => +export const rspackDevServerDemo = () => runDevServer({ compiler: rspack( createDemoConfig({ isProdBuild: false, latestBuild: true }) ), contentBase: paths.demo_output_root, port: 8090, - }) -); + }); -task("rspack-prod-demo", () => +export const rspackProdDemo = () => prodBuild( bothBuilds(createDemoConfig, { isProdBuild: true, isStatsBuild: isStatsBuild(), }) - ) -); + ); -task("rspack-dev-server-cast", () => +export const rspackDevServerCast = () => runDevServer({ compiler: rspack( createCastConfig({ isProdBuild: false, latestBuild: true }) @@ -156,18 +163,16 @@ task("rspack-dev-server-cast", () => port: 8080, // Accessible from the network, because that's how Cast hits it. listenHost: "0.0.0.0", - }) -); + }); -task("rspack-prod-cast", () => +export const rspackProdCast = () => prodBuild( bothBuilds(createCastConfig, { isProdBuild: true, }) - ) -); + ); -task("rspack-watch-hassio", () => { +export const rspackWatchHassio = () => { // This command will run forever because we don't close compiler rspack( createHassioConfig({ @@ -178,21 +183,20 @@ task("rspack-watch-hassio", () => { watch( path.join(paths.translations_src, "en.json"), - series("build-supervisor-translations", "copy-translations-supervisor") + series(buildSupervisorTranslations, copyTranslationsSupervisor) ); -}); +}; -task("rspack-prod-hassio", () => +export const rspackProdHassio = () => prodBuild( bothBuilds(createHassioConfig, { isProdBuild: true, isStatsBuild: isStatsBuild(), isTestBuild: isTestBuild(), }) - ) -); + ); -task("rspack-dev-server-gallery", () => +export const rspackDevServerGallery = () => runDevServer({ compiler: rspack( createGalleryConfig({ isProdBuild: false, latestBuild: true }) @@ -200,19 +204,17 @@ task("rspack-dev-server-gallery", () => contentBase: paths.gallery_output_root, port: 8100, listenHost: "0.0.0.0", - }) -); + }); -task("rspack-prod-gallery", () => +export const rspackProdGallery = () => prodBuild( createGalleryConfig({ isProdBuild: true, latestBuild: true, }) - ) -); + ); -task("rspack-watch-landing-page", () => { +export const rspackWatchLandingPage = () => { // This command will run forever because we don't close compiler rspack( process.env.ES5 @@ -222,16 +224,15 @@ task("rspack-watch-landing-page", () => { watch( path.join(paths.translations_src, "en.json"), - series("build-landing-page-translations", "copy-translations-landing-page") + series(buildLandingPageTranslations, copyTranslationsLandingPage) ); -}); +}; -task("rspack-prod-landing-page", () => +export const rspackProdLandingPage = () => prodBuild( bothBuilds(createLandingPageConfig, { isProdBuild: true, isStatsBuild: isStatsBuild(), isTestBuild: isTestBuild(), }) - ) -); + ); diff --git a/build-scripts/gulp/service-worker.ts b/build-scripts/gulp/service-worker.ts index fb487fee13..75d208a642 100644 --- a/build-scripts/gulp/service-worker.ts +++ b/build-scripts/gulp/service-worker.ts @@ -1,7 +1,6 @@ // Generate service workers import { deleteAsync } from "del"; -import { task } from "gulp"; import { mkdir, readFile, symlink, writeFile } from "node:fs/promises"; import { basename, join, relative } from "node:path"; import { injectManifest } from "workbox-build"; @@ -23,7 +22,7 @@ self.addEventListener('install', (event) => { }); `.trim() + "\n"; -task("gen-service-worker-app-dev", async () => { +export const genServiceWorkerAppDev = async () => { await mkdir(paths.app_output_root, { recursive: true }); await Promise.all( Object.values(SW_MAP).map((build) => @@ -32,9 +31,9 @@ task("gen-service-worker-app-dev", async () => { }) ) ); -}); +}; -task("gen-service-worker-app-prod", () => +export const genServiceWorkerAppProd = () => Promise.all( Object.entries(SW_MAP).map(async ([outPath, build]) => { const manifest = JSON.parse( @@ -83,5 +82,4 @@ task("gen-service-worker-app-prod", () => await symlink(basename(swDest), swOld); } }) - ) -); + ); diff --git a/build-scripts/gulp/translations.ts b/build-scripts/gulp/translations.ts index bedf1e1396..2c72d6b804 100755 --- a/build-scripts/gulp/translations.ts +++ b/build-scripts/gulp/translations.ts @@ -2,7 +2,7 @@ import { deleteAsync } from "del"; import { glob } from "glob"; -import { src as glupSrc, dest as gulpDest, parallel, series, task } from "gulp"; +import { src as glupSrc, dest as gulpDest, parallel, series } from "gulp"; import rename from "gulp-rename"; import merge from "lodash.merge"; import { createHash } from "node:crypto"; @@ -12,7 +12,10 @@ import { PassThrough, Transform } from "node:stream"; import { finished } from "node:stream/promises"; import { isProdBuild } from "../env.ts"; import paths from "../paths.ts"; -import "./fetch-nightly-translations.ts"; +import { + allowSetupFetchNightlyTranslations, + fetchNightlyTranslations, +} from "./fetch-nightly-translations.ts"; const inFrontendDir = "translations/frontend"; const inBackendDir = "translations/backend"; @@ -23,12 +26,10 @@ const TEST_LOCALE = "en-x-test"; let mergeBackend = false; -task( - "translations-enable-merge-backend", - parallel(async () => { - mergeBackend = true; - }, "allow-setup-fetch-nightly-translations") -); +// translations-enable-merge-backend +export const translationsEnableMergeBackend = parallel(async () => { + mergeBackend = true; +}, allowSetupFetchNightlyTranslations); // Transform stream to apply a function on Vinyl JSON files (buffer mode only). // The provided function can either return a new object, or an array of @@ -145,7 +146,7 @@ const lokaliseTransform = (data, path, original = data) => { return output; }; -task("clean-translations", () => deleteAsync([workDir])); +export const cleanTranslations = () => deleteAsync([workDir]); const makeWorkDir = () => mkdir(workDir, { recursive: true }); @@ -312,26 +313,20 @@ const writeTranslationMetaData = () => ) .pipe(gulpDest(workDir)); -task( - "build-translations", - series( - parallel( - "fetch-nightly-translations", - series("clean-translations", makeWorkDir) - ), - createTestTranslation, - createMasterTranslation, - createTranslations, - writeTranslationMetaData - ) +export const buildTranslations = series( + parallel(fetchNightlyTranslations, series(cleanTranslations, makeWorkDir)), + createTestTranslation, + createMasterTranslation, + createTranslations, + writeTranslationMetaData ); -task( - "build-supervisor-translations", - series(setFragment("supervisor"), "build-translations") +export const buildSupervisorTranslations = series( + setFragment("supervisor"), + buildTranslations ); -task( - "build-landing-page-translations", - series(setFragment("landing-page"), "build-translations") +export const buildLandingPageTranslations = series( + setFragment("landing-page"), + buildTranslations ); diff --git a/build-scripts/runTask.ts b/build-scripts/runTask.ts new file mode 100644 index 0000000000..456f53299d --- /dev/null +++ b/build-scripts/runTask.ts @@ -0,0 +1,42 @@ +// run-build.ts +import { series } from "gulp"; +import { availableParallelism } from "node:os"; +import tasks from "./gulp/index.ts"; + +process.env.UV_THREADPOOL_SIZE = availableParallelism().toString(); + +const runGulpTask = async (runTasks: string[]) => { + try { + for (const taskName of runTasks) { + if (tasks[taskName] === undefined) { + console.error(`Gulp task "${taskName}" does not exist.`); + console.log("Available tasks:"); + Object.keys(tasks).forEach((task) => { + console.log(` - ${task}`); + }); + process.exit(1); + } + } + + await new Promise((resolve, reject) => { + series(...runTasks.map((taskName) => tasks[taskName]))((err?: Error) => { + if (err) { + reject(err); + } else { + resolve(null); + } + }); + }); + + process.exit(0); + } catch (error: any) { + console.error(`Error running Gulp task "${runTasks}":`, error); + process.exit(1); + } +}; + +// Get the task name from command line arguments +// TODO arg validation +const tasksToRun = process.argv.slice(2); + +runGulpTask(tasksToRun); diff --git a/cast/script/build_cast b/cast/script/build_cast index 7dde6fef2e..a88fd43ac8 100755 --- a/cast/script/build_cast +++ b/cast/script/build_cast @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp build-cast +yarn run-task build-cast diff --git a/cast/script/develop_cast b/cast/script/develop_cast index 06788d0cbc..41f396d2ad 100755 --- a/cast/script/develop_cast +++ b/cast/script/develop_cast @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp develop-cast +yarn run-task develop-cast diff --git a/demo/script/build_demo b/demo/script/build_demo index 80608fa3ef..008007847c 100755 --- a/demo/script/build_demo +++ b/demo/script/build_demo @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp build-demo +yarn run-task build-demo diff --git a/demo/script/develop_demo b/demo/script/develop_demo index ef05a945ad..e57dddf80e 100755 --- a/demo/script/develop_demo +++ b/demo/script/develop_demo @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp develop-demo +yarn run-task develop-demo diff --git a/demo/script/size_stats b/demo/script/size_stats index 036ef215a5..7f1a231fc5 100755 --- a/demo/script/size_stats +++ b/demo/script/size_stats @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp analyze-demo \ No newline at end of file +yarn run-task analyze-demo \ No newline at end of file diff --git a/gallery/script/build_gallery b/gallery/script/build_gallery index dc29b40bfd..bef3e89946 100755 --- a/gallery/script/build_gallery +++ b/gallery/script/build_gallery @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp build-gallery +yarn run-task build-gallery diff --git a/gallery/script/develop_gallery b/gallery/script/develop_gallery index b9c6ee59a3..5a0b7f0b67 100755 --- a/gallery/script/develop_gallery +++ b/gallery/script/develop_gallery @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp develop-gallery +yarn run-task develop-gallery diff --git a/gulpfile.ts b/gulpfile.ts deleted file mode 100644 index 84f294cf4f..0000000000 --- a/gulpfile.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { availableParallelism } from "node:os"; -import "./build-scripts/gulp/index.ts"; - -process.env.UV_THREADPOOL_SIZE = availableParallelism().toString(); diff --git a/hassio/script/build_hassio b/hassio/script/build_hassio index 1ed0e98653..68e4383f13 100755 --- a/hassio/script/build_hassio +++ b/hassio/script/build_hassio @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp build-hassio +yarn run-task build-hassio diff --git a/hassio/script/develop b/hassio/script/develop index 567ea7daeb..ea16c77895 100755 --- a/hassio/script/develop +++ b/hassio/script/develop @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp develop-hassio +yarn run-task develop-hassio diff --git a/landing-page/script/build_landing_page b/landing-page/script/build_landing_page index 25ba673e23..be617142f8 100755 --- a/landing-page/script/build_landing_page +++ b/landing-page/script/build_landing_page @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp build-landing-page +yarn run-task build-landing-page diff --git a/landing-page/script/develop b/landing-page/script/develop index e9f3a190d7..053b4aa67c 100755 --- a/landing-page/script/develop +++ b/landing-page/script/develop @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/../.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp develop-landing-page +yarn run-task develop-landing-page diff --git a/package.json b/package.json index 85536681a0..eb843b0e22 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "prepack": "pinst --disable", "postpack": "pinst --enable", "test": "vitest run --config test/vitest.config.ts", - "test:coverage": "vitest run --config test/vitest.config.ts --coverage" + "test:coverage": "vitest run --config test/vitest.config.ts --coverage", + "run-task": "tsx ./build-scripts/runTask.ts" }, "author": "Paulus Schoutsen (http://paulusschoutsen.nl)", "license": "Apache-2.0", @@ -218,7 +219,7 @@ "tar": "7.4.3", "terser-webpack-plugin": "5.3.14", "ts-lit-plugin": "2.0.2", - "ts-node": "10.9.2", + "tsx": "4.19.4", "typescript": "5.8.3", "typescript-eslint": "8.31.1", "vite-tsconfig-paths": "5.1.4", diff --git a/script/build_frontend b/script/build_frontend index aefac647fc..6424058ac4 100755 --- a/script/build_frontend +++ b/script/build_frontend @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp build-app +yarn run-task build-app diff --git a/script/develop b/script/develop index f342370629..f3604f9938 100755 --- a/script/develop +++ b/script/develop @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp develop-app +yarn run-task develop-app diff --git a/script/setup_translations b/script/setup_translations index 6555711e04..c0c8f4dfe8 100755 --- a/script/setup_translations +++ b/script/setup_translations @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp setup-and-fetch-nightly-translations \ No newline at end of file +yarn run-task setup-and-fetch-nightly-translations \ No newline at end of file diff --git a/script/size_stats b/script/size_stats index 8c5b68f9e5..66d6d67185 100755 --- a/script/size_stats +++ b/script/size_stats @@ -6,4 +6,4 @@ set -e cd "$(dirname "$0")/.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp analyze-app +yarn run-task analyze-app diff --git a/script/translations_download b/script/translations_download index baa3b231e3..b73168f1d9 100755 --- a/script/translations_download +++ b/script/translations_download @@ -8,4 +8,4 @@ set -eu -o pipefail cd "$(dirname "$0")/.." -node --import ./ts-node-register.js ./node_modules/.bin/gulp download-translations \ No newline at end of file +yarn run-task download-translations \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index b502a2cb58..852fb29149 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -79,8 +79,5 @@ "./node_modules/@lit-labs/observers/resize-controller.js" ] } - }, - "ts-node": { - "esm": true } } diff --git a/yarn.lock b/yarn.lock index 198f1366b5..9825e47ad1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1253,15 +1253,6 @@ __metadata: languageName: node linkType: hard -"@cspotcode/source-map-support@npm:^0.8.0": - version: 0.8.1 - resolution: "@cspotcode/source-map-support@npm:0.8.1" - dependencies: - "@jridgewell/trace-mapping": "npm:0.3.9" - checksum: 10/b6e38a1712fab242c86a241c229cf562195aad985d0564bd352ac404be583029e89e93028ffd2c251d2c407ecac5fb0cbdca94a2d5c10f29ac806ede0508b3ff - languageName: node - linkType: hard - "@csstools/color-helpers@npm:^5.0.2": version: 5.0.2 resolution: "@csstools/color-helpers@npm:5.0.2" @@ -1331,177 +1322,177 @@ __metadata: languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/aix-ppc64@npm:0.25.2" +"@esbuild/aix-ppc64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/aix-ppc64@npm:0.25.5" conditions: os=aix & cpu=ppc64 languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/android-arm64@npm:0.25.2" +"@esbuild/android-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/android-arm64@npm:0.25.5" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@esbuild/android-arm@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/android-arm@npm:0.25.2" +"@esbuild/android-arm@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/android-arm@npm:0.25.5" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/android-x64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/android-x64@npm:0.25.2" +"@esbuild/android-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/android-x64@npm:0.25.5" conditions: os=android & cpu=x64 languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/darwin-arm64@npm:0.25.2" +"@esbuild/darwin-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/darwin-arm64@npm:0.25.5" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/darwin-x64@npm:0.25.2" +"@esbuild/darwin-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/darwin-x64@npm:0.25.5" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/freebsd-arm64@npm:0.25.2" +"@esbuild/freebsd-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/freebsd-arm64@npm:0.25.5" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/freebsd-x64@npm:0.25.2" +"@esbuild/freebsd-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/freebsd-x64@npm:0.25.5" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/linux-arm64@npm:0.25.2" +"@esbuild/linux-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-arm64@npm:0.25.5" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/linux-arm@npm:0.25.2" +"@esbuild/linux-arm@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-arm@npm:0.25.5" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/linux-ia32@npm:0.25.2" +"@esbuild/linux-ia32@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-ia32@npm:0.25.5" conditions: os=linux & cpu=ia32 languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/linux-loong64@npm:0.25.2" +"@esbuild/linux-loong64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-loong64@npm:0.25.5" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/linux-mips64el@npm:0.25.2" +"@esbuild/linux-mips64el@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-mips64el@npm:0.25.5" conditions: os=linux & cpu=mips64el languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/linux-ppc64@npm:0.25.2" +"@esbuild/linux-ppc64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-ppc64@npm:0.25.5" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/linux-riscv64@npm:0.25.2" +"@esbuild/linux-riscv64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-riscv64@npm:0.25.5" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/linux-s390x@npm:0.25.2" +"@esbuild/linux-s390x@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-s390x@npm:0.25.5" conditions: os=linux & cpu=s390x languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/linux-x64@npm:0.25.2" +"@esbuild/linux-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-x64@npm:0.25.5" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-arm64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/netbsd-arm64@npm:0.25.2" +"@esbuild/netbsd-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/netbsd-arm64@npm:0.25.5" conditions: os=netbsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/netbsd-x64@npm:0.25.2" +"@esbuild/netbsd-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/netbsd-x64@npm:0.25.5" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openbsd-arm64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/openbsd-arm64@npm:0.25.2" +"@esbuild/openbsd-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/openbsd-arm64@npm:0.25.5" conditions: os=openbsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/openbsd-x64@npm:0.25.2" +"@esbuild/openbsd-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/openbsd-x64@npm:0.25.5" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/sunos-x64@npm:0.25.2" +"@esbuild/sunos-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/sunos-x64@npm:0.25.5" conditions: os=sunos & cpu=x64 languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/win32-arm64@npm:0.25.2" +"@esbuild/win32-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/win32-arm64@npm:0.25.5" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/win32-ia32@npm:0.25.2" +"@esbuild/win32-ia32@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/win32-ia32@npm:0.25.5" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.25.2": - version: 0.25.2 - resolution: "@esbuild/win32-x64@npm:0.25.2" +"@esbuild/win32-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/win32-x64@npm:0.25.5" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -2062,7 +2053,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/resolve-uri@npm:^3.0.3, @jridgewell/resolve-uri@npm:^3.1.0": +"@jridgewell/resolve-uri@npm:^3.1.0": version: 3.1.2 resolution: "@jridgewell/resolve-uri@npm:3.1.2" checksum: 10/97106439d750a409c22c8bff822d648f6a71f3aa9bc8e5129efdc36343cd3096ddc4eeb1c62d2fe48e9bdd4db37b05d4646a17114ecebd3bbcacfa2de51c3c1d @@ -2093,16 +2084,6 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:0.3.9": - version: 0.3.9 - resolution: "@jridgewell/trace-mapping@npm:0.3.9" - dependencies: - "@jridgewell/resolve-uri": "npm:^3.0.3" - "@jridgewell/sourcemap-codec": "npm:^1.4.10" - checksum: 10/83deafb8e7a5ca98993c2c6eeaa93c270f6f647a4c0dc00deb38c9cf9b2d3b7bf15e8839540155247ef034a052c0ec4466f980bf0c9e2ab63b97d16c0cedd3ff - languageName: node - linkType: hard - "@jridgewell/trace-mapping@npm:^0.3.23, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": version: 0.3.25 resolution: "@jridgewell/trace-mapping@npm:0.3.25" @@ -4205,34 +4186,6 @@ __metadata: languageName: node linkType: hard -"@tsconfig/node10@npm:^1.0.7": - version: 1.0.11 - resolution: "@tsconfig/node10@npm:1.0.11" - checksum: 10/51fe47d55fe1b80ec35e6e5ed30a13665fd3a531945350aa74a14a1e82875fb60b350c2f2a5e72a64831b1b6bc02acb6760c30b3738b54954ec2dea82db7a267 - languageName: node - linkType: hard - -"@tsconfig/node12@npm:^1.0.7": - version: 1.0.11 - resolution: "@tsconfig/node12@npm:1.0.11" - checksum: 10/5ce29a41b13e7897a58b8e2df11269c5395999e588b9a467386f99d1d26f6c77d1af2719e407621412520ea30517d718d5192a32403b8dfcc163bf33e40a338a - languageName: node - linkType: hard - -"@tsconfig/node14@npm:^1.0.0": - version: 1.0.3 - resolution: "@tsconfig/node14@npm:1.0.3" - checksum: 10/19275fe80c4c8d0ad0abed6a96dbf00642e88b220b090418609c4376e1cef81bf16237bf170ad1b341452feddb8115d8dd2e5acdfdea1b27422071163dc9ba9d - languageName: node - linkType: hard - -"@tsconfig/node16@npm:^1.0.2": - version: 1.0.4 - resolution: "@tsconfig/node16@npm:1.0.4" - checksum: 10/202319785901f942a6e1e476b872d421baec20cf09f4b266a1854060efbf78cde16a4d256e8bc949d31e6cd9a90f1e8ef8fb06af96a65e98338a2b6b0de0a0ff - languageName: node - linkType: hard - "@tsparticles/basic@npm:^3.7.1": version: 3.8.1 resolution: "@tsparticles/basic@npm:3.8.1" @@ -5521,7 +5474,7 @@ __metadata: languageName: node linkType: hard -"acorn-walk@npm:8.3.4, acorn-walk@npm:^8.0.0, acorn-walk@npm:^8.1.1": +"acorn-walk@npm:8.3.4, acorn-walk@npm:^8.0.0": version: 8.3.4 resolution: "acorn-walk@npm:8.3.4" dependencies: @@ -5530,7 +5483,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.0.4, acorn@npm:^8.10.0, acorn@npm:^8.11.0, acorn@npm:^8.14.0, acorn@npm:^8.4.1, acorn@npm:^8.5.0, acorn@npm:^8.8.2": +"acorn@npm:^8.0.4, acorn@npm:^8.10.0, acorn@npm:^8.11.0, acorn@npm:^8.14.0, acorn@npm:^8.5.0, acorn@npm:^8.8.2": version: 8.14.1 resolution: "acorn@npm:8.14.1" bin: @@ -5755,13 +5708,6 @@ __metadata: languageName: node linkType: hard -"arg@npm:^4.1.0": - version: 4.1.3 - resolution: "arg@npm:4.1.3" - checksum: 10/969b491082f20cad166649fa4d2073ea9e974a4e5ac36247ca23d2e5a8b3cb12d60e9ff70a8acfe26d76566c71fd351ee5e6a9a6595157eb36f92b1fd64e1599 - languageName: node - linkType: hard - "argparse@npm:^2.0.1": version: 2.0.1 resolution: "argparse@npm:2.0.1" @@ -6964,13 +6910,6 @@ __metadata: languageName: node linkType: hard -"create-require@npm:^1.1.0": - version: 1.1.1 - resolution: "create-require@npm:1.1.1" - checksum: 10/a9a1503d4390d8b59ad86f4607de7870b39cad43d929813599a23714831e81c520bddf61bcdd1f8e30f05fd3a2b71ae8538e946eb2786dc65c2bbc520f692eff - languageName: node - linkType: hard - "crelt@npm:^1.0.5": version: 1.0.6 resolution: "crelt@npm:1.0.6" @@ -7357,13 +7296,6 @@ __metadata: languageName: node linkType: hard -"diff@npm:^4.0.1": - version: 4.0.2 - resolution: "diff@npm:4.0.2" - checksum: 10/ec09ec2101934ca5966355a229d77afcad5911c92e2a77413efda5455636c4cf2ce84057e2d7715227a2eeeda04255b849bd3ae3a4dd22eb22e86e76456df069 - languageName: node - linkType: hard - "diff@npm:^7.0.0": version: 7.0.0 resolution: "diff@npm:7.0.0" @@ -7806,35 +7738,35 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.25.0": - version: 0.25.2 - resolution: "esbuild@npm:0.25.2" +"esbuild@npm:^0.25.0, esbuild@npm:~0.25.0": + version: 0.25.5 + resolution: "esbuild@npm:0.25.5" dependencies: - "@esbuild/aix-ppc64": "npm:0.25.2" - "@esbuild/android-arm": "npm:0.25.2" - "@esbuild/android-arm64": "npm:0.25.2" - "@esbuild/android-x64": "npm:0.25.2" - "@esbuild/darwin-arm64": "npm:0.25.2" - "@esbuild/darwin-x64": "npm:0.25.2" - "@esbuild/freebsd-arm64": "npm:0.25.2" - "@esbuild/freebsd-x64": "npm:0.25.2" - "@esbuild/linux-arm": "npm:0.25.2" - "@esbuild/linux-arm64": "npm:0.25.2" - "@esbuild/linux-ia32": "npm:0.25.2" - "@esbuild/linux-loong64": "npm:0.25.2" - "@esbuild/linux-mips64el": "npm:0.25.2" - "@esbuild/linux-ppc64": "npm:0.25.2" - "@esbuild/linux-riscv64": "npm:0.25.2" - "@esbuild/linux-s390x": "npm:0.25.2" - "@esbuild/linux-x64": "npm:0.25.2" - "@esbuild/netbsd-arm64": "npm:0.25.2" - "@esbuild/netbsd-x64": "npm:0.25.2" - "@esbuild/openbsd-arm64": "npm:0.25.2" - "@esbuild/openbsd-x64": "npm:0.25.2" - "@esbuild/sunos-x64": "npm:0.25.2" - "@esbuild/win32-arm64": "npm:0.25.2" - "@esbuild/win32-ia32": "npm:0.25.2" - "@esbuild/win32-x64": "npm:0.25.2" + "@esbuild/aix-ppc64": "npm:0.25.5" + "@esbuild/android-arm": "npm:0.25.5" + "@esbuild/android-arm64": "npm:0.25.5" + "@esbuild/android-x64": "npm:0.25.5" + "@esbuild/darwin-arm64": "npm:0.25.5" + "@esbuild/darwin-x64": "npm:0.25.5" + "@esbuild/freebsd-arm64": "npm:0.25.5" + "@esbuild/freebsd-x64": "npm:0.25.5" + "@esbuild/linux-arm": "npm:0.25.5" + "@esbuild/linux-arm64": "npm:0.25.5" + "@esbuild/linux-ia32": "npm:0.25.5" + "@esbuild/linux-loong64": "npm:0.25.5" + "@esbuild/linux-mips64el": "npm:0.25.5" + "@esbuild/linux-ppc64": "npm:0.25.5" + "@esbuild/linux-riscv64": "npm:0.25.5" + "@esbuild/linux-s390x": "npm:0.25.5" + "@esbuild/linux-x64": "npm:0.25.5" + "@esbuild/netbsd-arm64": "npm:0.25.5" + "@esbuild/netbsd-x64": "npm:0.25.5" + "@esbuild/openbsd-arm64": "npm:0.25.5" + "@esbuild/openbsd-x64": "npm:0.25.5" + "@esbuild/sunos-x64": "npm:0.25.5" + "@esbuild/win32-arm64": "npm:0.25.5" + "@esbuild/win32-ia32": "npm:0.25.5" + "@esbuild/win32-x64": "npm:0.25.5" dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -7888,7 +7820,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 10/3b16423d33e0c05078b38bfe88e1b2125164a6b8dccfd06db8698766e54406f3299de8a74e3ce818f1d5a9c8bf993aa4d27a5716c39580eb80bd92d52ccf34d3 + checksum: 10/0fa4c3b42c6ddf1a008e75a4bb3dcab08ce22ac0b31dd59dc01f7fe8e21380bfaec07a2fe3730a7cf430da5a30142d016714b358666325a4733547afa42be405 languageName: node linkType: hard @@ -8989,6 +8921,15 @@ __metadata: languageName: node linkType: hard +"get-tsconfig@npm:^4.7.5": + version: 4.10.1 + resolution: "get-tsconfig@npm:4.10.1" + dependencies: + resolve-pkg-maps: "npm:^1.0.0" + checksum: 10/04d63f47fdecaefbd1f73ec02949be4ec4db7d6d9fbc8d4e81f9a4bb1c6f876e48943712f2f9236643d3e4d61d9a7b06da08564d08b034631ebe3f5605bef237 + languageName: node + linkType: hard + "gifwrap@npm:^0.10.1": version: 0.10.1 resolution: "gifwrap@npm:0.10.1" @@ -9562,7 +9503,7 @@ __metadata: terser-webpack-plugin: "npm:5.3.14" tinykeys: "npm:3.0.0" ts-lit-plugin: "npm:2.0.2" - ts-node: "npm:10.9.2" + tsx: "npm:4.19.4" typescript: "npm:5.8.3" typescript-eslint: "npm:8.31.1" ua-parser-js: "npm:2.0.3" @@ -11191,13 +11132,6 @@ __metadata: languageName: node linkType: hard -"make-error@npm:^1.1.1": - version: 1.3.6 - resolution: "make-error@npm:1.3.6" - checksum: 10/b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402 - languageName: node - linkType: hard - "make-fetch-happen@npm:^14.0.3": version: 14.0.3 resolution: "make-fetch-happen@npm:14.0.3" @@ -12928,6 +12862,13 @@ __metadata: languageName: node linkType: hard +"resolve-pkg-maps@npm:^1.0.0": + version: 1.0.0 + resolution: "resolve-pkg-maps@npm:1.0.0" + checksum: 10/0763150adf303040c304009231314d1e84c6e5ebfa2d82b7d94e96a6e82bacd1dcc0b58ae257315f3c8adb89a91d8d0f12928241cba2df1680fbe6f60bf99b0e + languageName: node + linkType: hard + "resolve@npm:^1.14.2, resolve@npm:^1.20.0, resolve@npm:^1.22.1, resolve@npm:^1.22.4": version: 1.22.10 resolution: "resolve@npm:1.22.10" @@ -14532,44 +14473,6 @@ __metadata: languageName: node linkType: hard -"ts-node@npm:10.9.2": - version: 10.9.2 - resolution: "ts-node@npm:10.9.2" - dependencies: - "@cspotcode/source-map-support": "npm:^0.8.0" - "@tsconfig/node10": "npm:^1.0.7" - "@tsconfig/node12": "npm:^1.0.7" - "@tsconfig/node14": "npm:^1.0.0" - "@tsconfig/node16": "npm:^1.0.2" - acorn: "npm:^8.4.1" - acorn-walk: "npm:^8.1.1" - arg: "npm:^4.1.0" - create-require: "npm:^1.1.0" - diff: "npm:^4.0.1" - make-error: "npm:^1.1.1" - v8-compile-cache-lib: "npm:^3.0.1" - yn: "npm:3.1.1" - peerDependencies: - "@swc/core": ">=1.2.50" - "@swc/wasm": ">=1.2.50" - "@types/node": "*" - typescript: ">=2.7" - peerDependenciesMeta: - "@swc/core": - optional: true - "@swc/wasm": - optional: true - bin: - ts-node: dist/bin.js - ts-node-cwd: dist/bin-cwd.js - ts-node-esm: dist/bin-esm.js - ts-node-script: dist/bin-script.js - ts-node-transpile-only: dist/bin-transpile.js - ts-script: dist/bin-script-deprecated.js - checksum: 10/a91a15b3c9f76ac462f006fa88b6bfa528130dcfb849dd7ef7f9d640832ab681e235b8a2bc58ecde42f72851cc1d5d4e22c901b0c11aa51001ea1d395074b794 - languageName: node - linkType: hard - "ts-simple-type@npm:2.0.0-next.0, ts-simple-type@npm:~2.0.0-next.0": version: 2.0.0-next.0 resolution: "ts-simple-type@npm:2.0.0-next.0" @@ -14610,6 +14513,22 @@ __metadata: languageName: node linkType: hard +"tsx@npm:4.19.4": + version: 4.19.4 + resolution: "tsx@npm:4.19.4" + dependencies: + esbuild: "npm:~0.25.0" + fsevents: "npm:~2.3.3" + get-tsconfig: "npm:^4.7.5" + dependenciesMeta: + fsevents: + optional: true + bin: + tsx: dist/cli.mjs + checksum: 10/4dde315aeda70b9cadfecbc8d05b1625f5831018b9cb2db25cbbd03c5f5ee9c59cdc6652a0fd8492176b50944a5af1d5af352b944d024f4a719f58d6f2ac3a7f + languageName: node + linkType: hard + "type-check@npm:^0.4.0, type-check@npm:~0.4.0": version: 0.4.0 resolution: "type-check@npm:0.4.0" @@ -15021,13 +14940,6 @@ __metadata: languageName: node linkType: hard -"v8-compile-cache-lib@npm:^3.0.1": - version: 3.0.1 - resolution: "v8-compile-cache-lib@npm:3.0.1" - checksum: 10/88d3423a52b6aaf1836be779cab12f7016d47ad8430dffba6edf766695e6d90ad4adaa3d8eeb512cc05924f3e246c4a4ca51e089dccf4402caa536b5e5be8961 - languageName: node - linkType: hard - "v8flags@npm:^4.0.0": version: 4.0.1 resolution: "v8flags@npm:4.0.1" @@ -16290,13 +16202,6 @@ __metadata: languageName: node linkType: hard -"yn@npm:3.1.1": - version: 3.1.1 - resolution: "yn@npm:3.1.1" - checksum: 10/2c487b0e149e746ef48cda9f8bad10fc83693cd69d7f9dcd8be4214e985de33a29c9e24f3c0d6bcf2288427040a8947406ab27f7af67ee9456e6b84854f02dd6 - languageName: node - linkType: hard - "yocto-queue@npm:^0.1.0": version: 0.1.0 resolution: "yocto-queue@npm:0.1.0"