Skip to content

Commit 85bf6b6

Browse files
author
Davy Steegen
committed
- Updated structure according to angular-cli generates it.
- angular.json updated to have a build for the library and a build for serving the demo. - Added peerDependencies for the library
1 parent e9f1da8 commit 85bf6b6

25 files changed

+171
-80
lines changed

angular.json

Lines changed: 62 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,54 @@
33
"version": 1,
44
"newProjectRoot": "projects",
55
"projects": {
6-
"library": {
7-
"root": "",
6+
"ngx-bootstrap-multiselect": {
7+
"projectType": "library",
8+
"root": "projects/ngx-bootstrap-multiselect",
9+
"sourceRoot": "projects/ngx-bootstrap-multiselect/src",
10+
"prefix": "lib",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-angular:ng-packagr",
14+
"options": {
15+
"project": "projects/ngx-bootstrap-multiselect/ng-package.json"
16+
},
17+
"configurations": {
18+
"production": {
19+
"tsConfig": "projects/ngx-bootstrap-multiselect/tsconfig.lib.prod.json"
20+
},
21+
"development": {
22+
"tsConfig": "projects/ngx-bootstrap-multiselect/tsconfig.lib.json"
23+
}
24+
},
25+
"defaultConfiguration": "production"
26+
},
27+
"test": {
28+
"builder": "@angular-devkit/build-angular:karma",
29+
"options": {
30+
"main": "projects/ngx-bootstrap-multiselect/src/test.ts",
31+
"tsConfig": "projects/ngx-bootstrap-multiselect/tsconfig.spec.json",
32+
"karmaConfig": "projects/ngx-bootstrap-multiselect/karma.conf.js"
33+
}
34+
}
35+
}
36+
},
37+
"demo": {
38+
"root": "demo/",
839
"sourceRoot": "demo/src",
940
"projectType": "application",
10-
"prefix": "app",
11-
"schematics": {},
41+
"prefix": "demo",
42+
"schematics": {
43+
"@schematics/angular:component": {
44+
"inlineTemplate": true,
45+
"inlineStyle": true
46+
}
47+
},
1248
"architect": {
1349
"build": {
1450
"builder": "@angular-devkit/build-angular:browser",
1551
"options": {
16-
"outputPath": "dist/library",
52+
"aot": true,
53+
"outputPath": "dist/demo",
1754
"index": "demo/src/index.html",
1855
"main": "demo/src/main.ts",
1956
"polyfills": "demo/src/polyfills.ts",
@@ -25,18 +62,20 @@
2562
"styles": [
2663
"demo/src/styles.css"
2764
],
28-
"scripts": [],
29-
"vendorChunk": true,
30-
"extractLicenses": false,
31-
"sourceMap": true,
32-
"namedChunks": true
65+
"preserveSymlinks": true
3366
},
3467
"configurations": {
3568
"production": {
69+
"budgets": [
70+
{
71+
"type": "anyComponentStyle",
72+
"maximumWarning": "6kb"
73+
}
74+
],
3675
"fileReplacements": [
3776
{
38-
"replace": "src/environments/environment.ts",
39-
"with": "src/environments/environment.prod.ts"
77+
"replace": "demo/src/environments/environment.ts",
78+
"with": "demo/src/environments/environment.prod.ts"
4079
}
4180
],
4281
"optimization": true,
@@ -53,34 +92,29 @@
5392
"serve": {
5493
"builder": "@angular-devkit/build-angular:dev-server",
5594
"options": {
56-
"browserTarget": "library:build"
95+
"browserTarget": "demo:build",
96+
"port": 4200
5797
},
5898
"configurations": {
5999
"production": {
60-
"browserTarget": "library:build:production"
100+
"browserTarget": "demo:build:production"
61101
}
62102
}
63103
},
64104
"extract-i18n": {
65105
"builder": "@angular-devkit/build-angular:extract-i18n",
66106
"options": {
67-
"browserTarget": "library:build"
107+
"browserTarget": "demo:build"
68108
}
69109
},
70-
"test": {
71-
"builder": "@angular-devkit/build-angular:karma",
110+
"lint": {
111+
"builder": "@angular-devkit/build-angular:tslint",
72112
"options": {
73-
"main": "src/test.ts",
74-
"polyfills": "src/polyfills.ts",
75-
"tsConfig": "src/tsconfig.spec.json",
76-
"karmaConfig": "src/karma.conf.js",
77-
"styles": [
78-
"src/styles.css"
113+
"tsConfig": [
114+
"demo/src/tsconfig.app.json"
79115
],
80-
"scripts": [],
81-
"assets": [
82-
"src/favicon.ico",
83-
"src/assets"
116+
"exclude": [
117+
"**/node_modules/**"
84118
]
85119
}
86120
}
@@ -90,4 +124,4 @@
90124
"cli": {
91125
"analytics": false
92126
}
93-
}
127+
}

demo/src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
33
import { FormsModule } from '@angular/forms';
44

5-
import { NgxBootstrapMultiselectModule } from '../../../src';
5+
import { NgxBootstrapMultiselectModule } from '../../../projects/ngx-bootstrap-multiselect/src';
66
import { AppComponent } from './app.component';
77
import { DataService } from './data.service';
88
import { DummyComponent } from './dummy.component';

demo/src/app/data-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IMultiSelectOption } from '../../../src';
1+
import { IMultiSelectOption } from '../../../projects/ngx-bootstrap-multiselect/src';
22

33
export interface DataModel {
44
options: IMultiSelectOption[];

demo/src/app/dummy.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
22

3-
import { IMultiSelectSettings, IMultiSelectOption } from '../../../src';
3+
import { IMultiSelectSettings, IMultiSelectOption } from '../../../projects/ngx-bootstrap-multiselect/src';
44
import { DataModel } from './data-model';
55

66
@Component({

demo/src/app/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IMultiSelectOption } from '../../../src';
1+
import { IMultiSelectOption } from '../../../projects/ngx-bootstrap-multiselect/src';
22

33
export const generateItem = (id: number): IMultiSelectOption => {
44
return {id, name: `Item #${id}`};

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
"scripts": {
99
"ng": "ng",
1010
"start": "ng serve",
11-
"prebuild": "rimraf dist",
12-
"build": "ng-packagr -p src/ng-package.json",
13-
"postbuild": "copyfiles README.md LICENSE dist"
11+
"build": "ng build ngx-bootstrap-multiselect"
1412
},
1513
"repository": {
1614
"type": "git",
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
The MIT License (MIT)
2-
3-
Copyright (c) 2020
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
2+
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
33
"dest": "../../dist/ngx-bootstrap-multiselect",
44
"lib": {
55
"entryFile": "src/public-api.ts"
6-
}
7-
}
6+
},
7+
"assets": ["LICENCE"]
8+
}

src/package.json renamed to projects/ngx-bootstrap-multiselect/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@
1515
"bugs": {
1616
"url": "https://github.com/softsimon/ngx-bootstrap-multiselect.git"
1717
},
18-
"homepage": "https://github.com/softsimon/ngx-bootstrap-multiselect.git"
18+
"homepage": "https://github.com/softsimon/ngx-bootstrap-multiselect.git",
19+
"peerDependencies": {
20+
"@angular/common": ">=15.0.0",
21+
"@angular/core": ">=15.0.0"
22+
}
1923
}
File renamed without changes.
File renamed without changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "../../out-tsc/lib",
6+
"declaration": true,
7+
"declarationMap": true,
8+
"inlineSources": true,
9+
"types": []
10+
},
11+
"exclude": [
12+
"src/test.ts",
13+
"**/*.spec.ts",
14+
]
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"extends": "./tsconfig.lib.json",
4+
"compilerOptions": {
5+
"declarationMap": false
6+
},
7+
"angularCompilerOptions": {
8+
"compilationMode": "partial"
9+
}
10+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "../../out-tsc/spec",
6+
"allowJs": true,
7+
"types": [
8+
"jasmine"
9+
]
10+
},
11+
"files": [
12+
"src/test.ts"
13+
],
14+
"include": [
15+
"**/*.spec.ts",
16+
"**/*.d.ts",
17+
]
18+
}

src/ng-package.json

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

tsconfig.json

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
12
{
3+
"compileOnSave": false,
24
"compilerOptions": {
3-
"target": "ES2022",
4-
"lib": [
5-
"es6",
6-
"dom",
7-
"es7"
8-
],
9-
"module": "commonjs",
10-
"moduleResolution": "node",
5+
"paths": {
6+
"ngx-bootstrap-multiselect": [
7+
"dist/ngx-bootstrap-multiselect"
8+
]
9+
},
10+
"baseUrl": "./",
11+
"outDir": "./dist/ngx-bootstrap-multiselect",
12+
"forceConsistentCasingInFileNames": true,
13+
"strict": false,
14+
"noImplicitOverride": true,
15+
"noPropertyAccessFromIndexSignature": false,
16+
"noImplicitReturns": true,
17+
"noFallthroughCasesInSwitch": true,
18+
"strictPropertyInitialization": false,
1119
"sourceMap": true,
20+
"declaration": false,
21+
"downlevelIteration": true,
1222
"experimentalDecorators": true,
13-
"skipLibCheck": true,
14-
"skipDefaultLibCheck": true,
15-
"useDefineForClassFields": false
23+
"moduleResolution": "node",
24+
"importHelpers": true,
25+
"target": "es2020",
26+
"module": "es2020",
27+
"lib": [
28+
"es2020",
29+
"dom"
30+
]
1631
},
1732
"angularCompilerOptions": {
18-
"genDir": "compiled"
33+
"enableI18nLegacyMessageIdFormat": false,
34+
"strictInjectionParameters": true,
35+
"strictInputAccessModifiers": true,
36+
"strictTemplates": true
1937
}
20-
}
38+
}

0 commit comments

Comments
 (0)