obsidian-plugin-config 1.6.2 โ†’ 1.6.4

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.
@@ -49,7 +49,14 @@
49
49
  "presentation": { "reveal": "always", "panel": "shared" },
50
50
  "problemMatcher": []
51
51
  },
52
-
52
+ {
53
+ "label": "Install/Update obsidian-inject",
54
+ "type": "shell",
55
+ "command": "npm list -g obsidian-plugin-config --depth=0 && npm install -g obsidian-plugin-config@latest --force --engine-strict=false && npm list -g obsidian-plugin-config --depth=0",
56
+ "group": "build",
57
+ "presentation": { "reveal": "always", "panel": "shared" },
58
+ "problemMatcher": []
59
+ },
53
60
  {
54
61
  "label": "Cleanup: Lint + Prettier",
55
62
  "dependsOrder": "sequence",
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * Obsidian Plugin Config - CLI Entry Point
5
5
  * Global command: obsidian-inject
6
- * Version: 1.6.2
6
+ * Version: 1.6.4
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.2",
3
+ "version": "1.6.4",
4
4
  "description": "Global CLI injection tool for Obsidian plugins",
5
5
  "type": "module",
6
6
  "bin": {
@@ -290,14 +290,18 @@ async function buildAndPublishNpm(): Promise<void> {
290
290
 
291
291
  // Optional: Update global CLI automatically
292
292
  console.log(`\n๐ŸŒ Updating global CLI...`);
293
- console.log(` โณ Waiting 15s for NPM registry propagation...`);
294
- await new Promise((resolve) => setTimeout(resolve, 15000));
295
- execSync(
296
- 'npm install -g obsidian-plugin-config@latest --force --engine-strict=false',
297
- { stdio: 'inherit' }
298
- );
299
- console.log(` โœ… Global CLI updated`);
300
-
293
+ console.log(` โณ Waiting 30s for NPM registry propagation...`);
294
+ await new Promise((resolve) => setTimeout(resolve, 30000));
295
+ try {
296
+ execSync(
297
+ 'npm install -g obsidian-plugin-config@latest --force --engine-strict=false',
298
+ { stdio: 'inherit' }
299
+ );
300
+ console.log(` โœ… Global CLI updated`);
301
+ } catch {
302
+ console.log(` โš ๏ธ Global CLI update failed (NPM registry may need more time)`);
303
+ console.log(` ๐Ÿ’ก Run manually in a few minutes: npm install -g obsidian-plugin-config@latest --force`);
304
+ }
301
305
  console.log(`\n๐ŸŽ‰ Complete workflow successful!`);
302
306
  console.log(` Test: cd any-plugin && obsidian-inject`);
303
307
  } catch (error) {
@@ -659,20 +659,10 @@ export async function cleanNpmArtifactsIfNeeded(targetPath: string): Promise<voi
659
659
  console.log(`\n๐Ÿงน Cleaning lock files and node_modules...`);
660
660
 
661
661
  try {
662
- if (hasPackageLock) {
663
- fs.unlinkSync(packageLockPath);
664
- console.log(` ๐Ÿ—‘๏ธ Removed package-lock.json`);
665
- }
666
-
667
- if (hasYarnLock) {
668
- fs.unlinkSync(yarnLockPath);
669
- console.log(` ๐Ÿ—‘๏ธ Removed yarn.lock`);
670
- }
671
-
662
+ // Remove node_modules FIRST (before lock files)
672
663
  if (fs.existsSync(nodeModulesPath)) {
673
664
  console.log(` โณ Removing node_modules (this may take a moment)...`);
674
665
  try {
675
- // Try standard rmdir first
676
666
  execSync(`rmdir /s /q "${nodeModulesPath}"`, {
677
667
  stdio: 'pipe',
678
668
  windowsHide: true
@@ -681,7 +671,7 @@ export async function cleanNpmArtifactsIfNeeded(targetPath: string): Promise<voi
681
671
  ` ๐Ÿ—‘๏ธ Removed node_modules (will be reinstalled with Yarn)`
682
672
  );
683
673
  } catch {
684
- // If locked, rename it and let yarn install create a fresh one
674
+ // If locked, rename it
685
675
  try {
686
676
  const timestamp = Date.now();
687
677
  const oldPath = `${nodeModulesPath}.old.${timestamp}`;
@@ -690,21 +680,36 @@ export async function cleanNpmArtifactsIfNeeded(targetPath: string): Promise<voi
690
680
  ` ๐Ÿ”„ Renamed locked node_modules to ${path.basename(oldPath)}`
691
681
  );
692
682
  console.log(
693
- ` ๐Ÿ’ก You can delete it manually later when processes are closed`
683
+ ` ๐Ÿ’ก Delete it manually later: ${oldPath}`
694
684
  );
695
685
  } catch {
696
686
  console.log(
697
- ` โš ๏ธ Could not remove node_modules (files locked by running processes)`
687
+ ` โš ๏ธ Could not remove/rename node_modules (locked by processes)`
698
688
  );
699
689
  console.log(
700
- ` ๐Ÿ’ก Yarn will update it anyway, but close processes for clean install`
690
+ ` ๐Ÿ’ก Close Obsidian/VSCode and run: obsidian-inject again`
701
691
  );
692
+ throw new Error('node_modules locked - close processes and retry');
702
693
  }
703
694
  }
704
695
  }
705
696
 
697
+ // Then remove lock files
698
+ if (hasPackageLock) {
699
+ fs.unlinkSync(packageLockPath);
700
+ console.log(` ๐Ÿ—‘๏ธ Removed package-lock.json`);
701
+ }
702
+
703
+ if (hasYarnLock) {
704
+ fs.unlinkSync(yarnLockPath);
705
+ console.log(` ๐Ÿ—‘๏ธ Removed yarn.lock`);
706
+ }
707
+
706
708
  console.log(` โœ… Lock files and artifacts cleaned for fresh install`);
707
709
  } catch (error) {
710
+ if (error instanceof Error && error.message.includes('locked')) {
711
+ throw error;
712
+ }
708
713
  console.error(` โŒ Failed to clean artifacts: ${error}`);
709
714
  console.log(
710
715
  ` ๐Ÿ’ก You may need to manually remove package-lock.json, yarn.lock and node_modules`