forked from loafle/openapi-generator-original
Updated npm configuration to use new typescript2 typings system
This also removes the dependency to the typings project. Issue #4761
This commit is contained in:
parent
45519c521c
commit
f760d93cd7
@ -28,9 +28,37 @@ _unPublished (not recommended):_
|
|||||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||||
```
|
```
|
||||||
|
|
||||||
|
_using `npm link`:_
|
||||||
|
|
||||||
|
In PATH_TO_GENERATED_PACKAGE:
|
||||||
|
```
|
||||||
|
npm link
|
||||||
|
```
|
||||||
|
|
||||||
|
In your project:
|
||||||
|
```
|
||||||
|
npm link {{npmName}}@{{npmVersion}}
|
||||||
|
```
|
||||||
|
|
||||||
In your angular2 project:
|
In your angular2 project:
|
||||||
|
|
||||||
TODO: paste example.
|
```
|
||||||
|
import { DefaultApi } from '{{npmName}}/api/api';
|
||||||
|
@NgModule({
|
||||||
|
imports: [],
|
||||||
|
declarations: [],
|
||||||
|
exports: [],
|
||||||
|
providers: [AppModule]
|
||||||
|
})
|
||||||
|
export class CoreModule {}
|
||||||
|
```
|
||||||
|
```
|
||||||
|
import { DefaultApi } from '{{npmName}}/api/api';
|
||||||
|
|
||||||
|
export class AppComponent {
|
||||||
|
constructor(private apiGateway: DefaultApi) { }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Set service base path
|
### Set service base path
|
||||||
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
||||||
@ -42,3 +70,29 @@ bootstrap(AppComponent, [
|
|||||||
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
||||||
]);
|
]);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Using @angular/cli
|
||||||
|
First extend your `src/environments/*.ts` files by adding the corresponding base path:
|
||||||
|
|
||||||
|
```
|
||||||
|
export const environment = {
|
||||||
|
production: false,
|
||||||
|
API_BASE_PATH: 'http://127.0.0.1:8080'
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
In the src/app/app.module.ts:
|
||||||
|
```
|
||||||
|
import { BASE_PATH } from '{{npmName}}';
|
||||||
|
import { environment } from '../environments/environment';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
],
|
||||||
|
imports: [ ],
|
||||||
|
providers: [{ provide: BASE_PATH, useValue: useValue: environment.API_BASE_PATH }],
|
||||||
|
bootstrap: [AppComponent]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
||||||
|
```
|
@ -10,31 +10,29 @@
|
|||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "typings install && tsc --outDir dist/",
|
"build": "tsc",
|
||||||
"postinstall": "npm run build"
|
"postinstall": "npm run build"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/core": "^2.0.0-rc.5",
|
"@angular/core": "^2.2.2",
|
||||||
"@angular/http": "^2.0.0-rc.5",
|
"@angular/http": "^2.2.2",
|
||||||
"@angular/common": "^2.0.0-rc.5",
|
"@angular/common": "^2.2.2",
|
||||||
"@angular/compiler": "^2.0.0-rc.5",
|
"@angular/compiler": "^2.2.2",
|
||||||
"core-js": "^2.4.0",
|
"core-js": "^2.4.0",
|
||||||
"reflect-metadata": "^0.1.3",
|
"reflect-metadata": "^0.1.3",
|
||||||
"rxjs": "5.0.0-beta.6",
|
"rxjs": "^5.1.0",
|
||||||
"zone.js": "^0.6.17"
|
"zone.js": "^0.7.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/core": "^2.0.0-rc.5",
|
"@angular/core": "^2.2.2",
|
||||||
"@angular/http": "^2.0.0-rc.5",
|
"@angular/http": "^2.2.2",
|
||||||
"@angular/common": "^2.0.0-rc.5",
|
"@angular/common": "^2.2.2",
|
||||||
"@angular/compiler": "^2.0.0-rc.5",
|
"@angular/compiler": "^2.2.2",
|
||||||
"@angular/platform-browser": "^2.0.0-rc.5",
|
"@angular/platform-browser": "^2.2.2",
|
||||||
"core-js": "^2.4.0",
|
|
||||||
"reflect-metadata": "^0.1.3",
|
"reflect-metadata": "^0.1.3",
|
||||||
"rxjs": "5.0.0-beta.6",
|
"rxjs": "5.1.0",
|
||||||
"zone.js": "^0.6.17",
|
"zone.js": "^0.7.6",
|
||||||
"typescript": "^1.8.10",
|
"typescript": "^2.1.5"
|
||||||
"typings": "^1.3.2"
|
|
||||||
}{{#npmRepository}},{{/npmRepository}}
|
}{{#npmRepository}},{{/npmRepository}}
|
||||||
{{#npmRepository}}
|
{{#npmRepository}}
|
||||||
"publishConfig":{
|
"publishConfig":{
|
||||||
|
@ -5,23 +5,21 @@
|
|||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"suppressImplicitAnyIndexErrors": true,
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"module": "commonjs",
|
"module": "es6",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"noLib": false,
|
"noLib": false,
|
||||||
"declaration": true
|
"declaration": true,
|
||||||
|
"lib": [ "es6", "dom" ]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"typings/main.d.ts",
|
|
||||||
"typings/main",
|
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"filesGlob": [
|
"filesGlob": [
|
||||||
"./model/*.ts",
|
"./model/*.ts",
|
||||||
"./api/*.ts",
|
"./api/*.ts"
|
||||||
"typings/browser.d.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,37 @@ _unPublished (not recommended):_
|
|||||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||||
```
|
```
|
||||||
|
|
||||||
|
_using `npm link`:_
|
||||||
|
|
||||||
|
In PATH_TO_GENERATED_PACKAGE:
|
||||||
|
```
|
||||||
|
npm link
|
||||||
|
```
|
||||||
|
|
||||||
|
In your project:
|
||||||
|
```
|
||||||
|
npm link @swagger/angular2-typescript-petstore@0.0.1
|
||||||
|
```
|
||||||
|
|
||||||
In your angular2 project:
|
In your angular2 project:
|
||||||
|
|
||||||
TODO: paste example.
|
```
|
||||||
|
import { DefaultApi } from '@swagger/angular2-typescript-petstore/api/api';
|
||||||
|
@NgModule({
|
||||||
|
imports: [],
|
||||||
|
declarations: [],
|
||||||
|
exports: [],
|
||||||
|
providers: [AppModule]
|
||||||
|
})
|
||||||
|
export class CoreModule {}
|
||||||
|
```
|
||||||
|
```
|
||||||
|
import { DefaultApi } from '@swagger/angular2-typescript-petstore/api/api';
|
||||||
|
|
||||||
|
export class AppComponent {
|
||||||
|
constructor(private apiGateway: DefaultApi) { }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Set service base path
|
### Set service base path
|
||||||
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
||||||
@ -42,3 +70,29 @@ bootstrap(AppComponent, [
|
|||||||
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
||||||
]);
|
]);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Using @angular/cli
|
||||||
|
First extend your `src/environments/*.ts` files by adding the corresponding base path:
|
||||||
|
|
||||||
|
```
|
||||||
|
export const environment = {
|
||||||
|
production: false,
|
||||||
|
API_BASE_PATH: 'http://127.0.0.1:8080'
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
In the src/app/app.module.ts:
|
||||||
|
```
|
||||||
|
import { BASE_PATH } from '@swagger/angular2-typescript-petstore';
|
||||||
|
import { environment } from '../environments/environment';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
],
|
||||||
|
imports: [ ],
|
||||||
|
providers: [{ provide: BASE_PATH, useValue: useValue: environment.API_BASE_PATH }],
|
||||||
|
bootstrap: [AppComponent]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
||||||
|
```
|
@ -10,31 +10,29 @@
|
|||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "typings install && tsc --outDir dist/",
|
"build": "tsc",
|
||||||
"postinstall": "npm run build"
|
"postinstall": "npm run build"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/core": "^2.0.0-rc.5",
|
"@angular/core": "^2.2.2",
|
||||||
"@angular/http": "^2.0.0-rc.5",
|
"@angular/http": "^2.2.2",
|
||||||
"@angular/common": "^2.0.0-rc.5",
|
"@angular/common": "^2.2.2",
|
||||||
"@angular/compiler": "^2.0.0-rc.5",
|
"@angular/compiler": "^2.2.2",
|
||||||
"core-js": "^2.4.0",
|
"core-js": "^2.4.0",
|
||||||
"reflect-metadata": "^0.1.3",
|
"reflect-metadata": "^0.1.3",
|
||||||
"rxjs": "5.0.0-beta.6",
|
"rxjs": "^5.1.0",
|
||||||
"zone.js": "^0.6.17"
|
"zone.js": "^0.7.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/core": "^2.0.0-rc.5",
|
"@angular/core": "^2.2.2",
|
||||||
"@angular/http": "^2.0.0-rc.5",
|
"@angular/http": "^2.2.2",
|
||||||
"@angular/common": "^2.0.0-rc.5",
|
"@angular/common": "^2.2.2",
|
||||||
"@angular/compiler": "^2.0.0-rc.5",
|
"@angular/compiler": "^2.2.2",
|
||||||
"@angular/platform-browser": "^2.0.0-rc.5",
|
"@angular/platform-browser": "^2.2.2",
|
||||||
"core-js": "^2.4.0",
|
|
||||||
"reflect-metadata": "^0.1.3",
|
"reflect-metadata": "^0.1.3",
|
||||||
"rxjs": "5.0.0-beta.6",
|
"rxjs": "5.1.0",
|
||||||
"zone.js": "^0.6.17",
|
"zone.js": "^0.7.6",
|
||||||
"typescript": "^1.8.10",
|
"typescript": "^2.1.5"
|
||||||
"typings": "^1.3.2"
|
|
||||||
},
|
},
|
||||||
"publishConfig":{
|
"publishConfig":{
|
||||||
"registry":"https://skimdb.npmjs.com/registry"
|
"registry":"https://skimdb.npmjs.com/registry"
|
||||||
|
@ -5,23 +5,21 @@
|
|||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"suppressImplicitAnyIndexErrors": true,
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"module": "commonjs",
|
"module": "es6",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"noLib": false,
|
"noLib": false,
|
||||||
"declaration": true
|
"declaration": true,
|
||||||
|
"lib": [ "es6", "dom" ]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"typings/main.d.ts",
|
|
||||||
"typings/main",
|
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"filesGlob": [
|
"filesGlob": [
|
||||||
"./model/*.ts",
|
"./model/*.ts",
|
||||||
"./api/*.ts",
|
"./api/*.ts"
|
||||||
"typings/browser.d.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user