Skip to content

Commit b7f551c

Browse files
eneufeldsdirix
andauthored
Update Seed
Co-authored-by: Stefan Dirix <sdirix@eclipsesource.com>
1 parent a0058a7 commit b7f551c

31 files changed

+12459
-6884
lines changed

.angular-cli.json

Lines changed: 0 additions & 60 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# compiled output
44
/dist
5+
/dist-server
56
/tmp
67
/out-tsc
78

@@ -30,6 +31,7 @@
3031
/coverage
3132
/libpeerconnection.log
3233
npm-debug.log
34+
yarn-error.log
3335
testem.log
3436
/typings
3537

README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
1-
# JsonformsAngularSeed
1+
# JSON Forms Angular Seed
22

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0.
3+
JSONForms Angular Seed.
44

5-
## Setup
5+
## Installation
66

7-
[Install node](https://nodejs.org/en/download/) in case you do not have it.
8-
Clone this Git repository and run `npm install`.
9-
Install the Angular CLI if you do not already have it with `npm install -g @angular/cli`.
7+
Run `npm ci` to install the necessary dependencies.
108

11-
## Build and Run
9+
## Development server
1210

13-
Then run `ng serve` for a dev server. Navigate to [`http://localhost:4200/`](http://localhost:4200/). The app will automatically reload if you change any of the source files.
11+
Run `npm start` for a dev server. Navigate to [http://localhost:4200/](http://localhost:4200/). The app will automatically reload if you change any of the source files.
1412

15-
## About
16-
This minimal seed applications is a show case for [JSON Forms](http://jsonforms.io). It defines one Angular component for the <app-root> element used in [index.html](https://github.com/eclipsesource/jsonforms-angular-seed/blob/master/src/index.html). The component makes use of the <jsonforms> element, see [app.component.html](https://github.com/eclipsesource/jsonforms-angular-seed/blob/master/src/app/app.component.html). A JSON Schema, UI Schema and JSON object are defined in [app.component.ts](https://github.com/eclipsesource/jsonforms-angular-seed/blob/master/src/app/app.component.ts).
13+
## Build
1714

18-
## Further help
15+
Run `npm build` to build the project. The build artifacts will be stored in the `dist` directory. Use the `-prod` flag for a production build.
1916

20-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
17+
## Running unit tests
18+
19+
Run `npm test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `npm e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24+
25+
## Customizations
26+
27+
For this showcase we hardcoded the schemas (`schema.json`, `uischema.json`) and the data (`data.ts`). You can replace them with your own or handle them completely dynamically.
28+
29+
We implemented three custom controls (`custom.autocomplete.ts`, `lang.control.ts` and `data.control.ts`). If you don't need them just remove them! See also `store.ts` where these custom renderers are registered.
30+
31+
In `app.module.ts` we customized the validation and executed a manual resolving step before handing the schemas over to JSON Forms. These steps are optional and can be skipped if needed.

angular.json

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"jsonforms-angular-material-playground": {
7+
"root": "",
8+
"sourceRoot": "src",
9+
"projectType": "application",
10+
"architect": {
11+
"build": {
12+
"builder": "@angular-devkit/build-angular:browser",
13+
"options": {
14+
"aot": true,
15+
"outputPath": "dist",
16+
"index": "src/index.html",
17+
"main": "src/main.ts",
18+
"tsConfig": "src/tsconfig.app.json",
19+
"polyfills": "src/polyfills.ts",
20+
"assets": [
21+
"src/assets",
22+
"src/favicon.ico"
23+
],
24+
"styles": [
25+
"src/styles.css"
26+
],
27+
"scripts": [],
28+
"preserveSymlinks": true
29+
},
30+
"configurations": {
31+
"production": {
32+
"budgets": [
33+
{
34+
"type": "anyComponentStyle",
35+
"maximumWarning": "6kb"
36+
}
37+
],
38+
"optimization": true,
39+
"outputHashing": "all",
40+
"sourceMap": false,
41+
"extractCss": true,
42+
"namedChunks": false,
43+
"aot": true,
44+
"extractLicenses": true,
45+
"vendorChunk": false,
46+
"buildOptimizer": true,
47+
"fileReplacements": [
48+
{
49+
"replace": "src/environments/environment.ts",
50+
"with": "src/environments/environment.prod.ts"
51+
}
52+
]
53+
}
54+
}
55+
},
56+
"serve": {
57+
"builder": "@angular-devkit/build-angular:dev-server",
58+
"options": {
59+
"browserTarget": "jsonforms-angular-material-playground:build"
60+
},
61+
"configurations": {
62+
"production": {
63+
"browserTarget": "jsonforms-angular-material-playground:build:production"
64+
}
65+
}
66+
},
67+
"extract-i18n": {
68+
"builder": "@angular-devkit/build-angular:extract-i18n",
69+
"options": {
70+
"browserTarget": "jsonforms-angular-material-playground:build"
71+
}
72+
},
73+
"test": {
74+
"builder": "@angular-devkit/build-angular:karma",
75+
"options": {
76+
"main": "src/test.ts",
77+
"karmaConfig": "./karma.conf.js",
78+
"polyfills": "src/polyfills.ts",
79+
"tsConfig": "src/tsconfig.spec.json",
80+
"scripts": [],
81+
"styles": [
82+
"src/styles.css"
83+
],
84+
"assets": [
85+
"src/assets",
86+
"src/favicon.ico"
87+
]
88+
}
89+
},
90+
"lint": {
91+
"builder": "@angular-devkit/build-angular:tslint",
92+
"options": {
93+
"tsConfig": [
94+
"src/tsconfig.app.json",
95+
"src/tsconfig.spec.json"
96+
],
97+
"exclude": [
98+
"**/node_modules/**"
99+
]
100+
}
101+
}
102+
}
103+
},
104+
"jsonforms-angular-material-playground-e2e": {
105+
"root": "e2e",
106+
"sourceRoot": "e2e",
107+
"projectType": "application",
108+
"architect": {
109+
"e2e": {
110+
"builder": "@angular-devkit/build-angular:protractor",
111+
"options": {
112+
"protractorConfig": "./protractor.conf.js",
113+
"devServerTarget": "jsonforms-angular-material-playground:serve"
114+
}
115+
},
116+
"lint": {
117+
"builder": "@angular-devkit/build-angular:tslint",
118+
"options": {
119+
"tsConfig": [
120+
"e2e/tsconfig.e2e.json"
121+
],
122+
"exclude": [
123+
"**/node_modules/**"
124+
]
125+
}
126+
}
127+
}
128+
}
129+
},
130+
"defaultProject": "jsonforms-angular-material-playground",
131+
"schematics": {
132+
"@schematics/angular:component": {
133+
"prefix": "app",
134+
"style": "css"
135+
},
136+
"@schematics/angular:directive": {
137+
"prefix": "app"
138+
}
139+
}
140+
}

e2e/app.e2e-spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { JsonformsAngularSeedPage } from './app.po';
1+
import { AppPage } from './app.po';
22

3-
describe('jsonforms-angular-seed App', () => {
4-
let page: JsonformsAngularSeedPage;
3+
describe('jsonforms-angular-material-playground App', () => {
4+
let page: AppPage;
55

66
beforeEach(() => {
7-
page = new JsonformsAngularSeedPage();
7+
page = new AppPage();
88
});
99

10-
it('should display message saying app works', () => {
10+
it('should display welcome message', () => {
1111
page.navigateTo();
12-
expect(page.getParagraphText()).toEqual('app works!');
12+
expect(page.getParagraphText()).toEqual('Welcome to app!');
1313
});
1414
});

e2e/app.po.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { browser, element, by } from 'protractor';
1+
import { browser, by, element } from 'protractor';
22

3-
export class JsonformsAngularSeedPage {
3+
export class AppPage {
44
navigateTo() {
55
return browser.get('/');
66
}

e2e/tsconfig.e2e.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/e2e",
5+
"baseUrl": "./",
56
"module": "commonjs",
67
"target": "es5",
7-
"types":[
8+
"types": [
89
"jasmine",
10+
"jasminewd2",
911
"node"
1012
]
1113
}

karma.conf.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,26 @@
11
// Karma configuration file, see link for more information
2-
// https://karma-runner.github.io/0.13/config/configuration-file.html
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
33

44
module.exports = function (config) {
55
config.set({
66
basePath: '',
7-
frameworks: ['jasmine', '@angular/cli'],
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
88
plugins: [
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
1111
require('karma-jasmine-html-reporter'),
1212
require('karma-coverage-istanbul-reporter'),
13-
require('@angular/cli/plugins/karma')
13+
require('@angular-devkit/build-angular/plugins/karma')
1414
],
1515
client:{
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
18-
files: [
19-
{ pattern: './src/test.ts', watched: false }
20-
],
21-
preprocessors: {
22-
'./src/test.ts': ['@angular/cli']
23-
},
24-
mime: {
25-
'text/x-typescript': ['ts','tsx']
26-
},
2718
coverageIstanbulReporter: {
28-
reports: [ 'html', 'lcovonly' ],
19+
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
2920
fixWebpackSourcePaths: true
3021
},
31-
angularCli: {
32-
environment: 'dev'
33-
},
34-
reporters: config.angularCli && config.angularCli.codeCoverage
35-
? ['progress', 'coverage-istanbul']
36-
: ['progress', 'kjhtml'],
22+
23+
reporters: ['progress', 'kjhtml'],
3724
port: 9876,
3825
colors: true,
3926
logLevel: config.LOG_INFO,

0 commit comments

Comments
 (0)