@@ -14,7 +14,7 @@ import { projectConfiguration } from "../configuration";
1414
1515import { loadScene } from "./scene" ;
1616import { LoadScenePrepareComponent } from "./prepare" ;
17- import { installBabylonJSEditorTools , installDependencies } from "./install" ;
17+ import { installBabylonJSEditorCLI , installBabylonJSEditorTools , installDependencies } from "./install" ;
1818
1919/**
2020 * Loads an editor project located at the given path. Typically called at startup when opening
@@ -93,26 +93,45 @@ export async function checkDependencies(
9393 toast . warning ( `Package manager "${ packageManager } " is not available on your system. Dependencies will not be updated.` ) ;
9494 }
9595
96+ const cliPackageJsonPath = join ( directory , "node_modules/babylonjs-editor-cli/package.json" ) ;
9697 const toolsPackageJsonPath = join ( directory , "node_modules/babylonjs-editor-tools/package.json" ) ;
9798
98- let matchesVersion = false ;
99+ let matchesToolsVersion = false ;
99100 try {
100101 const toolsPackageJson = await readJSON ( toolsPackageJsonPath , "utf-8" ) ;
101102 if ( toolsPackageJson . version === packageJson . version ) {
102- matchesVersion = true ;
103+ matchesToolsVersion = true ;
104+ }
105+ } catch ( e ) {
106+ // Catch silently
107+ }
108+
109+ let matchesCliVersion = false ;
110+ try {
111+ const cliPackageJson = await readJSON ( cliPackageJsonPath , "utf-8" ) ;
112+ if ( cliPackageJson . version === packageJson . version ) {
113+ matchesCliVersion = true ;
103114 }
104115 } catch ( e ) {
105116 // Catch silently
106117 }
107118
108119 let toolsCode = 0 ;
109- if ( ! matchesVersion ) {
120+ if ( ! matchesToolsVersion ) {
110121 toolsCode = await installBabylonJSEditorTools ( packageManager , directory , packageJson . version ) ;
111122 if ( toolsCode !== 0 ) {
112123 toast . warning ( `Package manager "${ packageManager } " is not available on your system. Can't install "babylonjs-editor-tools" package dependency.` ) ;
113124 }
114125 }
115126
127+ if ( ! matchesCliVersion ) {
128+ installBabylonJSEditorCLI ( packageManager , directory , packageJson . version ) . then ( ( code ) => {
129+ if ( code !== 0 ) {
130+ toast . warning ( `Package manager "${ packageManager } " is not available on your system. Can't install "babylonjs-editor-cli" package dependency.` ) ;
131+ }
132+ } ) ;
133+ }
134+
116135 toast . dismiss ( toastId ) ;
117136
118137 if ( installCode === 0 && toolsCode === 0 ) {
0 commit comments