obsidian-plugin-config 1.0.5 → 1.1.0

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.
Files changed (47) hide show
  1. package/README.md +80 -4
  2. package/docs/injection-strategy-analysis.md +277 -0
  3. package/eslint.config.mts +54 -0
  4. package/package.json +10 -1
  5. package/scripts/acp.ts +5 -1
  6. package/scripts/build-npm.ts +9 -11
  7. package/scripts/help.ts +31 -132
  8. package/scripts/inject-path.ts +313 -19
  9. package/scripts/inject-prompt.ts +119 -5
  10. package/scripts/release.ts +9 -2
  11. package/scripts/update-version-config.ts +1 -1
  12. package/scripts/update-version.ts +4 -1
  13. package/scripts/utils.ts +26 -0
  14. package/src/main.ts +74 -0
  15. package/templates/.github/workflows/release-body.md +14 -0
  16. package/templates/.github/workflows/release.yml +47 -0
  17. package/templates/{eslint.config.ts → eslint.config.mts} +6 -3
  18. package/templates/help-plugin.ts +43 -31
  19. package/{test-plugin → templates}/scripts/acp.ts +6 -2
  20. package/templates/scripts/esbuild.config.ts +320 -0
  21. package/templates/scripts/help.ts +51 -0
  22. package/{test-plugin → templates}/scripts/release.ts +10 -3
  23. package/{test-plugin-v2 → templates}/scripts/update-version.ts +5 -2
  24. package/{test-plugin → templates}/scripts/utils.ts +26 -0
  25. package/templates/{tsconfig.json → tsconfig-template.json} +4 -0
  26. package/tsconfig.json +26 -23
  27. package/versions.json +3 -1
  28. package/obsidian-plugin-config-1.0.2.tgz +0 -0
  29. package/src/main_test.ts +0 -106
  30. package/test-plugin/manifest.json +0 -10
  31. package/test-plugin/package.json +0 -38
  32. package/test-plugin/scripts/esbuild.config.ts +0 -165
  33. package/test-plugin/scripts/help.ts +0 -29
  34. package/test-plugin/scripts/update-version.ts +0 -102
  35. package/test-plugin/src/main.ts +0 -11
  36. package/test-plugin/yarn.lock +0 -386
  37. package/test-plugin-v2/main.js +0 -5
  38. package/test-plugin-v2/manifest.json +0 -10
  39. package/test-plugin-v2/package.json +0 -40
  40. package/test-plugin-v2/scripts/acp.ts +0 -71
  41. package/test-plugin-v2/scripts/esbuild.config.ts +0 -165
  42. package/test-plugin-v2/scripts/help.ts +0 -29
  43. package/test-plugin-v2/scripts/release.ts +0 -97
  44. package/test-plugin-v2/scripts/utils.ts +0 -117
  45. package/test-plugin-v2/src/main.ts +0 -11
  46. package/test-plugin-v2/tsconfig.json +0 -31
  47. package/test-plugin-v2/yarn.lock +0 -1986
package/README.md CHANGED
@@ -1,7 +1,14 @@
1
1
  # Obsidian Plugin Config
2
2
 
3
+ <!-- Test modification pour vérifier auto-commit -->
4
+
3
5
  🎯 Système d'injection pour plugins Obsidian autonomes.
4
6
 
