mirror of
https://github.com/strapi/strapi.git
synced 2025-11-05 20:36:08 +00:00
Fix PR feedback
Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
parent
036a371160
commit
cd9a6e4bd8
@ -86,7 +86,7 @@ async function createCacheDir({ appDir, plugins, useTypeScript }) {
|
|||||||
// Retrieve the custom config file extension
|
// Retrieve the custom config file extension
|
||||||
const customAdminAppConfigFile = await getCustomAppConfigFile(appDir, useTypeScript);
|
const customAdminAppConfigFile = await getCustomAppConfigFile(appDir, useTypeScript);
|
||||||
|
|
||||||
if (customAdminAppConfigFile !== undefined) {
|
if (customAdminAppConfigFile) {
|
||||||
const defaultAdminConfigFilePath = path.resolve(cacheDir, 'admin', 'src', 'app.js');
|
const defaultAdminConfigFilePath = path.resolve(cacheDir, 'admin', 'src', 'app.js');
|
||||||
const customAdminAppConfigFilePath = path.join(
|
const customAdminAppConfigFilePath = path.join(
|
||||||
appDir,
|
appDir,
|
||||||
|
|||||||
@ -13,11 +13,9 @@ const getCustomAppConfigFile = async (dir, useTypeScript) => {
|
|||||||
const adminSrcPath = join(dir, 'src', 'admin');
|
const adminSrcPath = join(dir, 'src', 'admin');
|
||||||
const files = await fse.readdir(adminSrcPath);
|
const files = await fse.readdir(adminSrcPath);
|
||||||
|
|
||||||
if (useTypeScript) {
|
const appRegex = new RegExp(`app.${useTypeScript ? 't' : 'j'}sx?$`);
|
||||||
return files.find(file => file.match(/app.tsx?$/));
|
|
||||||
}
|
|
||||||
|
|
||||||
return files.find(file => file.match(/app.jsx?$/));
|
return files.find(file => file.match(appRegex));
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = getCustomAppConfigFile;
|
module.exports = getCustomAppConfigFile;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ const hasCustomAdminCode = async (dir, useTypeScript) => {
|
|||||||
const customAdminAppConfigFile = await getCustomAppConfigFile(dir, useTypeScript);
|
const customAdminAppConfigFile = await getCustomAppConfigFile(dir, useTypeScript);
|
||||||
const customAdminWebpackFile = path.join(customAdminPath, 'webpack.config.js');
|
const customAdminWebpackFile = path.join(customAdminPath, 'webpack.config.js');
|
||||||
|
|
||||||
const hasCustomConfigFile = customAdminAppConfigFile !== undefined;
|
const hasCustomConfigFile = !!customAdminAppConfigFile;
|
||||||
const hasCustomWebpackFile = await fs.pathExists(customAdminWebpackFile);
|
const hasCustomWebpackFile = await fs.pathExists(customAdminWebpackFile);
|
||||||
|
|
||||||
return hasCustomConfigFile || hasCustomWebpackFile;
|
return hasCustomConfigFile || hasCustomWebpackFile;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user