Skip to content

Commit 2147d8a

Browse files
committed
Add examples app with bundled react vanilla, material examples
This introduces a new private package `examples-app` to create a simple web page that ultimately has child pages for every example. In this initial commit, only the react vanilla and material examples are added. Therefore, they are bundled with rollup to be able to run as standalone pages. - Add rollup configs to bundle react vanilla and material examples - Add required dev deps and upgrade rollup dev dep to ^2.78.0 for all packages - change material deps to ~5.2.2 because latest 5.x versions break api for Autocomplete - Add private package `examples-app` with a script to aggregate the examples - Add root level npm script to create the examples app - regenerate package-lock.json Part of #1706
1 parent 96be520 commit 2147d8a

File tree

22 files changed

+4966
-3634
lines changed

22 files changed

+4966
-3634
lines changed

package-lock.json

Lines changed: 4706 additions & 3615 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"clean": "lerna run clean",
1212
"test": "lerna run test",
1313
"test-cov": "lerna run test-cov",
14-
"lint": "tslint 'packages/**/*.{ts,tsx}' -c ./tslint.json"
14+
"lint": "tslint 'packages/**/*.{ts,tsx}' -c ./tslint.json",
15+
"examples-app": "lerna run build && lerna run example:bundle && node packages/examples-app/prepare-examples-app.js"
1516
},
1617
"devDependencies": {
1718
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5",

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"redux": "^4.0.4",
7979
"redux-mock-store": "1.5.3",
8080
"rimraf": "^3.0.2",
81-
"rollup": "^2.7.3",
81+
"rollup": "^2.78.0",
8282
"rollup-plugin-cleanup": "^3.2.1",
8383
"rollup-plugin-typescript2": "^0.31.1",
8484
"rollup-plugin-visualizer": "^5.4.1",

packages/examples-app/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# JSON Forms - More Forms. Less Code
2+
3+
*Complex forms in the blink of an eye*
4+
5+
JSON Forms eliminates the tedious task of writing fully-featured forms by hand by leveraging the capabilities of JSON, JSON Schema and Javascript.
6+
7+
## Examples App
8+
9+
This package aggregates JSON Forms examples and makes them reachable via single `index.html` file.
10+
11+
Aggregating the examples assumes that packages were built and their e examples bundled.
12+
Afterwards, the examples app can be aggregated with [prepare-examples-app.js](./prepare-examples-app.js) into folder `dist`.

packages/examples-app/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>JSON Forms Examples</title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
</head>
9+
10+
<body>
11+
<h1>JSON Forms Examples</h1>
12+
<ul>
13+
<li><a href="react-vanilla">React Vanilla Renderers</a></li>
14+
<li><a href="react-material">React Material Renderers</a></li>
15+
</ul>
16+
</body>
17+
</html>

packages/examples-app/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@jsonforms/examples-app",
3+
"version": "3.1.0-alpha.0",
4+
"private": true,
5+
"license": "MIT",
6+
"type": "module",
7+
"scripts": {
8+
},
9+
"devDependencies": {
10+
"@types/fs-extra": "^9.0.13",
11+
"fs-extra": "^11.1.0"
12+
}
13+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env node
2+
3+
import { copySync } from 'fs-extra/esm';
4+
import { copyFileSync, mkdirSync, rmdirSync } from 'fs';
5+
import { dirname, join } from 'path';
6+
import { fileURLToPath } from 'url';
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = dirname(__filename);
10+
11+
const distDir = join(__dirname, 'dist');
12+
const packagesDir = join(__dirname, '..');
13+
const examples = {
14+
'react-vanilla': join(packagesDir, 'vanilla', 'example', 'dist'),
15+
'react-material': join(packagesDir, 'material', 'example', 'dist')
16+
}
17+
18+
// Clean and recreate dist dir
19+
console.log('Clean and recreate dist dir...');
20+
rmdirSync(distDir, { recursive: true, force: true });
21+
mkdirSync(distDir, { recursive: true });
22+
23+
// Copy index and built examples
24+
console.log('Copy index.html...');
25+
console.log('Copy example apps...');
26+
copyFileSync(join(__dirname, 'index.html'), join(distDir, 'index.html'));
27+
Object.keys(examples).forEach(key => {
28+
console.log(`Copying example ${key}...`);
29+
const path = examples[key];
30+
copySync(path, join(distDir, key));
31+
});
32+
33+
console.log('...finished');

packages/examples-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@jsonforms/core": "^3.1.0-alpha.0",
77
"@jsonforms/examples": "^3.1.0-alpha.0",
88
"@jsonforms/react": "^3.1.0-alpha.0",
9-
"@mui/material": "^5.2.2",
9+
"@mui/material": "~5.2.2",
1010
"@types/react-highlight": "^0.12.5",
1111
"@types/react-tabs": "^2.3.3",
1212
"highlight.js": "^11.3.1",

packages/examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"devDependencies": {
5151
"@jsonforms/core": "^3.1.0-alpha.0",
5252
"rimraf": "^3.0.2",
53-
"rollup": "^2.7.3",
53+
"rollup": "^2.78.0",
5454
"rollup-plugin-cleanup": "^3.2.1",
5555
"rollup-plugin-typescript2": "^0.31.1",
5656
"rollup-plugin-visualizer": "^5.4.1",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>JSON Forms React Material RendererSet</title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link rel="stylesheet" href="bundle.css">
9+
</head>
10+
11+
<body>
12+
<div id="root"></div>
13+
</body>
14+
<script src="bundle.js"></script>
15+
16+
</html>

0 commit comments

Comments
 (0)