@@ -197,6 +197,34 @@ ${fs
197197 shell . exit ( 1 ) ;
198198 }
199199
200+ // This is a HACK! We rename the root `node_modules` to something else. Otherwise, due to the hoisting,
201+ // multiple Theia extensions will be picked up.
202+ if ( fs . existsSync ( join ( repoRoot , 'node_modules' ) ) ) {
203+ // We either do this or change the project structure.
204+ echo (
205+ "🔧 >>> [Hack] Renaming the root 'node_modules' folder to '.node_modules'..."
206+ ) ;
207+ mv ( '-f' , join ( repoRoot , 'node_modules' ) , join ( repoRoot , '.node_modules' ) ) ;
208+ echo (
209+ "👌 <<< [Hack] Renamed the root 'node_modules' folder to '.node_modules'."
210+ ) ;
211+ }
212+ toDispose . push ( ( ) => {
213+ if ( fs . existsSync ( join ( repoRoot , '.node_modules' ) ) ) {
214+ echo (
215+ "🔧 >>> [Restore] Renaming the root '.node_modules' folder to 'node_modules'..."
216+ ) ;
217+ mv (
218+ '-f' ,
219+ join ( repoRoot , '.node_modules' ) ,
220+ join ( repoRoot , 'node_modules' )
221+ ) ;
222+ echo (
223+ "👌 >>> [Restore] Renamed the root '.node_modules' folder to 'node_modules'."
224+ ) ;
225+ }
226+ } ) ;
227+
200228 //-------------------------------------------------------------------------------------------+
201229 // Install all private and public dependencies for the electron application and build Theia. |
202230 //-------------------------------------------------------------------------------------------+
@@ -299,6 +327,11 @@ ${fs
299327 assertNoError ( ) ;
300328 }
301329
330+ function mv ( options , source , destination ) {
331+ shell . mv ( options , source , destination ) ;
332+ assertNoError ( ) ;
333+ }
334+
302335 function mkdir ( options , ...dir ) {
303336 shell . mkdir ( options , dir ) ;
304337 assertNoError ( ) ;
0 commit comments