Skip to content

Commit 857742e

Browse files
authored
Merge pull request #20 from Axceta/editor-to-library
Upgrade to latest version of Angular and transform into a library
2 parents 38eb787 + 9097e48 commit 857742e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+22476
-11341
lines changed

.angular-cli.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"testTsconfig": "tsconfig.spec.json",
2020
"prefix": "app",
2121
"styles": [
22-
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
23-
"../node_modules/font-awesome/css/font-awesome.css",
22+
"node_modules/bootstrap/dist/css/bootstrap.min.css",
23+
"node_modules/font-awesome/css/font-awesome.css",
2424
"styles.css"
2525
],
2626
"scripts": [],

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
> Drag-and-drop editor based on Fabricjs for Angular v5 with multiple options
44
5-
### Preview
6-
![](https://s1.gifgif.io/0qQV2a.gif)
75
### Example
86
![Imgur](https://i.imgur.com/sQsL8G4.png)
97
### Output
@@ -36,9 +34,15 @@
3634
* Line Height To Object
3735
* Char Spacing to Object
3836

39-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.5.
37+
## Installing the library in your project
4038

41-
## Installation
39+
```bash
40+
npm i angular-editor-fabric-js
41+
```
42+
43+
# Development
44+
45+
## Installing the project
4246

4347
```bash
4448
git clone https://github.com/kevoj/angular-editor-fabric-js.git
@@ -63,4 +67,4 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac
6367
Before running the tests make sure you are serving the app via `ng serve`.
6468

6569
## License
66-
MIT © [Leonardo Rico](https://github.com/kevoj/angular-editor-fabric-js/blob/master/LICENSE)
70+
MIT © [Leonardo Rico](https://github.com/kevoj/angular-editor-fabric-js/blob/master/LICENSE)

angular.json

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

browserslist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# You can see what browsers were selected by your queries by running:
6+
# npx browserslist
7+
8+
> 0.5%
9+
last 2 versions
10+
Firefox ESR
11+
not dead
12+
not IE 9-11 # For IE 9-11 support, remove 'not'.

e2e/src/app.e2e-spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { AppPage } from './app.po';
2+
import { browser, logging } from 'protractor';
3+
4+
describe('workspace-project App', () => {
5+
let page: AppPage;
6+
7+
beforeEach(() => {
8+
page = new AppPage();
9+
});
10+
11+
it('should display welcome message', () => {
12+
page.navigateTo();
13+
expect(page.getTitleText()).toEqual('angular-editor-fabric-js app is running!');
14+
});
15+
16+
afterEach(async () => {
17+
// Assert that there are no errors emitted from the browser
18+
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19+
expect(logs).not.toContain(jasmine.objectContaining({
20+
level: logging.Level.SEVERE,
21+
} as logging.Entry));
22+
});
23+
});

e2e/src/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, by, element } from 'protractor';
2+
3+
export class AppPage {
4+
navigateTo(): Promise<unknown> {
5+
return browser.get(browser.baseUrl) as Promise<unknown>;
6+
}
7+
8+
getTitleText(): Promise<string> {
9+
return element(by.css('app-root .content span')).getText() as Promise<string>;
10+
}
11+
}

e2e/tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../out-tsc/e2e",
5+
"module": "commonjs",
6+
"target": "es5",
7+
"types": [
8+
"jasmine",
9+
"jasminewd2",
10+
"node"
11+
]
12+
}
13+
}

favicon.ico

948 Bytes
Binary file not shown.

karma.conf.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,29 @@
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('./projects/angular-editor-fabric-js/node_modules/@angular-devkit/build-angular/plugins/karma')
1414
],
15-
client:{
15+
client: {
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
1818
coverageIstanbulReporter: {
19-
reports: [ 'html', 'lcovonly' ],
19+
dir: require('path').join(__dirname, './coverage/angular-editor-fabric-js'),
20+
reports: ['html', 'lcovonly', 'text-summary'],
2021
fixWebpackSourcePaths: true
2122
},
22-
angularCli: {
23-
environment: 'dev'
24-
},
2523
reporters: ['progress', 'kjhtml'],
2624
port: 9876,
2725
colors: true,
2826
logLevel: config.LOG_INFO,
2927
autoWatch: true,
3028
browsers: ['Chrome'],
31-
singleRun: false
29+
singleRun: false,
30+
restartOnFileChange: true
3231
});
3332
};

0 commit comments

Comments
 (0)