obsidian-plugin-config 1.6.7 โ 1.6.8
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 +10 -42
package/bin/obsidian-inject.js
CHANGED
package/package.json
CHANGED
package/scripts/inject-core.ts
CHANGED
|
@@ -661,28 +661,16 @@ export async function cleanNpmArtifactsIfNeeded(targetPath: string): Promise<voi
|
|
|
661
661
|
try {
|
|
662
662
|
// Remove node_modules FIRST (before lock files)
|
|
663
663
|
if (fs.existsSync(nodeModulesPath)) {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
const oldPath = `${nodeModulesPath}.old.${timestamp}`;
|
|
675
|
-
try {
|
|
676
|
-
fs.renameSync(nodeModulesPath, oldPath);
|
|
677
|
-
console.log(` ๐ Renamed locked node_modules to ${path.basename(oldPath)}`);
|
|
678
|
-
console.log(` ๐ก Delete it manually later: ${oldPath}`);
|
|
679
|
-
} catch {
|
|
680
|
-
console.log(` โ ๏ธ Could not remove/rename node_modules (locked by processes)`);
|
|
681
|
-
console.log(` ๐ก Close Obsidian/VSCode and run: obsidian-inject again`);
|
|
682
|
-
throw new Error('node_modules locked - close processes and retry');
|
|
683
|
-
}
|
|
684
|
-
} else {
|
|
685
|
-
console.log(` ๐๏ธ Removed node_modules (will be reinstalled with Yarn)`);
|
|
664
|
+
const timestamp = Date.now();
|
|
665
|
+
const oldPath = `${nodeModulesPath}.old.${timestamp}`;
|
|
666
|
+
try {
|
|
667
|
+
fs.renameSync(nodeModulesPath, oldPath);
|
|
668
|
+
console.log(` ๐ Renamed node_modules to ${path.basename(oldPath)}`);
|
|
669
|
+
console.log(` ๐ก Delete it manually later: ${oldPath}`);
|
|
670
|
+
} catch {
|
|
671
|
+
console.log(` โ ๏ธ Could not rename node_modules (locked by processes)`);
|
|
672
|
+
console.log(` ๐ก Close Obsidian/VSCode and run: obsidian-inject again`);
|
|
673
|
+
throw new Error('node_modules locked - close processes and retry');
|
|
686
674
|
}
|
|
687
675
|
}
|
|
688
676
|
|
|
@@ -780,26 +768,6 @@ export async function performInjection(
|
|
|
780
768
|
|
|
781
769
|
await runYarnInstall(targetPath);
|
|
782
770
|
|
|
783
|
-
// Clean up old node_modules if yarn install succeeded
|
|
784
|
-
const oldDirs = fs.readdirSync(targetPath)
|
|
785
|
-
.filter(name => name.startsWith('node_modules.old.'))
|
|
786
|
-
.map(name => path.join(targetPath, name));
|
|
787
|
-
|
|
788
|
-
if (oldDirs.length > 0) {
|
|
789
|
-
console.log(`\n๐งน Cleaning up old node_modules...`);
|
|
790
|
-
for (const oldDir of oldDirs) {
|
|
791
|
-
try {
|
|
792
|
-
execSync(`rmdir /s /q "${oldDir}"`, {
|
|
793
|
-
stdio: 'pipe',
|
|
794
|
-
windowsHide: true
|
|
795
|
-
});
|
|
796
|
-
console.log(` ๐๏ธ Removed ${path.basename(oldDir)}`);
|
|
797
|
-
} catch {
|
|
798
|
-
console.log(` โ ๏ธ Could not remove ${path.basename(oldDir)} (delete manually)`);
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
|
|
803
771
|
console.log(`\n๐ Creating injection info...`);
|
|
804
772
|
await createInjectionInfo(targetPath);
|
|
805
773
|
|