diff --git a/packages/angular-material/example/index.bundled.html b/packages/angular-material/example/index.bundled.html new file mode 100644 index 000000000..3c6ae29cf --- /dev/null +++ b/packages/angular-material/example/index.bundled.html @@ -0,0 +1,22 @@ + + + + + JSON Forms Angular Material RendererSet + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/angular-material/package.json b/packages/angular-material/package.json index e4d00b1e9..a5d32a344 100644 --- a/packages/angular-material/package.json +++ b/packages/angular-material/package.json @@ -35,6 +35,7 @@ "typings": "./lib/esm/index.d.ts", "scripts": { "build": "ngc && ngc -p tsconfig.cjs.json", + "build:examples-app": "rollup -c rollup.example.config.js", "dev": "webpack --config webpack/webpack.dev.js && webpack-dev-server --config webpack/webpack.dev.js --env=dev --inline", "clean": "rimraf lib coverage dist .nyc_output 2> /dev/null", "lint": "tslint --project tsconfig.json --exclude src/models/jsonSchema.ts", @@ -88,6 +89,10 @@ "@jsonforms/angular-test": "^3.1.0-alpha.0", "@jsonforms/core": "^3.1.0-alpha.0", "@jsonforms/examples": "^3.1.0-alpha.0", + "@rollup/plugin-commonjs": "^23.0.3", + "@rollup/plugin-json": "^5.0.2", + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-replace": "^5.0.1", "@types/node": "^10.10.0", "angular2-template-loader": "^0.6.2", "copy-webpack-plugin": "^5.0.5", @@ -108,6 +113,12 @@ "protractor": "^5.4.1", "request": "^2.88.0", "rimraf": "^3.0.2", + "rollup": "^2.78.0", + "rollup-plugin-cleanup": "^3.2.1", + "rollup-plugin-copy": "^3.4.0", + "rollup-plugin-import-css": "^3.1.0", + "rollup-plugin-typescript2": "^0.31.1", + "rollup-plugin-visualizer": "^5.4.1", "rxjs": "^6.5.3", "ts-loader": "^6.2.1", "tslint": "^5.20.1", diff --git a/packages/angular-material/rollup.example.config.js b/packages/angular-material/rollup.example.config.js new file mode 100644 index 000000000..8869b27b6 --- /dev/null +++ b/packages/angular-material/rollup.example.config.js @@ -0,0 +1,52 @@ +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import nodeResolve from '@rollup/plugin-node-resolve'; +import replace from '@rollup/plugin-replace'; +import copy from 'rollup-plugin-copy'; +import css from 'rollup-plugin-import-css'; +import typescript from 'rollup-plugin-typescript2'; + +/** + * @type {import('rollup').RollupOptions} +*/ +const config = { + input: 'example/main.ts', + output: { + file: 'example/dist/bundle.js', + format: 'iife', + sourcemap: true + }, + plugins: [ + replace({ + 'process.env.NODE_ENV': JSON.stringify('production'), + preventAssignment: true, // recommended to be set by library to be forward compatible + }), + nodeResolve({ browser: true }), + // Transform mixed because some JsonForms modules use import and require + commonjs({ transformMixedEsModules: true }), + css(), + json(), + typescript({ + tsconfigOverride: { + compilerOptions: { + // Do not emit typescript declarations for our bundled example app + declaration: false + } + }}), + copy({ + targets: [ + { + src: '../../node_modules/@angular/material/prebuilt-themes/indigo-pink.css', + dest: 'example/dist' + }, + { + src: 'example/index.bundled.html', + dest: 'example/dist', + rename: () => 'index.html' + } + ] + }), + ] +} + +export default config; \ No newline at end of file diff --git a/packages/examples-app/index.html b/packages/examples-app/index.html index fd0015d4e..75c9e2bf7 100644 --- a/packages/examples-app/index.html +++ b/packages/examples-app/index.html @@ -12,6 +12,8 @@

JSON Forms Examples

\ No newline at end of file diff --git a/packages/examples-app/prepare-examples-app.js b/packages/examples-app/prepare-examples-app.js index 966c6fddc..3db3b1ed8 100644 --- a/packages/examples-app/prepare-examples-app.js +++ b/packages/examples-app/prepare-examples-app.js @@ -12,7 +12,9 @@ const distDir = join(__dirname, 'dist'); const packagesDir = join(__dirname, '..'); const examples = { 'react-vanilla': join(packagesDir, 'vanilla-renderers', 'example', 'dist'), - 'react-material': join(packagesDir, 'material-renderers', 'example', 'dist') + 'react-material': join(packagesDir, 'material-renderers', 'example', 'dist'), + 'angular-material': join(packagesDir, 'angular-material', 'example', 'dist'), + 'vue-vanilla': join(packagesDir, 'vue', 'vue-vanilla', 'example', 'dist') } // Clean and recreate dist dir diff --git a/packages/vue/vue-vanilla/example/index.bundled.html b/packages/vue/vue-vanilla/example/index.bundled.html new file mode 100644 index 000000000..6f3490282 --- /dev/null +++ b/packages/vue/vue-vanilla/example/index.bundled.html @@ -0,0 +1,16 @@ + + + + + + JSON Forms Vue Vanilla RendererSet + + + + + +
+ + + + \ No newline at end of file diff --git a/packages/vue/vue-vanilla/package.json b/packages/vue/vue-vanilla/package.json index ee8fa649e..02584c6e1 100644 --- a/packages/vue/vue-vanilla/package.json +++ b/packages/vue/vue-vanilla/package.json @@ -44,7 +44,8 @@ "build:do": "cross-env NODE_ENV=production rollup --config rollup.config.js", "build": "run-s --continue-on-error build:pre build:do build:after", "build:after": "symlink-dir ../../core ../vue/node_modules/@jsonforms/core", - "clean": "rimraf lib", + "build:examples-app": "rollup -c rollup.example.config.js", + "clean": "rimraf lib example/dist", "doc": "typedoc --name 'JSON Forms Vue Vanilla Renderers' --mode file --out docs src --ignoreCompilerErrors", "test": "vue-cli-service test:unit" }, diff --git a/packages/vue/vue-vanilla/rollup.example.config.js b/packages/vue/vue-vanilla/rollup.example.config.js new file mode 100644 index 000000000..99f88d83a --- /dev/null +++ b/packages/vue/vue-vanilla/rollup.example.config.js @@ -0,0 +1,52 @@ +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import nodeResolve from '@rollup/plugin-node-resolve'; +import replace from '@rollup/plugin-replace'; +import copy from 'rollup-plugin-copy'; +import css from 'rollup-plugin-import-css'; +import typescript from 'rollup-plugin-typescript2'; +import vue from 'rollup-plugin-vue'; + +/** + * @type {import('rollup').RollupOptions} +*/ +const config = { + input: 'dev/serve.ts', + output: { + file: 'example/dist/bundle.js', + format: 'iife', + sourcemap: true + }, + plugins: [ + replace({ + 'process.env.NODE_ENV': JSON.stringify('production'), + preventAssignment: true, // recommended to be set by library to be forward compatible + }), + vue(), + nodeResolve({ browser: true }), + // Transform mixed because some JsonForms modules use import and require + commonjs({ transformMixedEsModules: true }), + css(), + json(), + typescript({ + tsconfigOverride: { + include: null, + compilerOptions: { + // Do not emit typescript declarations for our bundled example app + declaration: false + } + } + }), + copy({ + targets: [ + { + src: 'example/index.bundled.html', + dest: 'example/dist', + rename: () => 'index.html' + }, + ] + }), + ] +} + +export default config; \ No newline at end of file