Skip to content

Commit

Permalink
ng6 compliancy
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrehault committed Jun 1, 2018
1 parent 1bb9f42 commit 8076ea9
Show file tree
Hide file tree
Showing 100 changed files with 12,184 additions and 561 deletions.
65 changes: 37 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
node_modules/
.DS_Store
npm-debug.log
compiled/
dist/
coverage/
.idea
yarn.lock
/.vscode
release/
*.metadata.json
*.ngfactory.ts
*.tgz
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# test subproject and demo
/demo
/tests/dist
/tests/src/lib/
/tests/tmp
/tests/node_modules
/tests/.idea
/tests/.vscode
/tests/.sass-cache
/tests/connect.lock
/tests/coverage/*
/tests/libpeerconnection.log
/tests/typings
/tests/e2e/*.js
/tests/e2e/*.map
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: node_js
dist: trusty

node_js:
- '6'
- 'node'

env:
Expand All @@ -16,10 +15,8 @@ before_script:

install:
- npm install && npm install -g @angular/cli
- npm info . peerDependencies | sed -n 's/^{\{0,1\}[[:space:]]*'\''\{0,1\}\([^:'\'']*\)'\''\{0,1\}:[[:space:]]'\''\([^'\'']*\).*$/\1@\2/p' | xargs npm i
- cd ./tests && npm install && cd ..

script:
- npm run test

sudo: required
sudo: required
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 2.0.0-beta.1

- Angular 6 compliancy
- Use default library project structure provided by Angular CLI 6

# 1.2.2 (2018-05-13)

# Bug fixes
Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Angular2 Schema Form [![Build Status](https://travis-ci.org/makinacorpus/angular2-schema-form.svg?branch=master)](https://travis-ci.org/makinacorpus/angular2-schema-form)
# Ngx Schema Form [![Build Status](https://travis-ci.org/makinacorpus/ngx-schema-form.svg?branch=master)](https://travis-ci.org/makinacorpus/ngx-schema-form)

Angular2 Schema Form is an Angular2 module allowing you to instanciate an HTML form from a [JSON schema](http://json-schema.org/).
Ngx Schema Form is an Angular 2+ module allowing you to instanciate an HTML form from a [JSON schema](http://json-schema.org/).

Note: Version 1.x is compliant with Angular <=4, version 2.x is compliant with Angular >=6.

## DISCLAIMER

Angular2 Schema Form is **not** related to [angular-schema-form](https://github.com/json-schema-form/angular-schema-form) and [schemaform.io](http://schemaform.io/).
Ngx Schema Form is **not** related to [angular-schema-form](https://github.com/json-schema-form/angular-schema-form) and [schemaform.io](http://schemaform.io/).

We think `angular-schema-form` is a great Angular 1 library, and when it will move to Angular 2, we will probably join our efforts to produce and maintain a unique Angular 2 solution.
We think `angular-schema-form` is a great Angular 1 library, and when it will move to Angular 2+, we will probably join our efforts to produce and maintain a unique Angular 2+ solution.

## Demo
There is an [example of application](https://github.com/fbessou/angular2-schema-form-demo) using Angular2 Schema Form.
You can also test the module on [the website](https://makinacorpus.github.io/angular2-schema-form).
There is an [example of application](https://github.com/fbessou/angular2-schema-form-demo) using Ngx Schema Form.
You can also test the module on [the website](https://makinacorpus.github.io/ngx-schema-form).

## Features

Expand All @@ -21,10 +23,10 @@ You can also test the module on [the website](https://makinacorpus.github.io/ang
* Allow declaration of custom widgets

## Installation
To use Angular2 Schema Form in your project simply execute the following command:
To use Ngx Schema Form in your project simply execute the following command:

```bash
npm install angular2-schema-form --save
npm install ngx-schema-form --save
```

You just have to check that all the peer-dependencies of this module are satisfied in your package.json.
Expand Down Expand Up @@ -68,13 +70,13 @@ export class AppComponent {
}
```

Create a module which import the AppComponent and configure Angular2 schema form.
Create a module which import the AppComponent and configure Ngx schema form.
```js
//app.module.ts

import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { SchemaFormModule, WidgetRegistry, DefaultWidgetRegistry } from "angular2-schema-form";
import { SchemaFormModule, WidgetRegistry, DefaultWidgetRegistry } from "ngx-schema-form";
import { AppComponent } from "./app.component";

@NgModule({
Expand Down Expand Up @@ -340,7 +342,7 @@ provide the properties `button` and `formProperty` by it self.

```js
import {Component} from "@angular/core";
import {ButtonWidget} from 'angular2-schema-form/dist/defaultwidgets'
import {ButtonWidget} from 'ngx-schema-form/dist/defaultwidgets'

@Component({
selector: 'sf-button-widget',
Expand Down Expand Up @@ -616,7 +618,7 @@ export class MyComponent {
```

## Creating a custom widget
Angular2 schema form allows you to create your own widget.
Ngx schema form allows you to create your own widget.

Note: Currently this feature is not completely defined and the API might change.

Expand Down
162 changes: 162 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ngx-schema-form": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ngx-schema-form",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ngx-schema-form:build"
},
"configurations": {
"production": {
"browserTarget": "ngx-schema-form:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ngx-schema-form:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"ngx-schema-form-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "ngx-schema-form:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"schema-form": {
"root": "projects/schema-form",
"sourceRoot": "projects/schema-form/src",
"projectType": "library",
"prefix": "sf",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/schema-form/tsconfig.lib.json",
"project": "projects/schema-form/ng-package.json"
},
"configurations": {
"production": {
"project": "projects/schema-form/ng-package.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/schema-form/src/test.ts",
"tsConfig": "projects/schema-form/tsconfig.spec.json",
"karmaConfig": "projects/schema-form/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/schema-form/tsconfig.lib.json",
"projects/schema-form/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "ngx-schema-form"
}
10 changes: 4 additions & 6 deletions tests/protractor.conf.js → e2e/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
Expand All @@ -19,12 +19,10 @@ exports.config = {
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
};
14 changes: 14 additions & 0 deletions e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { AppPage } from './app.po';

describe('workspace-project App', () => {
let page: AppPage;

beforeEach(() => {
page = new AppPage();
});

it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to app!');
});
});
4 changes: 2 additions & 2 deletions tests/e2e/app.po.ts → e2e/src/app.po.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { browser, element, by } from 'protractor';
import { browser, by, element } from 'protractor';

export class TestsPage {
export class AppPage {
navigateTo() {
return browser.get('/');
}
Expand Down
13 changes: 13 additions & 0 deletions e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
Loading

0 comments on commit 8076ea9

Please sign in to comment.