From 2e97eba633b69188ffae878b312c064bc3f9c582 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Mon, 27 Nov 2023 12:05:50 +0100 Subject: [PATCH] chore: unify examples * ensure every plug-in follows a similar structure * drop browserify + grunt legacy * sources in `src` bundles to `public` directory * `dev` and `all` scripts --- .eslintignore | 3 +- .github/workflows/CI.yml | 4 +- .gitignore | 1 + bpmn-properties/.babelrc | 3 - bpmn-properties/.gitignore | 1 - bpmn-properties/karma.conf.js | 42 +- bpmn-properties/package.json | 14 +- bundling/.gitignore | 3 - bundling/package.json | 5 +- bundling/{public => src}/index.html | 4 +- bundling/webpack.config.js | 15 +- bundling/webpack.es5.config.js | 15 +- commenting/.babelrc | 11 - commenting/.gitignore | 3 - commenting/Gruntfile.js | 101 - commenting/README.md | 2 +- commenting/package.json | 19 +- commenting/{app => src}/app.js | 4 + commenting/{app => src}/font/LICENSE.txt | 0 .../{app => src}/font/bpmn-js-comments.eot | Bin .../{app => src}/font/bpmn-js-comments.svg | 0 .../{app => src}/font/bpmn-js-comments.ttf | Bin .../{app => src}/font/bpmn-js-comments.woff | Bin commenting/{app => src}/font/config.json | 0 commenting/{app => src}/index.html | 8 - commenting/{app => src}/style.css | 2 + commenting/webpack.config.js | 36 + custom-bundle/.gitignore | 2 - custom-bundle/package.json | 3 +- custom-meta-model/.babelrc | 11 - custom-meta-model/.gitignore | 2 - custom-meta-model/Gruntfile.js | 94 - custom-meta-model/README.md | 2 +- custom-meta-model/package.json | 18 +- .../{app/index.js => src/app.js} | 5 + custom-meta-model/{app => src}/index.html | 6 +- custom-meta-model/webpack.config.js | 35 + custom-modeling-rules/.babelrc | 3 - custom-modeling-rules/.gitignore | 1 - custom-modeling-rules/karma.conf.js | 37 +- custom-modeling-rules/package.json | 9 +- deep-linking/.babelrc | 3 - deep-linking/.gitignore | 3 - deep-linking/package.json | 15 +- deep-linking/src/app.js | 5 + deep-linking/{public => src}/index.html | 4 +- deep-linking/webpack.config.js | 22 +- i18n/.eslintignore | 1 - i18n/.gitignore | 2 - i18n/package.json | 3 +- i18n/{app => src}/app.js | 5 + .../customTranslate/customTranslate.js | 0 .../customTranslate/translations.js | 0 i18n/{app => src}/index.html | 4 - i18n/webpack.config.js | 18 +- minimap/.eslintignore | 1 - minimap/.gitignore | 2 - minimap/README.md | 2 +- minimap/package.json | 5 +- minimap/{app => src}/app.js | 8 + minimap/{app => src}/index.html | 6 - minimap/{app/css/app.css => src/style.css} | 0 minimap/webpack.config.js | 19 +- modeler/.eslintignore | 1 - modeler/package.json | 3 +- modeler/{app => src}/app.js | 8 + modeler/{app => src}/index.html | 5 - modeler/{app/css/app.css => src/style.css} | 0 modeler/webpack.config.js | 18 +- modeling-api/.eslintignore | 1 - modeling-api/.gitignore | 1 - modeling-api/package.json | 8 +- modeling-api/{app => src}/app.js | 7 + modeling-api/{app => src}/index.html | 4 - .../{app => src}/snippets/businessObjects.js | 0 .../{app => src}/snippets/collaborations.js | 0 .../{app => src}/snippets/connectingShapes.js | 0 .../{app => src}/snippets/creatingShapes.js | 0 .../{app => src}/snippets/editingElements.js | 0 modeling-api/{app => src}/snippets/index.js | 0 .../{app => src}/snippets/introduction.js | 0 .../{app/css/app.css => src/style.css} | 0 modeling-api/webpack.config.js | 18 +- overlays/.babelrc | 3 - overlays/.gitignore | 4 - overlays/Gruntfile.js | 81 - overlays/README.md | 4 +- overlays/package.json | 22 +- overlays/{app => src}/app.js | 0 overlays/{app => src}/index.html | 0 overlays/webpack.config.js | 36 + package-lock.json | 46810 ++++------------ package.json | 6 +- properties-panel-async-extension/.gitignore | 3 - properties-panel-async-extension/package.json | 16 +- .../src/app.js | 9 +- .../{app => src}/descriptors/magic.json | 0 .../{app => src}/index.html | 7 +- .../provider/magic/MagicPropertiesProvider.js | 0 .../{app => src}/provider/magic/index.js | 0 .../provider/magic/parts/SpellProps.js | 0 .../{styles/app.less => src/style.less} | 0 .../webpack.config.js | 38 +- properties-panel-extension/.gitignore | 3 - properties-panel-extension/README.md | 6 +- properties-panel-extension/app/css/app.css | 97 - properties-panel-extension/package.json | 16 +- .../src/app.js | 9 +- .../{app => src}/descriptors/magic.json | 0 .../src}/index.html | 7 +- .../provider/magic/MagicPropertiesProvider.js | 0 .../{app => src}/provider/magic/index.js | 0 .../provider/magic/parts/SpellProps.js | 0 .../{styles/app.less => src/style.less} | 0 properties-panel-extension/webpack.config.js | 38 +- properties-panel-list-extension/.babelrc | 8 - properties-panel-list-extension/README.md | 6 +- .../app/css/app.css | 97 - properties-panel-list-extension/package.json | 16 +- .../{app/index.js => src/app.js} | 10 +- .../{app => src}/descriptors/magic.json | 0 .../src}/index.html | 7 +- .../provider/magic/MagicPropertiesProvider.js | 0 .../{app => src}/provider/magic/index.js | 0 .../provider/magic/parts/ExtensionList.js | 0 .../provider/magic/parts/ExtensionProps.js | 0 .../provider/magic/parts/ParameterProps.js | 0 .../provider/magic/parts/ParametersProps.js | 0 .../{app => src}/provider/magic/util.js | 0 .../{styles/app.less => src/style.less} | 0 .../webpack.config.js | 31 +- properties-panel/.gitignore | 3 - properties-panel/README.md | 2 +- properties-panel/package.json | 16 +- properties-panel/src/app.js | 8 + properties-panel/src/index.html | 5 - properties-panel/src/{app.less => style.less} | 0 properties-panel/webpack.config.js | 23 +- theming/.gitignore | 2 - theming/README.md | 2 +- theming/package.json | 3 +- theming/{ => resources}/kitchen-sink.bpmn | 0 transaction-boundaries/.babelrc | 11 - transaction-boundaries/.gitignore | 3 - transaction-boundaries/README.md | 2 +- transaction-boundaries/app/css/app.css | 97 - transaction-boundaries/package.json | 3 +- .../{app/index.js => src/app.js} | 6 + .../{app => src}/index.html | 7 +- .../src/style.css | 0 transaction-boundaries/webpack.config.js | 34 +- 151 files changed, 9888 insertions(+), 38455 deletions(-) delete mode 100644 bpmn-properties/.babelrc delete mode 100644 bpmn-properties/.gitignore delete mode 100644 bundling/.gitignore rename bundling/{public => src}/index.html (82%) delete mode 100644 commenting/.babelrc delete mode 100644 commenting/.gitignore delete mode 100644 commenting/Gruntfile.js rename commenting/{app => src}/app.js (97%) rename commenting/{app => src}/font/LICENSE.txt (100%) rename commenting/{app => src}/font/bpmn-js-comments.eot (100%) rename commenting/{app => src}/font/bpmn-js-comments.svg (100%) rename commenting/{app => src}/font/bpmn-js-comments.ttf (100%) rename commenting/{app => src}/font/bpmn-js-comments.woff (100%) rename commenting/{app => src}/font/config.json (100%) rename commenting/{app => src}/index.html (88%) rename commenting/{app => src}/style.css (97%) create mode 100644 commenting/webpack.config.js delete mode 100644 custom-bundle/.gitignore delete mode 100644 custom-meta-model/.babelrc delete mode 100644 custom-meta-model/.gitignore delete mode 100644 custom-meta-model/Gruntfile.js rename custom-meta-model/{app/index.js => src/app.js} (93%) rename custom-meta-model/{app => src}/index.html (52%) create mode 100644 custom-meta-model/webpack.config.js delete mode 100644 custom-modeling-rules/.babelrc delete mode 100644 custom-modeling-rules/.gitignore delete mode 100644 deep-linking/.babelrc delete mode 100644 deep-linking/.gitignore rename deep-linking/{public => src}/index.html (68%) delete mode 100644 i18n/.eslintignore delete mode 100644 i18n/.gitignore rename i18n/{app => src}/app.js (83%) rename i18n/{app => src}/customTranslate/customTranslate.js (100%) rename i18n/{app => src}/customTranslate/translations.js (100%) rename i18n/{app => src}/index.html (53%) delete mode 100644 minimap/.eslintignore delete mode 100644 minimap/.gitignore rename minimap/{app => src}/app.js (93%) rename minimap/{app => src}/index.html (67%) rename minimap/{app/css/app.css => src/style.css} (100%) delete mode 100644 modeler/.eslintignore rename modeler/{app => src}/app.js (94%) rename modeler/{app => src}/index.html (77%) rename modeler/{app/css/app.css => src/style.css} (100%) delete mode 100644 modeling-api/.eslintignore delete mode 100644 modeling-api/.gitignore rename modeling-api/{app => src}/app.js (94%) rename modeling-api/{app => src}/index.html (55%) rename modeling-api/{app => src}/snippets/businessObjects.js (100%) rename modeling-api/{app => src}/snippets/collaborations.js (100%) rename modeling-api/{app => src}/snippets/connectingShapes.js (100%) rename modeling-api/{app => src}/snippets/creatingShapes.js (100%) rename modeling-api/{app => src}/snippets/editingElements.js (100%) rename modeling-api/{app => src}/snippets/index.js (100%) rename modeling-api/{app => src}/snippets/introduction.js (100%) rename modeling-api/{app/css/app.css => src/style.css} (100%) delete mode 100644 overlays/.babelrc delete mode 100644 overlays/.gitignore delete mode 100644 overlays/Gruntfile.js rename overlays/{app => src}/app.js (100%) rename overlays/{app => src}/index.html (100%) create mode 100644 overlays/webpack.config.js delete mode 100644 properties-panel-async-extension/.gitignore rename properties-panel-extension/app/index.js => properties-panel-async-extension/src/app.js (93%) rename properties-panel-async-extension/{app => src}/descriptors/magic.json (100%) rename properties-panel-async-extension/{app => src}/index.html (73%) rename properties-panel-async-extension/{app => src}/provider/magic/MagicPropertiesProvider.js (100%) rename properties-panel-async-extension/{app => src}/provider/magic/index.js (100%) rename properties-panel-async-extension/{app => src}/provider/magic/parts/SpellProps.js (100%) rename properties-panel-async-extension/{styles/app.less => src/style.less} (100%) delete mode 100644 properties-panel-extension/.gitignore delete mode 100644 properties-panel-extension/app/css/app.css rename properties-panel-async-extension/app/index.js => properties-panel-extension/src/app.js (93%) rename properties-panel-extension/{app => src}/descriptors/magic.json (100%) rename {properties-panel-list-extension/app => properties-panel-extension/src}/index.html (73%) rename properties-panel-extension/{app => src}/provider/magic/MagicPropertiesProvider.js (100%) rename properties-panel-extension/{app => src}/provider/magic/index.js (100%) rename properties-panel-extension/{app => src}/provider/magic/parts/SpellProps.js (100%) rename properties-panel-extension/{styles/app.less => src/style.less} (100%) delete mode 100644 properties-panel-list-extension/.babelrc delete mode 100644 properties-panel-list-extension/app/css/app.css rename properties-panel-list-extension/{app/index.js => src/app.js} (93%) rename properties-panel-list-extension/{app => src}/descriptors/magic.json (100%) rename {properties-panel-extension/app => properties-panel-list-extension/src}/index.html (73%) rename properties-panel-list-extension/{app => src}/provider/magic/MagicPropertiesProvider.js (100%) rename properties-panel-list-extension/{app => src}/provider/magic/index.js (100%) rename properties-panel-list-extension/{app => src}/provider/magic/parts/ExtensionList.js (100%) rename properties-panel-list-extension/{app => src}/provider/magic/parts/ExtensionProps.js (100%) rename properties-panel-list-extension/{app => src}/provider/magic/parts/ParameterProps.js (100%) rename properties-panel-list-extension/{app => src}/provider/magic/parts/ParametersProps.js (100%) rename properties-panel-list-extension/{app => src}/provider/magic/util.js (100%) rename properties-panel-list-extension/{styles/app.less => src/style.less} (100%) delete mode 100644 properties-panel/.gitignore rename properties-panel/src/{app.less => style.less} (100%) delete mode 100644 theming/.gitignore rename theming/{ => resources}/kitchen-sink.bpmn (100%) delete mode 100644 transaction-boundaries/.babelrc delete mode 100644 transaction-boundaries/.gitignore delete mode 100644 transaction-boundaries/app/css/app.css rename transaction-boundaries/{app/index.js => src/app.js} (94%) rename transaction-boundaries/{app => src}/index.html (75%) rename properties-panel-async-extension/app/css/app.css => transaction-boundaries/src/style.css (100%) diff --git a/.eslintignore b/.eslintignore index d70ebaa1..c257d21f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ -public \ No newline at end of file +public +dist \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f4ace88d..353a9462 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,6 +19,6 @@ jobs: - name: Install dependencies run: npm ci - name: Build examples - run: npm run build:examples + run: npm run build - name: Lint examples - run: npm run lint:examples + run: npm run lint diff --git a/.gitignore b/.gitignore index 21b7ec0d..85da6f52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ +public/ dist/ .idea *.iml diff --git a/bpmn-properties/.babelrc b/bpmn-properties/.babelrc deleted file mode 100644 index 81eee51e..00000000 --- a/bpmn-properties/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": [ "env" ] -} \ No newline at end of file diff --git a/bpmn-properties/.gitignore b/bpmn-properties/.gitignore deleted file mode 100644 index 40b878db..00000000 --- a/bpmn-properties/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ \ No newline at end of file diff --git a/bpmn-properties/karma.conf.js b/bpmn-properties/karma.conf.js index 8abbdd3b..5a612937 100644 --- a/bpmn-properties/karma.conf.js +++ b/bpmn-properties/karma.conf.js @@ -1,8 +1,15 @@ +// use puppeteer provided Chrome for testing +process.env.CHROME_BIN = require('puppeteer').executablePath(); + +// configures browsers to run test against +// any of [ 'ChromeHeadless', 'Chrome', 'Firefox', 'Safari' ] +const browsers = (process.env.TEST_BROWSERS || 'ChromeHeadless').split(','); + module.exports = function(karma) { karma.set({ frameworks: [ - 'browserify', + 'webpack', 'mocha', 'chai' ], @@ -14,32 +21,25 @@ module.exports = function(karma) { reporters: [ 'dots' ], preprocessors: { - 'test/spec/**/*Spec.js': [ 'browserify' ] + 'test/spec/**/*Spec.js': [ 'webpack' ] }, - browsers: [ 'Chrome' ], - - browserNoActivityTimeout: 30000, + browsers, singleRun: true, autoWatch: false, - // browserify configuration - browserify: { - debug: true, - transform: [ - [ 'stringify', { - global: true, - extensions: [ - '.bpmn', - '.xml', - '.css' - ] - } ], - [ 'babelify', { - global: true - } ], - ] + webpack: { + mode: 'development', + module: { + rules: [ + { + test: /\.css|\.bpmn$/, + type: 'asset/source' + } + ] + }, + devtool: 'eval-source-map' } }); }; diff --git a/bpmn-properties/package.json b/bpmn-properties/package.json index b83a3841..7cf2de9f 100644 --- a/bpmn-properties/package.json +++ b/bpmn-properties/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "description": "An example how to read and write custom BPMN 2.0 extensions", "scripts": { - "all": "run-s lint test", + "all": "run-s test", "dev": "npm test -- --auto-watch --no-single-run", "test": "karma start" }, @@ -26,10 +26,6 @@ ], "license": "MIT", "devDependencies": { - "babel-core": "^6.26.0", - "babel-preset-env": "^1.6.1", - "babelify": "^10.0.0", - "browserify": "^16.0.0", "chai": "^4.1.2", "karma": "^6.0.0", "karma-browserify": "^8.0.0", @@ -37,14 +33,14 @@ "karma-chrome-launcher": "^3.0.0", "karma-firefox-launcher": "^2.0.0", "karma-mocha": "^2.0.0", + "karma-webpack": "^5.0.0", "mocha": "^10.0.0", "mocha-test-container-support": "^0.2.0", "npm-run-all": "^4.1.2", - "stringify": "^5.0.0", - "watchify": "^3.10.0" + "puppeteer": "^21.5.2", + "webpack": "^5.89.0" }, "dependencies": { - "bpmn-js": "^15.2.2", - "inherits": "^2.0.1" + "bpmn-js": "^15.2.2" } } diff --git a/bundling/.gitignore b/bundling/.gitignore deleted file mode 100644 index a3f3a867..00000000 --- a/bundling/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules/ -public/app.bundled.js -tmp/ \ No newline at end of file diff --git a/bundling/package.json b/bundling/package.json index f0f169ee..1b317a1a 100644 --- a/bundling/package.json +++ b/bundling/package.json @@ -2,14 +2,13 @@ "name": "bpmn-js-example-commonjs", "version": "0.0.0", "description": "An example how to bundle an app using bpmn-js for the browser", - "main": "src/app.js", "scripts": { - "all": "run-s bundle open", + "all": "run-s build build:es5", "build": "webpack", "build:es5": "webpack --config webpack.es5.config.js", "build:watch": "webpack -w", "open": "opn ./public/index.html", - "dev": "npm run bundle:watch" + "dev": "run-p bundle:watch open" }, "repository": { "type": "git", diff --git a/bundling/public/index.html b/bundling/src/index.html similarity index 82% rename from bundling/public/index.html rename to bundling/src/index.html index 82c20b0b..621f4bc9 100644 --- a/bundling/public/index.html +++ b/bundling/src/index.html @@ -13,7 +13,7 @@ - +