7
+ [![NPM Version](https://img.shields.io/npm/v/obsidian-plugin-config)](https://www.npmjs.com/package/obsidian-plugin-config)
8
+ [![License](https://img.shields.io/npm/l/obsidian-plugin-config)](LICENSE)
9
+
10
+ **Version actuelle : 1.0.6**
11
+
5
12
  ## Installation Globale
6
13
 
7
14
  ```bash
@@ -24,6 +31,14 @@ obsidian-inject ../mon-plugin
24
31
  obsidian-inject "C:\chemin\vers\plugin"
25
32
  ```
26
33
 
34
+ ### Vérification (sans injection)
35
+
36
+ ```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
40
+ ```
41
+
27
42
  ### Aide
28
43
 
29
44
  ```bash
@@ -33,10 +48,41 @@ obsidian-inject --help
33
48
  ## Ce qui est injecté
34
49
 
35
50
  - ✅ **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
51
+ - ✅ **Configuration package.json** : scripts, dépendances, protection yarn obligatoire, `"type": "module"` pour ESM
52
+ - ✅ **Template tsconfig.json** : configuration TypeScript moderne optimisée
38
53
  - ✅ **Installation automatique** des dépendances avec yarn
39
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 :
76
+
77
+ ```typescript
78
+ // ❌ Ancien format
79
+ import { helper } from "./MyHelper";
80
+
81
+ // ✅ Format ESM requis
82
+ import { helper } from "./MyHelper.js";
83
+ ```
84
+
85
+ Cette correction est nécessaire une seule fois après l'injection.
40
86
 
41
87
  ## Commandes disponibles après injection
42
88
 
@@ -67,15 +113,45 @@ Le plugin devient **100% AUTONOME** après injection :
67
113
 
68
114
  ## Développement Local (pour contributeurs)
69
115
 
116
+ ### Installation
117
+
70
118
  ```bash
71
119
  git clone https://github.com/3C0D/obsidian-plugin-config
72
120
  cd obsidian-plugin-config
73
121
  yarn install
122
+ ```
74
123
 
75
- # Test injection locale
124
+ ### Test injection locale
125
+
126
+ ```bash
127
+ # Injection automatique
76
128
  yarn inject ../mon-plugin --yes
129
+
130
+ # Injection avec prompts
77
131
  yarn inject-prompt "../mon-plugin"
132
+ ```
78
133
 
79
- # Build package NPM
134
+ ### Workflow complet : Local → NPM
135
+
136
+ ```bash
137
+ # 1. Développement local
138
+ yarn inject ../test-plugin --yes
139
+
140
+ # 2. Corriger imports ESM si nécessaire
141
+ # Exemple: "./utils.ts" → "./utils.js"
142
+
143
+ # 3. Build et publication NPM
80
144
  yarn build-npm
145
+ yarn update-version
146
+ npm login
147
+ npm publish
148
+ ```
149
+
150
+ ### Commandes de maintenance
151
+
152
+ ```bash
153
+ 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
81
157
  ```
@@ -0,0 +1,277 @@
1
+ # Analyse des Stratégies d'Injection - Plugins Obsidian
2
+
3
+ ## Vue d'ensemble
4
+
5
+ Ce document analyse les différentes approches d'injection de code et de configuration pour les plugins Obsidian, en comparant notre système actuel avec les solutions existantes.
6
+
7
+ ## 1. Notre Approche Actuelle (obsidian-plugin-config)
8
+
9
+ ### Stratégie : Injection Dure + Package NPM
10
+
11
+ **Principe :**
12
+
13
+ - **Injection locale** : Copie physique des fichiers depuis `templates/` vers le plugin cible
14
+ - **Package NPM global** : `obsidian-inject` pour injection depuis n'importe où
15
+ - **Autonomie complète** : Aucune dépendance externe après injection
16
+
17
+ **Architecture :**
18
+
19
+ ```
20
+ obsidian-plugin-config/
21
+ ├── templates/ # Templates à injecter
22
+ │ ├── scripts/ # Scripts de build/dev
23
+ │ ├── eslint.config.mts
24
+ │ └── tsconfig-template.json
25
+ ├── src/ # Modules réutilisables (actuels)
26
+ │ ├── modals/ # GenericConfirmModal
27
+ │ ├── utils/ # NoticeHelper, SettingsHelper
28
+ │ └── tools/ # (vide actuellement)
29
+ └── scripts/ # Scripts d'injection
30
+ ├── inject-path.ts
31
+ └── inject-prompt.ts
32
+ ```
33
+
34
+ **Avantages :**
35
+
36
+ - ✅ Autonomie totale après injection
37
+ - ✅ Pas de dépendances externes
38
+ - ✅ Contrôle total sur les versions
39
+ - ✅ Fonctionne offline
40
+
41
+ **Inconvénients :**
42
+
43
+ - ❌ Duplication de code entre plugins
44
+ - ❌ Mise à jour manuelle (re-injection)
45
+ - ❌ Modules src/ non utilisés (injection dure uniquement)
46
+
47
+ ## 2. Approche mnaoumov
48
+
49
+ ### Stratégie : Generator + Package NPM + Imports
50
+
51
+ **Architecture :**
52
+
53
+ 1. **generator-obsidian-plugin** : Yeoman generator pour créer des plugins
54
+ 2. **obsidian-dev-utils** : Package NPM avec utilitaires importables
55
+ 3. **obsidian-sample-plugin-extended** : Template de référence
56
+
57
+ **Principe :**
58
+
59
+ ```javascript
60
+ // Dans le plugin généré
61
+ import { someHelper } from "obsidian-dev-utils";
62
+ ```
63
+
64
+ **Package obsidian-dev-utils :**
65
+
66
+ - CLI commands (build, lint, etc.)
67
+ - Helper functions (importables)
68
+ - Setting components
69
+ - Modals
70
+ - Debugging tools
71
+
72
+ **Avantages :**
73
+
74
+ - ✅ Mise à jour automatique via NPM
75
+ - ✅ Pas de duplication de code
76
+ - ✅ Écosystème riche (Svelte, React, SASS)
77
+ - ✅ Maintenance centralisée
78
+
79
+ **Inconvénients :**
80
+
81
+ - ❌ Dépendance externe permanente
82
+ - ❌ Risque de breaking changes
83
+ - ❌ Nécessite connexion pour updates
84
+
85
+ ## 3. Approche Officielle (obsidian-sample-plugin)
86
+
87
+ ### Stratégie : Template Simple
88
+
89
+ **Principe :**
90
+
91
+ - Template minimal fourni par Obsidian
92
+ - Fork/clone + modification manuelle
93
+ - Aucun système d'injection
94
+
95
+ **Avantages :**
96
+
97
+ - ✅ Simplicité maximale
98
+ - ✅ Contrôle total
99
+
100
+ **Inconvénients :**
101
+
102
+ - ❌ Pas de réutilisabilité
103
+ - ❌ Maintenance manuelle
104
+ - ❌ Pas d'évolution
105
+
106
+ ## 4. Comparaison des Stratégies
107
+
108
+ | Aspect | Notre Approche | mnaoumov | Officiel |
109
+ | ------------------- | ------------------- | ---------------- | -------- |
110
+ | **Réutilisabilité** | Moyenne (templates) | Élevée (imports) | Faible |
111
+ | **Autonomie** | Totale | Dépendante | Totale |
112
+ | **Maintenance** | Manuelle | Automatique | Manuelle |
113
+ | **Complexité** | Moyenne | Élevée | Faible |
114
+ | **Évolutivité** | Bonne | Excellente | Limitée |
115
+
116
+ ## 5. Problématique Actuelle
117
+
118
+ ### Modules src/ Non Exploités
119
+
120
+ Nous avons des modules dans `src/` (modals, utils) mais ils ne sont pas utilisés car :
121
+
122
+ - L'injection est "dure" (copie de fichiers)
123
+ - Pas d'imports depuis le package NPM
124
+ - Système d'exports automatique non exploité
125
+
126
+ ### Questions Stratégiques
127
+
128
+ 1. **Faut-il passer aux imports NPM ?**
129
+
130
+ - Avantages : Réutilisabilité, maintenance centralisée
131
+ - Inconvénients : Dépendance externe, complexité
132
+
133
+ 2. **Faut-il garder l'injection dure ?**
134
+
135
+ - Avantages : Autonomie, simplicité
136
+ - Inconvénients : Duplication, maintenance manuelle
137
+
138
+ 3. **Approche hybride possible ?**
139
+ - Templates pour la structure (injection dure)
140
+ - Modules pour le code réutilisable (imports NPM)
141
+
142
+ ## 6. Recommandations Stratégiques
143
+
144
+ ### Option A : Hybride (Recommandée)
145
+
146
+ - **Templates** : Scripts, configuration (injection dure)
147
+ - **Modules** : Composants réutilisables (imports NPM)
148
+ - **Avantage** : Meilleur des deux mondes
149
+
150
+ ### Option B : Full NPM (comme mnaoumov)
151
+
152
+ - Tout en imports NPM
153
+ - Dépendance externe acceptée
154
+ - Maintenance centralisée
155
+
156
+ ### Option C : Full Injection (actuel)
157
+
158
+ - Tout en injection dure
159
+ - Déplacer src/ vers templates/
160
+ - Autonomie maximale
161
+
162
+ ## 7. Découvertes de l'Historique
163
+
164
+ ### Ancienne Approche (Trouvée dans obsidian-sample-plugin-modif)
165
+
166
+ **Imports NPM découverts :**
167
+
168
+ ```javascript
169
+ // Dans src/test-centralized-utils.ts (commenté)
170
+ import { NoticeHelper } from "obsidian-plugin-config/utils";
171
+ ```
172
+
173
+ **Configuration package.json (ancienne) :**
174
+
175
+ ```json
176
+ {
177
+ "dependencies": {
178
+ "obsidian-plugin-config": "file:../obsidian-plugin-config"
179
+ }
180
+ }
181
+ ```
182
+
183
+ **Exports dans obsidian-plugin-config :**
184
+
185
+ ```json
186
+ {
187
+ "exports": {
188
+ "./modals": "./src/modals/index.ts",
189
+ "./utils": "./src/utils/index.ts",
190
+ "./tools": "./src/tools/index.ts"
191
+ }
192
+ }
193
+ ```
194
+
195
+ ### Transition Observée
196
+
197
+ 1. **Avant** : Imports NPM depuis obsidian-plugin-config
198
+ 2. **Maintenant** : Injection dure + modules copiés localement
199
+ 3. **Résultat** : Duplication des modules (src/ dans les deux repos)
200
+
201
+ ### Pattern d'Utilisation Identifié
202
+
203
+ ```javascript
204
+ // Utilisation typique (avant)
205
+ import { NoticeHelper } from "obsidian-plugin-config/utils";
206
+ import { GenericConfirmModal } from "obsidian-plugin-config/modals";
207
+
208
+ // Dans le plugin
209
+ NoticeHelper.success("✅ Action réussie !");
210
+ new GenericConfirmModal(this.app, options).open();
211
+ ```
212
+
213
+ ## 8. Prochaines Étapes
214
+
215
+ 1. ✅ **Analyser l'historique** - FAIT : Trouvé les anciens imports NPM
216
+ 2. **Décider de la stratégie** : Hybride vs Full NPM vs Full Injection
217
+ 3. **Tester l'approche choisie** sur un plugin pilote
218
+ 4. **Implémenter la solution finale**
219
+
220
+ ### Recommandation Mise à Jour
221
+
222
+ **Option A : Retour aux Imports NPM (Recommandée)**
223
+
224
+ - Réactiver les exports dans package.json
225
+ - Permettre `import { NoticeHelper } from "obsidian-plugin-config/utils"`
226
+ - Garder l'injection dure pour les scripts/config
227
+ - **Avantage** : Pas de duplication, maintenance centralisée
228
+
229
+ ## 9. État Actuel (Mise à Jour)
230
+
231
+ ### ✅ Découvertes Positives
232
+
233
+ **Infrastructure déjà en place :**
234
+
235
+ - ✅ Exports configurés dans package.json
236
+ - ✅ Script update-exports.js fonctionnel
237
+ - ✅ Modules src/ complets (modals, utils, tools)
238
+ - ✅ Index.ts auto-généré
239
+
240
+ **Test réussi sur test-sample-plugin :**
241
+
242
+ ```javascript
243
+ // Imports fonctionnels
244
+ import { NoticeHelper } from "obsidian-plugin-config/utils";
245
+ import { GenericConfirmModal } from "obsidian-plugin-config/modals";
246
+
247
+ // Configuration package.json
248
+ "obsidian-plugin-config": "file:../obsidian-plugin-config"
249
+ ```
250
+
251
+ ### 🎯 Prochaines Étapes Immédiates
252
+
253
+ 1. ✅ **Test local** - FAIT : Imports fonctionnent en local
254
+ 2. **Test NPM** - Publier version avec exports et tester
255
+ 3. **Migration plugins existants** - Ajouter imports aux plugins actuels
256
+ 4. **Documentation** - Documenter l'usage hybride
257
+
258
+ ### 🔄 Workflow Recommandé
259
+
260
+ **Phase 1 : Test Local (En Cours)**
261
+
262
+ - Injection dure + dépendance locale `file:../obsidian-plugin-config`
263
+ - Validation des imports sur plugins de test
264
+
265
+ **Phase 2 : Package NPM**
266
+
267
+ - Publier obsidian-plugin-config avec exports
268
+ - Tester `obsidian-inject` + imports NPM
269
+
270
+ **Phase 3 : Migration**
271
+
272
+ - Migrer plugins existants vers approche hybride
273
+ - Documentation complète
274
+
275
+ ---
276
+
277
+ _Document créé pour clarifier la stratégie d'injection d'obsidian-plugin-config_
@@ -0,0 +1,54 @@
1
+ import * as typescriptEslintParser from "@typescript-eslint/parser";
2
+ import typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
3
+ import "eslint-import-resolver-typescript";
4
+ import type {
5
+ Linter
6
+ } from "eslint";
7
+
8
+ const configs: Linter.Config[] = [
9
+ {
10
+ ignores: [
11
+ "eslint.config.mts",
12
+ "templates/**"
13
+ ]
14
+ },
15
+ {
16
+ files: ["**/*.ts"],
17
+ ignores: [
18
+ "dist/**",
19
+ "node_modules/**",
20
+ "main.js"
21
+ ],
22
+ languageOptions: {
23
+ parser: typescriptEslintParser,
24
+ sourceType: "module",
25
+ parserOptions: {
26
+ project: "./tsconfig.json",
27
+ ecmaVersion: 2023
28
+ }
29
+ },
30
+ plugins: {
31
+ "@typescript-eslint": typescriptEslintPlugin as any // Type assertion to bypass type checking
32
+ },
33
+ rules: {
34
+ // Base rules
35
+ "no-unused-vars": "off",
36
+ "@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }],
37
+ "@typescript-eslint/ban-ts-comment": "off",
38
+ "no-prototype-builtins": "off",
39
+ "@typescript-eslint/no-empty-function": "off",
40
+
41
+ // Useful rules but not too strict
42
+ "semi": "error",
43
+ "@typescript-eslint/explicit-function-return-type": "warn",
44
+
45
+ // Disable overly strict rules
46
+ "@typescript-eslint/no-unsafe-assignment": "off",
47
+ "@typescript-eslint/no-unsafe-call": "off",
48
+ "@typescript-eslint/no-unsafe-member-access": "off",
49
+ "@typescript-eslint/no-unsafe-argument": "off"
50
+ }
51
+ }
52
+ ];
53
+
54
+ export default configs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-plugin-config",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "Système d'injection pour plugins Obsidian autonomes",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -27,10 +27,13 @@
27
27
  "inject-path": "tsx scripts/inject-path.ts",
28
28
  "inject": "tsx scripts/inject-path.ts",
29
29
  "inject-prompt": "tsx scripts/inject-prompt.ts",
30
+ "check-plugin": "tsx scripts/inject-path.ts --dry-run",
30
31
  "build-npm": "tsx scripts/build-npm.ts",
31
32
  "publish-npm": "tsx scripts/build-npm.ts",
32
33
  "help": "tsx scripts/help.ts",
33
34
  "h": "tsx scripts/help.ts",
35
+ "lint": "eslint . --ext .ts",
36
+ "lint:fix": "eslint . --ext .ts --fix",
34
37
  "dev": "tsx scripts/esbuild.config.ts",
35
38
  "build": "tsc -noEmit -skipLibCheck",
36
39
  "real": "tsx scripts/esbuild.config.ts production real",
@@ -46,13 +49,19 @@
46
49
  "./utils": "./src/utils/index.ts"
47
50
  },
48
51
  "devDependencies": {
52
+ "@types/eslint": "latest",
49
53
  "@types/node": "^22.15.26",
50
54
  "@types/semver": "^7.7.0",
55
+ "@typescript-eslint/eslint-plugin": "latest",
56
+ "@typescript-eslint/parser": "latest",
51
57
  "builtin-modules": "3.3.0",
52
58
  "dedent": "^1.6.0",
53
59
  "dotenv": "^16.4.5",
54
60
  "esbuild": "latest",
61
+ "eslint": "latest",
62
+ "eslint-import-resolver-typescript": "latest",
55
63
  "fs-extra": "^11.2.0",
64
+ "jiti": "latest",
56
65
  "obsidian": "*",
57
66
  "obsidian-typings": "^3.9.5",
58
67
  "semver": "^7.7.2",
package/scripts/acp.ts CHANGED
@@ -5,7 +5,8 @@ import {
5
5
  askQuestion,
6
6
  cleanInput,
7
7
  createReadlineInterface,
8
- gitExec
8
+ gitExec,
9
+ ensureGitSync
9
10
  } from "./utils.js";
10
11
 
11
12
  const rl = createReadlineInterface();
@@ -49,6 +50,9 @@ async function main(): Promise<void> {
49
50
  // get current branch name
50
51
  const currentBranch = execSync("git rev-parse --abbrev-ref HEAD").toString().trim();
51
52
 
53
+ // Ensure Git is synchronized before pushing
54
+ await ensureGitSync();
55
+
52
56
  try {
53
57
  gitExec(`git push origin ${currentBranch}`);
54
58
  console.log("Commit and push successful.");
@@ -1,10 +1,8 @@
1
1
  #!/usr/bin/env tsx
2
2
 
3
3
  import fs from "fs";
4
- import path from "path";
5
4
  import { execSync } from "child_process";
6
5
  import {
7
- askQuestion,
8
6
  askConfirmation,
9
7
  createReadlineInterface
10
8
  } from "./utils.js";
@@ -20,10 +18,10 @@ async function buildNpmPackage(): Promise<void> {
20
18
  try {
21
19
  // Step 1: Verify all scripts are ready
22
20
  console.log(`\n📋 Verifying scripts...`);
23
-
21
+
24
22
  const requiredScripts = [
25
23
  "scripts/inject-path.ts",
26
- "scripts/inject-prompt.ts",
24
+ "scripts/inject-prompt.ts",
27
25
  "scripts/utils.ts",
28
26
  "scripts/esbuild.config.ts",
29
27
  "scripts/acp.ts",
@@ -42,7 +40,7 @@ async function buildNpmPackage(): Promise<void> {
42
40
  // Step 2: Update bin/obsidian-inject.js if needed
43
41
  console.log(`\n📦 Checking bin/obsidian-inject.js...`);
44
42
  const binPath = "bin/obsidian-inject.js";
45
-
43
+
46
44
  if (fs.existsSync(binPath)) {
47
45
  console.log(` ✅ ${binPath} exists`);
48
46
  } else {
@@ -52,7 +50,7 @@ async function buildNpmPackage(): Promise<void> {
52
50
  // Step 3: Verify package.json is ready for NPM
53
51
  console.log(`\n📄 Verifying package.json for NPM...`);
54
52
  const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"));
55
-
53
+
56
54
  const requiredFields = {
57
55
  name: packageJson.name,
58
56
  version: packageJson.version,
@@ -74,7 +72,7 @@ async function buildNpmPackage(): Promise<void> {
74
72
  try {
75
73
  const whoami = execSync('npm whoami', { encoding: 'utf8' }).trim();
76
74
  console.log(` ✅ Logged in as: ${whoami}`);
77
- } catch (error) {
75
+ } catch {
78
76
  console.log(` ❌ Not logged into NPM`);
79
77
  console.log(` 💡 Run: npm login`);
80
78
  throw new Error("NPM authentication required");
@@ -85,15 +83,15 @@ async function buildNpmPackage(): Promise<void> {
85
83
  try {
86
84
  execSync('yarn build', { stdio: 'inherit' });
87
85
  console.log(` ✅ Build test passed`);
88
- } catch (error) {
86
+ } catch {
89
87
  throw new Error("Build test failed");
90
88
  }
91
89
 
92
90
  console.log(`\n✅ Package is ready for NPM publication!`);
93
-
91
+
94
92
  // Step 6: Ask for confirmation
95
93
  const shouldPublish = await askConfirmation(`\nProceed with NPM publication?`, rl);
96
-
94
+
97
95
  if (!shouldPublish) {
98
96
  console.log(`❌ Publication cancelled`);
99
97
  return;
@@ -102,7 +100,7 @@ async function buildNpmPackage(): Promise<void> {
102
100
  // Step 7: Publish to NPM
103
101
  console.log(`\n📤 Publishing to NPM...`);
104
102
  execSync('npm publish', { stdio: 'inherit' });
105
-
103
+
106
104
  console.log(`\n🎉 Package published successfully!`);
107
105
  console.log(`\n📋 Next steps:`);
108
106
  console.log(` 1. npm install -g ${packageJson.name}`);