Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
mvp
Browse files Browse the repository at this point in the history
  • Loading branch information
wtpisaac committed Oct 3, 2023
1 parent 80ffb2f commit 468a9e8
Show file tree
Hide file tree
Showing 10 changed files with 610 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,5 @@ $RECYCLE.BIN/
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/windows,linux,macos,visualstudiocode,node

out.json
47 changes: 43 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,46 @@
# bruno2postman
an experimental utility for doing best-effort conversion of Bruno collections
to Postman. I need this for my job :)
an experimental, WIP utility to convert Bruno collections into Postman
collections.

usage:
```
bruno2postman <input bruno collection folder> <output postman json file>
```

e.g.,
```
bruno2postman ~/Dev/Bruno/StarWarsAPI ./StarWars.json
```

## Features
this tool is VERY incomplete, and lacks substantial functionality. i am
building this primarily for the case where you need to give someone a set of
HTTP requests quickly, and they don't use Bruno.

currently, this handles:
- basic HTTP requests with JSON bodies
- headers
- query params
- folder/hiearchical structure

it does not support:
- graphql
- non-JSON bodies
- probably other things!

it will likely never support:
- scripts (I assume these are totally incompatible)
- tests (I assume these are totally incompatible)

this will also likely **crash and burn** on invalid input data. there is a
substantial lack of error handling at play. you are warned.

it may also break on valid data! i'm basically reverse engineering what Bruno
can do, because I have no idea how to read their parsing code :).

## Support
testing on Linux; will probably work on macOS; good luck on Windows (but
please feel free to PR fixes for Windows to get it working)

## License
Licensed under the MIT License (in the hopes this could be incorporated
upstream)
Licensed under the MIT License.
22 changes: 22 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#! /usr/bin/env node
/*
index.js - main CLI scaffolding of bruno2postman
Copyright (c) 2023 Isaac Trimble-Pederson
Licensed under the MIT License
*/

const { program } = require('commander');
const { bruno2postman } = require('./src/bruno2postman');


program
.argument('<input path>', 'path to bruno collection folder')
.argument('<output path>', 'path to output postman json file');

program.parse();

const inputPath = program.args[0];
const outputPath = program.args[1];

bruno2postman(inputPath, outputPath);
198 changes: 197 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@
"version": "0.0.1",
"description": "experimental utility to convert Bruno collections to Postman",
"main": "index.js",
"bin": {
"bruno2postman": "index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"run": "node index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/wtpisaac/bruno2postman.git"
},
"author": "Isaac Trimble-Pederson <[email protected]>",
"author": "Isaac Trimble-Pederson <[email protected]> (https://wtpisaac.com/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/wtpisaac/bruno2postman/issues"
},
"homepage": "https://github.com/wtpisaac/bruno2postman#readme"
"homepage": "https://github.com/wtpisaac/bruno2postman#readme",
"volta": {
"node": "18.18.0"
},
"dependencies": {
"@usebruno/lang": "^0.4.0",
"commander": "^11.0.0",
"postman-collection": "^4.2.1"
}
}
Loading

0 comments on commit 468a9e8

Please sign in to comment.