obsidian-plugin-config 1.0.2 → 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/README.md +50 -14
- package/package.json +87 -87
- 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 +3 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Obsidian Plugin Config
|
|
2
2
|
|
|
3
|
-
Système d'injection pour plugins Obsidian autonomes.
|
|
3
|
+
🎯 Système d'injection pour plugins Obsidian autonomes.
|
|
4
4
|
|
|
5
5
|
## Installation Globale
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ npm install -g obsidian-plugin-config
|
|
|
10
10
|
|
|
11
11
|
## Utilisation
|
|
12
12
|
|
|
13
|
-
### Injection dans
|
|
13
|
+
### Injection dans le répertoire courant
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
cd votre-plugin-obsidian
|
|
@@ -20,26 +20,62 @@ obsidian-inject
|
|
|
20
20
|
### Injection par chemin
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
obsidian-inject
|
|
23
|
+
obsidian-inject ../mon-plugin
|
|
24
|
+
obsidian-inject "C:\chemin\vers\plugin"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Aide
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
obsidian-inject --help
|
|
24
31
|
```
|
|
25
32
|
|
|
26
33
|
## Ce qui est injecté
|
|
27
34
|
|
|
28
|
-
- **Scripts locaux** : esbuild.config.ts
|
|
29
|
-
- **Configuration package.json** : scripts, dépendances, protection yarn
|
|
30
|
-
- **
|
|
31
|
-
- **Installation automatique** des dépendances
|
|
35
|
+
- ✅ **Scripts locaux autonomes** : `esbuild.config.ts`, `acp.ts`, `update-version.ts`, `utils.ts`, `help.ts`, `release.ts`
|
|
36
|
+
- ✅ **Configuration package.json** : scripts, dépendances, protection yarn obligatoire
|
|
37
|
+
- ✅ **Template tsconfig.json** : configuration TypeScript optimisée
|
|
38
|
+
- ✅ **Installation automatique** des dépendances avec yarn
|
|
39
|
+
- ✅ **Analyse des imports centralisés** avec avertissements
|
|
32
40
|
|
|
33
|
-
## Commandes disponibles
|
|
41
|
+
## Commandes disponibles après injection
|
|
34
42
|
|
|
35
43
|
```bash
|
|
36
|
-
yarn
|
|
37
|
-
yarn
|
|
38
|
-
yarn
|
|
39
|
-
yarn
|
|
40
|
-
yarn
|
|
44
|
+
yarn build # Build production
|
|
45
|
+
yarn dev # Build développement + watch
|
|
46
|
+
yarn start # Alias pour dev
|
|
47
|
+
yarn real # Build vers vault réel (nécessite REAL_VAULT)
|
|
48
|
+
yarn acp # Add-commit-push
|
|
49
|
+
yarn bacp # Build + add-commit-push
|
|
50
|
+
yarn update-version # Mise à jour version + commit + push
|
|
51
|
+
yarn v # Alias pour update-version
|
|
52
|
+
yarn release # Release GitHub
|
|
53
|
+
yarn r # Alias pour release
|
|
54
|
+
yarn help # Aide complète
|
|
55
|
+
yarn h # Alias pour help
|
|
41
56
|
```
|
|
42
57
|
|
|
43
58
|
## Architecture
|
|
44
59
|
|
|
45
|
-
|
|
60
|
+
Le plugin devient **100% AUTONOME** après injection :
|
|
61
|
+
|
|
62
|
+
- ❌ **Aucune dépendance externe** requise
|
|
63
|
+
- ✅ **Scripts intégrés localement**
|
|
64
|
+
- ✅ **Mise à jour possible** via re-injection
|
|
65
|
+
- ✅ **Protection yarn** maintenue
|
|
66
|
+
- ✅ **Compatible avec tous les plugins Obsidian**
|
|
67
|
+
|
|
68
|
+
## Développement Local (pour contributeurs)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git clone https://github.com/3C0D/obsidian-plugin-config
|
|
72
|
+
cd obsidian-plugin-config
|
|
73
|
+
yarn install
|
|
74
|
+
|
|
75
|
+
# Test injection locale
|
|
76
|
+
yarn inject ../mon-plugin --yes
|
|
77
|
+
yarn inject-prompt "../mon-plugin"
|
|
78
|
+
|
|
79
|
+
# Build package NPM
|
|
80
|
+
yarn build-npm
|
|
81
|
+
```
|
package/package.json
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
2
|
+
"name": "obsidian-plugin-config",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Système d'injection pour plugins Obsidian autonomes",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"obsidian-inject": "./bin/obsidian-inject.js"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"obsidian",
|
|
13
|
+
"obsidian-plugin",
|
|
14
|
+
"typescript",
|
|
15
|
+
"injection",
|
|
16
|
+
"autonomous",
|
|
17
|
+
"cli",
|
|
18
|
+
"development-tools",
|
|
19
|
+
"plugin-utilities"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"start": "yarn install && yarn run update-exports",
|
|
23
|
+
"update-exports": "node scripts/update-exports.js",
|
|
24
|
+
"acp": "tsx scripts/acp.ts",
|
|
25
|
+
"update-version": "tsx scripts/update-version-config.ts",
|
|
26
|
+
"v": "tsx scripts/update-version-config.ts",
|
|
27
|
+
"inject-path": "tsx scripts/inject-path.ts",
|
|
28
|
+
"inject": "tsx scripts/inject-path.ts",
|
|
29
|
+
"inject-prompt": "tsx scripts/inject-prompt.ts",
|
|
30
|
+
"build-npm": "tsx scripts/build-npm.ts",
|
|
31
|
+
"publish-npm": "tsx scripts/build-npm.ts",
|
|
32
|
+
"help": "tsx scripts/help.ts",
|
|
33
|
+
"h": "tsx scripts/help.ts",
|
|
34
|
+
"dev": "tsx scripts/esbuild.config.ts",
|
|
35
|
+
"build": "tsc -noEmit -skipLibCheck",
|
|
36
|
+
"real": "tsx scripts/esbuild.config.ts production real",
|
|
37
|
+
"bacp": "tsx scripts/acp.ts -b",
|
|
38
|
+
"release": "tsx scripts/release.ts",
|
|
39
|
+
"r": "tsx scripts/release.ts"
|
|
40
|
+
},
|
|
41
|
+
"exports": {
|
|
42
|
+
".": "./src/index.ts",
|
|
43
|
+
"./scripts/*": "./scripts/*",
|
|
44
|
+
"./modals": "./src/modals/index.ts",
|
|
45
|
+
"./tools": "./src/tools/index.ts",
|
|
46
|
+
"./utils": "./src/utils/index.ts"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^22.15.26",
|
|
50
|
+
"@types/semver": "^7.7.0",
|
|
51
|
+
"builtin-modules": "3.3.0",
|
|
52
|
+
"dedent": "^1.6.0",
|
|
53
|
+
"dotenv": "^16.4.5",
|
|
54
|
+
"esbuild": "latest",
|
|
55
|
+
"fs-extra": "^11.2.0",
|
|
56
|
+
"obsidian": "*",
|
|
57
|
+
"obsidian-typings": "^3.9.5",
|
|
58
|
+
"semver": "^7.7.2",
|
|
59
|
+
"tsx": "^4.19.4",
|
|
60
|
+
"typescript": "^5.8.2"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@types/lodash": "^4.17.17",
|
|
64
|
+
"@types/node": "^22.15.26",
|
|
65
|
+
"@types/semver": "^7.7.0",
|
|
66
|
+
"builtin-modules": "3.3.0",
|
|
67
|
+
"dedent": "^1.6.0",
|
|
68
|
+
"dotenv": "^16.4.5",
|
|
69
|
+
"esbuild": "latest",
|
|
70
|
+
"fs-extra": "^11.2.0",
|
|
71
|
+
"lodash": "^4.17.21",
|
|
72
|
+
"obsidian": "*",
|
|
73
|
+
"obsidian-typings": "^3.9.5",
|
|
74
|
+
"semver": "^7.7.2",
|
|
75
|
+
"tsx": "^4.19.4",
|
|
76
|
+
"typescript": "^5.8.2"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"npm": "please-use-yarn",
|
|
80
|
+
"yarn": ">=1.22.0",
|
|
81
|
+
"node": ">=16.0.0"
|
|
82
|
+
},
|
|
83
|
+
"repository": {
|
|
84
|
+
"type": "git",
|
|
85
|
+
"url": "https://github.com/3C0D/obsidian-plugin-config.git"
|
|
86
|
+
},
|
|
87
|
+
"author": "3C0D"
|
|
88
|
+
}
|
|
@@ -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
|
}
|