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

feat: replace library builder from ngm to ng-packagr #329

Merged
merged 4 commits into from
May 12, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 30 additions & 12 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,32 @@
"newProjectRoot": "projects",
"projects": {
"angular-froala-wysiwyg": {
"root": "demo",
"sourceRoot": "demo/src",
"root": "projects/library",
"projectType": "library",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/library/ng-package.json",
"tsConfig": "projects/library/tsconfig.json"
}
}
}
},
"angular-froala-wysiwyg-demo": {
"root": "projects/demo",
"sourceRoot": "projects/demo/src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "demo/dist",
"index": "demo/src/index.html",
"main": "demo/src/main.ts",
"tsConfig": "demo/src/tsconfig.json",
"outputPath": "dist-demo",
"index": "projects/demo/src/index.html",
"main": "projects/demo/src/main.ts",
"tsConfig": "projects/demo/tsconfig.json",
"assets": [
"demo/src/image.jpg"
"projects/demo/src/image.jpg"
],
"styles": [
"node_modules/froala-editor/css/froala_editor.pkgd.css"
Expand All @@ -25,10 +38,15 @@
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"optimization": false,
"outputHashing": "all",
"sourceMap": false,
"extractCss": false,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
Expand All @@ -40,14 +58,14 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular-froala-wysiwyg:build"
"browserTarget": "angular-froala-wysiwyg-demo:build"
},
"configurations": {}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-froala-wysiwyg:build"
"browserTarget": "angular-froala-wysiwyg-demo:build"
}
},
"lint": {
Expand All @@ -59,13 +77,13 @@
}
}
},
"angular-froala-wysiwyg-e2e": {
"angular-froala-wysiwyg-demo-e2e": {
"root": "demo/e2e",
"sourceRoot": "demo/e2e",
"projectType": "application"
}
},
"defaultProject": "angular-froala-wysiwyg",
"defaultProject": "angular-froala-wysiwyg-demo",
"schematics": {
"@schematics/angular:component": {
"prefix": "",
Expand Down
4 changes: 0 additions & 4 deletions demo/bs-config.json

This file was deleted.

20 changes: 0 additions & 20 deletions demo/src/app/app.module.ts

This file was deleted.

2 changes: 0 additions & 2 deletions demo/src/app/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions demo/src/main.ts

This file was deleted.

18 changes: 0 additions & 18 deletions demo/src/tsconfig.json

This file was deleted.

56 changes: 27 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
{
"name": "angular-froala-wysiwyg-base",
"version": "3.2.6-1",
"description": "Angular 4, 5, 6, 7, 8, 9 and 10 bindings for Froala WYSIWYG HTML rich text editor",
"description": "Angular 4, 5, 6, 7, 8, 9, 10, 11 and 12 bindings for Froala WYSIWYG HTML rich text editor",
"main": "bundles/angular-froala-wysiwyg.umd.js",
"typings": "index.d.ts",
"module": "index.js",
"scripts": {
"lite-server": "lite-server -c demo/bs-config.json",
"demo.serve": "npm run -s build link demo.build lite-server",
"demo.build": "ng build --aot=false",
"build": "ngm build --prod src --clean",
"link": "ngm link -p src --here",
"build.watch": "ngm build -p src --watch --skip-bundles",
"start": "ng serve --aot=false --host 0.0.0.0"
"demo.serve": "ng serve angular-froala-wysiwyg-demo",
"demo.build": "ng build angular-froala-wysiwyg-demo",
"build": "ng build angular-froala-wysiwyg",
"start": "npm run demo.serve"
},
"repository": {
"type": "git",
"url": "https://github.com/froala/angular-froala-wysiwyg.git"
},
"keywords": [
"angular2",
"angular4",
"angular5",
"angular6",
"angular7",
"angular8",
"angular9",
"angular10",
"ng2",
"angular11",
"angular12",
"ng4",
"ng5",
"ng6",
"ng7",
"ng8",
"ng9",
"ng10",
"ng11",
"ng12",
"froala",
"html",
"text",
Expand All @@ -53,33 +52,32 @@
"dependencies": {
"font-awesome": "^4.7.0",
"froala-editor": "^3.2.6-1",
"tslib": "^1.9.0"
"tslib": "^2.0.0"
},
"peerDependencies": {},
"devDependencies": {
"lite-server": "^2.5.4",
"@angular-devkit/build-angular": "^0.1000.7",
"@angular/cli": "^10.0.7",
"@angular/common": "^10.0.11",
"@angular/compiler": "^10.0.11",
"@angular/compiler-cli": "^10.0.11",
"@angular/core": "^10.0.11",
"@angular/forms": "^10.0.11",
"@angular/language-service": "^10.0.11",
"@angular/platform-browser": "^10.0.11",
"@angular/platform-browser-dynamic": "^10.0.11",
"@angular/router": "^10.0.11",
"@angular-devkit/build-angular": "^0.1102.12",
"@angular/cli": "^11.2.12",
"@angular/common": "^11.2.13",
"@angular/compiler": "^11.2.13",
"@angular/compiler-cli": "^11.2.13",
"@angular/core": "^11.2.13",
"@angular/forms": "^11.2.13",
"@angular/language-service": "^11.2.13",
"@angular/platform-browser": "^11.2.13",
"@angular/platform-browser-dynamic": "^11.2.13",
"@angular/router": "^11.2.13",
"core-js": "^2.6.11",
"@types/marked": "0.0.28",
"@types/node": "7.0.0",
"@types/tapable": "^1.0.4",
"@types/webpack": "^4.39.5",
"classlist-polyfill": "1.0.3",
"ngm-cli": "^1.0.4",
"rxjs": "^6.3.3",
"rxjs-compat": "^6.3.2",
"classlist.js": "^1.1.20150312",
"ng-packagr": "^11.2.4",
"rxjs": "^6.5.3",
"ts-helpers": "^1.1.1",
"typescript": "^3.9.7",
"zone.js": "~0.10.2"
"typescript": "4.0.5",
"zone.js": "~0.10.3",
"tsickle": "^0.39.1"
}
}
19 changes: 19 additions & 0 deletions projects/demo/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'froala-editor/js/plugins.pkgd.min.js';

import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { AppComponent } from './app/app.component';
import { BrowserModule } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { FroalaComponent } from "./app/froala.component";
import { FroalaEditorModule } from 'angular-fraola-wysiwyg';
import { FroalaViewModule } from 'angular-fraola-wysiwyg';
import { NgModule } from '@angular/core';

@NgModule({
declarations: [AppComponent, FroalaComponent],
imports: [BrowserModule, CommonModule, FormsModule, ReactiveFormsModule, FroalaEditorModule, FroalaViewModule],
bootstrap: [AppComponent]
})
export class AppModule {
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import FroalaEditor from 'froala-editor';
<form [formGroup]="form" (ngSubmit)="onSubmit()">
<div *ngIf="formModel.invalid"> Name is too short. </div>
<h3>Textarea with formControlName and froalaModel</h3>
<textarea id="sample9-1" [froalaEditor] formControlName="formModel" [(froalaModel)]="form.formModel"></textarea>
<textarea id="sample9-1" [froalaEditor] formControlName="formModel" [(froalaModel)]="formControls.formModel"></textarea>
<h4>Rendered Content:</h4>
<div [froalaView]="form.value.formModel"></div>
<h3>Textarea only with formControlName</h3>
Expand Down Expand Up @@ -174,17 +174,20 @@ export class AppComponent implements OnInit {
};

// Sample 8 model
public initializeLink = function(linkInitControls) {
linkInitControls;
initializeLink(linkInitControls) {
this.linkInitControls = linkInitControls;
};
}

public linkModel: Object = {
href: 'https://www.froala.com/wysiwyg-editor'
};

// Sample 9
form = new FormGroup({
formControls = {
formModel: new FormControl('Hello World', Validators.minLength(2)),
});
};
form = new FormGroup(this.formControls);
get formModel(): any { return this.form.get('formModel'); }
onSubmit(): void {
console.log(this.form.value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, Output, forwardRef } from '@angular/core';
import { Component, forwardRef } from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from "@angular/forms";

@Component({
Expand Down
File renamed without changes
4 changes: 2 additions & 2 deletions demo/src/index.html → projects/demo/src/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Angular2 Froala WYSIWYG</title>
<title>Angular Froala WYSIWYG</title>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Angular2 Froala WYSIWYG">
<meta name="description" content="Angular Froala WYSIWYG">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
Expand Down
5 changes: 5 additions & 0 deletions projects/demo/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import './polyfills';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule);
4 changes: 2 additions & 2 deletions demo/src/polyfills.ts → projects/demo/src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// This file includes polyfills needed by Angular 2 and is loaded before
// the app. You can add your own extra polyfills to this file.
import 'ts-helpers';
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
Expand All @@ -17,4 +16,5 @@ import 'core-js/es6/set';
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'classlist-polyfill';

import 'classlist.js';
File renamed without changes.
32 changes: 32 additions & 0 deletions projects/demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noEmitHelpers" :true,
"lib": ["es6", "dom"],
"types": [
"webpack"
],
"module": "esnext",
"moduleResolution": "node",
"target": "es2015",
"baseUrl": ".",
"sourceMap": true,
"typeRoots": [
"../../node_modules/@types"
],
"paths": {
"angular-fraola-wysiwyg": [
"../library/src/index.ts"
]
}
},
"files": [
"src/main.ts"
],
"include": [
"**/*.d.ts"
]
}
11 changes: 11 additions & 0 deletions projects/library/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",
"dest": "../../dist",
"deleteDestPath": true,
"whitelistedNonPeerDependencies": [
"froala-editor"
],
"lib": {
"entryFile": "src/index.ts"
}
}
2 changes: 1 addition & 1 deletion src/package.json → projects/library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"dependencies": {
"froala-editor": "3.2.6-1"
}
}
}