fix: Fallback for pre Strapi 4.2
parent
c9e45c3909
commit
56ee854e71
|
@ -7,7 +7,6 @@ const chalk = require('chalk');
|
||||||
const inquirer = require('inquirer');
|
const inquirer = require('inquirer');
|
||||||
const { isEmpty } = require('lodash');
|
const { isEmpty } = require('lodash');
|
||||||
const strapi = require('@strapi/strapi'); // eslint-disable-line
|
const strapi = require('@strapi/strapi'); // eslint-disable-line
|
||||||
const tsUtils = require('@strapi/typescript-utils'); // eslint-disable-line
|
|
||||||
const gitDiff = require('git-diff');
|
const gitDiff = require('git-diff');
|
||||||
|
|
||||||
const warnings = require('./warnings');
|
const warnings = require('./warnings');
|
||||||
|
@ -16,6 +15,9 @@ const packageJSON = require('../package.json');
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
|
||||||
const getStrapiApp = async () => {
|
const getStrapiApp = async () => {
|
||||||
|
try {
|
||||||
|
const tsUtils = require('@strapi/typescript-utils'); // eslint-disable-line
|
||||||
|
|
||||||
const appDir = process.cwd();
|
const appDir = process.cwd();
|
||||||
const isTSProject = await tsUtils.isUsingTypeScript(appDir);
|
const isTSProject = await tsUtils.isUsingTypeScript(appDir);
|
||||||
const outDir = await tsUtils.resolveOutDir(appDir);
|
const outDir = await tsUtils.resolveOutDir(appDir);
|
||||||
|
@ -32,6 +34,11 @@ const getStrapiApp = async () => {
|
||||||
const app = await strapi({ appDir, distDir }).load();
|
const app = await strapi({ appDir, distDir }).load();
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
} catch (e) {
|
||||||
|
// Fallback for pre Strapi 4.2.
|
||||||
|
const app = await strapi().load();
|
||||||
|
return app;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const initTable = (head) => {
|
const initTable = (head) => {
|
||||||
|
|
Loading…
Reference in New Issue