Skip to content

Commit

Permalink
chore: unify examples
Browse files Browse the repository at this point in the history
* ensure every plug-in follows a similar structure
* drop browserify + grunt legacy
* sources in `src` bundles to `public` directory
* `dev` and `all` scripts
  • Loading branch information
nikku committed Nov 27, 2023
1 parent bd289f0 commit 2e97eba
Show file tree
Hide file tree
Showing 151 changed files with 9,888 additions and 38,455 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
public
public
dist
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
public/
dist/
.idea
*.iml
Expand Down
3 changes: 0 additions & 3 deletions bpmn-properties/.babelrc

This file was deleted.

1 change: 0 additions & 1 deletion bpmn-properties/.gitignore

This file was deleted.

42 changes: 21 additions & 21 deletions bpmn-properties/karma.conf.js
Original file line number Diff line number Diff line change
@@ -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'
],
Expand All @@ -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'
}
});
};
14 changes: 5 additions & 9 deletions bpmn-properties/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -26,25 +26,21 @@
],
"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",
"karma-chai": "^0.1.0",
"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"
}
}
3 changes: 0 additions & 3 deletions bundling/.gitignore

This file was deleted.

5 changes: 2 additions & 3 deletions bundling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions bundling/public/index.html → bundling/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</style>

<!-- required viewer styles -->
<link rel="stylesheet" href="https://unpkg.com/bpmn-js@9.0.1/dist/assets/bpmn-js.css">
<link rel="stylesheet" href="https://unpkg.com/bpmn-js@15.0.1/dist/assets/bpmn-js.css">

<!--
this is an example of how to use bpmn-js in a standalone application built with
Expand All @@ -28,6 +28,6 @@ <h1>Pizza Collaboration Viewer</h1>

<div id="canvas"></div>

<script src="./app.bundled.js"></script>
<script src="./app.js"></script>
</body>
</html>
15 changes: 12 additions & 3 deletions bundling/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
var path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const path = require('path');

module.exports = {
mode: 'development',
entry: './src/app.js',
output: {
path: path.resolve(__dirname, 'public'),
filename: 'app.bundled.js'
filename: 'app.js'
},
module: {
rules: [
Expand All @@ -14,5 +16,12 @@ module.exports = {
type: 'asset/source'
}
]
}
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'src/index.html', to: '.' }
]
})
]
};
15 changes: 12 additions & 3 deletions bundling/webpack.es5.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
var path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const path = require('path');

module.exports = {
mode: 'development',
entry: './src/app.js',
output: {
path: path.resolve(__dirname, 'public'),
filename: 'app.bundled.js'
filename: 'app.js'
},
module: {
rules: [
Expand All @@ -24,5 +26,12 @@ module.exports = {
}
}
]
}
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'src/index.html', to: '.' }
]
})
]
};
11 changes: 0 additions & 11 deletions commenting/.babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions commenting/.gitignore

This file was deleted.

101 changes: 0 additions & 101 deletions commenting/Gruntfile.js

This file was deleted.

2 changes: 1 addition & 1 deletion commenting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ npm install
```


Building the app into the `dist` directory and opening it in a browser:
Building the app into the `public` directory and opening it in a browser:

```
npm run dev
Expand Down
19 changes: 5 additions & 14 deletions commenting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
"name": "bpmn-js-example-commenting",
"version": "0.0.0",
"description": "A simple commenting app based on bpmn-js",
"main": "app/app.js",
"scripts": {
"all": "grunt",
"dev": "grunt auto-build"
"all": "webpack",
"dev": "webpack-dev-server"
},
"repository": {
"type": "git",
Expand All @@ -26,17 +25,9 @@
],
"license": "MIT",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babelify": "^8.0.0",
"grunt": "^1.0.1",
"grunt-browserify": "^6.0.0",
"grunt-cli": "^1.2.0",
"grunt-contrib-connect": "^4.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"load-grunt-tasks": "^5.0.0",
"stringify": "^5.0.0"
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
"dependencies": {
"bpmn-js": "^15.2.2",
Expand Down
Loading

0 comments on commit 2e97eba

Please sign in to comment.