Skip to content
Source
Sign inSign up
pingdotgg/t3code

build: opt-in pnpm global store makes dev worktrees install in ~1s and delete instantly #22765

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromt3/pnpm-global-virtual-storeopened View on GitHub

Showing 10 changed files with 94 additions and 20 deletions (loading 7).

x
0 of 10 viewed, 10 left
93 additions and 20 deletionsapps/desktop/scripts/ensure-electron-runtime.mjsModified
View file
@@ -32,6 +32,7 @@
​
+// Written through a rename so a concurrent reader never sees a partial file.
function repairPathFile(electronDir, platformPath) {
const pathFile = NodePath.join(electronDir, "path.txt");
const currentPath = NodeFS.existsSync(pathFile)
@@ -39,7 +40,9 @@
: undefined;
​
if (currentPath !== platformPath) {
- NodeFS.writeFileSync(pathFile, platformPath);
+ const tempPath = `${pathFile}.${process.pid}`;
+ NodeFS.writeFileSync(tempPath, platformPath);
+ NodeFS.renameSync(tempPath, pathFile);
​
@@ -118,12 +121,17 @@
​
// electron's own installer goes through @electron/get, which reuses its
// download cache (~/.cache/electron, ~/Library/Caches/electron) and verifies
-// the bundled checksums. pnpm 11 never runs it because electron has no
-// install script, so a new worktree would otherwise download 130 MB again.
-function installFromElectronCache(electronDir) {
+// the bundled checksums. pnpm never runs it because electron has no install
+// script, so a new worktree would otherwise download 130 MB again.