obsidian-plugin-config 1.6.1 β 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/obsidian-inject.js +1 -1
- package/package.json +1 -1
- package/scripts/inject-core.ts +28 -6
package/bin/obsidian-inject.js
CHANGED
package/package.json
CHANGED
package/scripts/inject-core.ts
CHANGED
|
@@ -670,15 +670,37 @@ export async function cleanNpmArtifactsIfNeeded(targetPath: string): Promise<voi
|
|
|
670
670
|
}
|
|
671
671
|
|
|
672
672
|
if (fs.existsSync(nodeModulesPath)) {
|
|
673
|
+
console.log(` β³ Removing node_modules (this may take a moment)...`);
|
|
673
674
|
try {
|
|
674
|
-
|
|
675
|
+
// Try standard rmdir first
|
|
676
|
+
execSync(`rmdir /s /q "${nodeModulesPath}"`, {
|
|
677
|
+
stdio: 'pipe',
|
|
678
|
+
windowsHide: true
|
|
679
|
+
});
|
|
680
|
+
console.log(
|
|
681
|
+
` ποΈ Removed node_modules (will be reinstalled with Yarn)`
|
|
682
|
+
);
|
|
675
683
|
} catch {
|
|
676
|
-
//
|
|
677
|
-
|
|
684
|
+
// If locked, rename it and let yarn install create a fresh one
|
|
685
|
+
try {
|
|
686
|
+
const timestamp = Date.now();
|
|
687
|
+
const oldPath = `${nodeModulesPath}.old.${timestamp}`;
|
|
688
|
+
fs.renameSync(nodeModulesPath, oldPath);
|
|
689
|
+
console.log(
|
|
690
|
+
` π Renamed locked node_modules to ${path.basename(oldPath)}`
|
|
691
|
+
);
|
|
692
|
+
console.log(
|
|
693
|
+
` π‘ You can delete it manually later when processes are closed`
|
|
694
|
+
);
|
|
695
|
+
} catch {
|
|
696
|
+
console.log(
|
|
697
|
+
` β οΈ Could not remove node_modules (files locked by running processes)`
|
|
698
|
+
);
|
|
699
|
+
console.log(
|
|
700
|
+
` π‘ Yarn will update it anyway, but close processes for clean install`
|
|
701
|
+
);
|
|
702
|
+
}
|
|
678
703
|
}
|
|
679
|
-
console.log(
|
|
680
|
-
` ποΈ Removed node_modules (will be reinstalled with Yarn)`
|
|
681
|
-
);
|
|
682
704
|
}
|
|
683
705
|
|
|
684
706
|
console.log(` β
Lock files and artifacts cleaned for fresh install`);
|