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.
- package/.vscode/tasks.json +8 -1
- package/bin/obsidian-inject.js +1 -1
- package/package.json +1 -1
- package/scripts/build-npm.ts +12 -8
- package/scripts/inject-core.ts +20 -15
package/.vscode/tasks.json
CHANGED
|
@@ -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",
|
package/bin/obsidian-inject.js
CHANGED
package/package.json
CHANGED
package/scripts/build-npm.ts
CHANGED
|
@@ -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
|
|
294
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
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) {
|
package/scripts/inject-core.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
-
` ๐ก
|
|
683
|
+
` ๐ก Delete it manually later: ${oldPath}`
|
|
694
684
|
);
|
|
695
685
|
} catch {
|
|
696
686
|
console.log(
|
|
697
|
-
` โ ๏ธ Could not remove node_modules (
|
|
687
|
+
` โ ๏ธ Could not remove/rename node_modules (locked by processes)`
|
|
698
688
|
);
|
|
699
689
|
console.log(
|
|
700
|
-
` ๐ก
|
|
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`
|