obsidian-plugin-config 1.5.10 → 1.5.12

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.5.10
6
+ * Version: 1.5.12
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.5.10",
3
+ "version": "1.5.12",
4
4
  "description": "Système d'injection pour plugins Obsidian autonomes",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -209,7 +209,7 @@ async function buildAndPublishNpm(): Promise<void> {
209
209
  console.log(`Full automation: version → exports → bin → commit → publish\n`);
210
210
 
211
211
  try {
212
- // Step 0: Check NPM login (disabled - npm publish will handle auth)
212
+ // Step 0: Check NPM login
213
213
  // console.log(`🔐 Checking NPM authentication...`);
214
214
  // try {
215
215
  // const whoami = execSync('npm whoami --registry https://registry.npmjs.org/', {
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env tsx
2
2
 
3
3
  import fs from 'fs';
4
- import fsExtra from 'fs-extra';
5
4
  import path from 'path';
6
5
  import { execSync } from 'child_process';
7
6
  import { fileURLToPath } from 'url';
@@ -634,8 +633,12 @@ export async function cleanNpmArtifactsIfNeeded(targetPath: string): Promise<voi
634
633
  }
635
634
 
636
635
  if (fs.existsSync(nodeModulesPath)) {
637
- // Use fs-extra for better Windows compatibility with locked files
638
- await fsExtra.remove(nodeModulesPath);
636
+ try {
637
+ execSync(`rmdir /s /q "${nodeModulesPath}"`, { stdio: 'inherit' });
638
+ } catch {
639
+ // Fallback: fs.rmSync si rmdir échoue
640
+ fs.rmSync(nodeModulesPath, { recursive: true, force: true });
641
+ }
639
642
  console.log(
640
643
  ` 🗑️ Removed node_modules (will be reinstalled with Yarn)`
641
644
  );
package/versions.json CHANGED
@@ -58,5 +58,7 @@
58
58
  "1.5.7": "1.8.9",
59
59
  "1.5.8": "1.8.9",
60
60
  "1.5.9": "1.8.9",
61
- "1.5.10": "1.8.9"
61
+ "1.5.10": "1.8.9",
62
+ "1.5.11": "1.8.9",
63
+ "1.5.12": "1.8.9"
62
64
  }
@@ -1,239 +0,0 @@
1
- # Instructions for LLM — obsidian-plugin-config v2
2
-
3
- ## Context
4
-
5
- This repo has TWO complementary roles:
6
-
7
- 1. **Injection system**: copies scripts + configs
8
- into Obsidian plugin repos via NPM global CLI
9
- 2. **Snippet development**: local workspace to
10
- create/test reusable code (modals, helpers)
11
- exported via NPM for other plugins to import
12
-
13
- **Root**:
14
- `c:\Users\dd200\Documents\Mes_projets\Mes repo obsidian new\obsidian-plugin-config`
15
-
16
- ---
17
-
18
- ## Tasks to execute (in order)
19
-
20
- ### Task 1: Create `scripts/inject-core.ts`
21
-
22
- Extract shared logic from `scripts/inject-path.ts`
23
- and `scripts/inject-prompt.ts`.
24
-
25
- **Critical**: Simplify `findPluginConfigRoot()`.
26
- Remove ALL sibling directory detection
27
- (`../obsidian-plugin-config`). The function should:
28
- 1. Check `import.meta.url` to find the NPM
29
- package root
30
- 2. Fallback to `process.cwd()`
31
- 3. Nothing else
32
-
33
- Shared functions to extract:
34
- - `InjectionPlan` interface
35
- - `analyzePlugin()`
36
- - `findPluginConfigRoot()` (simplified as above)
37
- - `copyFromLocal()`
38
- - `ensurePluginConfigClean()`
39
- - `showInjectionPlan()`
40
- - `cleanOldScripts()`
41
- - `cleanOldLintFiles()`
42
- - `injectScripts()` — use inject-path version
43
- (more complete)
44
- - `updatePackageJson()` — use inject-path version
45
- - `analyzeCentralizedImports()`
46
- - `createRequiredDirectories()`
47
- - `createInjectionInfo()`
48
- - `readInjectionInfo()`
49
- - `cleanNpmArtifactsIfNeeded()`
50
- - `ensureTsxInstalled()`
51
- - `runYarnInstall()`
52
- - `performInjection()` — main orchestration
53
-
54
- **Remove**: All debug logging (lines with
55
- `CRITICAL DEBUG`, `FINAL CHECK`, `VERIFICATION`).
56
-
57
- ### Task 2: Simplify `scripts/inject-path.ts`
58
-
59
- Keep only:
60
- - CLI argument parsing
61
- - Dry-run display logic
62
- - Call to inject-core functions
63
- - `main()` + script execution
64
-
65
- ### Task 3: Simplify `scripts/inject-prompt.ts`
66
-
67
- Keep only:
68
- - Interactive prompting
69
- - Calls to inject-core functions
70
- - Add SASS support (currently missing)
71
-
72
- ### Task 4: Fix ESLint configs
73
-
74
- **Both root AND template `eslint.config.mts`**:
75
- ```diff
76
- -"@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }],
77
- -"@typescript-eslint/ban-ts-comment": "off",
78
- +"@typescript-eslint/no-unused-vars": ["error", { "args": "none", "varsIgnorePattern": "^_" }],
79
- +"@typescript-eslint/ban-ts-comment": "warn",
80
- ```
81
-
82
- ### Task 5: Fix `tsconfig.json` (root)
83
-
84
- Remove nonexistent include:
85
- ```diff
86
- "include": [
87
- "./src/**/*.ts",
88
- - "./scripts/**/*.ts",
89
- - "eslint.config.fix.d.ts"
90
- + "./scripts/**/*.ts"
91
- ]
92
- ```
93
-
94
- ### Task 5b: Fix `templates/tsconfig.json`
95
-
96
- Fix obsidian-typings paths (the root tsconfig
97
- has the correct paths per official docs):
98
- ```diff
99
- "paths": {
100
- "obsidian-typings/implementations": [
101
- - "./node_modules/obsidian-typings/dist/cjs/implementations.cts",
102
- - "./node_modules/obsidian-typings/dist/esm/implementations.mjs"
103
- + "./node_modules/obsidian-typings/dist/implementations.d.ts",
104
- + "./node_modules/obsidian-typings/dist/implementations.cjs"
105
- ]
106
- }
107
- ```
108
-
109
- ### Task 6: Fix `package.json`
110
-
111
- 1. **Add prettier**: `"prettier": "^3.4.0"` to
112
- `devDependencies`
113
-
114
- 2. **Simplify exports** — replace entire exports:
115
- ```json
116
- "exports": {
117
- ".": "./src/index.ts"
118
- }
119
- ```
120
- Remove `./scripts/*`, `./modals`, `./tools`,
121
- `./utils` — the root export covers everything.
122
-
123
- 3. **Clean duplicate dependencies**:
124
- Keep in `dependencies` only what the NPM CLI
125
- needs at runtime:
126
- - `tsx`, `fs-extra`, `esbuild`, `dotenv`,
127
- `builtin-modules`, `dedent`, `semver`,
128
- `@types/node`, `@types/semver`, `typescript`
129
- Remove from `dependencies` (keep in devDeps):
130
- - `obsidian`, `obsidian-typings`, `lodash`,
131
- `@types/lodash`
132
-
133
- ### Task 7: Remove path aliases from templates
134
-
135
- In `templates/scripts/esbuild.config.ts`, **delete
136
- the entire `path-alias` plugin**:
137
- ```ts
138
- // DELETE THIS ENTIRE PLUGIN:
139
- {
140
- name: "path-alias",
141
- setup: (build) => {
142
- build.onResolve({ filter: /^@config\// }, ...);
143
- build.onResolve({ filter: /^@config-scripts\// }, ...);
144
- }
145
- }
146
- ```
147
-
148
- Do the same in the root `scripts/esbuild.config.ts`.
149
-
150
- ### Task 8: Complete injection — add missing files
151
-
152
- In `inject-core.ts`, add to `configFiles`:
153
- - `templates/.editorconfig`
154
- - `templates/.prettierrc`
155
- - `templates/.npmrc`
156
- - `templates/.env`
157
- - `templates/.vscode/tasks.json`
158
-
159
- Add `prettier` to `requiredDeps` in
160
- `updatePackageJson()`.
161
-
162
- ### Task 9: Delete obsolete files
163
-
164
- - `templates/package-versions.json`
165
- - `templates/package-versions-sass.json`
166
- - `templates/scripts/esbuild.config-sass.ts`
167
-
168
- ### Task 10: Fix `build-npm.ts`
169
-
170
- Replace fragile echo piping:
171
- ```diff
172
- -execSync('echo 1 | tsx scripts/update-version-config.ts', ...);
173
- +execSync('tsx scripts/update-version-config.ts', ...);
174
- ```
175
-
176
- Replace hardcoded `"1.8.9"` with:
177
- ```ts
178
- const manifest = JSON.parse(
179
- fs.readFileSync("manifest.json", "utf8")
180
- );
181
- versions[packageJson.version] =
182
- manifest.minAppVersion;
183
- ```
184
-
185
- ### Task 11: Translate French comments
186
-
187
- All templates — replace French comments with
188
- English. Examples:
189
- ```diff
190
- -// Plugin pour gérer les alias de chemin
191
- +// Plugin to handle path aliases
192
- ```
193
- (This specific one will be deleted with the
194
- path-alias plugin, but check all files)
195
-
196
- ### Task 12: Update help scripts
197
-
198
- Update `scripts/help.ts` to document the
199
- simplified architecture.
200
-
201
- ### Task 13: Align root `.vscode/settings.json`
202
-
203
- Add formatter settings from template:
204
- ```json
205
- {
206
- "npm.packageManager": "yarn",
207
- "js/ts.preferences.includePackageJsonAutoImports": "off",
208
- "[typescript]": {
209
- "editor.defaultFormatter": "esbenp.prettier-vscode"
210
- },
211
- "[markdown]": {
212
- "editor.defaultFormatter": "yzhang.markdown-all-in-one"
213
- },
214
- "editor.formatOnSave": true
215
- }
216
- ```
217
-
218
- ### Task 14: Simplify `update-exports.js`
219
-
220
- Since exports are simplified to just `"."`,
221
- update-exports should:
222
- 1. Still scan `src/` and regenerate `src/index.ts`
223
- 2. Set exports to just `{ ".": "./src/index.ts" }`
224
- (remove the loop that adds per-module exports)
225
-
226
- ---
227
-
228
- ## Important constraints
229
-
230
- - **Line length**: Max 100 characters per line
231
- - **Language**: All code and comments in English
232
- - **Verification**: After modifications, run:
233
- - `yarn build` (TypeScript check)
234
- - `yarn lint` (ESLint check)
235
- - Uses `yarn` — never `npm`
236
- - ESM (`"type": "module"`)
237
- - Templates are NOT linted (`templates/**` ignored)
238
- - Keep `obsidian` and `obsidian-typings` in
239
- devDependencies for local snippet development