typescript-mock-server 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,16 +5,15 @@ have to update your mock, otherwise you will receive compile errors.
5
5
 
6
6
  # Quickstart
7
7
  The easiest way to check out this stub/mock server is by installing it as a (dev)dependency and then
8
- add a script to you scripts section: `cd node_modules/typescript-mock-server && npm run start -- --path=../../path-to-your-model-directory`.
9
- Please note we are changing the directory and therefore, to set the path parameter, you need to go 2 levels up to be in your root.
10
- I am looking for a cleaner way of doing this. Your models should export a data const and your file should be named as `^(get|post){1}(-\d)?.ts$`.
8
+ add a script to you scripts section: `npm run --prefix node_modules/typescript-mock-server start -- --path=$(pwd)/tms-models`.
9
+ Your models should export a data const and your file should be named as `^(get|post){1}(-\d)?.ts$`.
11
10
  Changes are being picked up automatically, so no need for a restart.
12
11
 
13
12
  Check out the [working example project](https://github.com/GuyT07/typescript-mock-server-examle) and source [the examples](https://github.com/GuyT07/typescript-mock-server/tree/main/tms-models/users).
14
13
 
15
14
  # Options
16
- `--port=x`: Port number the server runs on
17
- `--path=x`: Path to your models
15
+ - `--port=x`: Port number the server runs on
16
+ - `--path=x`: Path to your models
18
17
 
19
18
  ## Adding GET mocks/stubs
20
19
  Examples talk, so lets start with an example.
@@ -70,7 +69,7 @@ Following dependencies are being used:
70
69
 
71
70
  ## Roadmap
72
71
  - [x] Support other server port
73
- - [ ] Improve paths/way to start
72
+ - [x] Improve paths/way to start
74
73
  - [ ] Support different headers
75
74
  - [ ] Support all HTTP methods
76
75
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "typescript-mock-server",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Simple mock server that can be used in front end development. Instead of creating json files you can just publish TypeScript objects as json",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
7
- "example": "ts-node-dev src/index.ts --path=tms-models --port=5000",
7
+ "example": "ts-node-dev src/index.ts --path=$(pwd)/tms-models --port=5000",
8
8
  "start": "ts-node-dev src/index.ts"
9
9
  },
10
10
  "repository": {
@@ -12,12 +12,15 @@
12
12
  "url": "git+https://github.com/GuyT07/typescript-mock-server.git"
13
13
  },
14
14
  "keywords": ["mock server", "testing", "stub", "typescript"],
15
- "author": "",
15
+ "author": "Guy Theuws",
16
16
  "license": "ISC",
17
17
  "bugs": {
18
18
  "url": "https://github.com/GuyT07/typescript-mock-server/issues"
19
19
  },
20
20
  "homepage": "https://github.com/GuyT07/typescript-mock-server#readme",
21
+ "funding": {
22
+ "url" : "https://genydev.nl"
23
+ },
21
24
  "devDependencies": {
22
25
  "prettier": "^2.6.2"
23
26
  },
package/src/index.ts CHANGED
@@ -3,9 +3,6 @@
3
3
  import express, { Express } from 'express';
4
4
  import * as fs from 'fs';
5
5
 
6
- const baseDirPath = process.cwd();
7
- console.log(baseDirPath);
8
-
9
6
  const argv: { [key: string]: string } = (() => {
10
7
  const args = {};
11
8
  process.argv.slice(2).map((element) => {
@@ -26,8 +23,7 @@ const app: Express = express();
26
23
 
27
24
  const {path, port} = argv;
28
25
 
29
- // @ts-ignore
30
- const basePath = `${baseDirPath}/${path}`;
26
+ const basePath = `${path}`;
31
27
 
32
28
  console.log('basePath:' + basePath);
33
29