obsidian-plugin-config 1.6.3 โ 1.6.5
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/inject-core.ts +20 -15
- package/scripts/inject-path.ts +13 -1
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/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`
|
package/scripts/inject-path.ts
CHANGED
|
@@ -17,7 +17,19 @@ const rl = createReadlineInterface();
|
|
|
17
17
|
|
|
18
18
|
async function main(): Promise<void> {
|
|
19
19
|
try {
|
|
20
|
-
|
|
20
|
+
// Show version
|
|
21
|
+
const configRoot = findPluginConfigRoot();
|
|
22
|
+
let version = 'unknown';
|
|
23
|
+
try {
|
|
24
|
+
const pkg = JSON.parse(
|
|
25
|
+
fs.readFileSync(path.join(configRoot, 'package.json'), 'utf8')
|
|
26
|
+
);
|
|
27
|
+
version = pkg.version || 'unknown';
|
|
28
|
+
} catch {
|
|
29
|
+
// Ignore
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log(`๐ฏ Obsidian Plugin Config - Local Injection Tool v${version}`);
|
|
21
33
|
console.log(`๐ฅ Inject autonomous configuration from local files\n`);
|
|
22
34
|
|
|
23
35
|
const args = process.argv.slice(2);
|