obsidian-plugin-config 1.0.3 → 1.0.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/package.json +2 -2
- package/scripts/esbuild.config.ts +9 -0
- package/scripts/inject-path.ts +13 -0
- package/src/main_test.ts +5 -5
- package/src/test-centralized-utils.ts +19 -19
- package/versions.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obsidian-plugin-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Système d'injection pour plugins Obsidian autonomes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"help": "tsx scripts/help.ts",
|
|
33
33
|
"h": "tsx scripts/help.ts",
|
|
34
34
|
"dev": "tsx scripts/esbuild.config.ts",
|
|
35
|
-
"build": "tsc -noEmit -skipLibCheck
|
|
35
|
+
"build": "tsc -noEmit -skipLibCheck",
|
|
36
36
|
"real": "tsx scripts/esbuild.config.ts production real",
|
|
37
37
|
"bacp": "tsx scripts/acp.ts -b",
|
|
38
38
|
"release": "tsx scripts/release.ts",
|
|
@@ -5,6 +5,7 @@ import { config } from "dotenv";
|
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { readFileSync } from "fs";
|
|
7
7
|
import { rm } from "fs/promises";
|
|
8
|
+
import fs from "fs";
|
|
8
9
|
import { isValidPath, copyFilesToTargetDir, askQuestion, createReadlineInterface } from "./utils.js";
|
|
9
10
|
|
|
10
11
|
// Determine the plugin directory (where the script is called from)
|
|
@@ -102,6 +103,14 @@ function getVaultPath(vaultPath: string): string {
|
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
const manifestPath = path.join(pluginDir, "manifest.json");
|
|
106
|
+
|
|
107
|
+
// Check if manifest exists (for plugin-config itself, it might not exist)
|
|
108
|
+
if (!fs.existsSync(manifestPath)) {
|
|
109
|
+
console.log("⚠️ No manifest.json found - this script is designed for Obsidian plugins");
|
|
110
|
+
console.log(" If you're building plugin-config itself, use 'tsc' instead");
|
|
111
|
+
process.exit(0);
|
|
112
|
+
}
|
|
113
|
+
|
|
105
114
|
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
106
115
|
|
|
107
116
|
config();
|
package/scripts/inject-path.ts
CHANGED
|
@@ -220,7 +220,9 @@ async function updatePackageJson(targetPath: string): Promise<void> {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
try {
|
|
223
|
+
console.log(` 🔍 Reading package.json from: ${packageJsonPath}`);
|
|
223
224
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
225
|
+
console.log(` 🔍 Original package name: ${packageJson.name}`);
|
|
224
226
|
|
|
225
227
|
// Update scripts
|
|
226
228
|
packageJson.scripts = {
|
|
@@ -291,6 +293,11 @@ async function updatePackageJson(targetPath: string): Promise<void> {
|
|
|
291
293
|
// Debug: verify package.json was written correctly
|
|
292
294
|
console.log(` 🔍 Package name: ${packageJson.name}`);
|
|
293
295
|
|
|
296
|
+
// CRITICAL DEBUG: Re-read the file to verify what was actually written
|
|
297
|
+
const verifyContent = fs.readFileSync(packageJsonPath, 'utf8');
|
|
298
|
+
const verifyJson = JSON.parse(verifyContent);
|
|
299
|
+
console.log(` 🔍 VERIFICATION - File actually contains: ${verifyJson.name}`);
|
|
300
|
+
|
|
294
301
|
} catch (error) {
|
|
295
302
|
console.error(` ❌ Failed to update package.json: ${error}`);
|
|
296
303
|
}
|
|
@@ -417,6 +424,12 @@ export async function performInjection(targetPath: string): Promise<void> {
|
|
|
417
424
|
// Step 5: Install dependencies
|
|
418
425
|
await runYarnInstall(targetPath);
|
|
419
426
|
|
|
427
|
+
// FINAL DEBUG: Check package.json one last time
|
|
428
|
+
const finalPackageJsonPath = path.join(targetPath, "package.json");
|
|
429
|
+
const finalContent = fs.readFileSync(finalPackageJsonPath, 'utf8');
|
|
430
|
+
const finalJson = JSON.parse(finalContent);
|
|
431
|
+
console.log(`\n🔍 FINAL CHECK - Package name at end: ${finalJson.name}`);
|
|
432
|
+
|
|
420
433
|
console.log(`\n✅ Injection completed successfully!`);
|
|
421
434
|
console.log(`\n📋 Next steps:`);
|
|
422
435
|
console.log(` 1. cd ${targetPath}`);
|
package/src/main_test.ts
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
Setting,
|
|
6
6
|
Notice
|
|
7
7
|
} from "obsidian";
|
|
8
|
-
import { showConfirmModal } from "./modals/GenericConfirmModal.
|
|
9
|
-
import { showTestMessage, getRandomEmoji } from "obsidian-plugin-config/tools";
|
|
8
|
+
import { showConfirmModal } from "./modals/GenericConfirmModal.js";
|
|
9
|
+
// import { showTestMessage, getRandomEmoji } from "obsidian-plugin-config/tools";
|
|
10
10
|
|
|
11
11
|
interface MyPluginSettings {
|
|
12
12
|
mySetting: string;
|
|
@@ -39,9 +39,9 @@ export default class MyPlugin extends Plugin {
|
|
|
39
39
|
id: 'test-tools',
|
|
40
40
|
name: 'Test Centralized Tools',
|
|
41
41
|
callback: () => {
|
|
42
|
-
const message = showTestMessage();
|
|
43
|
-
const emoji = getRandomEmoji();
|
|
44
|
-
new Notice(
|
|
42
|
+
// const message = showTestMessage();
|
|
43
|
+
// const emoji = getRandomEmoji();
|
|
44
|
+
new Notice(`🎯 Test centralized tools (commented for autonomous mode)`);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
// Simple test file to verify centralized utils work
|
|
2
|
-
import { NoticeHelper } from "obsidian-plugin-config/utils";
|
|
2
|
+
// import { NoticeHelper } from "obsidian-plugin-config/utils";
|
|
3
3
|
|
|
4
4
|
export function testCentralizedUtils(): void {
|
|
5
|
-
console.log("🧪 Testing centralized utils...");
|
|
6
|
-
|
|
7
|
-
// Test different notice types
|
|
8
|
-
NoticeHelper.success("✅ Centralized utils are working!");
|
|
9
|
-
|
|
10
|
-
setTimeout(() => {
|
|
11
|
-
|
|
12
|
-
}, 1000);
|
|
13
|
-
|
|
14
|
-
setTimeout(() => {
|
|
15
|
-
|
|
16
|
-
}, 2000);
|
|
17
|
-
|
|
18
|
-
setTimeout(() => {
|
|
19
|
-
|
|
20
|
-
}, 3000);
|
|
21
|
-
|
|
22
|
-
console.log("✅ All centralized utils tests completed!");
|
|
5
|
+
console.log("🧪 Testing centralized utils (commented for autonomous mode)...");
|
|
6
|
+
|
|
7
|
+
// Test different notice types (commented for autonomous mode)
|
|
8
|
+
// NoticeHelper.success("✅ Centralized utils are working!");
|
|
9
|
+
|
|
10
|
+
// setTimeout(() => {
|
|
11
|
+
// NoticeHelper.info("ℹ️ This notice comes from the centralized config");
|
|
12
|
+
// }, 1000);
|
|
13
|
+
|
|
14
|
+
// setTimeout(() => {
|
|
15
|
+
// NoticeHelper.warning("⚠️ This is a warning from centralized utils");
|
|
16
|
+
// }, 2000);
|
|
17
|
+
|
|
18
|
+
// setTimeout(() => {
|
|
19
|
+
// NoticeHelper.custom("🚀", "Custom notice with rocket emoji!");
|
|
20
|
+
// }, 3000);
|
|
21
|
+
|
|
22
|
+
console.log("✅ All centralized utils tests completed (autonomous mode)!");
|
|
23
23
|
}
|