obsidian-plugin-config 1.1.19 → 1.3.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.
- package/.injection-info.json +1 -0
- package/.prettierrc +10 -0
- package/.vscode/settings.json +8 -1
- package/.vscode/tasks.json +110 -0
- package/README.md +1 -1
- package/bin/obsidian-inject.js +1 -1
- package/docs/EXPORTS-EXPLAINED.md +164 -0
- package/docs/IMPROVEMENT-PLAN-FOR-LLM.md +239 -0
- package/eslint.config.mts +3 -3
- package/manifest.json +1 -1
- package/package.json +3 -6
- package/scripts/build-npm.ts +3 -2
- package/scripts/esbuild.config.ts +0 -19
- package/scripts/help.ts +78 -34
- package/scripts/inject-core.ts +660 -0
- package/scripts/inject-path.ts +41 -758
- package/scripts/inject-prompt.ts +14 -439
- package/scripts/update-exports.js +1 -10
- package/src/modals/GenericConfirmModal.ts +2 -3
- package/templates/.editorconfig +10 -0
- package/templates/.prettierrc +10 -0
- package/templates/.vscode/settings.json +9 -2
- package/templates/.vscode/tasks.json +53 -0
- package/templates/eslint.config.mts +3 -3
- package/templates/help-plugin.ts +24 -24
- package/templates/scripts/esbuild.config.ts +0 -20
- package/tsconfig.json +1 -2
- package/versions.json +4 -1
- package/templates/package-versions-sass.json +0 -29
- package/templates/package-versions.json +0 -28
- package/templates/scripts/esbuild.config-sass.ts +0 -294
- /package/templates/{tsconfig-template.json → tsconfig.json} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"injectorVersion": "1.1.20", "injectionDate": "2025-07-18T22:04:30.392Z", "injectorName": "obsidian-plugin-config"}
|
package/.prettierrc
ADDED
package/.vscode/settings.json
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"npm.packageManager": "yarn",
|
|
3
|
-
"
|
|
3
|
+
"js/ts.preferences.includePackageJsonAutoImports": "off",
|
|
4
|
+
"[typescript]": {
|
|
5
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
6
|
+
},
|
|
7
|
+
"[markdown]": {
|
|
8
|
+
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
|
|
9
|
+
},
|
|
10
|
+
"editor.formatOnSave": true
|
|
4
11
|
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "Build",
|
|
6
|
+
"type": "shell",
|
|
7
|
+
"command": "yarn build",
|
|
8
|
+
"group": { "kind": "build", "isDefault": true },
|
|
9
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
10
|
+
"problemMatcher": ["$tsc"]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"label": "Dev (watch)",
|
|
14
|
+
"type": "shell",
|
|
15
|
+
"command": "yarn dev",
|
|
16
|
+
"group": "build",
|
|
17
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
18
|
+
"problemMatcher": ["$tsc-watch"],
|
|
19
|
+
"isBackground": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"label": "Real (build to vault)",
|
|
23
|
+
"type": "shell",
|
|
24
|
+
"command": "yarn real",
|
|
25
|
+
"group": "build",
|
|
26
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
27
|
+
"problemMatcher": ["$tsc"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"label": "Lint",
|
|
31
|
+
"type": "shell",
|
|
32
|
+
"command": "yarn lint",
|
|
33
|
+
"group": "test",
|
|
34
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
35
|
+
"problemMatcher": ["$eslint-stylish"]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"label": "Lint: Fix",
|
|
39
|
+
"type": "shell",
|
|
40
|
+
"command": "yarn lint:fix",
|
|
41
|
+
"group": "test",
|
|
42
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
43
|
+
"problemMatcher": ["$eslint-stylish"]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"label": "Prettier: Check",
|
|
47
|
+
"type": "shell",
|
|
48
|
+
"command": "npx prettier --check \"src/**/*.ts\"",
|
|
49
|
+
"group": "test",
|
|
50
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
51
|
+
"problemMatcher": []
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"label": "Prettier: Fix",
|
|
55
|
+
"type": "shell",
|
|
56
|
+
"command": "npx prettier --write \"src/**/*.ts\"",
|
|
57
|
+
"group": "test",
|
|
58
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
59
|
+
"problemMatcher": []
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"label": "Update Exports",
|
|
63
|
+
"type": "shell",
|
|
64
|
+
"command": "yarn update-exports",
|
|
65
|
+
"group": "build",
|
|
66
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
67
|
+
"problemMatcher": []
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"label": "ACP (add, commit, push)",
|
|
71
|
+
"type": "shell",
|
|
72
|
+
"command": "yarn acp",
|
|
73
|
+
"group": "build",
|
|
74
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
75
|
+
"problemMatcher": []
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"label": "BACP (build + acp)",
|
|
79
|
+
"type": "shell",
|
|
80
|
+
"command": "yarn bacp",
|
|
81
|
+
"group": "build",
|
|
82
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
83
|
+
"problemMatcher": []
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"label": "Version update",
|
|
87
|
+
"type": "shell",
|
|
88
|
+
"command": "yarn v",
|
|
89
|
+
"group": "build",
|
|
90
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
91
|
+
"problemMatcher": []
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"label": "NPM Publish",
|
|
95
|
+
"type": "shell",
|
|
96
|
+
"command": "yarn npm-publish",
|
|
97
|
+
"group": "build",
|
|
98
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
99
|
+
"problemMatcher": []
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"label": "Cleanup: Lint + Prettier + Build",
|
|
103
|
+
"dependsOrder": "sequence",
|
|
104
|
+
"dependsOn": ["Lint: Fix", "Prettier: Fix", "Build"],
|
|
105
|
+
"group": "build",
|
|
106
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
107
|
+
"problemMatcher": []
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
package/README.md
CHANGED
package/bin/obsidian-inject.js
CHANGED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# NPM Exports — How it works
|
|
2
|
+
|
|
3
|
+
## The two roles of this repo
|
|
4
|
+
|
|
5
|
+
### 1. Injection system (primary)
|
|
6
|
+
|
|
7
|
+
The injection system copies scripts and config files
|
|
8
|
+
**directly into target plugins**. After injection,
|
|
9
|
+
the plugin is **100% standalone**.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
templates/ → target-plugin/
|
|
13
|
+
scripts/utils.ts → scripts/utils.ts
|
|
14
|
+
scripts/esbuild... → scripts/esbuild...
|
|
15
|
+
tsconfig.json → tsconfig.json
|
|
16
|
+
.gitignore → .gitignore
|
|
17
|
+
...
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. Exportable snippets (complementary)
|
|
21
|
+
|
|
22
|
+
The `src/` directory contains reusable code
|
|
23
|
+
(modals, helpers, utilities) that can be imported
|
|
24
|
+
by other plugins via the NPM package.
|
|
25
|
+
|
|
26
|
+
**These two systems are complementary, not opposed.**
|
|
27
|
+
Injection provides the base infrastructure.
|
|
28
|
+
Exports provide optional reusable components.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## How NPM exports work
|
|
33
|
+
|
|
34
|
+
The `exports` field in `package.json`:
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"exports": {
|
|
38
|
+
".": "./src/index.ts"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This single entry is enough. `src/index.ts`
|
|
44
|
+
re-exports everything from all submodules.
|
|
45
|
+
|
|
46
|
+
### Importing in another plugin
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
// Import what you need
|
|
50
|
+
import {
|
|
51
|
+
showConfirmModal,
|
|
52
|
+
NoticeHelper,
|
|
53
|
+
SettingsHelper
|
|
54
|
+
} from "obsidian-plugin-config";
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
That's it. One import path covers everything.
|
|
58
|
+
|
|
59
|
+
### What `update-exports` does
|
|
60
|
+
|
|
61
|
+
Running `yarn update-exports` (or `yarn ue`):
|
|
62
|
+
|
|
63
|
+
1. **Scans `src/` subdirectories** for folders
|
|
64
|
+
containing an `index.ts` file
|
|
65
|
+
2. **Regenerates `src/index.ts`** with
|
|
66
|
+
`export * from` for each found module
|
|
67
|
+
3. **Updates `package.json` `exports`** field
|
|
68
|
+
|
|
69
|
+
Example: Adding `src/components/index.ts` and
|
|
70
|
+
running `update-exports` will add:
|
|
71
|
+
```ts
|
|
72
|
+
// In src/index.ts:
|
|
73
|
+
export * from './components/index.js';
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Local development
|
|
79
|
+
|
|
80
|
+
This repo also works as an Obsidian plugin for
|
|
81
|
+
testing purposes. The `src/main.ts` loads a
|
|
82
|
+
sample plugin that exercises the exportable code.
|
|
83
|
+
|
|
84
|
+
### Why keep obsidian + obsidian-typings locally?
|
|
85
|
+
|
|
86
|
+
The snippets in `src/` use Obsidian's API (modals,
|
|
87
|
+
settings, notices). To develop and test these
|
|
88
|
+
snippets, you need the Obsidian types available.
|
|
89
|
+
|
|
90
|
+
You can:
|
|
91
|
+
- Run `yarn build` to check for type errors
|
|
92
|
+
- Run `yarn dev` to test in a vault
|
|
93
|
+
- **Never** release this as a real plugin
|
|
94
|
+
|
|
95
|
+
### Workflow for adding new snippets
|
|
96
|
+
|
|
97
|
+
1. Create your module in `src/mymodule/`
|
|
98
|
+
2. Add an `index.ts` that exports everything
|
|
99
|
+
3. Run `yarn update-exports` to update the barrel
|
|
100
|
+
4. Test locally with `yarn dev`
|
|
101
|
+
5. When ready, publish via `yarn npm-publish`
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Injection scripts explained
|
|
106
|
+
|
|
107
|
+
### `inject-path.ts` — Direct injection
|
|
108
|
+
|
|
109
|
+
Options:
|
|
110
|
+
- `--yes` / `-y` : Skip confirmation
|
|
111
|
+
- `--sass` : Include SASS support
|
|
112
|
+
- `--dry-run` / `--check` : Preview only
|
|
113
|
+
|
|
114
|
+
### `inject-prompt.ts` — Interactive injection
|
|
115
|
+
|
|
116
|
+
Prompts for target path and confirmation.
|
|
117
|
+
|
|
118
|
+
### `obsidian-inject` CLI (global)
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npm install -g obsidian-plugin-config
|
|
122
|
+
obsidian-inject # Current dir
|
|
123
|
+
obsidian-inject ../my-plugin # By path
|
|
124
|
+
obsidian-inject ../my-plugin --sass # With SASS
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### `build-npm.ts` — NPM publish workflow
|
|
128
|
+
|
|
129
|
+
Automates: version → commit → push → exports →
|
|
130
|
+
bin → publish.
|
|
131
|
+
|
|
132
|
+
> **Tip**: Run `npm login` first, or visit
|
|
133
|
+
> https://www.npmjs.com/ to get your auth token.
|
|
134
|
+
|
|
135
|
+
### `update-exports.js` — Refresh exports
|
|
136
|
+
|
|
137
|
+
Scans `src/` and regenerates `src/index.ts` and
|
|
138
|
+
the `exports` field in `package.json`.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## SASS support
|
|
143
|
+
|
|
144
|
+
The template `esbuild.config.ts` handles SASS
|
|
145
|
+
automatically via dynamic import:
|
|
146
|
+
```ts
|
|
147
|
+
const { sassPlugin } =
|
|
148
|
+
await import('esbuild-sass-plugin');
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
If `.scss` files are detected in `src/`, the SASS
|
|
152
|
+
plugin is loaded. If not installed, it warns you.
|
|
153
|
+
|
|
154
|
+
The `--sass` injection flag adds
|
|
155
|
+
`esbuild-sass-plugin` to the target's dependencies.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Svelte support (planned)
|
|
160
|
+
|
|
161
|
+
Not yet implemented. Would require:
|
|
162
|
+
- `esbuild-svelte` package
|
|
163
|
+
- `svelte` compiler
|
|
164
|
+
- Detection of `.svelte` files in esbuild config
|
|
@@ -0,0 +1,239 @@
|
|
|
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
|
package/eslint.config.mts
CHANGED
|
@@ -33,14 +33,14 @@ const configs: Linter.Config[] = [
|
|
|
33
33
|
rules: {
|
|
34
34
|
// Base rules
|
|
35
35
|
"no-unused-vars": "off",
|
|
36
|
-
"@typescript-eslint/no-unused-vars": ["
|
|
37
|
-
"@typescript-eslint/ban-ts-comment": "
|
|
36
|
+
"@typescript-eslint/no-unused-vars": ["error", { "args": "none", "varsIgnorePattern": "^_" }],
|
|
37
|
+
"@typescript-eslint/ban-ts-comment": "warn",
|
|
38
38
|
"no-prototype-builtins": "off",
|
|
39
39
|
"@typescript-eslint/no-empty-function": "off",
|
|
40
40
|
|
|
41
41
|
// Useful rules but not too strict
|
|
42
42
|
"semi": "error",
|
|
43
|
-
"@typescript-eslint/explicit-function-return-type": "warn",
|
|
43
|
+
"@typescript-eslint/explicit-function-return-type": ["warn", { "allowExpressions": true }],
|
|
44
44
|
|
|
45
45
|
// Disable overly strict rules
|
|
46
46
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
package/manifest.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"version": "1.0.0",
|
|
5
5
|
"minAppVersion": "0.15.0",
|
|
6
6
|
"description": "Development and testing environment for obsidian-plugin-config NPM exports and injection system",
|
|
7
|
-
"author": "
|
|
7
|
+
"author": "3C0D",
|
|
8
8
|
"authorUrl": "",
|
|
9
9
|
"fundingUrl": "",
|
|
10
10
|
"isDesktopOnly": false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obsidian-plugin-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Système d'injection pour plugins Obsidian autonomes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -42,11 +42,7 @@
|
|
|
42
42
|
"h": "tsx scripts/help.ts"
|
|
43
43
|
},
|
|
44
44
|
"exports": {
|
|
45
|
-
".": "./src/index.ts"
|
|
46
|
-
"./scripts/*": "./scripts/*",
|
|
47
|
-
"./modals": "./src/modals/index.ts",
|
|
48
|
-
"./tools": "./src/tools/index.ts",
|
|
49
|
-
"./utils": "./src/utils/index.ts"
|
|
45
|
+
".": "./src/index.ts"
|
|
50
46
|
},
|
|
51
47
|
"devDependencies": {
|
|
52
48
|
"@types/eslint": "latest",
|
|
@@ -64,6 +60,7 @@
|
|
|
64
60
|
"jiti": "latest",
|
|
65
61
|
"obsidian": "*",
|
|
66
62
|
"obsidian-typings": "^3.9.5",
|
|
63
|
+
"prettier": "^3.4.0",
|
|
67
64
|
"semver": "^7.7.2",
|
|
68
65
|
"tsx": "^4.19.4",
|
|
69
66
|
"typescript": "^5.8.2"
|
package/scripts/build-npm.ts
CHANGED
|
@@ -204,7 +204,7 @@ function buildAndPublishNpm(): void {
|
|
|
204
204
|
try {
|
|
205
205
|
// Step 1: Update version and push to GitHub
|
|
206
206
|
console.log(`📋 Step 1/6: Updating version...`);
|
|
207
|
-
execSync('
|
|
207
|
+
execSync('tsx scripts/update-version-config.ts', { stdio: 'inherit' });
|
|
208
208
|
|
|
209
209
|
// Step 2: Commit and push any remaining changes
|
|
210
210
|
console.log(`\n📤 Step 2/6: Committing and pushing changes...`);
|
|
@@ -289,7 +289,8 @@ function verifyPackage(): void {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
if (!versions[packageJson.version]) {
|
|
292
|
-
|
|
292
|
+
const manifest = JSON.parse(fs.readFileSync("manifest.json", "utf8"));
|
|
293
|
+
versions[packageJson.version] = manifest.minAppVersion;
|
|
293
294
|
fs.writeFileSync(versionsPath, JSON.stringify(versions, null, "\t"), "utf8");
|
|
294
295
|
console.log(` ✅ Added version ${packageJson.version} to versions.json`);
|
|
295
296
|
} else {
|
|
@@ -183,25 +183,6 @@ async function createBuildContext(buildPath: string, isProd: boolean, entryPoint
|
|
|
183
183
|
outdir: buildPath,
|
|
184
184
|
outbase: path.join(pluginDir, "src"),
|
|
185
185
|
plugins: [
|
|
186
|
-
// Plugin pour gérer les alias de chemin
|
|
187
|
-
{
|
|
188
|
-
name: "path-alias",
|
|
189
|
-
setup: (build): void => {
|
|
190
|
-
build.onResolve({ filter: /^@config\// }, (args) => {
|
|
191
|
-
const relativePath = args.path.replace(/^@config\//, "");
|
|
192
|
-
return {
|
|
193
|
-
path: path.resolve("../obsidian-plugin-config/src", relativePath)
|
|
194
|
-
};
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
build.onResolve({ filter: /^@config-scripts\// }, (args) => {
|
|
198
|
-
const relativePath = args.path.replace(/^@config-scripts\//, "");
|
|
199
|
-
return {
|
|
200
|
-
path: path.resolve("../obsidian-plugin-config/scripts", relativePath)
|
|
201
|
-
};
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
186
|
{
|
|
206
187
|
name: "copy-to-plugins-folder",
|
|
207
188
|
setup: (build): void => {
|