Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bundled examples for Angular Material and Vue Vanilla #2074

Merged
merged 2 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/angular-material/example/index.bundled.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSON Forms Angular Material RendererSet</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="indigo-pink.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,900,700,500,300,100' rel='stylesheet' type='text/css'>
</head>
<body>
<app-root></app-root>
</body>
<script src="bundle.js"></script>
</html>

<!--
Copyright 2017-2018 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->
11 changes: 11 additions & 0 deletions packages/angular-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
52 changes: 52 additions & 0 deletions packages/angular-material/rollup.example.config.js
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 2 additions & 0 deletions packages/examples-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ <h1>JSON Forms Examples</h1>
<ul>
<li><a href="react-vanilla">React Vanilla Renderers</a></li>
<li><a href="react-material">React Material Renderers</a></li>
<li><a href="angular-material">Angular Material Renderers</a></li>
<li><a href="vue-vanilla">Vue Vanilla Renderers</a></li>
</ul>
</body>
</html>
4 changes: 3 additions & 1 deletion packages/examples-app/prepare-examples-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions packages/vue/vue-vanilla/example/index.bundled.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8">
<title>JSON Forms Vue Vanilla RendererSet</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bundle.css">
</head>

<body>
<div id="app"></div>
</body>
<script src="bundle.js"></script>

</html>
3 changes: 2 additions & 1 deletion packages/vue/vue-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
52 changes: 52 additions & 0 deletions packages/vue/vue-vanilla/rollup.example.config.js
Original file line number Diff line number Diff line change
@@ -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;