obsidian-plugin-config 1.5.5 โ 1.5.7
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/templates/package.json +11 -12
- package/templates/scripts/release.ts +15 -4
- package/versions.json +3 -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
|
}
|
package/templates/package.json
CHANGED
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
},
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "yarn install && yarn dev",
|
|
9
|
-
"dev": "tsx scripts/esbuild.config.ts",
|
|
10
|
-
"build": "tsc -noEmit -skipLibCheck && tsx scripts/esbuild.config.ts production",
|
|
11
|
-
"real": "tsx scripts/esbuild.config.ts production real",
|
|
12
|
-
"acp": "tsx scripts/acp.ts",
|
|
13
|
-
"bacp": "tsx scripts/acp.ts -b",
|
|
14
|
-
"update-version": "tsx scripts/update-version.ts",
|
|
15
|
-
"v": "tsx scripts/update-version.ts",
|
|
16
|
-
"release": "tsx scripts/release.ts",
|
|
17
|
-
"r": "tsx scripts/release.ts",
|
|
18
|
-
"help": "tsx scripts/help.ts",
|
|
19
|
-
"h": "tsx scripts/help.ts",
|
|
9
|
+
"dev": "npx tsx scripts/esbuild.config.ts",
|
|
10
|
+
"build": "tsc -noEmit -skipLibCheck && npx tsx scripts/esbuild.config.ts production",
|
|
11
|
+
"real": "npx tsx scripts/esbuild.config.ts production real",
|
|
12
|
+
"acp": "npx tsx scripts/acp.ts",
|
|
13
|
+
"bacp": "npx tsx scripts/acp.ts -b",
|
|
14
|
+
"update-version": "npx tsx scripts/update-version.ts",
|
|
15
|
+
"v": "npx tsx scripts/update-version.ts",
|
|
16
|
+
"release": "npx tsx scripts/release.ts",
|
|
17
|
+
"r": "npx tsx scripts/release.ts",
|
|
18
|
+
"help": "npx tsx scripts/help.ts",
|
|
19
|
+
"h": "npx tsx scripts/help.ts",
|
|
20
20
|
"lint": "eslint . --ext .ts",
|
|
21
21
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
22
22
|
"prettier": "npx prettier --check '**/*.{ts,json}'",
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"eslint-import-resolver-typescript": "latest",
|
|
37
37
|
"jiti": "latest",
|
|
38
38
|
"obsidian": "*",
|
|
39
|
-
"obsidian-plugin-config": "latest",
|
|
40
39
|
"obsidian-typings": "latest",
|
|
41
40
|
"prettier": "latest",
|
|
42
41
|
"semver": "latest",
|
|
@@ -22,10 +22,21 @@ async function createReleaseNotesFile(tagMessage: string, tag: string): Promise<
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async function handleExistingTag(tag: string): Promise<boolean> {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
// Get the existing tag message to show to the user
|
|
26
|
+
let existingMessage = '';
|
|
27
|
+
try {
|
|
28
|
+
existingMessage = execSync(`git tag -l -n999 ${tag}`, { encoding: 'utf8' }).trim();
|
|
29
|
+
} catch {
|
|
30
|
+
// If we can't get the message, continue anyway
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let prompt = `Tag ${tag} already exists.`;
|
|
34
|
+
if (existingMessage) {
|
|
35
|
+
prompt += `\n\nExisting tag message:\n${existingMessage}\n`;
|
|
36
|
+
}
|
|
37
|
+
prompt += `\nDo you want to replace it?`;
|
|
38
|
+
|
|
39
|
+
const confirmed = await askConfirmation(prompt, rl);
|
|
29
40
|
|
|
30
41
|
if (!confirmed) {
|
|
31
42
|
console.log('Operation aborted');
|