File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import inquirer from 'inquirer';
88import isEmpty from 'lodash/isEmpty' ;
99import { createStrapi , compileStrapi } from '@strapi/strapi' ;
1010import gitDiff from 'git-diff' ;
11+ import tsUtils from '@strapi/typescript-utils' ;
1112
1213import warnings from './warnings' ;
1314import packageJSON from '../package.json' ;
@@ -17,7 +18,17 @@ const program = new Command();
1718const getStrapiApp = async ( ) => {
1819 process . env . CONFIG_SYNC_CLI = 'true' ;
1920
20- const appContext = await compileStrapi ( ) ;
21+ const appDir = process . cwd ( ) ;
22+ const isTSProject = await tsUtils . isUsingTypeScript ( appDir ) ;
23+ const outDir = await tsUtils . resolveOutDir ( appDir ) ;
24+ const alreadyCompiled = await fs . existsSync ( outDir ) ;
25+
26+ let appContext ;
27+ if ( ! isTSProject || ! alreadyCompiled ) {
28+ appContext = await compileStrapi ( ) ;
29+ } else {
30+ appContext = { appDir, outDir } ;
31+ }
2132 const app = await createStrapi ( appContext ) . load ( ) ;
2233 return app ;
2334} ;
You can’t perform that action at this time.
0 commit comments