Skip to content

Commit 8186f8b

Browse files
committed
Make library AOT ready and remove conflicting reflect-metadata import. Fix #13 and #35
1 parent 115d0c1 commit 8186f8b

10 files changed

+11
-15
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ npm-debug.log
66
*.js
77
*.map
88
*.d.ts
9+
*.metadata.json
10+
src/compiled
911

1012
# JetBrains
1113
.idea

README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ It's also possible to handle errors for all requests by overriding `handleError(
441441
To generate all `*.js`, `*.js.map` and `*.d.ts` files:
442442

443443
```bash
444-
$ npm run tsc
444+
$ npm run ngc
445445
```
446446

447447
To lint all `*.ts` files:

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"version": "3.3.0",
44
"description": "A lightweight Angular 2 adapter for JSON API",
55
"scripts": {
6-
"build": "rimraf dist && tsc",
6+
"build": "rimraf dist src/compiled && ngc",
77
"lint": "tslint src/**/*.ts",
88
"pretest": "npm run build",
99
"test": "karma start",
10-
"prepublish": "tsc",
11-
"tsc": "tsc"
10+
"prepublish": "ngc",
11+
"ngc": "ngc"
1212
},
1313
"repository": {
1414
"type": "git",
@@ -43,10 +43,12 @@
4343
"devDependencies": {
4444
"@angular/common": "2.2.3",
4545
"@angular/compiler": "2.2.3",
46+
"@angular/compiler-cli": "2.2.3",
4647
"@angular/core": "2.2.3",
4748
"@angular/http": "2.2.3",
4849
"@angular/platform-browser": "2.2.3",
4950
"@angular/platform-browser-dynamic": "2.2.3",
51+
"@angular/platform-server": "2.2.3",
5052
"@types/jasmine": "^2.2.34",
5153
"@types/lodash": "^4.14.37",
5254
"@types/reflect-metadata": "0.0.4",

src/decorators/attribute.decorator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'reflect-metadata';
2-
31
export function Attribute(config: any = {}) {
42
return function (target: any, propertyName: string) {
53

src/decorators/belongs-to.decorator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'reflect-metadata';
2-
31
export function BelongsTo(config: any = {}) {
42
return function (target: any, propertyName: string | symbol) {
53
let annotations = Reflect.getMetadata('BelongsTo', target) || [];

src/decorators/has-many.decorator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'reflect-metadata';
2-
31
export function HasMany(config: any = {}) {
42
return function (target: any, propertyName: string | symbol) {
53
let annotations = Reflect.getMetadata('HasMany', target) || [];

src/decorators/json-api-datastore-config.decorator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'reflect-metadata';
2-
31
export function JsonApiDatastoreConfig(config: any = {}) {
42
return function (target: any) {
53
Reflect.defineMetadata('JsonApiDatastoreConfig', config, target);

src/decorators/json-api-model-config.decorator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'reflect-metadata';
2-
31
export function JsonApiModelConfig(config: any = {}) {
42
return function (target: any) {
53
Reflect.defineMetadata('JsonApiModelConfig', config, target);

src/models/json-api.model.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as _ from 'lodash';
2-
import 'reflect-metadata';
32
import { Headers } from '@angular/http';
43
import { Observable } from 'rxjs/Observable';
54
import { JsonApiDatastore, ModelType } from '../services/json-api-datastore.service';

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@
3838
"awesomeTypescriptLoaderOptions": {
3939
"sourceMap": false,
4040
"inlineSourceMap": true
41+
},
42+
"angularCompilerOptions": {
43+
"genDir": "src/compiled"
4144
}
4245
}

0 commit comments

Comments
 (0)