From 909e255de7a7aaae1e99d48a1437530a3328c055 Mon Sep 17 00:00:00 2001 From: GermanBluefox Date: Sat, 21 Sep 2024 15:38:14 +0800 Subject: [PATCH] * (bluefox) added `patternForWidgetsFiles` --- README.md | 9 ++++++--- index.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4faa730..6fd7101 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This module is a replacement for gulp that is commonly used in ioBroker reposito First, you need to install the module: -``` +```shell npm install @iobroker/build-tools --save-dev ``` @@ -25,11 +25,11 @@ And use in `package.json` `scripts`: ## Converting i18n structure You can convert the old i18n structure i18n/lang/translations.json to the new structure i18n/lang.json with the following command: -``` +```shell node node_modules/@iobroker/build-tools/convertI18n.js ``` Optionally, you can specify the path to the i18n folder: -``` +```shell node node_modules/@iobroker/build-tools/convertI18n.js path/to/i18n ``` @@ -38,6 +38,9 @@ node node_modules/@iobroker/build-tools/convertI18n.js path/to/i18n ### **WORK IN PROGRESS** --> ## Changelog +### **WORK IN PROGRESS** +* (bluefox) added `patternForWidgetsFiles` + ### 1.0.7 (2024-09-21) * (bluefox) Added log outputs diff --git a/index.ts b/index.ts index 1d9f790..e003430 100644 --- a/index.ts +++ b/index.ts @@ -439,6 +439,38 @@ function _patchHtmlFile(fileName: string): boolean { return changed; } +export function patternForWidgetsFiles(src: string): string[] { + src = src || './src-widgets/'; + if (!src.endsWith('/')) { + src += '/'; + } + + return [ + `${src}build/static/js/*fast-xml*.*`, + `${src}build/static/js/*react-swipeable*.*`, + `${src}build/static/js/*moment_*.*`, + `${src}build/static/js/*react-beautiful-dnd*.*`, + `${src}build/static/js/*vis-2-widgets-react-dev_index_jsx*.*`, + `${src}build/static/js/*vis-2-widgets-react-dev_node_modules_babel_runtime_helpers*.*`, + `${src}build/static/js/*runtime_helpers_asyncToGenerator*.*`, + `${src}build/static/js/*modules_color*.*`, + `${src}build/static/js/*echarts-for-react_lib_core_js-node_modules_echarts_core_js-*.chunk.*`, + `${src}build/static/js/*echarts_lib*.*`, + `${src}build/static/js/*vis-2-widgets-react-dev_node_modules_babel_runtime_helpers*.*`, + `${src}build/static/js/*leaflet*.*`, + `${src}build/static/js/*react-circular*.*`, + `${src}build/static/js/*d3-array_src_index_js-node_modules_d3-collection_src_index_js-*.*`, + `${src}build/static/js/*d3-dispatch_*.*`, + `${src}build/static/js/*lodash_*.*`, + `${src}build/static/js/*react-battery-gauge_dist_react-battery-gauge*.*`, + `${src}build/static/js/*react-gauge-chart*.*`, + `${src}build/static/js/*react-liquid-gauge*.*`, + `${src}build/static/js/*helpers_esm_asyncToGener*.*`, + `${src}build/static/js/*emotion_styled_dist*.*`, + `${src}build/static/js/*mui_system_colorManipulator*.*`, + ]; +} + // Patch an HTML file (async function) export function patchHtmlFile(fileName: string): Promise { return new Promise(resolve => {