obsidian-plugin-config 1.5.5 โ 1.5.6
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/bin/obsidian-inject.js +1 -1
- package/package.json +1 -1
- package/scripts/inject-core.ts +20 -9
- package/versions.json +2 -1
package/bin/obsidian-inject.js
CHANGED
package/package.json
CHANGED
package/scripts/inject-core.ts
CHANGED
|
@@ -608,19 +608,30 @@ export function readInjectionInfo(targetPath: string): Record<string, string> |
|
|
|
608
608
|
}
|
|
609
609
|
|
|
610
610
|
/**
|
|
611
|
-
* Clean NPM
|
|
611
|
+
* Clean NPM/Yarn lock files and node_modules to ensure fresh install
|
|
612
612
|
*/
|
|
613
613
|
export async function cleanNpmArtifactsIfNeeded(targetPath: string): Promise<void> {
|
|
614
614
|
const packageLockPath = path.join(targetPath, 'package-lock.json');
|
|
615
|
+
const yarnLockPath = path.join(targetPath, 'yarn.lock');
|
|
616
|
+
const nodeModulesPath = path.join(targetPath, 'node_modules');
|
|
615
617
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
+
const hasPackageLock = fs.existsSync(packageLockPath);
|
|
619
|
+
const hasYarnLock = fs.existsSync(yarnLockPath);
|
|
620
|
+
|
|
621
|
+
if (hasPackageLock || hasYarnLock) {
|
|
622
|
+
console.log(`\n๐งน Cleaning lock files and node_modules...`);
|
|
618
623
|
|
|
619
624
|
try {
|
|
620
|
-
|
|
621
|
-
|
|
625
|
+
if (hasPackageLock) {
|
|
626
|
+
fs.unlinkSync(packageLockPath);
|
|
627
|
+
console.log(` ๐๏ธ Removed package-lock.json`);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
if (hasYarnLock) {
|
|
631
|
+
fs.unlinkSync(yarnLockPath);
|
|
632
|
+
console.log(` ๐๏ธ Removed yarn.lock`);
|
|
633
|
+
}
|
|
622
634
|
|
|
623
|
-
const nodeModulesPath = path.join(targetPath, 'node_modules');
|
|
624
635
|
if (fs.existsSync(nodeModulesPath)) {
|
|
625
636
|
fs.rmSync(nodeModulesPath, { recursive: true, force: true });
|
|
626
637
|
console.log(
|
|
@@ -628,11 +639,11 @@ export async function cleanNpmArtifactsIfNeeded(targetPath: string): Promise<voi
|
|
|
628
639
|
);
|
|
629
640
|
}
|
|
630
641
|
|
|
631
|
-
console.log(` โ
|
|
642
|
+
console.log(` โ
Lock files and artifacts cleaned for fresh install`);
|
|
632
643
|
} catch (error) {
|
|
633
|
-
console.error(` โ Failed to clean
|
|
644
|
+
console.error(` โ Failed to clean artifacts: ${error}`);
|
|
634
645
|
console.log(
|
|
635
|
-
` ๐ก You may need to manually remove package-lock.json and node_modules`
|
|
646
|
+
` ๐ก You may need to manually remove package-lock.json, yarn.lock and node_modules`
|
|
636
647
|
);
|
|
637
648
|
}
|
|
638
649
|
}
|