Skip to content

Commit a59c6c6

Browse files
author
Akos Kitta
committed
restore hack
Signed-off-by: Akos Kitta <[email protected]>
1 parent 19a0a31 commit a59c6c6

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

electron/build/template-package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"scripts": {
2121
"build": "yarn download:plugins && theia build --mode production && yarn patch",
2222
"rebuild": "yarn theia rebuild:electron",
23-
"package": "cross-env DEBUG=* USE_HARD_LINKS=false && electron-builder --publish=never",
23+
"package": "cross-env DEBUG=* && electron-builder --publish=never",
2424
"download:plugins": "theia download:plugins",
2525
"patch": "ncp ./patch/backend/main.js ./src-gen/backend/main.js"
2626
},

electron/packager/index.js

+33
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)