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

Commit 08f6bc3

Browse files
authored
Merge pull request #35 from mocks-server/release
Release
2 parents 5ef585c + 90704f4 commit 08f6bc3

Some content is hidden

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

78 files changed

+2528
-25969
lines changed

.travis.yml

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,2 @@
1-
language: node_js
2-
3-
node_js:
4-
- 10.8
5-
6-
cache:
7-
directories:
8-
- ~/.npm
9-
- ~/.cache
10-
- ~/.sonar/cache
11-
12-
addons:
13-
apt:
14-
packages:
15-
- libgconf-2-4
16-
sonarcloud:
17-
organization: "mocks-server"
18-
branch:
19-
name: "$TRAVIS_CURRENT_BRANCH"
20-
21-
script:
22-
- npm run lint
23-
- npm run test
24-
- npm run build
25-
- npm run test:e2e:ci
26-
- npm run coveralls
27-
- 'if [ -n "$SONAR_TOKEN" ]; then sonar-scanner -Dsonar.login=${SONAR_TOKEN}; fi'
28-
29-
deploy:
30-
provider: npm
31-
email: "javier.brea@gmail.com"
32-
api_key: "$NPM_TOKEN"
33-
edge: true
34-
on:
35-
tags: true
36-
skip_cleanup: true
1+
version: ~> 1.0
2+
import: mocks-server/ci-cd:.travis-build-deploy.yml@master

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ 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+
- chore(deps): Update dev-dependencies
18+
19+
## [1.0.3] - 2020-01-26
20+
### Changed
21+
- Update dependencies
22+
1323
## [1.0.2] - 2020-01-12
1424
### Changed
1525
- Update dependencies

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
[![Build status][travisci-image]][travisci-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Quality Gate][quality-gate-image]][quality-gate-url]
22

3-
[![NPM dependencies][npm-dependencies-image]][npm-dependencies-url] [![Greenkeeper badge](https://badges.greenkeeper.io/mocks-server/admin-api-client.svg)](https://greenkeeper.io/) [![Last commit][last-commit-image]][last-commit-url] [![Last release][release-image]][release-url]
3+
[![NPM dependencies][npm-dependencies-image]][npm-dependencies-url] [![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com) [![Last commit][last-commit-image]][last-commit-url] [![Last release][release-image]][release-url]
44

55
[![NPM downloads][npm-downloads-image]][npm-downloads-url] [![License][license-image]][license-url]
66

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

greenkeeper.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

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)