Skip to content

Commit 880fe2f

Browse files
authored
Merge pull request #2 from nobrainr/fix/npm-package
Fix/npm package
2 parents 6d69491 + 3eeab81 commit 880fe2f

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

Diff for: README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,35 @@
55
### Installation
66

77
```sh
8-
8+
npm install --save axios
99
npm install --save axios-morphism
10-
1110
```
1211

1312
### Example
1413

1514
```typescript
1615
import { apply, AxiosMorphismConfiguration } from './axios-morphism';
1716

18-
const peopleSchema = { name: 'name', firstName: 'firstName' };
17+
const peopleSchema = {
18+
name: 'name',
19+
height: 'height',
20+
weight: 'mass'
21+
};
1922

2023
const configuration: AxiosMorphismConfiguration = {
21-
url: 'https://api.com',
24+
url: 'https://swapi.co/api/',
2225
interceptors: {
2326
responses: [{ matcher: '/people/:id', schema: peopleSchema }]
2427
}
2528
};
2629

30+
const client = axios.create({baseURL: 'https://swapi.co/api/'});
2731
apply(client, configuration);
28-
await client.get(`https://api.com/people/1`);
2932

33+
await client.get('/people/1');
3034
3135
// {
32-
// name: 'Smith',
33-
// firstName: 'John'
36+
// name: 'Luke Skywalker'
3437
// }
3538
```
3639

Diff for: package.json

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
{
2-
"author": "Yann renaudin",
2+
"name": "axios-morphism",
33
"description": "",
44
"version": "1.0.0",
5+
"main": "./dist/axios-morphism.js",
6+
"types": "./dist/axios-morphism.d.ts",
7+
"scripts": {
8+
"build": "npm run build:prod",
9+
"build:dev": "webpack --mode development --config ./webpack.config.js --progress --color --display-error-details",
10+
"build:prod": "cross-env NODE_ENV=production webpack --mode production --config ./webpack.config.js --progress --color --display-error-details --bail",
11+
"clean": "npm cache clear && rimraf -- dist",
12+
"server": "npm run server:dev",
13+
"server:dev": "webpack-dev-server --mode development --config ./webpack.config.js --hot --inline --progress --watch --open",
14+
"server:prod": "cross-env NODE_ENV=production webpack-dev-server --mode production --config ./webpack.config.js --port 3000 --host 0.0.0.0 --hot --inline --progress --watch --open --content-base dist/",
15+
"start": "npm run server:dev",
16+
"test": "karma start",
17+
"semantic-release": "semantic-release"
18+
},
519
"dependencies": {
620
"morphism": "^1.6.1",
721
"path-to-regexp": "^2.4.0",
@@ -44,19 +58,6 @@
4458
"webpack-cli": "^3.1.0",
4559
"webpack-dev-server": "^3.1.5"
4660
},
47-
"license": "MIT",
48-
"main": "src/index.ts",
49-
"name": "axios-morphism",
50-
"scripts": {
51-
"build": "npm run build:prod",
52-
"build:dev": "webpack --mode development --config ./webpack.config.js --progress --color --display-error-details",
53-
"build:prod": "cross-env NODE_ENV=production webpack --mode production --config ./webpack.config.js --progress --color --display-error-details --bail",
54-
"clean": "npm cache clear && rimraf -- dist",
55-
"server": "npm run server:dev",
56-
"server:dev": "webpack-dev-server --mode development --config ./webpack.config.js --hot --inline --progress --watch --open",
57-
"server:prod": "cross-env NODE_ENV=production webpack-dev-server --mode production --config ./webpack.config.js --port 3000 --host 0.0.0.0 --hot --inline --progress --watch --open --content-base dist/",
58-
"start": "npm run server:dev",
59-
"test": "karma start",
60-
"semantic-release": "semantic-release"
61-
}
61+
"author": "Yann renaudin",
62+
"license": "MIT"
6263
}

0 commit comments

Comments
 (0)