Skip to content

Commit

Permalink
Make library AOT ready and remove conflicting reflect-metadata import.
Browse files Browse the repository at this point in the history
…Fix #13 and #35
  • Loading branch information
ghidoz committed Dec 17, 2016
1 parent 115d0c1 commit 8186f8b
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ npm-debug.log
*.js
*.map
*.d.ts
*.metadata.json
src/compiled

# JetBrains
.idea
Expand Down
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ It's also possible to handle errors for all requests by overriding `handleError(
To generate all `*.js`, `*.js.map` and `*.d.ts` files:

```bash
$ npm run tsc
$ npm run ngc
```

To lint all `*.ts` files:
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"version": "3.3.0",
"description": "A lightweight Angular 2 adapter for JSON API",
"scripts": {
"build": "rimraf dist && tsc",
"build": "rimraf dist src/compiled && ngc",
"lint": "tslint src/**/*.ts",
"pretest": "npm run build",
"test": "karma start",
"prepublish": "tsc",
"tsc": "tsc"
"prepublish": "ngc",
"ngc": "ngc"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -43,10 +43,12 @@
"devDependencies": {
"@angular/common": "2.2.3",
"@angular/compiler": "2.2.3",
"@angular/compiler-cli": "2.2.3",
"@angular/core": "2.2.3",
"@angular/http": "2.2.3",
"@angular/platform-browser": "2.2.3",
"@angular/platform-browser-dynamic": "2.2.3",
"@angular/platform-server": "2.2.3",
"@types/jasmine": "^2.2.34",
"@types/lodash": "^4.14.37",
"@types/reflect-metadata": "0.0.4",
Expand Down
2 changes: 0 additions & 2 deletions src/decorators/attribute.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'reflect-metadata';

export function Attribute(config: any = {}) {
return function (target: any, propertyName: string) {

Expand Down
2 changes: 0 additions & 2 deletions src/decorators/belongs-to.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'reflect-metadata';

export function BelongsTo(config: any = {}) {
return function (target: any, propertyName: string | symbol) {
let annotations = Reflect.getMetadata('BelongsTo', target) || [];
Expand Down
2 changes: 0 additions & 2 deletions src/decorators/has-many.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'reflect-metadata';

export function HasMany(config: any = {}) {
return function (target: any, propertyName: string | symbol) {
let annotations = Reflect.getMetadata('HasMany', target) || [];
Expand Down
2 changes: 0 additions & 2 deletions src/decorators/json-api-datastore-config.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'reflect-metadata';

export function JsonApiDatastoreConfig(config: any = {}) {
return function (target: any) {
Reflect.defineMetadata('JsonApiDatastoreConfig', config, target);
Expand Down
2 changes: 0 additions & 2 deletions src/decorators/json-api-model-config.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'reflect-metadata';

export function JsonApiModelConfig(config: any = {}) {
return function (target: any) {
Reflect.defineMetadata('JsonApiModelConfig', config, target);
Expand Down
1 change: 0 additions & 1 deletion src/models/json-api.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as _ from 'lodash';
import 'reflect-metadata';
import { Headers } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { JsonApiDatastore, ModelType } from '../services/json-api-datastore.service';
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@
"awesomeTypescriptLoaderOptions": {
"sourceMap": false,
"inlineSourceMap": true
},
"angularCompilerOptions": {
"genDir": "src/compiled"
}
}

0 comments on commit 8186f8b

Please sign in to comment.