mirror of
https://github.com/strapi/strapi.git
synced 2025-11-14 01:02:04 +00:00
Allow app.jsx for typescript projects
This commit is contained in:
parent
bdc043aaec
commit
758c10fb6b
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { join } = require('path');
|
const { join } = require('path');
|
||||||
|
const { eq } = require('lodash/fp');
|
||||||
const fse = require('fs-extra');
|
const fse = require('fs-extra');
|
||||||
const { isUsingTypeScript } = require('@strapi/typescript-utils');
|
const { isUsingTypeScript } = require('@strapi/typescript-utils');
|
||||||
|
|
||||||
@ -15,9 +16,14 @@ const getCustomAppConfigFile = async dir => {
|
|||||||
|
|
||||||
const files = await fse.readdir(adminSrcPath);
|
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;
|
module.exports = getCustomAppConfigFile;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user