Skip to content

Commit 7a34226

Browse files
committed
Use Angular CLI instead of ngm for building
Some commands: npm run build - to build the library. Output is in dist/ng2-file-upload/. npm run test - to run tests. Coverage report is in coverage/ as before. npm run demo.serve - to build demo application and serve it through browsersync npm run start - to run demo application using `ng serve`. Requires the library to be built and linked first.
1 parent 6cb3f87 commit 7a34226

18 files changed

Lines changed: 1632 additions & 1658 deletions

angular.json

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44
"newProjectRoot": "projects",
55
"projects": {
66
"ng2-file-upload": {
7+
"root": ".",
8+
"sourceRoot": "src",
9+
"projectType": "library",
10+
"architect": {
11+
"build": {
12+
"builder": "@angular-devkit/build-ng-packagr:build",
13+
"options": {
14+
"tsConfig": "src/tsconfig.json",
15+
"project": "src/ng-package.json"
16+
}
17+
}
18+
}
19+
},
20+
"ng2-file-upload-demo": {
721
"root": "demo",
822
"sourceRoot": "demo/src",
923
"projectType": "application",
@@ -44,38 +58,48 @@
4458
"serve": {
4559
"builder": "@angular-devkit/build-angular:dev-server",
4660
"options": {
47-
"browserTarget": "ng2-file-upload:build"
61+
"browserTarget": "ng2-file-upload-demo:build"
4862
},
4963
"configurations": {
5064
"production": {
51-
"browserTarget": "ng2-file-upload:build:production"
65+
"browserTarget": "ng2-file-upload-demo:build:production"
5266
}
5367
}
54-
},
68+
}
69+
}
70+
},
71+
"ng2-file-upload-test": {
72+
"root": ".",
73+
"sourceRoot": "test",
74+
"projectType": "library",
75+
"architect": {
5576
"test": {
5677
"builder": "@angular-devkit/build-angular:karma",
5778
"options": {
58-
"main": "demo/src/../../scripts/test.ts",
59-
"karmaConfig": "karma.conf.js",
79+
"main": "test/test.ts",
80+
"karmaConfig": "test/karma.conf.js",
6081
"scripts": [],
6182
"styles": [],
62-
"tsConfig": "demo/src/tsconfig.json",
63-
"assets": [
64-
"demo/src/assets"
65-
]
83+
"tsConfig": "test/tsconfig.json"
6684
}
6785
},
6886
"lint": {
6987
"builder": "@angular-devkit/build-angular:tslint",
7088
"options": {
71-
"tsConfig": [],
72-
"exclude": []
89+
"tsConfig": [
90+
"src/tsconfig.json",
91+
"demo/src/tsconfig.json",
92+
"test/tsconfig.json"
93+
],
94+
"exclude": [
95+
"**/node_modules/**"
96+
]
7397
}
7498
}
7599
}
76100
}
77101
},
78-
"defaultProject": "ng2-file-upload",
102+
"defaultProject": "ng2-file-upload-demo",
79103
"schematics": {
80104
"@schematics/angular:component": {
81105
"prefix": "",

demo/src/app/components/file-upload-section.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ let doc = require('html-loader!markdown-loader!../../doc.md');
55
let tabDesc:Array<any> = [
66
{
77
heading: 'Simple',
8-
ts: require('!!raw-loader?lang=typescript!./file-upload/simple-demo.ts'),
9-
html: require('!!raw-loader?lang=markup!./file-upload/simple-demo.html'),
10-
js: require('!!raw-loader?lang=javascript!./file-upload/file-catcher.js')
8+
ts: require('!!raw-loader!./file-upload/simple-demo.ts').default,
9+
html: require('!!raw-loader!./file-upload/simple-demo.html').default,
10+
js: require('!!raw-loader!./file-upload/file-catcher.js').default
1111
}
1212
];
1313

demo/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import './polyfills.ts';
1+
import '../../scripts/polyfills.ts';
22

33
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
44
import { enableProdMode } from '@angular/core';

demo/src/tsconfig.json

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
{
22
"compilerOptions": {
3+
"baseUrl": ".",
34
"declaration": false,
45
"downlevelIteration": true,
56
"emitDecoratorMetadata": true,
67
"experimentalDecorators": true,
78
"noEmitHelpers": false,
89
"lib": ["es6", "dom"],
9-
"types": [
10-
"jasmine",
11-
"webpack"
12-
],
1310
"mapRoot": "./",
1411
"module": "esnext",
1512
"moduleResolution": "node",
1613
"outDir": "../temp/out-tsc",
1714
"sourceMap": true,
18-
"target": "es2015",
19-
"typeRoots": [
20-
"../node_modules/@types"
21-
]
15+
"target": "es2015"
2216
},
2317
"files": [
18+
"../../scripts/typings.d.ts",
2419
"main.ts",
25-
"polyfills.ts"
20+
"../../scripts/polyfills.ts"
2621
],
27-
"include": [
28-
"*.d.ts",
29-
"../../src/spec/*.spec.ts",
30-
"../../scripts/test.ts"
22+
"exclude": [
23+
"**/*.spec.ts"
3124
]
3225
}

demo/src/typings.d.ts

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

0 commit comments

Comments
 (0)