mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
refactor resolveOutDir
This commit is contained in:
parent
12c64a2d11
commit
716e4fae8f
@ -1,16 +1,17 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const resolveConfigOptions = require('./resolve-config-options');
|
||||
const isUsingTypescript = require('./is-using-typescript');
|
||||
|
||||
const DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';
|
||||
/**
|
||||
* Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)
|
||||
* Gets the outDir value from config file (tsconfig)
|
||||
* @param {string} dir
|
||||
* @param {string | undefined} configFilename
|
||||
* @returns {string | undefined}
|
||||
*/
|
||||
module.exports = async (dir, configFilename = DEFAULT_TS_CONFIG_FILENAME) => {
|
||||
return (await isUsingTypescript(dir))
|
||||
? resolveConfigOptions(`${dir}/${configFilename}`).options.outDir
|
||||
? resolveConfigOptions(path.join(dir, configFilename)).options.outDir
|
||||
: undefined;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user