mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-28 15:14:06 +00:00
* feat: enhance variable highlighting in CodeMirror and update interpolation method * feat: add interpolate function to bru shim and corresponding tests - Implemented the `interpolate` function in the bru shim to handle variable interpolation. - Added a new test case for the `interpolate` function to verify its functionality with mock variables. * feat: enhance interpolate function to support object interpolation * feat: add translation support for pm.variables.replaceIn to bru.interpolate * revert: eslint config changes * revert: eslint config changes * fix: update method call to use correct interpolation function in Bru class * refactor: added jsdoc to codemirror highlighting code * fix: higlighting for multiline editor
bruno-converters
The converters package is responsible for converting collections from one format to a Bruno collection. It can be used as a standalone package or as a part of the Bruno framework.
Installation
npm install @usebruno/converters
Usage
Convert Postman collection to Bruno collection
const { postmanToBruno } = require('@usebruno/converters');
// Convert Postman collection to Bruno collection
const brunoCollection = postmanToBruno(postmanCollection);
Convert Postman Environment to Bruno Environment
const { postmanToBrunoEnvironment } = require('@usebruno/converters');
const brunoEnvironment = postmanToBrunoEnvironment(postmanEnvironment);
Convert Insomnia collection to Bruno collection
import { insomniaToBruno } from '@usebruno/converters';
const brunoCollection = insomniaToBruno(insomniaCollection);
Convert OpenAPI specification to Bruno collection
import { openApiToBruno } from '@usebruno/converters';
const brunoCollection = openApiToBruno(openApiSpecification);
Example
const { postmanToBruno } = require('@usebruno/converters');
const fs = require('fs/promises');
const path = require('path');
async function convertPostmanToBruno(inputFile, outputFile) {
try {
// Read Postman collection file
const inputData = await fs.readFile(inputFile, 'utf8');
// Convert to Bruno collection
const brunoCollection = postmanToBruno(JSON.parse(inputData));
// Save Bruno collection
await fs.writeFile(outputFile, JSON.stringify(brunoCollection, null, 2));
console.log('Conversion successful!');
} catch (error) {
console.error('Error during conversion:', error);
}
}
// Usage
const inputFilePath = path.resolve(__dirname, 'demo_collection.postman_collection.json');
const outputFilePath = path.resolve(__dirname, 'bruno-collection.json');
convertPostmanToBruno(inputFilePath, outputFilePath);