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.
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * Obsidian Plugin Config - CLI Entry Point
5
5
  * Global command: obsidian-inject
6
- * Version: 1.6.1
6
+ * Version: 1.6.2
7
7
  */
8
8
 
9
9
  import { execSync } from 'child_process';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-plugin-config",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Global CLI injection tool for Obsidian plugins",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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
- execSync(`rmdir /s /q "${nodeModulesPath}"`, { stdio: 'inherit' });
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
- // Fallback: fs.rmSync si rmdir Γ©choue
677
- fs.rmSync(nodeModulesPath, { recursive: true, force: true });
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`);