post-api-sync 0.1.1 → 0.1.2
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 +10 -10
- package/bin/{api-sync.js → post-api-sync.js} +2 -2
- package/package.json +6 -6
- package/src/collection/insomnia.js +1 -1
- package/src/config.js +3 -3
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# api-sync
|
|
1
|
+
# post-api-sync
|
|
2
2
|
|
|
3
3
|
Sync your API code directly to Postman and Insomnia collections.
|
|
4
4
|
|
|
5
|
-
`api-sync` extracts endpoint definitions, parameters, and validation schemas (Zod, Class Validator) from your Hono, Express, or NestJS code and generates ready-to-use collections. It can also push changes directly to Postman Cloud.
|
|
5
|
+
`post-api-sync` extracts endpoint definitions, parameters, and validation schemas (Zod, Class Validator) from your Hono, Express, or NestJS code and generates ready-to-use collections. It can also push changes directly to Postman Cloud.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -18,32 +18,32 @@ Sync your API code directly to Postman and Insomnia collections.
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
npm install -g api-sync
|
|
21
|
+
npm install -g post-api-sync
|
|
22
22
|
# or use via npx
|
|
23
|
-
npx api-sync --help
|
|
23
|
+
npx post-api-sync --help
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Quick Start
|
|
27
27
|
|
|
28
28
|
1. **Initialize configuration**:
|
|
29
29
|
```bash
|
|
30
|
-
npx api-sync init
|
|
30
|
+
npx post-api-sync init
|
|
31
31
|
```
|
|
32
|
-
This will create an `api-sync.config.js` file in your project root.
|
|
32
|
+
This will create an `post-api-sync.config.js` file in your project root.
|
|
33
33
|
|
|
34
34
|
2. **Run extraction**:
|
|
35
35
|
```bash
|
|
36
|
-
npx api-sync sync
|
|
36
|
+
npx post-api-sync sync
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
3. **Watch for changes**:
|
|
40
40
|
```bash
|
|
41
|
-
npx api-sync watch
|
|
41
|
+
npx post-api-sync watch
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
## Configuration
|
|
45
45
|
|
|
46
|
-
The `api-sync.config.js` file allows you to customize the tool's behavior:
|
|
46
|
+
The `post-api-sync.config.js` file allows you to customize the tool's behavior:
|
|
47
47
|
|
|
48
48
|
```javascript
|
|
49
49
|
module.exports = {
|
|
@@ -84,7 +84,7 @@ You can push your generated collection directly to Postman without manual import
|
|
|
84
84
|
3. Run the sync command:
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
|
-
npx api-sync sync --postman-key <YOUR_KEY> --postman-id <COLLECTION_UID>
|
|
87
|
+
npx post-api-sync sync --postman-key <YOUR_KEY> --postman-id <COLLECTION_UID>
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
Or set them in your config/environment variables to use with `watch` mode.
|
|
@@ -6,12 +6,12 @@ const { syncOnce } = require('../src/sync');
|
|
|
6
6
|
const { watchMode } = require('../src/watch');
|
|
7
7
|
|
|
8
8
|
program
|
|
9
|
-
.name('api-sync')
|
|
9
|
+
.name('post-api-sync')
|
|
10
10
|
.description('Sync Postman and Insomnia collections from API code');
|
|
11
11
|
|
|
12
12
|
program
|
|
13
13
|
.command('init')
|
|
14
|
-
.description('Create api-sync.config.js')
|
|
14
|
+
.description('Create post-api-sync.config.js')
|
|
15
15
|
.option('--cwd <path>', 'Project root for config')
|
|
16
16
|
.action(async (opts) => {
|
|
17
17
|
await initConfig({ baseDir: opts.cwd });
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "post-api-sync",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Sync Postman and Insomnia collections from API code",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
7
|
-
"api-sync": "bin/api-sync.js"
|
|
7
|
+
"post-api-sync": "bin/post-api-sync.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"sync": "node bin/api-sync.js sync",
|
|
11
|
-
"watch": "node bin/api-sync.js watch",
|
|
12
|
-
"init": "node bin/api-sync.js init"
|
|
10
|
+
"sync": "node bin/post-api-sync.js sync",
|
|
11
|
+
"watch": "node bin/post-api-sync.js watch",
|
|
12
|
+
"init": "node bin/post-api-sync.js init"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/parser": "^7.24.0",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"package.json"
|
|
45
45
|
],
|
|
46
46
|
"license": "MIT"
|
|
47
|
-
}
|
|
47
|
+
}
|
package/src/config.js
CHANGED
|
@@ -41,18 +41,18 @@ async function resolveConfigPath(configPath, baseDir) {
|
|
|
41
41
|
const stat = await fs.stat(abs);
|
|
42
42
|
if (stat.isDirectory()) {
|
|
43
43
|
cwd = abs;
|
|
44
|
-
return { path: path.resolve(cwd, 'api-sync.config.js'), baseDir: cwd };
|
|
44
|
+
return { path: path.resolve(cwd, 'post-api-sync.config.js'), baseDir: cwd };
|
|
45
45
|
}
|
|
46
46
|
return { path: abs, baseDir: path.dirname(abs) };
|
|
47
47
|
}
|
|
48
48
|
if (!path.extname(abs)) {
|
|
49
49
|
cwd = abs;
|
|
50
|
-
return { path: path.resolve(cwd, 'api-sync.config.js'), baseDir: cwd };
|
|
50
|
+
return { path: path.resolve(cwd, 'post-api-sync.config.js'), baseDir: cwd };
|
|
51
51
|
}
|
|
52
52
|
return { path: abs, baseDir: cwd };
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
return { path: path.resolve(cwd, 'api-sync.config.js'), baseDir: cwd };
|
|
55
|
+
return { path: path.resolve(cwd, 'post-api-sync.config.js'), baseDir: cwd };
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
async function loadConfig(configPath, baseDir) {
|