Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.

Commit b21bc33

Browse files
authored
Merge pull request #34 from mocks-server/v2.0.0
V2.0.0
2 parents 8593921 + e0c7d9e commit b21bc33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+520
-26079
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Fixed
1111
### Removed
1212

13+
## [2.0.0] - 2020-03-01
14+
### Changed
15+
- feat: [BREAKING CHANGE] Stop using @data-provider. (admin-api-client-data-provider package available for that purpose).
16+
- feat: Use cross-fetch for making requests.
17+
1318
## [1.0.3] - 2020-01-26
1419
### Changed
1520
- Update dependencies

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,26 @@
77

88
# Mocks-server administration api client
99

10-
This package contains methods for administrating the mocks-server _(through the [@mocks-server/plugin-admin-api](https://github.com/mocks-server/plugin-admin-api) RESTful API)_.
10+
This package contains methods for administrating the mocks-server _(through the [@mocks-server/plugin-admin-api](https://github.com/mocks-server/plugin-admin-api) REST API)_.
1111

12-
Built using [@data-provider](https://github.com/data-provider), it can be used in Node.js, browsers, and is also compatible with @data-provider connectors, such as [@data-provider/connector-react](https://github.com/data-provider/connector-react), so can be easily integrated with frameworks.
12+
Requests to the @mocks-server are made using [cross-fetch](https://www.npmjs.com/package/cross-fetch), which makes this package compatible with browsers and nodejs environments, but, if you are going to build a browser application, you'll probably prefer to use the [@mocks-server/admin-api-client-data-provider package](https://www.npmjs.com/package/@mocks-server/admin-api-client-data-provider), which uses [@data-provider](https://github.com/data-provider), and works well with Redux, React, etc.
1313

14-
## Usage with promises
14+
## Install
15+
16+
```bash
17+
npm install --save @mocks-server/admin-api-client
18+
```
19+
20+
The UMD build is also available on unpkg:
21+
22+
```html
23+
<script src="https://unpkg.com/@mocks-server/admin-api-paths/dist/index.umd.js"></script>
24+
<script src="https://unpkg.com/@mocks-server/admin-api-client/dist/index.umd.js"></script>
25+
```
26+
27+
> The umd distribution is bundled with the "cross-env" dependency, but requires the "@mocks-server/admin-api-paths" dependency to be added separately.
28+
29+
## Usage
1530

1631
All methods described in the [Api](#api) (expect the `config` method) return Promises when executed:
1732

@@ -35,21 +50,15 @@ const example = async () => {
3550
example();
3651
```
3752

38-
## Usage with data-provider
39-
40-
Exported properties `about`, `settings`, `behaviors`, `behaviorsModel`, `fixtures` and `fixturesModel` are [@data-provider/axios](https://github.com/data-provider/axios) providers, so can be used to define @data-provider Selectors. Methods can also be connected to frameworks using @data-provider connectors, such as [@data-provider/connector-react](https://github.com/data-provider/connector-react).
41-
4253
## Api
4354

4455
* `about.read()` - Returns info about mocks-server/plugin-admin-api, such as current version.
4556
* `settings.read()` - Returns current @mocks-server settings.
4657
* `settings.update(settingsObject)` - Updates @mocks-server settings. A settings object has to be provided. Read the [@mocks-server configuration documentation](https://www.mocks-server.org/docs/configuration-options) for further info.
4758
* `behaviors.read()` - Returns collection of available behaviors.
4859
* `behavior(behaviorName).read()` - Returns an specific behavior.
49-
* `behaviorsModel.byName(behaviorName).read()` - Returns an specific behavior.
5060
* `fixtures.read()` - Returns collection of available fixtures.
5161
* `fixture(fixtureId).read()` - Returns an specific fixture.
52-
* `fixturesModel.byId(fixtureId).read()` - Returns an specific fixture.
5362

5463
## Configuration
5564

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export * from "./src/config";
2-
export * from "./src/providers";
1+
export * from "./src/methods";

jest.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@ module.exports = {
3535
},
3636

3737
// The test environment that will be used for testing
38-
testEnvironment: "node"
38+
testEnvironment: "node",
39+
40+
setupFiles: ["<rootDir>/jest.init.js"]
3941
};

jest.init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "babel-polyfill";
File renamed without changes.

mocks/mocks-server.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
options: {
3+
port: 3200
4+
}
5+
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)