mirror of
https://github.com/Rushilwiz/spaceout.git
synced 2025-04-22 12:29:50 -04:00
26 lines
987 B
JavaScript
26 lines
987 B
JavaScript
const cacheDefaults = (finalConfig, parsedArgs, outputOptions) => {
|
|
// eslint-disable-next-line no-prototype-builtins
|
|
const hasCache = finalConfig.hasOwnProperty('cache');
|
|
let cacheConfig = {};
|
|
if (hasCache && (parsedArgs.config || (outputOptions && outputOptions.defaultConfig))) {
|
|
if (finalConfig.cache && finalConfig.cache.type === 'filesystem') {
|
|
cacheConfig.buildDependencies = {
|
|
config: parsedArgs.config || [outputOptions.defaultConfig],
|
|
};
|
|
} else {
|
|
cacheConfig = finalConfig.cache;
|
|
}
|
|
return { cache: cacheConfig };
|
|
}
|
|
return cacheConfig;
|
|
};
|
|
|
|
const assignFlagDefaults = (compilerConfig, parsedArgs, outputOptions) => {
|
|
if (Array.isArray(compilerConfig)) {
|
|
return compilerConfig.map((config) => cacheDefaults(config, parsedArgs, outputOptions));
|
|
}
|
|
return cacheDefaults(compilerConfig, parsedArgs, outputOptions);
|
|
};
|
|
|
|
module.exports = assignFlagDefaults;
|