Skip to content

Commit

Permalink
feat(core): rename package to @ngx-formly + follow Angular Package …
Browse files Browse the repository at this point in the history
…Format. (#497)
  • Loading branch information
aitboudad authored Aug 25, 2017
1 parent c7d5384 commit 2197a51
Show file tree
Hide file tree
Showing 39 changed files with 1,076 additions and 181 deletions.
13 changes: 13 additions & 0 deletions .config/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const fs = require("fs");
const packages = [
'boostrap',
'core',
];

// update `FORMLY-VERSION` in package.json for all sub-packages
const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version;
packages.map(package => {
const packagePath = `dist/${package}/package.json`;
package = fs.readFileSync(packagePath, 'utf8');
fs.writeFileSync(packagePath, package.replace(/FORMLY-VERSION/, version));
});
18 changes: 18 additions & 0 deletions .config/ng-packagr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
commit b8996dd950f9177a8c50cbf5120ba972944ef1af
Author: Abdellatif Ait boudad <a.aitboudad@gmail.com>
Date: Mon Aug 7 16:12:26 2017 +0100

www

diff --git a/ngc.js b/ngc.js
index fac23e1..14e373e 100644
--- a/ngc.js
+++ b/ngc.js
@@ -7,6 +7,7 @@ var path = require('path');
exports.prepareTsConfig = function (ngPkg, outFile) {
return json_1.readJson(path.resolve(__dirname, '..', 'conf', 'tsconfig.ngc.json'))
.then(function (tsConfig) {
+ tsConfig['compilerOptions']['paths'] = { "@ngx-formly/core": ["../../dist/core"] };
tsConfig['angularCompilerOptions']['flatModuleId'] = ngPkg.packageJson.name;
tsConfig['angularCompilerOptions']['flatModuleOutFile'] = ngPkg.flatModuleFileName + ".js";
tsConfig['files'] = [ngPkg.ngPackageJson.lib.entryFile];
30 changes: 0 additions & 30 deletions .config/webpack.build.js

This file was deleted.

3 changes: 2 additions & 1 deletion .config/webpack.demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ module.exports = {
resolve: {
extensions: ['.ts', '.webpack.js', '.web.js', '.js'],
alias: {
'ng-formly': path.join(__dirname, '..', 'src'),
'@ngx-formly/core': path.join(__dirname, '..', 'src/core'),
'@ngx-formly/bootstrap': path.join(__dirname, '..', 'src/ui-bootstrap'),
},
},
module: {
Expand Down
4 changes: 4 additions & 0 deletions .config/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ module.exports = {
output: {},
resolve: {
extensions: ['.ts', '.webpack.js', '.web.js', '.js'],
alias: {
'@ngx-formly/core': path.join(__dirname, '..', 'src/core'),
'@ngx-formly/bootstrap': path.join(__dirname, '..', 'src/ui-bootstrap'),
},
},
devtool: 'inline-source-map',
module: {
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.idea
.vscode
bundles
lib
.ng_build
dist
node_modules
npm-debug.log
yarn-error.log
Expand Down
2 changes: 1 addition & 1 deletion demo/src/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
import { FormlyFieldConfig } from 'ng-formly';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { ValidationService, SuperHerosService } from './services';

@Component({
Expand Down
3 changes: 2 additions & 1 deletion demo/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { FormlyModule, FormlyBootstrapModule } from 'ng-formly';
import { FormlyModule } from '@ngx-formly/core';
import { FormlyBootstrapModule } from '@ngx-formly/bootstrap';

import { NgFormlyConfig, FORMLY_COMPONENTS } from './formly';
import { SuperHerosService } from './services';
Expand Down
2 changes: 1 addition & 1 deletion demo/src/formly/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Validators } from '@angular/forms';
import { ConfigOption, Field } from 'ng-formly';
import { ConfigOption, Field } from '@ngx-formly/core';
import { RepeatComponent } from './types/repeatedSection';
import { FormlyFieldToggle } from './types/toggle';
import { FormlyWrapperHorizontalLabel } from './wrappers/horizontal.wrapper';
Expand Down
2 changes: 1 addition & 1 deletion demo/src/formly/types/repeatedSection.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { FormArray, FormGroup } from '@angular/forms';
import { FieldType, FormlyFormBuilder } from 'ng-formly';
import { FieldType, FormlyFormBuilder } from '@ngx-formly/core';
import * as clonedeep from 'lodash.clonedeep';

@Component({
Expand Down
2 changes: 1 addition & 1 deletion demo/src/formly/types/toggle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { Field } from 'ng-formly';
import { Field } from '@ngx-formly/core';
@Component({
selector: 'formly-field-toggle',
template: `
Expand Down
2 changes: 1 addition & 1 deletion demo/src/formly/wrappers/horizontal.wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ViewContainerRef, ViewChild } from '@angular/core';
import { FieldWrapper } from 'ng-formly';
import { FieldWrapper } from '@ngx-formly/core';
@Component({
selector: 'formly-wrapper-horizontal',
template: `
Expand Down
2 changes: 1 addition & 1 deletion demo/src/formly/wrappers/panel.wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ViewContainerRef, ViewChild } from '@angular/core';
import { FieldWrapper } from 'ng-formly';
import { FieldWrapper } from '@ngx-formly/core';
@Component({
selector: 'formly-wrapper-panel',
template: `
Expand Down
44 changes: 20 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-formly",
"version": "1.0.0-rc.10",
"name": "@ngx-formly/platform",
"version": "2.0.0-alpha.1",
"author": "Zama Khan Mohammed <mohammedzamakhan@gmail.com>",
"contributors": [
"Zama Khan Mohammed <mohammedzamakhan@gmail.com>",
Expand All @@ -12,20 +12,16 @@
"scripts": {
"contrib:add": "all-contributors add",
"contrib:generate": "all-contributors generate",
"ngc": "./node_modules/.bin/ngc",
"lint": "./node_modules/.bin/tslint 'src/**/*.ts' 'demo/**/*.ts'",
"lint": "tslint 'src/**/*.ts' 'demo/**/*.ts'",
"postinstall": "patch --forward node_modules/ng-packagr/lib/steps/ngc.js .config/ng-packagr.patch || true",
"commit": "npm run build && git-cz",
"prepublish": "npm run build",
"build": "npm run build:lib && npm run build:bundles",
"prebuild:lib": "shx rm -rf ./lib",
"build:lib": "npm run ngc -- --project tsconfig.build.json",
"prebuild:bundles": "shx rm -rf ./bundles",
"build:bundles": "npm run build:bundles:compile && npm run build:bundles:minify",
"build:bundles:compile": "./node_modules/.bin/webpack --config .config/webpack.build.js",
"build:bundles:minify": "uglifyjs bundles/ng-formly.umd.js --output bundles/ng-formly.umd.min.js --in-source-map bundles/ng-formly.umd.js.map --source-map bundles/ng-formly.umd.min.js.map",
"build": "npm run build-core && npm run build-bootstrap && node .config/build.js",
"build-core": "ng-packagr -p src/core/ng-package.json",
"build-bootstrap": "ng-packagr -p src/ui-bootstrap/ng-package.json",
"demo": "node_modules/.bin/webpack-dashboard --title ng-formly-demo -- node_modules/.bin/webpack-dev-server --quiet --port 9000 --content-base demo --config .config/webpack.demo.js --open",
"test": "./node_modules/.bin/karma start",
"test-watch": "./node_modules/.bin/karma start --no-single-run --auto-watch"
"test": "karma start",
"test-watch": "karma start --no-single-run --auto-watch"
},
"keywords": [
"angular",
Expand Down Expand Up @@ -54,13 +50,13 @@
"tslib": "^1.7.1"
},
"devDependencies": {
"@angular/common": "^2.4.10",
"@angular/compiler": "^2.4.10",
"@angular/compiler-cli": "^2.4.10",
"@angular/core": "^2.4.10",
"@angular/forms": "^2.4.10",
"@angular/platform-browser": "^2.4.10",
"@angular/platform-browser-dynamic": "^2.4.10",
"@angular/common": "^4.3.6",
"@angular/compiler": "^4.3.6",
"@angular/compiler-cli": "^4.3.6",
"@angular/core": "^4.3.6",
"@angular/forms": "^4.3.6",
"@angular/platform-browser": "^4.3.6",
"@angular/platform-browser-dynamic": "^4.3.6",
"@types/jasmine": "2.5.40",
"@types/node": "^7.0.22",
"angular2-template-loader": "^0.6.2",
Expand All @@ -82,18 +78,18 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3",
"lodash.clonedeep": "^4.5.0",
"ng-packagr": "^1.0.0-pre.16",
"phantomjs-prebuilt": "^2.1.14",
"raw-loader": "^0.5.1",
"remap-istanbul": "^0.9.5",
"rxjs": "^5.4.1",
"rxjs": "^5.4.3",
"shx": "^0.2.2",
"tslint": "^5.4.3",
"typescript": "^2.3.3",
"uglify-js": "^2.8.22",
"typescript": "^2.4.2",
"webpack": "^3.0.0",
"webpack-dashboard": "^0.4.0",
"webpack-dev-server": "^2.5.0",
"zone.js": "^0.8.12"
"zone.js": "^0.8.17"
},
"config": {
"commitizen": {
Expand Down
8 changes: 8 additions & 0 deletions src/core/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "index.ts"
},
"dest": "../../dist/core",
"workingDirectory": "../../.ng_build"
}
12 changes: 12 additions & 0 deletions src/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@ngx-formly/core",
"version": "FORMLY-VERSION",
"description": "",
"license": "MIT",
"dependencies": {
"tslib": "^1.7.1"
},
"peerDependencies": {
"@angular/forms": "^4.0"
}
}
11 changes: 11 additions & 0 deletions src/ui-bootstrap/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "index.ts",
"externals": {
"@ngx-formly/core": "@ngx-formly/core"
}
},
"dest": "../../dist/boostrap",
"workingDirectory": "../../.ng_build"
}
10 changes: 10 additions & 0 deletions src/ui-bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@ngx-formly/bootstrap",
"version": "FORMLY-VERSION",
"description": "",
"license": "MIT",
"dependencies": {
"tslib": "^1.7.1",
"@ngx-formly/core": "FORMLY-VERSION"
}
}
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/formly.validation-message.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createGenericTestComponent } from '../../core/src/test-utils';

import { Component } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { FormlyModule, FormlyFieldConfig } from '../../core';
import { FormlyModule, FormlyFieldConfig } from '@ngx-formly/core';
import { FormlyValidationMessage } from './formly.validation-message';

const createTestComponent = (html: string) =>
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/formly.validation-message.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Input } from '@angular/core';
import { FormControl } from '@angular/forms';
import { FormlyFieldConfig, FormlyValidationMessages } from '../../core';
import { FormlyFieldConfig, FormlyValidationMessages } from '@ngx-formly/core';

@Component({
selector: 'formly-validation-message',
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/run/addon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FormlyConfig } from '../../../core';
import { FormlyConfig } from '@ngx-formly/core';

export class TemplateAddons {
run(fc: FormlyConfig) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/run/description.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FormlyFieldConfig, FormlyConfig } from '../../../core';
import { FormlyFieldConfig, FormlyConfig } from '@ngx-formly/core';

export class TemplateDescription {
run(fc: FormlyConfig) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/run/validation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FormlyFieldConfig, FormlyConfig } from '../../../core';
import { FormlyFieldConfig, FormlyConfig } from '@ngx-formly/core';

export class TemplateValidation {
run(fc: FormlyConfig) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/types/checkbox.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { FormControl, AbstractControl } from '@angular/forms';
import { FieldType, FormlyFieldConfig } from '../../../core';
import { FieldType, FormlyFieldConfig } from '@ngx-formly/core';

@Component({
selector: 'formly-field-checkbox',
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/types/input.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { FieldType } from '../../../core';
import { FieldType } from '@ngx-formly/core';

@Component({
selector: 'formly-field-input',
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/types/multicheckbox.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { FormGroup, FormControl, AbstractControl } from '@angular/forms';
import { FieldType, FormlyFieldConfig } from '../../../core';
import { FieldType, FormlyFieldConfig } from '@ngx-formly/core';

@Component({
selector: 'formly-field-multicheckbox',
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/types/radio.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { FieldType } from '../../../core';
import { FieldType } from '@ngx-formly/core';

@Component({
selector: 'formly-field-radio',
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/types/select.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { FieldType } from '../../../core';
import { FieldType } from '@ngx-formly/core';

export class SelectOption {
label: string;
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/types/textarea.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { FieldType } from '../../../core';
import { FieldType } from '@ngx-formly/core';

@Component({
selector: 'formly-field-textarea',
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/ui-bootstrap.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConfigOption } from '../../core/src/services/formly.config';
import { ConfigOption } from '@ngx-formly/core';
import { FormlyWrapperAddons } from './wrappers/addons';
import { TemplateDescription } from './run/description';
import { TemplateValidation } from './run/validation';
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/ui-bootstrap.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';
import { FormlyModule } from '../../core';
import { FormlyModule } from '@ngx-formly/core';
import { BOOTSTRAP_FORMLY_CONFIG, FIELD_TYPE_COMPONENTS } from './ui-bootstrap.config';
import { FormlyValidationMessage } from './formly.validation-message';

Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/wrappers/addons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
import { FieldWrapper } from '../../../core';
import { FieldWrapper } from '@ngx-formly/core';

@Component({
selector: 'formly-wrapper-addons',
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/wrappers/description.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
import { FieldWrapper } from '../../../core';
import { FieldWrapper } from '@ngx-formly/core';

@Component({
selector: 'formly-wrapper-description',
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/wrappers/fieldset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
import { FieldWrapper } from '../../../core';
import { FieldWrapper } from '@ngx-formly/core';

@Component({
selector: 'formly-wrapper-fieldset',
Expand Down
2 changes: 1 addition & 1 deletion src/ui-bootstrap/src/wrappers/label.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
import { FieldWrapper } from '../../../core';
import { FieldWrapper } from '@ngx-formly/core';

@Component({
selector: 'formly-wrapper-label',
Expand Down
Loading

0 comments on commit 2197a51

Please sign in to comment.