feat(import): set yml as a default file format across all types of imports (#8363)

* feat(import): set yml as a default file formal accross all type of imports

* addressed review comments

* addressed review comments

* set DEFAULT_COLLECTION_FORMAT as the default for collection format options
This commit is contained in:
sharan-bruno
2026-06-30 19:07:09 +05:30
committed by GitHub
parent bb21d4c1c9
commit 2f0f2e1c79
5 changed files with 90 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ const os = require('os');
const fs = require('fs');
const path = require('path');
const { sanitizeName } = require('./filesystem');
const { parseRequest, parseCollection, parseFolder, stringifyCollection, stringifyFolder, stringifyEnvironment, stringifyRequest } = require('@usebruno/filestore');
const { parseRequest, parseCollection, parseFolder, stringifyCollection, stringifyFolder, stringifyEnvironment, stringifyRequest, DEFAULT_COLLECTION_FORMAT } = require('@usebruno/filestore');
const constants = require('../constants');
const chalk = require('chalk');
@@ -539,7 +539,7 @@ const safeWriteFileSync = (filePath, content) => {
* @param {string} dirPath - The output directory path
*/
const createCollectionFromBrunoObject = async (collection, dirPath, options = {}) => {
const { format = 'bru' } = options;
const { format = DEFAULT_COLLECTION_FORMAT } = options;
// Create brunoConfig for yml format
const brunoConfig = {
version: '1',
@@ -595,7 +595,7 @@ const createCollectionFromBrunoObject = async (collection, dirPath, options = {}
* @param {"bru"|"yml"} options.format - Current directory path
*/
const processCollectionItems = async (items = [], currentPath, options = {}) => {
const { format = 'bru' } = options;
const { format = DEFAULT_COLLECTION_FORMAT } = options;
for (const item of items) {
if (item.type === 'folder') {
// Create folder