obsidian-plugin-config 1.1.5 → 1.1.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/README.md CHANGED
@@ -1,117 +1,97 @@
1
1
  # Obsidian Plugin Config
2
2
 
3
- <!-- Test modification pour vérifier auto-commit -->
4
-
5
- 🎯 Système d'injection pour plugins Obsidian autonomes.
3
+ 🎯 Injection system for standalone Obsidian plugins.
6
4
 
7
5
  [![NPM Version](https://img.shields.io/npm/v/obsidian-plugin-config)](https://www.npmjs.com/package/obsidian-plugin-config)
8
6
  [![License](https://img.shields.io/npm/l/obsidian-plugin-config)](LICENSE)
9
7
 
10
- **Version actuelle : 1.0.6**
8
+ **Current version: 1.1.5**
11
9
 
12
- ## Installation Globale
10
+ ## Installation
13
11
 
14
12
  ```bash
15
13
  npm install -g obsidian-plugin-config
16
14
  ```
17
15
 
18
- ## Utilisation
19
-
20
- ### Injection dans le répertoire courant
16
+ ## Update
21
17
 
22
18
  ```bash
23
- cd votre-plugin-obsidian
24
- obsidian-inject
19
+ npm update -g obsidian-plugin-config
25
20
  ```
26
21
 
27
- ### Injection par chemin
28
-
29
- ```bash
30
- obsidian-inject ../mon-plugin
31
- obsidian-inject "C:\chemin\vers\plugin"
32
- ```
22
+ ## Commands
33
23
 
34
- ### Vérification (sans injection)
24
+ ### For Plugin Config Development
35
25
 
36
26
  ```bash
37
- # Vérifier si un plugin est déjà injecté (avec info de version)
38
- yarn check-plugin ../mon-plugin
39
- yarn verify-plugin ../mon-plugin # alias
27
+ # Development
28
+ yarn start # Install dependencies + update exports
29
+ yarn build # Build the project
30
+ yarn dev # Development build
31
+ yarn real # Build to real vault
32
+
33
+ # Git Operations
34
+ yarn acp # Add, commit, push
35
+ yarn bacp # Build + add, commit, push
36
+ yarn v # Update version
37
+
38
+ # NPM Publishing
39
+ yarn build-npm # Build NPM package
40
+ yarn publish-npm # Publish to NPM
41
+
42
+ # Help
43
+ yarn help # Show help
40
44
  ```
41
45
 
42
- ### Aide
46
+ ### For Plugin Injection
43
47
 
44
48
  ```bash
45
- obsidian-inject --help
46
- ```
47
-
48
- ## Ce qui est injecté
49
-
50
- - ✅ **Scripts locaux autonomes** : `esbuild.config.ts`, `acp.ts`, `update-version.ts`, `utils.ts`, `help.ts`, `release.ts`
51
- - ✅ **Configuration package.json** : scripts, dépendances, protection yarn obligatoire, `"type": "module"` pour ESM
52
- - ✅ **Template tsconfig.json** : configuration TypeScript moderne optimisée
53
- - ✅ **Installation automatique** des dépendances avec yarn
54
- - ✅ **Analyse des imports centralisés** avec avertissements
55
- - ✅ **Fichier de traçabilité** : `.injection-info.json` (version, date d'injection)
56
-
57
- ## 📋 Suivi des versions d'injection
58
-
59
- Le système crée un fichier `.injection-info.json` dans chaque plugin injecté pour tracer :
60
-
61
- - **Version de l'injecteur** utilisée
62
- - **Date d'injection**
63
- - **Nom de l'injecteur** (`obsidian-plugin-config`)
64
-
65
- > ⚠️ **Important** : Le fichier `.injection-info.json` est **commité avec le plugin** pour assurer la traçabilité sur GitHub et permettre de voir facilement qu'un plugin a été injecté et avec quelle version.
66
-
67
- ### Statuts possibles lors de la vérification
68
-
69
- - ✅ **Plugin injecté** : Affiche version, date et détecte les mises à jour disponibles
70
- - ⚠️ **Plugin injecté (legacy)** : Injecté avec l'ancien système, re-injection recommandée
71
- - ❌ **Plugin non injecté** : Aucune injection détectée
72
-
73
- ## ⚠️ Configuration ESM Moderne
74
-
75
- Le système utilise une configuration TypeScript moderne avec ESM. Si votre plugin a des imports relatifs, vous devrez peut-être les corriger :
49
+ # Interactive injection (recommended)
50
+ obsidian-inject
51
+ obsidian-inject ../my-plugin
52
+ yarn inject-prompt "../my-plugin"
76
53
 
77
- ```typescript
78
- // Ancien format
79
- import { helper } from "./MyHelper";
54
+ # Automatic injection
55
+ obsidian-inject ../my-plugin --yes
56
+ yarn inject-path ../my-plugin --yes
80
57
 
81
- // Format ESM requis
82
- import { helper } from "./MyHelper.js";
58
+ # Verification only
59
+ yarn check-plugin ../my-plugin
83
60
  ```
84
61
 
85
- Cette correction est nécessaire une seule fois après l'injection.
62
+ ## What is injected
63
+
64
+ - ✅ **Standalone local scripts**: `esbuild.config.ts`, `acp.ts`, `update-version.ts`, etc.
65
+ - ✅ **package.json configuration**: scripts, dependencies, yarn protection
66
+ - ✅ **tsconfig.json template**: modern optimized TypeScript configuration
67
+ - ✅ **Automatic installation** of dependencies with yarn
68
+ - ✅ **Traceability file**: `.injection-info.json` (version, injection date)
86
69
 
87
- ## Commandes disponibles après injection
70
+ ## Commands available after injection
88
71
 
89
72
  ```bash
90
- yarn build # Build production
91
- yarn dev # Build développement + watch
92
- yarn start # Alias pour dev
93
- yarn real # Build vers vault réel (nécessite REAL_VAULT)
73
+ yarn build # Production build
74
+ yarn dev # Development build + watch
75
+ yarn start # Install dependencies + start dev
76
+ yarn real # Build to real vault
94
77
  yarn acp # Add-commit-push
95
78
  yarn bacp # Build + add-commit-push
96
- yarn update-version # Mise à jour version + commit + push
97
- yarn v # Alias pour update-version
98
- yarn release # Release GitHub
99
- yarn r # Alias pour release
100
- yarn help # Aide complète
101
- yarn h # Alias pour help
79
+ yarn v # Update version
80
+ yarn release # GitHub release
81
+ yarn help # Full help
102
82
  ```
103
83
 
104
84
  ## Architecture
105
85
 
106
- Le plugin devient **100% AUTONOME** après injection :
86
+ The plugin becomes **100% STANDALONE** after injection:
107
87
 
108
- - ❌ **Aucune dépendance externe** requise
109
- - ✅ **Scripts intégrés localement**
110
- - ✅ **Mise à jour possible** via re-injection
111
- - ✅ **Protection yarn** maintenue
112
- - ✅ **Compatible avec tous les plugins Obsidian**
88
+ - ❌ **No external dependencies** required
89
+ - ✅ **Scripts integrated locally**
90
+ - ✅ **Updatable** via re-injection
91
+ - ✅ **Yarn protection** maintained
92
+ - ✅ **Compatible with all Obsidian plugins**
113
93
 
114
- ## Développement Local (pour contributeurs)
94
+ ## Local Development (for contributors)
115
95
 
116
96
  ### Installation
117
97
 
@@ -121,37 +101,37 @@ cd obsidian-plugin-config
121
101
  yarn install
122
102
  ```
123
103
 
124
- ### Test injection locale
104
+ ### Local injection test
125
105
 
126
106
  ```bash
127
- # Injection automatique
128
- yarn inject ../mon-plugin --yes
107
+ # Automatic injection
108
+ yarn inject ../my-plugin --yes
129
109
 
130
- # Injection avec prompts
131
- yarn inject-prompt "../mon-plugin"
110
+ # Injection with prompts
111
+ yarn inject-prompt "../my-plugin"
132
112
  ```
133
113
 
134
- ### Workflow complet : Local → NPM
114
+ ### Full workflow: Local → NPM
135
115
 
136
116
  ```bash
137
- # 1. Développement local
117
+ # 1. Local development
138
118
  yarn inject ../test-plugin --yes
139
119
 
140
- # 2. Corriger imports ESM si nécessaire
141
- # Exemple: "./utils.ts" → "./utils.js"
120
+ # 2. Fix ESM imports if necessary
121
+ # Example: "./utils.ts" → "./utils.js"
142
122
 
143
- # 3. Build et publication NPM
123
+ # 3. Build and publish to NPM
144
124
  yarn build-npm
145
125
  yarn update-version
146
126
  npm login
147
127
  npm publish
148
128
  ```
149
129
 
150
- ### Commandes de maintenance
130
+ ### Maintenance commands
151
131
 
152
132
  ```bash
153
133
  yarn acp # Add, commit, push
154
- yarn update-version # Mise à jour version
155
- yarn build-npm # Build package NPM
156
- yarn help # Aide complète
134
+ yarn update-version # Update version
135
+ yarn build-npm # Build NPM package
136
+ yarn help # Full help
157
137
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-plugin-config",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Système d'injection pour plugins Obsidian autonomes",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -20,26 +20,25 @@
20
20
  ],
21
21
  "scripts": {
22
22
  "start": "yarn install && yarn run update-exports",
23
+ "i": "yarn install && yarn run update-exports",
23
24
  "update-exports": "node scripts/update-exports.js",
25
+ "ue": "node scripts/update-exports.js",
24
26
  "acp": "tsx scripts/acp.ts",
27
+ "bacp": "tsx scripts/acp.ts -b",
25
28
  "update-version": "tsx scripts/update-version-config.ts",
26
29
  "v": "tsx scripts/update-version-config.ts",
30
+ "build": "tsc -noEmit -skipLibCheck",
31
+ "dev": "tsx scripts/esbuild.config.ts",
32
+ "real": "tsx scripts/esbuild.config.ts production real",
33
+ "lint": "eslint . --ext .ts",
34
+ "lint:fix": "eslint . --ext .ts --fix",
27
35
  "inject-path": "tsx scripts/inject-path.ts",
28
- "inject": "tsx scripts/inject-path.ts",
29
36
  "inject-prompt": "tsx scripts/inject-prompt.ts",
30
37
  "check-plugin": "tsx scripts/inject-path.ts --dry-run",
31
38
  "build-npm": "tsx scripts/build-npm.ts",
32
39
  "publish-npm": "tsx scripts/build-npm.ts",
33
40
  "help": "tsx scripts/help.ts",
34
- "h": "tsx scripts/help.ts",
35
- "lint": "eslint . --ext .ts",
36
- "lint:fix": "eslint . --ext .ts --fix",
37
- "dev": "tsx scripts/esbuild.config.ts",
38
- "build": "tsc -noEmit -skipLibCheck",
39
- "real": "tsx scripts/esbuild.config.ts production real",
40
- "bacp": "tsx scripts/acp.ts -b",
41
- "release": "tsx scripts/release.ts",
42
- "r": "tsx scripts/release.ts"
41
+ "h": "tsx scripts/help.ts"
43
42
  },
44
43
  "exports": {
45
44
  ".": "./src/index.ts",
@@ -94,4 +93,4 @@
94
93
  "url": "https://github.com/3C0D/obsidian-plugin-config.git"
95
94
  },
96
95
  "author": "3C0D"
97
- }
96
+ }
package/src/main.ts ADDED
@@ -0,0 +1,106 @@
1
+ import {
2
+ App,
3
+ Plugin,
4
+ PluginSettingTab,
5
+ Setting,
6
+ Notice
7
+ } from "obsidian";
8
+ import { showConfirmModal } from "./modals/GenericConfirmModal.ts";
9
+ // import { showTestMessage, getRandomEmoji } from "obsidian-plugin-config/tools";
10
+
11
+ interface MyPluginSettings {
12
+ mySetting: string;
13
+ }
14
+
15
+ const DEFAULT_SETTINGS: MyPluginSettings = {
16
+ mySetting: "default"
17
+ };
18
+
19
+ export default class MyPlugin extends Plugin {
20
+ settings: MyPluginSettings;
21
+
22
+ async onload(): Promise<void> {
23
+ console.log("loading plugin");
24
+ await this.loadSettings();
25
+
26
+ this.addCommand({
27
+ id: 'show-confirmation-modal',
28
+ name: 'Show Confirmation Modal (Local)',
29
+ callback: () => this.showConfirmationModal()
30
+ });
31
+
32
+ this.addCommand({
33
+ id: 'show-centralized-modal',
34
+ name: 'Show Confirmation Modal (Centralized)',
35
+ callback: () => this.showCentralizedModal()
36
+ });
37
+
38
+ this.addCommand({
39
+ id: 'test-tools',
40
+ name: 'Test Centralized Tools',
41
+ callback: () => {
42
+ // const message = showTestMessage();
43
+ // const emoji = getRandomEmoji();
44
+ new Notice(`🎯 Test centralized tools (commented for autonomous mode)`);
45
+ }
46
+ });
47
+
48
+ this.addSettingTab(new SampleSettingTab(this.app, this));
49
+ }
50
+
51
+ private showConfirmationModal(): void {
52
+ showConfirmModal(this.app, {
53
+ title: "Confirmation requise",
54
+ message: "Êtes-vous sûr de vouloir effectuer cette action ? Cette action ne peut pas être annulée.",
55
+ confirmText: "Confirmer",
56
+ cancelText: "Annuler",
57
+ onConfirm: () => {
58
+ new Notice("Action confirmée !");
59
+ console.log("Action confirmée par l'utilisateur");
60
+ },
61
+ onCancel: () => {
62
+ new Notice("Action annulée.");
63
+ console.log("Action annulée par l'utilisateur");
64
+ }
65
+ });
66
+ }
67
+
68
+ private showCentralizedModal(): void {
69
+ showConfirmModal(this.app, {
70
+ title: "Centralized Modal Test",
71
+ message: "This modal comes from the centralized configuration! Pretty cool, right?",
72
+ confirmText: "Awesome!",
73
+ cancelText: "Not bad",
74
+ onConfirm: () => {
75
+ new Notice("Centralized modal confirmed! 🎉");
76
+ },
77
+ onCancel: () => {
78
+ new Notice("Centralized modal cancelled 😢");
79
+ }
80
+ });
81
+ }
82
+
83
+ async loadSettings(): Promise<void> {
84
+ this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
85
+ }
86
+
87
+ async saveSettings(): Promise<void> {
88
+ await this.saveData(this.settings);
89
+ }
90
+ }
91
+
92
+ class SampleSettingTab extends PluginSettingTab {
93
+ plugin: MyPlugin;
94
+
95
+ constructor(app: App, plugin: MyPlugin) {
96
+ super(app, plugin);
97
+ this.plugin = plugin;
98
+ }
99
+
100
+ display(): void {
101
+ const { containerEl } = this;
102
+ containerEl.empty();
103
+ new Setting(containerEl);
104
+ }
105
+ }
106
+
package/versions.json CHANGED
@@ -9,5 +9,6 @@
9
9
  "1.0.7": "1.8.9",
10
10
  "1.0.8": "1.8.9",
11
11
  "1.0.9": "1.8.9",
12
- "1.0.10": "1.8.9"
12
+ "1.0.10": "1.8.9",
13
+ "1.1.6": "1.8.9"
13
14
  }
package/src/main_test.ts DELETED
File without changes
@@ -1,23 +0,0 @@
1
- // Simple test file to verify centralized utils work
2
- // import { NoticeHelper } from "obsidian-plugin-config/utils";
3
-
4
- export function testCentralizedUtils(): void {
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
- }