obsidian-plugin-config 1.6.8 โ†’ 1.6.9

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.8
6
+ * Version: 1.6.9
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.8",
3
+ "version": "1.6.9",
4
4
  "description": "Global CLI injection tool for Obsidian plugins",
5
5
  "type": "module",
6
6
  "bin": {
@@ -661,16 +661,28 @@ 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
- 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');
664
+ console.log(` โณ Removing node_modules (this may take a moment)...`);
665
+
666
+ execSync(`rmdir /s /q "${nodeModulesPath}"`, {
667
+ stdio: 'pipe',
668
+ windowsHide: true
669
+ });
670
+
671
+ if (fs.existsSync(nodeModulesPath)) {
672
+ // rmdir failed silently (locked .exe files) - rename instead
673
+ const timestamp = Date.now();
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)`);
674
686
  }
675
687
  }
676
688
 
@@ -779,6 +791,19 @@ export async function performInjection(
779
791
  console.log(
780
792
  ` 4. yarn acp # Commit changes (or yarn bacp for build+commit)`
781
793
  );
794
+
795
+ // Check for .old directories and remind user to delete them
796
+ const oldDirs = fs.readdirSync(targetPath)
797
+ .filter(name => name.startsWith('node_modules.old.'))
798
+ .map(name => path.basename(name));
799
+
800
+ if (oldDirs.length > 0) {
801
+ console.log(`\n๐Ÿงน Cleanup reminder:`);
802
+ for (const oldDir of oldDirs) {
803
+ console.log(` ๐Ÿ—‘๏ธ Delete manually: ${oldDir}`);
804
+ }
805
+ console.log(` ๐Ÿ’ก Close all processes first, then delete these folders`);
806
+ }
782
807
  } catch (error) {
783
808
  console.error(`\nโŒ Injection failed: ${error}`);
784
809
  throw error;