diff --git a/LICENSE b/LICENSE index 51dfbf50dc..8c705ebe13 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +186,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Mendix Technology BV + Copyright 2022 Mendix Technology B.V. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +198,4 @@ Apache License distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. \ No newline at end of file diff --git a/automation/utils/src/steps.ts b/automation/utils/src/steps.ts index 106540d446..a9f9263f50 100644 --- a/automation/utils/src/steps.ts +++ b/automation/utils/src/steps.ts @@ -187,6 +187,8 @@ export async function addWidgetsToMpk({ config }: ModuleStepParams): Promise { console.log("Copying package.xml..."); cp(join(paths.package, "src", "package.xml"), join(paths.tmp, "package.xml")); + console.log("Copying License.txt..."); + cp(join(paths.package, "../../../LICENSE"), join(paths.tmp, "License.txt")); console.log("Creating mpk..."); await zip(paths.tmp, output.files.mpk); } diff --git a/packages/pluggableWidgets/combobox-web/package.json b/packages/pluggableWidgets/combobox-web/package.json index f0e229cd9d..00d0136f27 100644 --- a/packages/pluggableWidgets/combobox-web/package.json +++ b/packages/pluggableWidgets/combobox-web/package.json @@ -56,6 +56,7 @@ "@mendix/eslint-config-web-widgets": "workspace:*", "@mendix/pluggable-widgets-tools": "*", "@mendix/prettier-config-web-widgets": "workspace:*", + "@mendix/rollup-web-widgets": "workspace:*", "@mendix/run-e2e": "workspace:^*", "@mendix/widget-plugin-component-kit": "workspace:*", "@mendix/widget-plugin-grid": "workspace:*", diff --git a/packages/pluggableWidgets/combobox-web/rollup.config.js b/packages/pluggableWidgets/combobox-web/rollup.config.js deleted file mode 100644 index 48e21a9f79..0000000000 --- a/packages/pluggableWidgets/combobox-web/rollup.config.js +++ /dev/null @@ -1,20 +0,0 @@ -const { join } = require("path"); -const { cp, mkdir, rm } = require("shelljs"); - -const sourcePath = process.cwd(); -const outDir = join(sourcePath, "/dist/tmp/widgets/"); - -module.exports = args => { - const result = args.configDefaultConfig; - - const localesDir = join(outDir, "locales/"); - mkdir("-p", localesDir); - - const translationFiles = join(sourcePath, "dist/locales/**/*"); - // copy everything under dist/locales to dist/tmp/widgets/locales for the widget mpk - cp("-r", translationFiles, localesDir); - // remove root level *.json locales files (duplicate with language specific files (e.g. en-US/*.json)) - rm("-f", join(outDir, "locales/*.json"), localesDir); - - return result; -}; diff --git a/packages/pluggableWidgets/combobox-web/rollup.config.mjs b/packages/pluggableWidgets/combobox-web/rollup.config.mjs new file mode 100644 index 0000000000..688a1a7197 --- /dev/null +++ b/packages/pluggableWidgets/combobox-web/rollup.config.mjs @@ -0,0 +1,5 @@ +import copyFiles from "@mendix/rollup-web-widgets/copyFiles.mjs"; + +export default args => { + return copyFiles(args); +}; diff --git a/packages/pluggableWidgets/document-viewer-web/package.json b/packages/pluggableWidgets/document-viewer-web/package.json index b24d62f014..039e54587c 100644 --- a/packages/pluggableWidgets/document-viewer-web/package.json +++ b/packages/pluggableWidgets/document-viewer-web/package.json @@ -48,6 +48,7 @@ "@babel/plugin-transform-private-methods": "^7.27.1", "@babel/plugin-transform-private-property-in-object": "^7.27.1", "@mendix/pluggable-widgets-tools": "*", + "@mendix/rollup-web-widgets": "workspace:*", "@rollup/plugin-replace": "^6.0.2" } } diff --git a/packages/pluggableWidgets/document-viewer-web/rollup.config.mjs b/packages/pluggableWidgets/document-viewer-web/rollup.config.mjs index 126825bde1..08186f7455 100644 --- a/packages/pluggableWidgets/document-viewer-web/rollup.config.mjs +++ b/packages/pluggableWidgets/document-viewer-web/rollup.config.mjs @@ -1,5 +1,6 @@ import commonjs from "@rollup/plugin-commonjs"; import replace from "@rollup/plugin-replace"; +import { copyDefaultFilesPlugin } from "@mendix/rollup-web-widgets/copyFiles.mjs"; export default args => { const result = args.configDefaultConfig; @@ -41,7 +42,8 @@ export default args => { // Tree-shake client worker initialization logic. "!PDFWorkerUtil.isWorkerDisabled && !PDFWorker.#mainThreadWorkerMessageHandler": "false" } - }) + }), + copyDefaultFilesPlugin() ] }; }); diff --git a/packages/pluggableWidgets/events-web/rollup.config.mjs b/packages/pluggableWidgets/events-web/rollup.config.mjs new file mode 100644 index 0000000000..688a1a7197 --- /dev/null +++ b/packages/pluggableWidgets/events-web/rollup.config.mjs @@ -0,0 +1,5 @@ +import copyFiles from "@mendix/rollup-web-widgets/copyFiles.mjs"; + +export default args => { + return copyFiles(args); +}; diff --git a/packages/pluggableWidgets/maps-web/package.json b/packages/pluggableWidgets/maps-web/package.json index e7c1550273..f598b8ba5b 100644 --- a/packages/pluggableWidgets/maps-web/package.json +++ b/packages/pluggableWidgets/maps-web/package.json @@ -55,6 +55,7 @@ "@mendix/eslint-config-web-widgets": "workspace:*", "@mendix/pluggable-widgets-tools": "*", "@mendix/prettier-config-web-widgets": "workspace:*", + "@mendix/rollup-web-widgets": "workspace:*", "@mendix/run-e2e": "workspace:*", "@mendix/widget-plugin-component-kit": "workspace:*", "@mendix/widget-plugin-platform": "workspace:*", diff --git a/packages/pluggableWidgets/maps-web/rollup.config.mjs b/packages/pluggableWidgets/maps-web/rollup.config.mjs index 5bac11eeaf..d355d4ad4f 100644 --- a/packages/pluggableWidgets/maps-web/rollup.config.mjs +++ b/packages/pluggableWidgets/maps-web/rollup.config.mjs @@ -1,8 +1,10 @@ import { mkdirSync } from "node:fs"; import { fileURLToPath } from "url"; +import copyFiles from "@mendix/rollup-web-widgets/copyFiles.mjs"; export default args => { - const result = args.configDefaultConfig; + const result = copyFiles(args); + const [jsConfig, mJsConfig] = result; const folderUrl = new URL("dist/tmp/widgets/com/mendix/widget/custom/Maps/", import.meta.url); diff --git a/packages/pluggableWidgets/markdown-web/package.json b/packages/pluggableWidgets/markdown-web/package.json index b151761c84..cef3aec366 100644 --- a/packages/pluggableWidgets/markdown-web/package.json +++ b/packages/pluggableWidgets/markdown-web/package.json @@ -53,6 +53,7 @@ "@mendix/eslint-config-web-widgets": "workspace:*", "@mendix/pluggable-widgets-tools": "*", "@mendix/prettier-config-web-widgets": "workspace:*", + "@mendix/rollup-web-widgets": "workspace:*", "@mendix/run-e2e": "workspace:*", "@mendix/widget-plugin-hooks": "workspace:*", "@mendix/widget-plugin-platform": "workspace:*", diff --git a/packages/pluggableWidgets/markdown-web/rollup.config.mjs b/packages/pluggableWidgets/markdown-web/rollup.config.mjs new file mode 100644 index 0000000000..688a1a7197 --- /dev/null +++ b/packages/pluggableWidgets/markdown-web/rollup.config.mjs @@ -0,0 +1,5 @@ +import copyFiles from "@mendix/rollup-web-widgets/copyFiles.mjs"; + +export default args => { + return copyFiles(args); +}; diff --git a/packages/pluggableWidgets/rich-text-web/package.json b/packages/pluggableWidgets/rich-text-web/package.json index d403d0166c..e98d9a5d0c 100644 --- a/packages/pluggableWidgets/rich-text-web/package.json +++ b/packages/pluggableWidgets/rich-text-web/package.json @@ -63,6 +63,7 @@ "@mendix/eslint-config-web-widgets": "workspace:*", "@mendix/pluggable-widgets-tools": "*", "@mendix/prettier-config-web-widgets": "workspace:*", + "@mendix/rollup-web-widgets": "workspace:*", "@mendix/run-e2e": "workspace:*", "@mendix/widget-plugin-component-kit": "workspace:*", "@mendix/widget-plugin-platform": "workspace:*", diff --git a/packages/pluggableWidgets/rich-text-web/rollup.config.js b/packages/pluggableWidgets/rich-text-web/rollup.config.mjs similarity index 88% rename from packages/pluggableWidgets/rich-text-web/rollup.config.js rename to packages/pluggableWidgets/rich-text-web/rollup.config.mjs index d6ffe27ced..1f0b9dfc38 100644 --- a/packages/pluggableWidgets/rich-text-web/rollup.config.js +++ b/packages/pluggableWidgets/rich-text-web/rollup.config.mjs @@ -1,6 +1,7 @@ import typescript from "@rollup/plugin-typescript"; import preserveDirectives from "rollup-preserve-directives"; import alias from "@rollup/plugin-alias"; +import { copyDefaultFilesPlugin } from "@mendix/rollup-web-widgets/copyFiles.mjs"; export default args => { const result = args.configDefaultConfig; @@ -23,7 +24,8 @@ export default args => { target: "es2022", // we transpile the result with babel anyway, see below useDefineForClassFields: false, exclude: ["**/__tests__/**/*"] - }) + }), + copyDefaultFilesPlugin() ]; return config; diff --git a/packages/shared/rollup-web-widgets/copyFiles.mjs b/packages/shared/rollup-web-widgets/copyFiles.mjs new file mode 100644 index 0000000000..ef38d0a9d7 --- /dev/null +++ b/packages/shared/rollup-web-widgets/copyFiles.mjs @@ -0,0 +1,28 @@ +import copy from "rollup-plugin-copy"; + +export function copyDefaultFilesPlugin() { + return copy({ + targets: [ + { + src: "dist/locales", + dest: "dist/tmp/widgets", + flatten: false + }, + { + src: "../../../LICENSE", + dest: "dist/tmp/widgets", + rename: "License.txt" + } + ] + }); +} + +export default args => { + const result = args.configDefaultConfig; + return result.map((config, _index) => { + return { + ...config, + plugins: [...config.plugins, copyDefaultFilesPlugin()] + }; + }); +}; diff --git a/packages/shared/rollup-web-widgets/package.json b/packages/shared/rollup-web-widgets/package.json new file mode 100644 index 0000000000..3b03cbc9eb --- /dev/null +++ b/packages/shared/rollup-web-widgets/package.json @@ -0,0 +1,15 @@ +{ + "name": "@mendix/rollup-web-widgets", + "version": "1.0.0", + "description": "Place to keep shared rollup configs.", + "copyright": "© Mendix Technology BV 2025. All rights reserved.", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/mendix/web-widgets.git" + }, + "devDependencies": { + "@mendix/pluggable-widgets-tools": "*", + "rollup-plugin-copy": "^3.5.0" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 054ac8ba19..1056c118db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -944,6 +944,9 @@ importers: '@mendix/prettier-config-web-widgets': specifier: workspace:* version: link:../../shared/prettier-config-web-widgets + '@mendix/rollup-web-widgets': + specifier: workspace:* + version: link:../../shared/rollup-web-widgets '@mendix/run-e2e': specifier: workspace:^* version: link:../../../automation/run-e2e @@ -1281,6 +1284,9 @@ importers: '@mendix/pluggable-widgets-tools': specifier: 10.21.2 version: 10.21.2(@jest/transform@29.7.0)(@jest/types@29.6.3)(@swc/core@1.7.26(@swc/helpers@0.5.15))(@types/babel__core@7.20.3)(@types/node@22.14.1)(picomatch@4.0.2)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.3(@babel/core@7.27.4)(@babel/preset-env@7.26.9(@babel/core@7.27.4))(@types/react@18.2.36)(react@18.2.0))(react@18.2.0)(tslib@2.8.1) + '@mendix/rollup-web-widgets': + specifier: workspace:* + version: link:../../shared/rollup-web-widgets '@rollup/plugin-replace': specifier: ^6.0.2 version: 6.0.2(rollup@3.29.5) @@ -1728,6 +1734,9 @@ importers: '@mendix/prettier-config-web-widgets': specifier: workspace:* version: link:../../shared/prettier-config-web-widgets + '@mendix/rollup-web-widgets': + specifier: workspace:* + version: link:../../shared/rollup-web-widgets '@mendix/run-e2e': specifier: workspace:* version: link:../../../automation/run-e2e @@ -1774,6 +1783,9 @@ importers: '@mendix/prettier-config-web-widgets': specifier: workspace:* version: link:../../shared/prettier-config-web-widgets + '@mendix/rollup-web-widgets': + specifier: workspace:* + version: link:../../shared/rollup-web-widgets '@mendix/run-e2e': specifier: workspace:* version: link:../../../automation/run-e2e @@ -2069,6 +2081,9 @@ importers: '@mendix/prettier-config-web-widgets': specifier: workspace:* version: link:../../shared/prettier-config-web-widgets + '@mendix/rollup-web-widgets': + specifier: workspace:* + version: link:../../shared/rollup-web-widgets '@mendix/run-e2e': specifier: workspace:* version: link:../../../automation/run-e2e @@ -2541,6 +2556,15 @@ importers: specifier: ^2.5.10 version: 2.5.10(prettier@3.5.3) + packages/shared/rollup-web-widgets: + devDependencies: + '@mendix/pluggable-widgets-tools': + specifier: 10.21.2 + version: 10.21.2(@jest/transform@29.7.0)(@jest/types@29.6.3)(@swc/core@1.7.26(@swc/helpers@0.5.15))(@types/babel__core@7.20.3)(@types/node@22.14.1)(picomatch@4.0.2)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.3(@babel/core@7.27.4)(@babel/preset-env@7.26.9(@babel/core@7.27.4))(@types/react@18.2.36)(react@18.2.0))(react@18.2.0)(tslib@2.8.1) + rollup-plugin-copy: + specifier: ^3.5.0 + version: 3.5.0 + packages/shared/tsconfig-web-widgets: {} packages/shared/widget-plugin-component-kit: @@ -7136,10 +7160,6 @@ packages: filelist@1.0.4: resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==} - fill-range@7.0.1: - resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} - engines: {node: '>=8'} - fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} @@ -10236,9 +10256,6 @@ packages: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} - scheduler@0.23.0: - resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} - scheduler@0.23.2: resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} @@ -15319,7 +15336,7 @@ snapshots: braces@3.0.2: dependencies: - fill-range: 7.0.1 + fill-range: 7.1.1 braces@3.0.3: dependencies: @@ -15475,7 +15492,7 @@ snapshots: chokidar@3.5.2: dependencies: anymatch: 3.1.3 - braces: 3.0.2 + braces: 3.0.3 glob-parent: 5.1.2 is-binary-path: 2.1.0 is-glob: 4.0.3 @@ -17142,10 +17159,6 @@ snapshots: dependencies: minimatch: 5.0.1 - fill-range@7.0.1: - dependencies: - to-regex-range: 5.0.1 - fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -17485,7 +17498,7 @@ snapshots: '@types/glob': 7.2.0 array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.3.2 + fast-glob: 3.3.3 glob: 7.2.3 ignore: 5.3.2 merge2: 1.4.1 @@ -17503,7 +17516,7 @@ snapshots: globby@13.1.4: dependencies: dir-glob: 3.0.1 - fast-glob: 3.3.2 + fast-glob: 3.3.3 ignore: 5.3.2 merge2: 1.4.1 slash: 4.0.0 @@ -20659,7 +20672,7 @@ snapshots: react: 18.2.0 react-is: 18.2.0 react-shallow-renderer: 16.15.0(react@18.2.0) - scheduler: 0.23.0 + scheduler: 0.23.2 react@18.2.0: dependencies: @@ -21089,10 +21102,6 @@ snapshots: dependencies: xmlchars: 2.2.0 - scheduler@0.23.0: - dependencies: - loose-envify: 1.4.0 - scheduler@0.23.2: dependencies: loose-envify: 1.4.0