fakelab 0.0.2 โ 0.0.4
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/LICENSE +21 -0
- package/README.md +75 -1
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Alireza Hemati
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Fakelab
|
|
2
|
+
|
|
3
|
+
โก A fast, easy-config mock API server for frontend developers.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ๐ Instant mock server
|
|
8
|
+
- ๐๏ธ Mock from Typescript files
|
|
9
|
+
- ๐ฆ Lightweight ~ 653 kB
|
|
10
|
+
- ๐งช Perfect for local development, prototyping, and frontend testing
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install fakelab --save-dev
|
|
16
|
+
# or
|
|
17
|
+
pnpm add -D fakelab
|
|
18
|
+
# or
|
|
19
|
+
yarn add -D fakelab
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage/Examples
|
|
23
|
+
|
|
24
|
+
create `fakelab.config.ts` file in the project root. and reference your app interfaces files.
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { defineConfig } from "fakelab";
|
|
28
|
+
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
sourcePath: "./interfaces", // can set a directory or a single typescript file.
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
interfaces folder:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
export interface User {
|
|
38
|
+
name: string;
|
|
39
|
+
age: number;
|
|
40
|
+
admin: boolean;
|
|
41
|
+
address: string;
|
|
42
|
+
tags: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface User {
|
|
45
|
+
gender: "male" | "female";
|
|
46
|
+
}
|
|
47
|
+
export interface Post {
|
|
48
|
+
id: string;
|
|
49
|
+
title: string;
|
|
50
|
+
content: string;
|
|
51
|
+
published: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface Profile {
|
|
55
|
+
id: string;
|
|
56
|
+
bio: string;
|
|
57
|
+
user: User;
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Start the mock api server
|
|
62
|
+
|
|
63
|
+
Run:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx fakelab serve
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Related
|
|
70
|
+
|
|
71
|
+
Fakelab is powered by [Fakerjs](https://fakerjs.dev/) library.
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fakelab",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/main.js",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"zod": "^4.1.13"
|
|
58
58
|
},
|
|
59
59
|
"bin": {
|
|
60
|
-
"fakelab": "
|
|
60
|
+
"fakelab": "bin/run.js"
|
|
61
61
|
}
|
|
62
62
|
}
|