Allow app.jsx for typescript projects

This commit is contained in:
Convly 2022-06-07 17:33:20 +02:00
parent bdc043aaec
commit 758c10fb6b

View File

@ -1,6 +1,7 @@
'use strict';
const { join } = require('path');
const { eq } = require('lodash/fp');
const fse = require('fs-extra');
const { isUsingTypeScript } = require('@strapi/typescript-utils');
@ -15,9 +16,14 @@ const getCustomAppConfigFile = async dir => {
const files = await fse.readdir(adminSrcPath);
const appRegex = new RegExp(`app.${useTypeScript ? 't' : 'j'}sx?$`);
const appJsx = files.find(eq('app.jsx'));
const appTsx = files.find(eq('app.tsx'));
return files.find(file => file.match(appRegex));
if (useTypeScript) {
return appTsx || appJsx;
}
return appJsx;
};
module.exports = getCustomAppConfigFile;