@boost/config
Version:
Powerful convention based finder, loader, and manager of both configuration and ignore files.
31 lines (23 loc) • 572 B
text/typescript
import { CONFIG_FOLDER } from '../constants';
import type { FileType } from '../types';
export function createFileName(type: FileType, name: string, ext: string, suffix?: string): string {
// boost.js
let fileName = name;
// .boost.js
if (type === 'branch') {
fileName = `.${name}`;
}
// .config/boost.js
if (type === 'root-folder') {
fileName = `${CONFIG_FOLDER}/${name}`;
}
// boost.config.js
if (type === 'root-file') {
fileName = name + CONFIG_FOLDER;
}
if (suffix) {
fileName += `.${suffix}`;
}
fileName += `.${ext}`;
return fileName;
}