bigbuffet-rw/src/custom.ts
marcin mikołajczak cb7976bd3d prefer arrow functions
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-05-12 15:24:15 +02:00

16 lines
481 B
TypeScript

/**
* Functions for dealing with custom build configuration.
*/
import * as BuildConfig from 'soapbox/build-config';
/** Require a custom JSON file if it exists */
const custom = (filename: string, fallback: any = {}): any => {
if (BuildConfig.NODE_ENV === 'test') return fallback;
const modules = import.meta.glob('../custom/*.json', { eager: true });
const key = `../../custom/${filename}.json`;
return modules[key] ? modules[key] : fallback;
};
export { custom };