Compare commits

...

11 Commits

Author SHA1 Message Date
naman-bruno
8300abe086 fix: auth in cli (#6675)
* fix: auth in cli

* fixes
2026-01-05 22:06:26 +05:30
Abhishek S Lal
a3809ce4b9 style: remove unnecessary padding from pre elements in StyledWrapper component (#6674) 2026-01-05 20:39:58 +05:30
gopu-bruno
adb46110dd Fix/ws environment input alignment (#6672)
* style: enhance EnvironmentList component with improved flex properties

* refactor: remove report issue link for YAML format in CreateCollection component
2026-01-05 20:28:56 +05:30
naman-bruno
7cc4c0993e fix: atomic write issue (#6664) 2026-01-05 17:29:03 +05:30
Abhishek S Lal
1030d02ac7 fix: update hover background color in dark theme (#6666) 2026-01-05 17:28:49 +05:30
Anoop M D
d616be7271 Merge pull request #6661 from naman-bruno/cli/opencollection
add: oc support for cli
2026-01-05 16:09:51 +05:30
naman-bruno
afd49d146f add: oc support for cli 2026-01-05 15:57:49 +05:30
Abhishek S Lal
97e43c4489 feat: add native select styling to global styles (#6660) 2026-01-05 15:52:34 +05:30
gopu-bruno
f9af22d586 fix: apply infoTip styling to CodeMirror tooltip (#6658)
* style: apply infoTip styling to CodeMirror tooltip

* fix: add CodeMirror lint tooltip warning and  error text colors

* fix: update font size of CodeMirror lint tooltip
2026-01-05 14:16:52 +05:30
sreelakshmi-bruno
8590bacd79 add license and readme to bruno query package (#6654) 2026-01-05 13:22:54 +05:30
Bijin A B
a7d1a349e3 fix: lighten dark pastel theme modal background color (#6653) 2026-01-04 21:46:04 +05:30
19 changed files with 318 additions and 157 deletions

View File

@@ -259,10 +259,6 @@ const StyledWrapper = styled.div`
height: 400px;
display: flex;
flex-direction: column;
pre {
padding: 8px !important;
}
.w-full.h-full.relative.flex {
height: 100% !important;
@@ -321,7 +317,7 @@ const StyledWrapper = styled.div`
height: 100% !important;
max-height: 400px !important;
padding: 0.5rem !important;
.network-logs-pre {
color: ${(props) => props.theme.console.messageColor} !important;
font-size: ${(props) => props.theme.font.size.xs} !important;

View File

@@ -191,9 +191,12 @@ const StyledWrapper = styled.div`
display: flex;
align-items: center;
flex: 1;
min-width: 0;
overflow: hidden;
.environment-name-input {
flex: 1;
min-width: 0;
background: transparent;
border: none;
outline: none;
@@ -210,12 +213,14 @@ const StyledWrapper = styled.div`
display: flex;
gap: 2px;
margin-left: 4px;
flex-shrink: 0;
}
}
&.creating {
.environment-name-input {
flex: 1;
min-width: 0;
background: transparent;
border: none;
outline: none;
@@ -232,6 +237,7 @@ const StyledWrapper = styled.div`
display: flex;
gap: 2px;
margin-left: 4px;
flex-shrink: 0;
}
}

View File

@@ -252,21 +252,6 @@ const CreateCollection = ({ onClose, defaultLocation: propDefaultLocation }) =>
{formik.touched.format && formik.errors.format ? (
<div className="text-red-500">{formik.errors.format}</div>
) : null}
{formik.values.format === 'yml' && (
<div className="mt-2">
<a
href="#"
className="report-issue-link"
onClick={(e) => {
e.preventDefault();
window.open('https://github.com/usebruno/bruno/discussions/6466', '_blank', 'noopener,noreferrer');
}}
>
<IconExternalLink size={14} strokeWidth={1.5} />
<span>Report an issue</span>
</a>
</div>
)}
</div>
</div>
<div className="flex justify-end items-center mt-8 bruno-modal-footer">

View File

@@ -191,9 +191,12 @@ const StyledWrapper = styled.div`
display: flex;
align-items: center;
flex: 1;
min-width: 0;
overflow: hidden;
.environment-name-input {
flex: 1;
min-width: 0;
background: transparent;
border: none;
outline: none;
@@ -210,12 +213,14 @@ const StyledWrapper = styled.div`
display: flex;
gap: 2px;
margin-left: 4px;
flex-shrink: 0;
}
}
&.creating {
.environment-name-input {
flex: 1;
min-width: 0;
background: transparent;
border: none;
outline: none;
@@ -232,6 +237,7 @@ const StyledWrapper = styled.div`
display: flex;
gap: 2px;
margin-left: 4px;
flex-shrink: 0;
}
.inline-action-btn {

View File

@@ -324,6 +324,27 @@ const GlobalStyle = createGlobalStyle`
margin: 1em 0;
}
.CodeMirror-lint-tooltip {
padding: 4px 8px;
background-color: ${(props) => props.theme.infoTip.bg};
border: 1px solid ${(props) => props.theme.infoTip.border};
box-shadow: ${(props) => props.theme.infoTip.boxShadow};
border-radius: ${(props) => props.theme.border.radius.sm};
}
.CodeMirror-lint-message {
font-size: ${(props) => props.theme.font.size.xs};
color: ${(props) => props.theme.text};
}
.CodeMirror-lint-message-warning {
color: ${(props) => props.theme.status.warning.text};
}
.CodeMirror-lint-message-error {
color: ${(props) => props.theme.status.danger.text};
}
/* Header */
.CodeMirror-brunoVarInfo .var-info-header {
display: flex;
@@ -540,6 +561,25 @@ const GlobalStyle = createGlobalStyle`
cursor: pointer;
color: ${(props) => props.theme.textLink} !important;
}
// Native select styling
select {
background-color: ${(props) => props.theme.input.bg};
color: ${(props) => props.theme.text};
font-size: ${(props) => props.theme.font.size.base};
font-weight: 400;
}
select option {
background-color: ${(props) => props.theme.dropdown.bg};
color: ${(props) => props.theme.dropdown.color};
}
select option:hover,
select option:focus {
background-color: ${(props) => props.theme.dropdown.hoverBg} !important;
color: ${(props) => props.theme.dropdown.color} !important;
}
`;
export default GlobalStyle;

View File

@@ -295,7 +295,7 @@ const darkPastelTheme = {
},
body: {
color: colors.TEXT,
bg: colors.GRAY_1
bg: colors.GRAY_2
},
input: {
bg: 'transparent',

View File

@@ -241,7 +241,7 @@ const darkTheme = {
color: palette.text.BASE,
iconColor: palette.text.SUBTEXT2,
bg: palette.background.MANTLE,
hoverBg: palette.background.MANTLE,
hoverBg: palette.background.SURFACE0,
shadow: 'none',
border: palette.border.BORDER1,
separator: palette.border.BORDER1,

View File

@@ -15,7 +15,7 @@ const { rpad } = require('../utils/common');
const { getOptions } = require('../utils/bru');
const { parseDotEnv, parseEnvironment } = require('@usebruno/filestore');
const constants = require('../constants');
const { findItemInCollection, createCollectionJsonFromPathname, getCallStack } = require('../utils/collection');
const { findItemInCollection, createCollectionJsonFromPathname, getCallStack, FORMAT_CONFIG } = require('../utils/collection');
const { hasExecutableTestInScript } = require('../utils/request');
const command = 'run [paths...]';
const desc = 'Run one or more requests/folders';
@@ -359,21 +359,21 @@ const handler = async function (argv) {
}
if (envFile || env) {
const envExt = FORMAT_CONFIG[collection.format].ext;
const envFilePath = envFile
? path.resolve(collectionPath, envFile)
: path.join(collectionPath, 'environments', `${env}.bru`);
: path.join(collectionPath, 'environments', `${env}${envExt}`);
const envFileExists = await exists(envFilePath);
if (!envFileExists) {
const errorPath = envFile || `environments/${env}.bru`;
const errorPath = envFile || `environments/${env}${envExt}`;
console.error(chalk.red(`Environment file not found: `) + chalk.dim(errorPath));
process.exit(constants.EXIT_STATUS.ERROR_ENV_NOT_FOUND);
}
const ext = path.extname(envFilePath).toLowerCase();
if (ext === '.json') {
// Parse Bruno schema JSON environment
const fileExt = path.extname(envFilePath).toLowerCase();
if (fileExt === '.json') {
let envJsonContent;
try {
envJsonContent = fs.readFileSync(envFilePath, 'utf8');
@@ -387,8 +387,12 @@ const handler = async function (argv) {
console.error(chalk.red(`Failed to parse Environment JSON: ${err.message}`));
process.exit(constants.EXIT_STATUS.ERROR_INVALID_FILE);
}
} else if (fileExt === '.yml' || fileExt === '.yaml') {
const envContent = fs.readFileSync(envFilePath, 'utf8');
const envJson = parseEnvironment(envContent, { format: 'yml' });
envVars = getEnvVars(envJson);
envVars.__name__ = envFile ? path.basename(envFilePath, fileExt) : env;
} else {
// Default to .bru parsing
const envBruContent = fs.readFileSync(envFilePath, 'utf8').replace(/\r\n/g, '\n');
const envJson = parseEnvironment(envBruContent);
envVars = getEnvVars(envJson);
@@ -596,10 +600,11 @@ const handler = async function (argv) {
const runtime = getJsSandboxRuntime(sandbox);
const runSingleRequestByPathname = async (relativeItemPathname) => {
const ext = FORMAT_CONFIG[collection.format].ext;
return new Promise(async (resolve, reject) => {
let itemPathname = path.join(collectionPath, relativeItemPathname);
if (itemPathname && !itemPathname?.endsWith('.bru')) {
itemPathname = `${itemPathname}.bru`;
if (itemPathname && !itemPathname?.endsWith(ext)) {
itemPathname = `${itemPathname}${ext}`;
}
const requestItem = cloneDeep(findItemInCollection(collection, itemPathname));
if (requestItem) {

View File

@@ -288,13 +288,16 @@ const prepareRequest = async (item = {}, collection = {}) => {
request.body = request.body || {};
if (request.body.mode === 'json') {
if (!contentTypeDefined) {
axiosRequest.headers['content-type'] = 'application/json';
}
try {
axiosRequest.data = decomment(request?.body?.json);
} catch (error) {
axiosRequest.data = request?.body?.json;
const jsonBody = request.body.json;
if (jsonBody && jsonBody.length > 0) {
if (!contentTypeDefined) {
axiosRequest.headers['content-type'] = 'application/json';
}
try {
axiosRequest.data = decomment(jsonBody);
} catch (error) {
axiosRequest.data = jsonBody;
}
}
}

View File

@@ -7,116 +7,90 @@ const { parseRequest, parseCollection, parseFolder, stringifyCollection, stringi
const constants = require('../constants');
const chalk = require('chalk');
const createCollectionJsonFromPathname = (collectionPath) => {
const environmentsPath = path.join(collectionPath, `environments`);
// get the collection bruno json config [<collection-path>/bruno.json]
const brunoConfig = getCollectionBrunoJsonConfig(collectionPath);
// get the collection root [<collection-path>/collection.bru]
const collectionRoot = getCollectionRoot(collectionPath);
// get the collection items recursively
const traverse = (currentPath) => {
const filesInCurrentDir = fs.readdirSync(currentPath);
if (currentPath.includes('node_modules')) {
return;
}
const currentDirItems = [];
for (const file of filesInCurrentDir) {
const filePath = path.join(currentPath, file);
const stats = fs.lstatSync(filePath);
if (stats.isDirectory()) {
if (filePath === environmentsPath) continue;
if (filePath.startsWith('.git') || filePath.startsWith('node_modules')) continue;
// get the folder root
let folderItem = { name: file, pathname: filePath, type: 'folder', items: traverse(filePath) };
const folderBruJson = getFolderRoot(filePath);
if (folderBruJson) {
folderItem.root = folderBruJson;
folderItem.seq = folderBruJson.meta.seq;
}
currentDirItems.push(folderItem);
} else {
if (['collection.bru', 'folder.bru'].includes(file)) continue;
if (path.extname(filePath) !== '.bru') continue;
// get the request item
try {
const bruContent = fs.readFileSync(filePath, 'utf8');
const requestItem = parseRequest(bruContent);
currentDirItems.push({
name: file,
pathname: filePath,
...requestItem
});
} catch (err) {
// Log warning for invalid .bru file but continue processing
console.warn(chalk.yellow(`Warning: Skipping invalid file ${filePath}\nError: ${err.message}`));
// Track skipped files for later reporting
if (!global.brunoSkippedFiles) {
global.brunoSkippedFiles = [];
}
global.brunoSkippedFiles.push({ path: filePath, error: err.message });
}
}
}
let currentDirFolderItems = currentDirItems?.filter((iter) => iter.type === 'folder');
let sortedFolderItems = sortByNameThenSequence(currentDirFolderItems);
let currentDirRequestItems = currentDirItems?.filter((iter) => iter.type !== 'folder');
let sortedRequestItems = currentDirRequestItems?.sort((a, b) => a.seq - b.seq);
return sortedFolderItems?.concat(sortedRequestItems);
};
let collectionItems = traverse(collectionPath);
let collection = {
brunoConfig,
root: collectionRoot,
pathname: collectionPath,
items: collectionItems
};
return collection;
const FORMAT_CONFIG = {
yml: { ext: '.yml', collectionFile: 'opencollection.yml', folderFile: 'folder.yml' },
bru: { ext: '.bru', collectionFile: 'collection.bru', folderFile: 'folder.bru' }
};
const getCollectionBrunoJsonConfig = (dir) => {
// right now, bru must be run from the root of the collection
// will add support in the future to run it from anywhere inside the collection
const brunoJsonPath = path.join(dir, 'bruno.json');
const brunoJsonExists = fs.existsSync(brunoJsonPath);
if (!brunoJsonExists) {
const getCollectionFormat = (collectionPath) => {
if (fs.existsSync(path.join(collectionPath, 'opencollection.yml'))) return 'yml';
if (fs.existsSync(path.join(collectionPath, 'bruno.json'))) return 'bru';
return null;
};
const getCollectionConfig = (collectionPath, format) => {
if (format === 'yml') {
const content = fs.readFileSync(path.join(collectionPath, 'opencollection.yml'), 'utf8');
const parsed = parseCollection(content, { format: 'yml' });
return { brunoConfig: parsed.brunoConfig, collectionRoot: parsed.collectionRoot || {} };
}
const brunoConfig = JSON.parse(fs.readFileSync(path.join(collectionPath, 'bruno.json'), 'utf8'));
const collectionBruPath = path.join(collectionPath, 'collection.bru');
const collectionRoot = fs.existsSync(collectionBruPath)
? parseCollection(fs.readFileSync(collectionBruPath, 'utf8'), { format: 'bru' })
: {};
return { brunoConfig, collectionRoot };
};
const getFolderRoot = (dir, format) => {
const folderPath = path.join(dir, FORMAT_CONFIG[format].folderFile);
if (!fs.existsSync(folderPath)) return null;
return parseFolder(fs.readFileSync(folderPath, 'utf8'), { format });
};
const createCollectionJsonFromPathname = (collectionPath) => {
const format = getCollectionFormat(collectionPath);
if (!format) {
console.error(chalk.red(`You can run only at the root of a collection`));
process.exit(constants.EXIT_STATUS.ERROR_NOT_IN_COLLECTION);
}
const brunoConfigFile = fs.readFileSync(brunoJsonPath, 'utf8');
const brunoConfig = JSON.parse(brunoConfigFile);
return brunoConfig;
};
const { brunoConfig, collectionRoot } = getCollectionConfig(collectionPath, format);
const { ext, collectionFile, folderFile } = FORMAT_CONFIG[format];
const environmentsPath = path.join(collectionPath, 'environments');
const getCollectionRoot = (dir) => {
const collectionRootPath = path.join(dir, 'collection.bru');
const exists = fs.existsSync(collectionRootPath);
if (!exists) {
return {};
}
const traverse = (currentPath) => {
if (currentPath.includes('node_modules')) return [];
const currentDirItems = [];
const content = fs.readFileSync(collectionRootPath, 'utf8');
return parseCollection(content);
};
for (const file of fs.readdirSync(currentPath)) {
const filePath = path.join(currentPath, file);
const stats = fs.lstatSync(filePath);
const getFolderRoot = (dir) => {
const folderRootPath = path.join(dir, 'folder.bru');
const exists = fs.existsSync(folderRootPath);
if (!exists) {
return null;
}
if (stats.isDirectory()) {
if (filePath === environmentsPath || file === '.git' || file === 'node_modules') continue;
const folderItem = { name: file, pathname: filePath, type: 'folder', items: traverse(filePath) };
const folderRoot = getFolderRoot(filePath, format);
if (folderRoot) {
folderItem.root = folderRoot;
folderItem.seq = folderRoot.meta?.seq;
}
currentDirItems.push(folderItem);
} else {
if (file === collectionFile || file === folderFile || path.extname(filePath) !== ext) continue;
try {
const requestItem = parseRequest(fs.readFileSync(filePath, 'utf8'), { format });
currentDirItems.push({ name: file, ...requestItem, pathname: filePath });
} catch (err) {
console.warn(chalk.yellow(`Warning: Skipping invalid file ${filePath}\nError: ${err.message}`));
global.brunoSkippedFiles = global.brunoSkippedFiles || [];
global.brunoSkippedFiles.push({ path: filePath, error: err.message });
}
}
}
const content = fs.readFileSync(folderRootPath, 'utf8');
return parseFolder(content);
const folders = sortByNameThenSequence(currentDirItems.filter((i) => i.type === 'folder'));
const requests = currentDirItems.filter((i) => i.type !== 'folder').sort((a, b) => a.seq - b.seq);
return folders.concat(requests);
};
return {
brunoConfig,
format,
root: collectionRoot,
pathname: collectionPath,
items: traverse(collectionPath)
};
};
const mergeHeaders = (collection, request, requestTreePath) => {
@@ -612,6 +586,8 @@ const sortByNameThenSequence = (items) => {
};
module.exports = {
FORMAT_CONFIG,
getCollectionFormat,
createCollectionJsonFromPathname,
mergeHeaders,
mergeVars,

View File

@@ -1,7 +1,9 @@
const path = require('node:path');
const fs = require('node:fs');
const { describe, it, expect } = require('@jest/globals');
const constants = require('../../src/constants');
const { createCollectionJsonFromPathname } = require('../../src/utils/collection');
const { createCollectionJsonFromPathname, getCollectionFormat, FORMAT_CONFIG } = require('../../src/utils/collection');
const { parseEnvironment } = require('@usebruno/filestore');
describe('create collection json from pathname', () => {
it('should throw an error when the pathname is not a valid bruno collection root', () => {
@@ -169,4 +171,96 @@ describe('create collection json from pathname', () => {
// tests
expect(c).toHaveProperty('items[4].request.tests', 'test(\"request level script\", function() {\n expect(\"test\").to.equal(\"test\");\n});');
});
it('creates a collection json from OpenCollection yml files', () => {
const collectionPathname = path.join(__dirname, './fixtures/opencollection/collection');
const c = createCollectionJsonFromPathname(collectionPathname);
expect(c).toBeDefined();
expect(c).toHaveProperty('format', 'yml');
expect(c).toHaveProperty('brunoConfig.opencollection', '1.0.0');
expect(c).toHaveProperty('brunoConfig.name', 'Test OpenCollection');
expect(c).toHaveProperty('brunoConfig.type', 'collection');
expect(c).toHaveProperty('brunoConfig.ignore', ['node_modules', '.git']);
expect(c).toHaveProperty('pathname', collectionPathname);
// collection root headers
expect(c).toHaveProperty('root.request.headers[0].name', 'X-Collection-Header');
expect(c).toHaveProperty('root.request.headers[0].value', 'collection-header-value');
expect(c).toHaveProperty('root.request.headers[0].enabled', true);
// folder
expect(c.items.some((i) => i.type === 'folder' && i.name === 'users')).toBe(true);
const usersFolder = c.items.find((i) => i.name === 'users');
expect(usersFolder).toHaveProperty('root.meta.name', 'Users');
expect(usersFolder).toHaveProperty('root.meta.seq', 1);
expect(usersFolder.pathname).toContain('users');
// request in folder - name comes from info.name, pathname is correct
const createUserReq = usersFolder.items.find((i) => i.name === 'Create User');
expect(createUserReq).toBeDefined();
expect(createUserReq).toHaveProperty('type', 'http-request');
expect(createUserReq).toHaveProperty('request.method', 'POST');
expect(createUserReq).toHaveProperty('request.url', 'https://api.example.com/users');
expect(createUserReq.pathname).toContain('create-user.yml');
// root level request - name comes from info.name, pathname is correct
const getUsersReq = c.items.find((i) => i.name === 'Get Users');
expect(getUsersReq).toBeDefined();
expect(getUsersReq).toHaveProperty('type', 'http-request');
expect(getUsersReq).toHaveProperty('request.method', 'GET');
expect(getUsersReq).toHaveProperty('request.url', 'https://api.example.com/users');
expect(getUsersReq.pathname).toContain('get-users.yml');
});
});
describe('getCollectionFormat', () => {
it('returns yml for OpenCollection', () => {
const collectionPath = path.join(__dirname, './fixtures/opencollection/collection');
expect(getCollectionFormat(collectionPath)).toBe('yml');
});
it('returns bru for Bruno collection', () => {
const collectionPath = path.join(__dirname, './fixtures/collection-json-from-pathname/collection');
expect(getCollectionFormat(collectionPath)).toBe('bru');
});
it('returns null for invalid path', () => {
const collectionPath = path.join(__dirname, './fixtures/collection-invalid');
expect(getCollectionFormat(collectionPath)).toBe(null);
});
});
describe('FORMAT_CONFIG', () => {
it('has correct config for yml format', () => {
expect(FORMAT_CONFIG.yml).toEqual({
ext: '.yml',
collectionFile: 'opencollection.yml',
folderFile: 'folder.yml'
});
});
it('has correct config for bru format', () => {
expect(FORMAT_CONFIG.bru).toEqual({
ext: '.bru',
collectionFile: 'collection.bru',
folderFile: 'folder.bru'
});
});
});
describe('OpenCollection environment parsing', () => {
it('parses YML environment files correctly', () => {
const envPath = path.join(__dirname, './fixtures/opencollection/collection/environments/dev.yml');
const envContent = fs.readFileSync(envPath, 'utf8');
const env = parseEnvironment(envContent, { format: 'yml' });
expect(env).toBeDefined();
expect(env).toHaveProperty('name', 'Development');
expect(env.variables).toHaveLength(2);
expect(env.variables[0]).toHaveProperty('name', 'baseUrl');
expect(env.variables[0]).toHaveProperty('value', 'https://api.dev.example.com');
expect(env.variables[1]).toHaveProperty('name', 'apiKey');
expect(env.variables[1]).toHaveProperty('value', 'dev-api-key-123');
});
});

View File

@@ -0,0 +1,6 @@
name: Development
variables:
- name: baseUrl
value: https://api.dev.example.com
- name: apiKey
value: dev-api-key-123

View File

@@ -0,0 +1,8 @@
info:
name: Get Users
type: http
seq: 1
http:
method: GET
url: https://api.example.com/users

View File

@@ -0,0 +1,14 @@
opencollection: "1.0.0"
info:
name: Test OpenCollection
extensions:
ignore:
- node_modules
- .git
request:
headers:
- name: X-Collection-Header
value: collection-header-value
enabled: true

View File

@@ -0,0 +1,14 @@
info:
name: Create User
type: http
seq: 1
http:
method: POST
url: https://api.example.com/users
body:
mode: json
json: |
{
"name": "John Doe"
}

View File

@@ -0,0 +1,3 @@
info:
name: Users
seq: 1

View File

@@ -1,8 +1,6 @@
const fs = require('fs');
const path = require('path');
const os = require('os');
const yaml = require('js-yaml');
const crypto = require('node:crypto');
const { writeFile, validateName, isValidCollectionDirectory } = require('./filesystem');
const { generateUidBasedOnHash } = require('./common');
const { withLock, getWorkspaceLockKey } = require('./workspace-lock');
@@ -25,24 +23,29 @@ const quoteYamlValue = (value) => {
const writeWorkspaceFileAtomic = async (workspacePath, content) => {
const workspaceFilePath = path.join(workspacePath, 'workspace.yml');
const tempFilePath = path.join(os.tmpdir(), `workspace-${Date.now()}-${crypto.randomBytes(16).toString('hex')}.yml`);
await writeFile(workspaceFilePath, content);
try {
await writeFile(tempFilePath, content);
// Previous atomic write implementation commented out due to permission issues on Linux
// when temp directory is on a different filesystem (cross-device link error)
if (fs.existsSync(workspaceFilePath)) {
fs.unlinkSync(workspaceFilePath);
}
// const tempFilePath = path.join(os.tmpdir(), `workspace-${Date.now()}-${crypto.randomBytes(16).toString('hex')}.yml`);
fs.renameSync(tempFilePath, workspaceFilePath);
} catch (error) {
if (fs.existsSync(tempFilePath)) {
try {
fs.unlinkSync(tempFilePath);
} catch (_) {}
}
throw error;
}
// try {
// await writeFile(tempFilePath, content);
// if (fs.existsSync(workspaceFilePath)) {
// fs.unlinkSync(workspaceFilePath);
// }
// fs.renameSync(tempFilePath, workspaceFilePath);
// } catch (error) {
// if (fs.existsSync(tempFilePath)) {
// try {
// fs.unlinkSync(tempFilePath);
// } catch (_) {}
// }
// throw error;
// }
};
const isValidCollectionEntry = (collection) => {

View File

@@ -193,7 +193,7 @@ export const toBrunoAuth = (auth: Auth | null | undefined): BrunoAuth | null =>
case 'bearer':
brunoAuth.mode = 'bearer';
brunoAuth.bearer = {
token: auth.token || null
token: auth.token || ''
};
break;

View File

@@ -8,6 +8,8 @@
"files": [
"dist",
"src",
"license.md",
"readme.md",
"package.json"
],
"scripts": {