obsidian-plugin-config 1.6.13 → 1.6.14

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.
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * Obsidian Plugin Config - CLI Entry Point
5
5
  * Global command: obsidian-inject
6
- * Version: 1.6.13
6
+ * Version: 1.6.14
7
7
  */
8
8
 
9
9
  import { execSync } from 'child_process';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-plugin-config",
3
- "version": "1.6.13",
3
+ "version": "1.6.14",
4
4
  "description": "Global CLI injection tool for Obsidian plugins",
5
5
  "type": "module",
6
6
  "bin": {
@@ -257,7 +257,8 @@ export async function cleanOldLintFiles(targetPath: string): Promise<void> {
257
257
  if (await isValidPath(filePath)) {
258
258
  fs.unlinkSync(filePath);
259
259
  console.log(
260
- `🗑️ Removed old ESLint file: ${fileName} (replaced by eslint.config.ts)`
260
+ `🗑️ Removed old ESLint file: ${fileName} (replaced by 1
261
+ fig.ts)`
261
262
  );
262
263
  }
263
264
  }
@@ -396,6 +397,19 @@ export async function diffAndPromptFiles(
396
397
  continue;
397
398
  }
398
399
 
400
+ // Special case: eslint.config.mts - auto-approve if old .eslintrc exists
401
+ if (entry.dest.endsWith('eslint.config.mts')) {
402
+ const oldEslintFiles = ['.eslintrc', '.eslintrc.js', '.eslintrc.json', '.eslintrc.cjs'];
403
+ const hasOldEslint = oldEslintFiles.some(file =>
404
+ fs.existsSync(path.join(targetPath, file))
405
+ );
406
+ if (hasOldEslint) {
407
+ console.log(` 🔄 ${path.relative(targetPath, entry.dest)} (migrating from old .eslintrc format)`);
408
+ approved.add(entry.dest);
409
+ continue;
410
+ }
411
+ }
412
+
399
413
  const destContent = fs.readFileSync(entry.dest, 'utf8');
400
414
 
401
415
  // Identical → skip silently
package/DONE.md DELETED
@@ -1,60 +0,0 @@
1
- # Transformation Terminée ✅
2
-
3
- ## Résumé
4
-
5
- Le projet **obsidian-plugin-config** est maintenant un **outil d'injection pur**.
6
-
7
- ## Ce qui a été fait
8
-
9
- ### ✅ Fichiers supprimés
10
- - `src/` - Code du plugin local et exports
11
- - `manifest.json`, `versions.json`, `.injection-info.json` - Fichiers du plugin
12
- - `scripts/esbuild.config.ts` - Build local
13
- - `scripts/sync-template-deps.ts` - Sync dépendances
14
- - `scripts/update-exports.js` - Génération exports
15
- - `docs/EXPORTS-EXPLAINED.md` - Doc exports
16
- - `CLEANUP.md`, `CHANGES.md` - Guides temporaires
17
-
18
- ### ✅ Fichiers mis à jour
19
- - `README.md` - Simplifié, focus injection
20
- - `package.json` - Retiré exports, scripts inutiles, dépendances
21
- - `tsconfig.json` - Retiré références à src/ et obsidian-typings
22
- - `scripts/build-npm.ts` - Retiré étape update-exports
23
- - `scripts/help.ts` - Simplifié
24
- - `docs/LLM-GUIDE.md` - Focus injection uniquement
25
- - `.npmignore` - Exclusion des fichiers dev
26
-
27
- ### ✅ Nouveaux fichiers
28
- - `docs/implementation_plan.md` - Plan et décisions
29
-
30
- ## Structure finale
31
-
32
- ```
33
- obsidian-plugin-config/
34
- ├── bin/obsidian-inject.js # CLI global
35
- ├── scripts/inject-*.ts # Logique d'injection
36
- ├── templates/ # Ce qui est injecté
37
- ├── docs/ # Documentation
38
- └── package.json # Config outil
39
- ```
40
-
41
- ## Utilisation
42
-
43
- ### Développement
44
- ```bash
45
- # Modifier templates/
46
- yarn lint:fix
47
- yarn npm-publish
48
- ```
49
-
50
- ### Global
51
- ```bash
52
- npm install -g obsidian-plugin-config@latest --force
53
- obsidian-inject ../my-plugin
54
- ```
55
-
56
- ## Prochaines étapes
57
-
58
- 1. Tester : `yarn lint`
59
- 2. Tester injection : `yarn inject-prompt`
60
- 3. Publier : `yarn npm-publish`
package/FINAL_SUMMARY.md DELETED
@@ -1,163 +0,0 @@
1
- # Résumé Final - Transformation Complète
2
-
3
- ## ✅ Transformation en Outil d'Injection Pur
4
-
5
- ### Fichiers Supprimés
6
- - `src/` - Code du plugin local et exports
7
- - `manifest.json`, `versions.json`, `.injection-info.json`
8
- - `scripts/esbuild.config.ts`, `scripts/sync-template-deps.ts`, `scripts/update-exports.js`
9
- - `docs/EXPORTS-EXPLAINED.md`
10
- - `CLEANUP.md`, `CHANGES.md`
11
-
12
- ### Fichiers Mis à Jour
13
-
14
- #### README.md
15
- - Ajout section "Development Workflow (for injected plugins)"
16
- - Ajout commandes prettier
17
- - Ajout `yarn upgrade` pour mises à jour
18
- - Simplifié focus injection
19
-
20
- #### package.json (racine)
21
- - Retiré `main`, `exports`
22
- - Retiré scripts: `dev`, `real`, `build`, `bacp`, `update-exports`, `sync-template-deps`, `upgrade-all`
23
- - Retiré dépendances: `obsidian`, `obsidian-typings`, `esbuild`, `builtin-modules`, `dotenv`
24
-
25
- #### tsconfig.json (racine)
26
- - Retiré `types: ["obsidian-typings"]` et `paths`
27
- - Retiré `./src/**/*.ts` de `include`
28
-
29
- #### scripts/build-npm.ts
30
- - Retiré étape update-exports
31
- - Retiré sync versions.json/manifest.json
32
- - 5 étapes au lieu de 7
33
-
34
- #### scripts/help.ts
35
- - Simplifié, focus injection uniquement
36
-
37
- #### docs/LLM-GUIDE.md
38
- - Retiré sections exports et plugin local
39
- - Focus injection pure
40
-
41
- ### Templates Améliorés
42
-
43
- #### templates/tsconfig.json
44
- - Ajout `"templates"` dans `exclude`
45
-
46
- #### templates/package.json
47
- - Ajout `"tslib": "2.4.0"`
48
- - Prettier version `"^3.8.1"`
49
-
50
- #### templates/eslint.config.mts
51
- - Ajout `"templates/**"` dans ignores
52
-
53
- #### Nouveaux fichiers templates
54
- - `.prettierignore`
55
- - `.gitattributes`
56
- - `.vscode/settings.json`
57
- - `.vscode/tasks.json` (déjà existait)
58
-
59
- #### templates/scripts/esbuild.config.ts
60
- - Amélioration détection in-place vs external
61
- - Meilleure gestion prompts vault paths
62
-
63
- ## 📦 Structure Finale
64
-
65
- ```
66
- obsidian-plugin-config/
67
- ├── bin/
68
- │ └── obsidian-inject.js # CLI global
69
- ├── docs/
70
- │ ├── LLM-GUIDE.md # Guide injection
71
- │ ├── implementation_plan.md # Plan et décisions
72
- │ ├── APPLIED_MODIFS.md # Modifs appliquées
73
- │ └── modifs.md # Source des modifs
74
- ├── scripts/
75
- │ ├── inject-core.ts # Logique injection
76
- │ ├── inject-path.ts # CLI avec flags
77
- │ ├── inject-prompt.ts # CLI interactif
78
- │ ├── build-npm.ts # Publication NPM
79
- │ ├── acp.ts # Git workflow
80
- │ ├── help.ts # Aide
81
- │ ├── update-version-config.ts # Version bump
82
- │ └── utils.ts # Utilitaires
83
- ├── templates/ # SOURCE DE VÉRITÉ
84
- │ ├── scripts/ # Scripts injectés
85
- │ ├── .github/workflows/ # GitHub Actions
86
- │ ├── .vscode/ # VSCode config
87
- │ ├── package.json # Config base
88
- │ ├── package-sass.json # Config SASS
89
- │ ├── tsconfig.json # Config TypeScript
90
- │ ├── eslint.config.mts # Config ESLint
91
- │ ├── .prettierrc # Config Prettier
92
- │ ├── .prettierignore # Prettier ignores
93
- │ ├── .gitattributes # Git line endings
94
- │ ├── .editorconfig # EditorConfig
95
- │ └── ...
96
- ├── .npmignore # Exclusions NPM
97
- ├── package.json # Config outil
98
- ├── tsconfig.json # Config TS outil
99
- ├── README.md # Documentation
100
- └── DONE.md # Résumé transformation
101
- ```
102
-
103
- ## 🎯 Utilisation
104
-
105
- ### Installation globale
106
- ```bash
107
- npm install -g obsidian-plugin-config@latest --force
108
- ```
109
-
110
- ### Injection
111
- ```bash
112
- cd my-plugin
113
- obsidian-inject # Injection simple
114
- obsidian-inject --sass # Avec SASS
115
- obsidian-inject --dry-run # Vérification
116
- ```
117
-
118
- ### Développement outil
119
- ```bash
120
- yarn lint:fix # Fix code
121
- yarn inject-prompt # Test local
122
- yarn npm-publish # Publier
123
- ```
124
-
125
- ## 🚀 Workflow Plugin Injecté
126
-
127
- ### In-place (dans vault)
128
- ```bash
129
- cd /vault/.obsidian/plugins/my-plugin
130
- yarn dev
131
- ```
132
-
133
- ### External (hors vault)
134
- ```bash
135
- cd /projects/my-plugin
136
- # Configurer .env
137
- yarn dev # Build vers TEST_VAULT
138
- yarn real # Build vers REAL_VAULT
139
- ```
140
-
141
- ### Release
142
- ```bash
143
- yarn bacp # Build + commit
144
- yarn v # Version bump
145
- yarn r # GitHub release
146
- ```
147
-
148
- ## ✨ Améliorations Clés
149
-
150
- 1. **Architecture simplifiée** - Outil d'injection pur, pas de double rôle
151
- 2. **Templates améliorés** - Configs à jour, nouveaux fichiers
152
- 3. **Workflow clarifié** - Documentation complète dans README
153
- 4. **Détection améliorée** - In-place vs external plus robuste
154
- 5. **VSCode intégré** - Settings et tasks prêts à l'emploi
155
- 6. **Prettier intégré** - Format automatique du code
156
- 7. **Git line endings** - .gitattributes pour éviter problèmes Windows/Unix
157
-
158
- ## 📝 Prochaines Étapes
159
-
160
- 1. Tester injection : `yarn inject-prompt`
161
- 2. Vérifier dans plugin test
162
- 3. Publier : `yarn npm-publish`
163
- 4. Mettre à jour global : `npm install -g obsidian-plugin-config@latest --force`
@@ -1,82 +0,0 @@
1
- # Windows node_modules Cleanup Problem
2
-
3
- ## Issue
4
- Injection fails on Windows with EPERM error when Yarn tries to install dependencies:
5
- ```
6
- error Error: EPERM: operation not permitted, unlink 'C:\...\node_modules\@esbuild\win32-x64\esbuild.exe'
7
- ```
8
-
9
- ## Root Cause
10
- 1. Script reports "🗑️ Removed node_modules" but `rmdir /s /q` fails silently on locked .exe files
11
- 2. node_modules remains partially present with corrupted/locked files
12
- 3. Yarn tries to reuse this corrupted node_modules and fails
13
-
14
- ## Current Code (inject-core.ts, ~line 680)
15
- ```typescript
16
- if (fs.existsSync(nodeModulesPath)) {
17
- console.log(` ⏳ Removing node_modules (this may take a moment)...`);
18
- try {
19
- execSync(`rmdir /s /q "${nodeModulesPath}"`, {
20
- stdio: 'pipe',
21
- windowsHide: true
22
- });
23
- console.log(` 🗑️ Removed node_modules (will be reinstalled with Yarn)`);
24
- } catch {
25
- // Rename fallback - BUT THIS NEVER EXECUTES because rmdir doesn't throw!
26
- try {
27
- const timestamp = Date.now();
28
- const oldPath = `${nodeModulesPath}.old.${timestamp}`;
29
- fs.renameSync(nodeModulesPath, oldPath);
30
- console.log(` 🔄 Renamed locked node_modules to ${path.basename(oldPath)}`);
31
- } catch {
32
- console.log(` ⚠️ Could not remove/rename node_modules`);
33
- throw new Error('node_modules locked - close processes and retry');
34
- }
35
- }
36
- }
37
- ```
38
-
39
- ## Problem
40
- `execSync('rmdir /s /q ...')` with `stdio: 'pipe'` does NOT throw an exception when it fails to delete locked files. It exits with code 0 even though files remain.
41
-
42
- ## Required Fix
43
- After `rmdir` command, CHECK if node_modules still exists. If yes, execute the rename fallback:
44
-
45
- ```typescript
46
- if (fs.existsSync(nodeModulesPath)) {
47
- console.log(` ⏳ Removing node_modules (this may take a moment)...`);
48
-
49
- // Try to remove
50
- execSync(`rmdir /s /q "${nodeModulesPath}"`, {
51
- stdio: 'pipe',
52
- windowsHide: true
53
- });
54
-
55
- // CHECK if it actually worked
56
- if (fs.existsSync(nodeModulesPath)) {
57
- // rmdir failed silently - rename instead
58
- const timestamp = Date.now();
59
- const oldPath = `${nodeModulesPath}.old.${timestamp}`;
60
- try {
61
- fs.renameSync(nodeModulesPath, oldPath);
62
- console.log(` 🔄 Renamed locked node_modules to ${path.basename(oldPath)}`);
63
- console.log(` 💡 Delete it manually later: ${oldPath}`);
64
- } catch {
65
- console.log(` ⚠️ Could not remove/rename node_modules (locked by processes)`);
66
- console.log(` 💡 Close Obsidian/VSCode and run: obsidian-inject again`);
67
- throw new Error('node_modules locked - close processes and retry');
68
- }
69
- } else {
70
- console.log(` 🗑️ Removed node_modules (will be reinstalled with Yarn)`);
71
- }
72
- }
73
- ```
74
-
75
- ## File to Fix
76
- `scripts/inject-core.ts` - function `cleanNpmArtifactsIfNeeded` (around line 680-730)
77
-
78
- ## Test Case
79
- User runs `obsidian-inject` while VSCode is open on the plugin directory. The esbuild.exe file is locked by VSCode's TypeScript server.
80
-
81
- Expected: node_modules gets renamed to node_modules.old.{timestamp}, Yarn creates fresh node_modules
82
- Actual: rmdir fails silently, Yarn tries to use corrupted node_modules, EPERM error
@@ -1,104 +0,0 @@
1
- # Modifications Appliquées depuis modifs.md
2
-
3
- ## ✅ Fichiers Templates Mis à Jour
4
-
5
- ### tsconfig.json
6
- - Ajout de `"templates"` dans `exclude`
7
-
8
- ### package.json
9
- - Ajout de `"tslib": "2.4.0"` dans devDependencies
10
- - Version prettier fixée à `"^3.8.1"`
11
-
12
- ### eslint.config.mts
13
- - Ajout de `"templates/**"` dans ignores
14
-
15
- ### Nouveaux fichiers créés
16
-
17
- #### .prettierignore
18
- ```
19
- # Build output
20
- dist/
21
- main.js
22
-
23
- # Dependencies
24
- node_modules/
25
- ```
26
-
27
- #### .gitattributes
28
- ```
29
- # On Windows, git defaults to core.autocrlf=true
30
- * text=auto eol=lf
31
- *.ts text eol=lf
32
- *.json text eol=lf
33
- ```
34
-
35
- #### .vscode/settings.json
36
- ```json
37
- {
38
- "npm.packageManager": "yarn",
39
- "[typescript]": {
40
- "editor.defaultFormatter": "esbenp.prettier-vscode"
41
- },
42
- "[markdown]": {
43
- "editor.defaultFormatter": "yzhang.markdown-all-in-one"
44
- },
45
- "editor.formatOnSave": true
46
- }
47
- ```
48
-
49
- #### .vscode/tasks.json
50
- - Tâches pour lint, prettier, build
51
- - Tâche "Obsidian Inject"
52
- - Tâche "Cleanup" combinée
53
-
54
- ### esbuild.config.ts
55
- - Amélioration de la logique de détection in-place vs external
56
- - Détection plus claire du dossier plugins
57
- - Meilleure gestion des prompts pour vault paths
58
-
59
- ## 📝 Notes
60
-
61
- ### Extensions VSCode recommandées
62
- Les fichiers .vscode/settings.json suggèrent d'installer :
63
- - `esbenp.prettier-vscode` - Prettier formatter
64
- - `yzhang.markdown-all-in-one` - Markdown formatter
65
- - EditorConfig extension (pour .editorconfig)
66
-
67
- ### Commandes disponibles après injection
68
- ```bash
69
- yarn start # Install + dev
70
- yarn dev # Watch mode
71
- yarn build # Production build
72
- yarn real # Build to real vault
73
- yarn acp # Add, commit, push
74
- yarn bacp # Build + acp
75
- yarn v # Update version
76
- yarn r # Release
77
- yarn h # Help
78
- yarn lint # ESLint check
79
- yarn lint:fix # ESLint fix
80
- yarn prettier # Prettier check
81
- yarn prettier:fix # Prettier fix
82
- ```
83
-
84
- ### Workflow de développement
85
-
86
- #### In-place (dans .obsidian/plugins)
87
- ```bash
88
- cd /path/to/vault/.obsidian/plugins/my-plugin
89
- yarn dev
90
- ```
91
-
92
- #### External (hors vault)
93
- ```bash
94
- cd /path/to/my-plugin
95
- # Configure .env avec TEST_VAULT et REAL_VAULT
96
- yarn dev # Build vers TEST_VAULT
97
- yarn real # Build vers REAL_VAULT
98
- ```
99
-
100
- ## 🔄 Prochaines étapes
101
-
102
- 1. Tester l'injection : `yarn inject-prompt`
103
- 2. Vérifier dans un plugin test
104
- 3. Publier : `yarn npm-publish`
@@ -1,43 +0,0 @@
1
- # Notes Techniques
2
-
3
- ## tslib
4
-
5
- **Qu'est-ce que c'est ?**
6
- `tslib` est une bibliothèque runtime pour TypeScript qui contient les helpers TypeScript (comme `__awaiter`, `__extends`, `__spreadArray`, etc.).
7
-
8
- **Pourquoi c'est important ?**
9
- Quand tu utilises `"importHelpers": true` dans `tsconfig.json`, TypeScript importe ces helpers depuis tslib au lieu de les dupliquer dans chaque fichier compilé. Ça réduit significativement la taille du bundle.
10
-
11
- **Exemple :**
12
- Sans tslib, chaque fichier async duplique le helper `__awaiter` (~200 bytes).
13
- Avec tslib, un seul import : `import { __awaiter } from "tslib"`.
14
-
15
- **Version :**
16
- On utilise `"tslib": "2.4.0"` (version stable, pas latest) pour éviter les breaking changes.
17
-
18
- ## EditorConfig
19
-
20
- **Qu'est-ce que c'est ?**
21
- EditorConfig permet de définir des règles de formatage (indentation, line endings, etc.) qui fonctionnent dans tous les éditeurs.
22
-
23
- **Fichier injecté :**
24
- `.editorconfig` est automatiquement injecté dans le plugin.
25
-
26
- **Pour VSCode :**
27
- L'extension `editorconfig.editorconfig` doit être installée pour que VSCode respecte les règles.
28
-
29
- **Recommandations automatiques :**
30
- Le fichier `.vscode/extensions.json` suggère automatiquement les extensions nécessaires :
31
- - `esbenp.prettier-vscode` - Prettier
32
- - `dbaeumer.vscode-eslint` - ESLint
33
- - `editorconfig.editorconfig` - EditorConfig
34
- - `yzhang.markdown-all-in-one` - Markdown
35
-
36
- Quand l'utilisateur ouvre le projet, VSCode propose d'installer ces extensions.
37
-
38
- ## Prettier vs EditorConfig
39
-
40
- **EditorConfig** : Règles de base (tabs/spaces, line endings, charset)
41
- **Prettier** : Formatage avancé du code (quotes, semicolons, line width, etc.)
42
-
43
- Les deux sont complémentaires. EditorConfig s'applique à tous les fichiers, Prettier se concentre sur le code.
@@ -1,127 +0,0 @@
1
- # Architecture Finale - Outil d'Injection Pur
2
-
3
- ## ✅ Décisions Prises
4
-
5
- ### 1. Suppression du développement local de plugin
6
- - **Avant** : Le projet servait à la fois d'outil d'injection ET de plugin local pour tester du code
7
- - **Après** : Outil d'injection pur, pas de développement local
8
- - **Raison** : Trop complexe pour les utilisateurs, dépendance inutile
9
-
10
- ### 2. Suppression du système d'exports NPM
11
- - **Avant** : `src/` contenait du code exportable (modals, utils) via NPM
12
- - **Après** : Plus d'exports, uniquement injection de fichiers
13
- - **Raison** : Les utilisateurs préfèrent avoir le code directement dans leur plugin plutôt qu'une dépendance externe
14
-
15
- ### 3. Workflow simplifié
16
- - **Avant** : Développement local → exports → injection
17
- - **Après** : Modification templates → publication NPM → injection globale
18
- - **Raison** : Un seul flux, plus simple à comprendre et maintenir
19
-
20
- ## 🗑️ Fichiers Supprimés
21
-
22
- ### Dossiers
23
- - `src/` - Code du plugin local et exports
24
- - `.vscode/` - Configuration VSCode (optionnel)
25
-
26
- ### Fichiers racine
27
- - `manifest.json` - Manifeste du plugin Obsidian
28
- - `versions.json` - Versions du plugin
29
- - `.injection-info.json` - Métadonnées d'injection (pour plugins injectés uniquement)
30
- - `.env` - Chemins des vaults (plus nécessaire)
31
- - `CLEANUP.md` - Guide de nettoyage (obsolète après nettoyage)
32
- - `CHANGES.md` - Résumé des changements (obsolète)
33
-
34
- ### Scripts
35
- - `scripts/esbuild.config.ts` - Build du plugin local
36
- - `scripts/sync-template-deps.ts` - Sync des dépendances
37
- - `scripts/update-exports.js` - Génération des exports
38
-
39
- ### Documentation
40
- - `docs/EXPORTS-EXPLAINED.md` - Explication du système d'exports
41
-
42
- ## 📦 Structure Finale
43
-
44
- ```
45
- obsidian-plugin-config/
46
- ├── bin/
47
- │ └── obsidian-inject.js # CLI global (généré)
48
- ├── docs/
49
- │ ├── LLM-GUIDE.md # Guide pour LLM (mis à jour)
50
- │ └── implementation_plan.md # Ce fichier
51
- ├── scripts/
52
- │ ├── inject-core.ts # Logique d'injection
53
- │ ├── inject-path.ts # CLI avec flags
54
- │ ├── inject-prompt.ts # CLI interactif
55
- │ ├── build-npm.ts # Workflow de publication
56
- │ ├── acp.ts # Add, commit, push
57
- │ ├── help.ts # Aide
58
- │ ├── update-version-config.ts # Bump de version
59
- │ └── utils.ts # Utilitaires
60
- ├── templates/ # SOURCE DE VÉRITÉ
61
- │ ├── scripts/ # Scripts injectés
62
- │ ├── .github/workflows/ # GitHub Actions
63
- │ ├── package.json # Config de base
64
- │ ├── package-sass.json # Config SASS
65
- │ ├── tsconfig.json # Config TypeScript
66
- │ ├── eslint.config.mts # Config ESLint
67
- │ └── ... # Autres configs
68
- ├── .npmignore # Exclusions NPM
69
- ├── package.json # Config de l'outil
70
- ├── tsconfig.json # Config TS (nettoyée)
71
- ├── README.md # Documentation
72
- └── ...
73
- ```
74
-
75
- ## 🔄 Workflow de Développement
76
-
77
- ### Modifier ce qui est injecté
78
- 1. Éditer les fichiers dans `templates/`
79
- 2. Tester localement : `yarn inject-path ../test-plugin`
80
- 3. Publier : `yarn npm-publish`
81
- 4. Installer globalement : `npm install -g obsidian-plugin-config@latest --force`
82
-
83
- ### Utilisation globale
84
- ```bash
85
- obsidian-inject # Dans le dossier du plugin
86
- obsidian-inject ../my-plugin # Par chemin
87
- obsidian-inject ../my-plugin --sass # Avec SASS
88
- ```
89
-
90
- ## 🎯 Ce qui reste à faire
91
-
92
- ### Nettoyage des dépendances
93
- ```bash
94
- yarn remove obsidian obsidian-typings esbuild builtin-modules dotenv
95
- ```
96
-
97
- ### Vérification
98
- ```bash
99
- yarn lint # Vérifier le code
100
- yarn inject-prompt # Tester l'injection
101
- ```
102
-
103
- ## 📝 Notes Importantes
104
-
105
- ### Templates = Source de vérité
106
- - **JAMAIS** modifier les fichiers racine en pensant que ça affectera l'injection
107
- - **TOUJOURS** modifier `templates/` pour changer ce qui est injecté
108
- - Les scripts dans `scripts/` sont pour l'outil lui-même, pas pour l'injection
109
-
110
- ### Pas de test local
111
- - Plus besoin de `.env` avec TEST_VAULT et REAL_VAULT
112
- - Plus de `yarn dev` ou `yarn real`
113
- - Tout passe par NPM global : modifier → publier → installer → tester
114
-
115
- ### Plugins injectés = 100% autonomes
116
- - Aucune dépendance à `obsidian-plugin-config` après injection
117
- - Tous les scripts sont copiés localement
118
- - Mise à jour possible via ré-injection
119
-
120
- ## 🚀 Prochaines Étapes
121
-
122
- 1. ✅ Supprimer les fichiers obsolètes
123
- 2. ✅ Nettoyer `tsconfig.json`
124
- 3. ✅ Mettre à jour la documentation
125
- 4. ⏳ Supprimer les dépendances inutiles
126
- 5. ⏳ Tester l'injection
127
- 6. ⏳ Publier la nouvelle version
package/docs/modifs.md DELETED
@@ -1,434 +0,0 @@
1
- # Mise à jour du readme auto
2
-
3
- vérifier si section ## Development (Add this to your README) ou ## Development
4
- si ## Development (Add this to your README)
5
- - remplacer le contenu de la section par le nouveau contenu
6
- si ## Development
7
- - ajouter le nouveau contenu à la suite du contenu existant
8
- On va évidemment générer ce nouveau contenu en fonction du projet actuel.
9
-
10
-
11
- voici un ancien exemple à mettre à jour:
12
- ## Development (Add this to your README)
13
-
14
- Automate the development and publication processes on github, including releases. You are supposed to git clone your plugin out of the vault and set the right path in the .env file (1 for your trying vault, 1 for the real vault).
15
-
16
- If you want more options like sass, check out other branches
17
-
18
- ### Environment Setup
19
-
20
- - **Development in the plugins folder of your vault:**
21
- - Set the `REAL` variable to `-1` in the `.env` file. Or delete the file. Run the usual npm commands.
22
-
23
- - **Development outside the vault:**
24
- - If your plugin's source code is outside the vault, the necessary files will be automatically copied to the targeted vault. Set the paths in the .env file. Use TestVault for the development vault and RealVault to simulate production.
25
-
26
- - **other steps:**
27
- - You can then do `npm run version` to update the version and do the push of the changed files (package, manifest, version). Prompts will guide you.
28
-
29
- - You can then do `npm run release` to create the release. Few seconds later you can see the created release in the GitHub releases.
30
-
31
- ### Available Commands
32
-
33
- *I recommend a `npm run start` then `npm run bacp` then `npm run version` then `npm run release`. Super fast and easy.*
34
-
35
- - **`npm run dev` and `npm start`**: For development.
36
- `npm start` opens Visual Studio Code, runs `npm install`, and then `npm run dev`
37
-
38
- - **`npm run build`**: Builds the project in the folder containing the source code.
39
-
40
- - **`npm run real`**: Equivalent to a traditional installation of the plugin in your REAL vault.
41
-
42
- - **`npm run bacp`** & **`npm run acp`**: `b` stands for build, and `acp` stands for add, commit, push. You will be prompted for the commit message.
43
-
44
- - **`npm run version`**: Asks for the type of version update, modifies the relevant files, and then performs an add, commit, push.
45
-
46
- - **`npm run release`**: Asks for the release title, creates the release. This command works with the configurations in the `.github` folder. The release title can be multiline by using `\n`.
47
-
48
- --- fin
49
-
50
- Autre chose Ajouter `yarn upgrade` au readme pour les mises à jour libs.
51
-
52
- # exemple config dernier plugin réalisé ok
53
-
54
- je vais ajouter des configs qui sont ok Vérifiez avec ce qu'il y a dans Templates pour mettre à jour
55
-
56
- ts-config
57
-
58
- ```json
59
- {
60
- "compilerOptions": {
61
- "types": ["obsidian-typings"],
62
- "paths": {
63
- "obsidian-typings/implementations": [
64
- "./node_modules/obsidian-typings/dist/cjs/implementations.d.cts",
65
- "./node_modules/obsidian-typings/dist/esm/implementations.mjs"
66
- ]
67
- },
68
- "module": "NodeNext",
69
- "moduleResolution": "NodeNext",
70
- "target": "ES2021",
71
- "inlineSourceMap": true,
72
- "inlineSources": true,
73
- "allowJs": true,
74
- "noImplicitAny": true,
75
- "importHelpers": true,
76
- "isolatedModules": true,
77
- "allowImportingTsExtensions": true,
78
- "noEmit": true,
79
- "allowSyntheticDefaultImports": true,
80
- "verbatimModuleSyntax": true,
81
- "forceConsistentCasingInFileNames": true,
82
- "strictNullChecks": true,
83
- "resolveJsonModule": true,
84
- "lib": ["DOM", "ES2021"]
85
- },
86
- "include": ["./src/**/*.ts", "./scripts/**/*.ts"],
87
- "exclude": ["node_modules", "eslint.config.ts", "templates"]
88
- }
89
- ```
90
-
91
-
92
- package
93
- ```json
94
- {
95
- "name": "obsidian-code-files-modif",
96
- "version": "1.0.0",
97
- "description": "Code Files Modif",
98
- "type": "module",
99
- "main": "src/index.ts",
100
- "license": "MIT",
101
- "keywords": [
102
- "obsidian",
103
- "obsidian-plugin",
104
- "typescript"
105
- ],
106
- "scripts": {
107
- "start": "yarn install && yarn dev",
108
- "dev": "tsx scripts/esbuild.config.ts",
109
- "build": "tsc -noEmit -skipLibCheck && tsx scripts/esbuild.config.ts production",
110
- "real": "tsx scripts/esbuild.config.ts production real",
111
- "acp": "tsx scripts/acp.ts",
112
- "bacp": "tsx scripts/acp.ts -b",
113
- "v": "tsx scripts/update-version.ts",
114
- "r": "tsx scripts/release.ts",
115
- "h": "tsx scripts/help.ts",
116
- "lint": "eslint . --ext .ts",
117
- "lint:fix": "eslint . --ext .ts --fix",
118
- "prettier": "prettier --check '**/*.{ts,json}'",
119
- "prettier:fix": "prettier --write '**/*.{ts,json}'"
120
- },
121
- "devDependencies": {
122
- "@types/eslint": "latest",
123
- "@types/node": "latest",
124
- "@typescript-eslint/eslint-plugin": "latest",
125
- "@typescript-eslint/parser": "latest",
126
- "builtin-modules": "latest",
127
- "dedent": "latest",
128
- "dotenv": "latest",
129
- "esbuild": "latest",
130
- "eslint": "latest",
131
- "eslint-import-resolver-typescript": "latest",
132
- "jiti": "latest",
133
- "obsidian": "*",
134
- "obsidian-typings": "latest",
135
- "prettier": "^3.8.1",
136
- "tslib": "2.4.0",
137
- "tsx": "^4.21.0",
138
- "typescript": "^5.8.2"
139
- },
140
- "dependencies": {
141
- },
142
- "engines": {
143
- "npm": "please-use-yarn",
144
- "yarn": ">=1.22.0",
145
- "node": ">=16.0.0"
146
- },
147
- "repository": {
148
- "type": "git",
149
- "url": "https://github.com/3C0D/obsidian-plugin-config.git"
150
- },
151
- "author": "3C0D"
152
- }
153
- ```
154
-
155
- Bon, normalement j'ai laissé que les bibliothèques utiles Si je me suis pas trompé, mais bon tu verras Si y a des différences ou si y a des trucs à ajouter. Avec discernement bien sûr
156
-
157
- eslint.config.mts
158
- ```ts
159
- import * as typescriptEslintParser from "@typescript-eslint/parser";
160
- import typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
161
- import "eslint-import-resolver-typescript";
162
- import type {
163
- Linter
164
- } from "eslint";
165
-
166
- const configs: Linter.Config[] = [
167
- {
168
- ignores: ["eslint.config.mts", "templates/**"]
169
- },
170
- {
171
- files: ["**/*.ts"],
172
- ignores: [
173
- "dist/**",
174
- "node_modules/**",
175
- "main.js"
176
- ],
177
- languageOptions: {
178
- parser: typescriptEslintParser,
179
- sourceType: "module",
180
- parserOptions: {
181
- project: "./tsconfig.json",
182
- ecmaVersion: 2023
183
- }
184
- },
185
- plugins: {
186
- "@typescript-eslint": typescriptEslintPlugin as any // Type assertion to bypass type checking
187
- },
188
- rules: {
189
- // Base rules
190
- "no-unused-vars": "off",
191
- "@typescript-eslint/no-unused-vars": ["error", { "args": "none", "varsIgnorePattern": "^_" }],
192
- "@typescript-eslint/ban-ts-comment": "warn",
193
- "no-prototype-builtins": "off",
194
- "@typescript-eslint/no-empty-function": "off",
195
-
196
- // Useful rules but not too strict
197
- "semi": "error",
198
- "eqeqeq": ["error", "always"],
199
- "prefer-const": "error",
200
- "@typescript-eslint/explicit-function-return-type": ["warn", { "allowExpressions": true }],
201
- "@typescript-eslint/no-explicit-any": "warn",
202
- "@typescript-eslint/consistent-type-imports": ["warn", { "prefer": "type-imports" }],
203
-
204
- // Disable overly strict rules
205
- "@typescript-eslint/no-unsafe-assignment": "off",
206
- "@typescript-eslint/no-unsafe-call": "off",
207
- "@typescript-eslint/no-unsafe-member-access": "off",
208
- "@typescript-eslint/no-unsafe-argument": "off"
209
- }
210
- }
211
- ];
212
-
213
- export default configs;
214
-
215
- ```
216
-
217
- .pettrierrc
218
- ```json
219
- {
220
- "useTabs": true,
221
- "tabWidth": 4,
222
- "printWidth": 90,
223
- "endOfLine": "lf",
224
- "trailingComma": "none",
225
- "semi": true,
226
- "singleQuote": true,
227
- "arrowParens": "always",
228
- "overrides": [
229
- {
230
- "files": ["*.json"],
231
- "options": {
232
- "useTabs": false,
233
- "tabWidth": 2
234
- }
235
- }
236
- ]
237
- }
238
- ```
239
-
240
- .prettierignore
241
- ```py
242
- # Build output
243
- dist/
244
- main.js
245
-
246
- # Dependencies
247
- node_modules/
248
- ```
249
-
250
- .gitattributes
251
- ```py
252
- # On Windows, git defaults to core.autocrlf=true which converts LF to CRLF and creates false modifications
253
- * text=auto eol=lf
254
- *.ts text eol=lf
255
- *.json text eol=lf
256
- ```
257
-
258
- editorconfig
259
- ```py
260
- # top-most EditorConfig file
261
- root = true
262
-
263
- [*]
264
- charset = utf-8
265
- end_of_line = lf
266
- insert_final_newline = true
267
- indent_style = tab
268
- indent_size = 4
269
- tab_width = 4
270
-
271
- [*.json]
272
- indent_style = space
273
- indent_size = 2
274
- ```
275
-
276
- dans package:
277
- En fait, d'après ce que je sais, c'est une extension vsc que j'ai activée. Donc il faudrait dire dans les extensions de suggéré de l'installer. Sinon, peut-être que il y a directement un module dans package?
278
-
279
- dans docs j'ai mis le esbuild.config.ts De ce même autre plugin Le truc c'est que la logique pour SASS a été retirée parce que il y en avait pas besoin. Par contre, la logique par rapport au fait que si on est en train de faire Un développement extérieur ou in place A été amélioré. Du coup, le fichier Utils.ts A été joint parce que peut-être que y a eu aussi des modifications Si tu as besoin d'autres fichiers, tu me le dis Normalement, les autres scripts n'ont pas été touchés.
280
-
281
- En fait, il faut bien comprendre que je viens de faire un autre plugin et que j'ai retouché plusieurs choses par rapport au Template initial Donc je te donne un peu l'actualité pour que tu puisses améliorer le template
282
-
283
- dans .vscode/settings
284
- ```json
285
- {
286
- "npm.packageManager": "yarn",
287
- // "js/ts.preferences.includePackageJsonAutoImports": "off",
288
- "[typescript]": {
289
- "editor.defaultFormatter": "esbenp.prettier-vscode"
290
- },
291
- "[markdown]": {
292
- "editor.defaultFormatter": "yzhang.markdown-all-in-one"
293
- },
294
- "editor.formatOnSave": true,
295
- }
296
- ```
297
-
298
- Là peut-être suggérer d'utiliser. Editor Config. Sauf si Une extension a été installée dans package bien sûr.
299
-
300
- tasks.json
301
- ```json
302
- {
303
- "version": "2.0.0",
304
- "tasks": [
305
- {
306
- "label": "Lint",
307
- "type": "shell",
308
- "command": "yarn lint",
309
- "group": "test",
310
- "presentation": { "reveal": "always", "panel": "shared" },
311
- "problemMatcher": ["$eslint-stylish"]
312
- },
313
- {
314
- "label": "Lint: Fix",
315
- "type": "shell",
316
- "command": "yarn lint:fix",
317
- "group": "test",
318
- "presentation": { "reveal": "always", "panel": "shared" },
319
- "problemMatcher": ["$eslint-stylish"]
320
- },
321
- {
322
- "label": "Prettier: Check",
323
- "type": "shell",
324
- "command": "yarn prettier",
325
- "group": "test",
326
- "presentation": { "reveal": "always", "panel": "shared" },
327
- "problemMatcher": []
328
- },
329
- {
330
- "label": "Prettier: Fix",
331
- "type": "shell",
332
- "command": "yarn prettier:fix",
333
- "group": "test",
334
- "presentation": { "reveal": "always", "panel": "shared" },
335
- "problemMatcher": []
336
- },
337
- {
338
- "label": "Build",
339
- "type": "shell",
340
- "command": "yarn build",
341
- "group": { "kind": "build", "isDefault": true },
342
- "presentation": { "reveal": "always", "panel": "shared" },
343
- "problemMatcher": ["$tsc"]
344
- },
345
- {
346
- "label": "Obsidian Inject",
347
- "type": "shell",
348
- "command": "obsidian-inject",
349
- "group": "build",
350
- "presentation": { "reveal": "always", "panel": "shared" },
351
- "problemMatcher": []
352
- },
353
- {
354
- "label": "Cleanup: Lint + Prettier + Build",
355
- "dependsOrder": "sequence",
356
- "dependsOn": ["Lint: Fix", "Prettier: Fix", "Build"],
357
- "group": "build",
358
- "presentation": { "reveal": "always", "panel": "shared" },
359
- "problemMatcher": []
360
- }
361
- ]
362
- }
363
- ```
364
-
365
- .github/workflows/release
366
- ````yaml
367
- name: Release Obsidian Plugin
368
-
369
- on:
370
- push:
371
- tags:
372
- - "*"
373
-
374
- jobs:
375
- build:
376
- runs-on: ubuntu-latest
377
- permissions:
378
- contents: write
379
-
380
- steps:
381
- - uses: actions/checkout@v3
382
- - name: Use Node.js
383
- uses: actions/setup-node@v3
384
- with:
385
- node-version: "22.x"
386
-
387
- # Setup Yarn
388
- - name: Setup Yarn
389
- run: |
390
- corepack enable
391
- yarn --version
392
-
393
- # Build the plugin
394
- - name: Build
395
- id: build
396
- run: |
397
- yarn install
398
- yarn build
399
-
400
- # Package all necessary files into a zip
401
- - name: Package release files
402
- run: |
403
- mkdir release-package
404
- cp manifest.json main.js styles.css monacoEditor.html monacoHtml.js monacoHtml.css release-package/
405
- cp -r vs monaco-themes formatters release-package/
406
- cd release-package && zip -r ../obsidian-code-files-modif.zip .
407
-
408
- # Create the release on GitHub
409
- - name: Create Release
410
- id: create_release
411
- uses: ncipollo/release-action@v1.13.0
412
- env:
413
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
414
- VERSION: ${{ github.ref }}
415
- with:
416
- allowUpdates: true
417
- generateReleaseNotes: true
418
- artifactErrorsFailBuild: false
419
- makeLatest: true
420
- artifacts: "manifest.json,main.js,styles.css,obsidian-code-files-modif.zip"
421
- bodyFile: ".github/workflows/release-body.md"
422
- ```
423
-
424
- # Bon ça je pense que ça a été fait. J'avais noté ça dans mes notes:
425
- - ajouter command format all `prettier --write` installer `yarn add -D prettier`
426
-
427
- - lancer un yarn install après injection?
428
-
429
- - Ah oui, j'avais eu un problème avec la configuration, c'est qu'ils n'installaient pas obsidian-typing latest. Mais bon, je t'ai donné un package qui marchait au dessus.
430
- npx(pas besoin) prettier → yarn exec prettier pour résoudre le problème de PATH sur Windows
431
-
432
- @types/lodash et lodash sont en dependencies — @types/lodash devrait être en devDependencies (c'est uniquement des types TypeScript, rien de runtime). Et lodash lui-même, est-ce qu'il est vraiment utilisé dans le plugin ? Parce que si c'est juste pour les scripts de build, il devrait aussi être en -D.
433
-
434
-