mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 11:25:17 +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
|
||||
const customAdminAppConfigFile = await getCustomAppConfigFile(appDir, useTypeScript);
|
||||
|
||||
if (customAdminAppConfigFile !== undefined) {
|
||||
if (customAdminAppConfigFile) {
|
||||
const defaultAdminConfigFilePath = path.resolve(cacheDir, 'admin', 'src', 'app.js');
|
||||
const customAdminAppConfigFilePath = path.join(
|
||||
appDir,
|
||||
|
||||
@ -13,11 +13,9 @@ const getCustomAppConfigFile = async (dir, useTypeScript) => {
|
||||
const adminSrcPath = join(dir, 'src', 'admin');
|
||||
const files = await fse.readdir(adminSrcPath);
|
||||
|
||||
if (useTypeScript) {
|
||||
return files.find(file => file.match(/app.tsx?$/));
|
||||
}
|
||||
const appRegex = new RegExp(`app.${useTypeScript ? 't' : 'j'}sx?$`);
|
||||
|
||||
return files.find(file => file.match(/app.jsx?$/));
|
||||
return files.find(file => file.match(appRegex));
|
||||
};
|
||||
|
||||
module.exports = getCustomAppConfigFile;
|
||||
|
||||
@ -36,7 +36,7 @@ const hasCustomAdminCode = async (dir, useTypeScript) => {
|
||||
const customAdminAppConfigFile = await getCustomAppConfigFile(dir, useTypeScript);
|
||||
const customAdminWebpackFile = path.join(customAdminPath, 'webpack.config.js');
|
||||
|
||||
const hasCustomConfigFile = customAdminAppConfigFile !== undefined;
|
||||
const hasCustomConfigFile = !!customAdminAppConfigFile;
|
||||
const hasCustomWebpackFile = await fs.pathExists(customAdminWebpackFile);
|
||||
|
||||
return hasCustomConfigFile || hasCustomWebpackFile;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user