obsidian-plugin-config 1.6.18 → 1.7.1
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/.editorconfig +9 -14
- package/.prettierrc +3 -12
- package/README.md +8 -12
- package/bin/obsidian-inject.js +2 -10
- package/docs/INTERACTIVE_INJECTION.md +55 -116
- package/docs/LLM-GUIDE.md +17 -8
- package/eslint.config.mts +63 -64
- package/package.json +3 -4
- package/scripts/acp.ts +53 -57
- package/scripts/build-npm.ts +180 -167
- package/scripts/help.ts +3 -6
- package/scripts/inject-core.ts +765 -829
- package/scripts/inject-path.ts +144 -160
- package/scripts/inject-prompt.ts +86 -91
- package/scripts/update-version-config.ts +121 -89
- package/scripts/utils.ts +112 -112
- package/templates/.editorconfig +11 -14
- package/templates/.prettierrc +3 -12
- package/templates/env.template +12 -9
- package/templates/eslint.config.mts +1 -1
- package/templates/package.json +2 -3
- package/templates/scripts/acp.ts +50 -74
- package/templates/scripts/constants.ts +26 -0
- package/templates/scripts/env.ts +94 -0
- package/templates/scripts/esbuild.config.ts +134 -287
- package/templates/scripts/release.ts +92 -87
- package/templates/scripts/reload.ts +46 -0
- package/templates/scripts/typingsPlugin.ts +26 -0
- package/templates/scripts/update-version.ts +120 -123
- package/templates/scripts/utils.ts +234 -134
- package/templates/tsconfig.json +2 -2
- package/tsconfig.json +1 -1
- package/templates/package-sass.json +0 -5
package/.editorconfig
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
# top-most EditorConfig file
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
end_of_line = lf
|
|
7
|
-
insert_final_newline = true
|
|
8
|
-
indent_style =
|
|
9
|
-
indent_size =
|
|
10
|
-
tab_width = 4
|
|
11
|
-
|
|
12
|
-
[*.json]
|
|
13
|
-
indent_style = space
|
|
14
|
-
indent_size = 2
|
|
1
|
+
# top-most EditorConfig file
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
insert_final_newline = true
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
package/.prettierrc
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"useTabs":
|
|
3
|
-
"tabWidth":
|
|
2
|
+
"useTabs": false,
|
|
3
|
+
"tabWidth": 2,
|
|
4
4
|
"printWidth": 90,
|
|
5
5
|
"endOfLine": "lf",
|
|
6
6
|
"trailingComma": "none",
|
|
7
7
|
"semi": true,
|
|
8
8
|
"singleQuote": true,
|
|
9
|
-
"arrowParens": "always"
|
|
10
|
-
"overrides": [
|
|
11
|
-
{
|
|
12
|
-
"files": ["*.json"],
|
|
13
|
-
"options": {
|
|
14
|
-
"useTabs": false,
|
|
15
|
-
"tabWidth": 2
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
]
|
|
9
|
+
"arrowParens": "always"
|
|
19
10
|
}
|
package/README.md
CHANGED
|
@@ -32,10 +32,6 @@ obsidian-inject ../my-plugin
|
|
|
32
32
|
# Auto-confirms all file replacements (no prompts)
|
|
33
33
|
obsidian-inject ../my-plugin --no
|
|
34
34
|
|
|
35
|
-
# Inject with SASS support
|
|
36
|
-
# Adds esbuild-sass-plugin dependency and SCSS compilation
|
|
37
|
-
obsidian-inject ../my-plugin --sass
|
|
38
|
-
|
|
39
35
|
# Verification only (dry-run)
|
|
40
36
|
# Shows what would be injected without making any changes
|
|
41
37
|
obsidian-inject ../my-plugin --dry-run
|
|
@@ -47,7 +43,6 @@ obsidian-inject --help
|
|
|
47
43
|
## CLI Options
|
|
48
44
|
|
|
49
45
|
- `--no`, `-n` - Skip confirmation prompts (auto-confirm)
|
|
50
|
-
- `--sass` - Add SASS support (esbuild-sass-plugin)
|
|
51
46
|
- `--dry-run` - Verification only (no changes)
|
|
52
47
|
|
|
53
48
|
## What is injected
|
|
@@ -61,7 +56,7 @@ obsidian-inject --help
|
|
|
61
56
|
`.env`, `.vscode/settings.json`, `.vscode/tasks.json`
|
|
62
57
|
- ✅ **GitHub Actions**: release workflow
|
|
63
58
|
- ✅ **Traceability**: `.injection-info.json` (version, date)
|
|
64
|
-
- 🎨 **
|
|
59
|
+
- 🎨 **SCSS support**: automatic detection in the injected `esbuild.config.ts`
|
|
65
60
|
|
|
66
61
|
## Commands available after injection
|
|
67
62
|
|
|
@@ -89,15 +84,17 @@ yarn upgrade # Update all dependencies to latest
|
|
|
89
84
|
|
|
90
85
|
## SASS Support
|
|
91
86
|
|
|
92
|
-
|
|
93
|
-
obsidian-inject ../my-plugin --sass
|
|
94
|
-
```
|
|
87
|
+
SCSS is detected automatically by the injected `esbuild.config.ts`:
|
|
95
88
|
|
|
96
|
-
What gets added:
|
|
97
|
-
- ✅ `esbuild-sass-plugin` dependency
|
|
98
89
|
- ✅ Automatic `.scss` detection (`src/styles.scss` priority)
|
|
99
90
|
- ✅ CSS cleanup after compilation
|
|
100
91
|
|
|
92
|
+
If your plugin uses SCSS, install the plugin once:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
yarn add -D esbuild-sass-plugin
|
|
96
|
+
```
|
|
97
|
+
|
|
101
98
|
## Architecture
|
|
102
99
|
|
|
103
100
|
Target plugins become **100% standalone** after injection:
|
|
@@ -192,7 +189,6 @@ yarn install
|
|
|
192
189
|
```bash
|
|
193
190
|
yarn inject-prompt # Interactive injection
|
|
194
191
|
yarn inject-path ../my-plugin # Direct injection
|
|
195
|
-
yarn inject ../my-plugin --sass # With SASS support
|
|
196
192
|
yarn check-plugin ../my-plugin # Dry-run only
|
|
197
193
|
```
|
|
198
194
|
|
package/bin/obsidian-inject.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Obsidian Plugin Config - CLI Entry Point
|
|
5
5
|
* Global command: obsidian-inject
|
|
6
|
-
* Version: 1.
|
|
6
|
+
* Version: 1.7.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { execSync } from 'child_process';
|
|
@@ -28,19 +28,16 @@ USAGE:
|
|
|
28
28
|
obsidian-inject # Inject in current directory (with confirmation)
|
|
29
29
|
obsidian-inject <path> # Inject by path (with confirmation)
|
|
30
30
|
obsidian-inject <path> --no # Inject without confirmation
|
|
31
|
-
obsidian-inject <path> --sass # Inject with SASS support
|
|
32
31
|
obsidian-inject --help, -h # Show this help
|
|
33
32
|
|
|
34
33
|
OPTIONS:
|
|
35
34
|
--no, -n # Skip confirmation prompts (auto-confirm all)
|
|
36
|
-
--sass # Add SASS support (esbuild-sass-plugin)
|
|
37
35
|
--dry-run # Verification only (no changes)
|
|
38
36
|
|
|
39
37
|
EXAMPLES:
|
|
40
38
|
cd my-plugin && obsidian-inject
|
|
41
39
|
obsidian-inject ../my-other-plugin
|
|
42
40
|
obsidian-inject ../my-plugin --no
|
|
43
|
-
obsidian-inject ../my-plugin --sass
|
|
44
41
|
obsidian-inject "C:\\Users\\dev\\plugins\\my-plugin"
|
|
45
42
|
|
|
46
43
|
WHAT IS INJECTED:
|
|
@@ -49,7 +46,6 @@ WHAT IS INJECTED:
|
|
|
49
46
|
✅ Config files (tsconfig, eslint, prettier, vscode, github)
|
|
50
47
|
✅ Yarn protection enforced
|
|
51
48
|
✅ Automatic dependency installation
|
|
52
|
-
🎨 SASS support (with --sass option): esbuild-sass-plugin + SCSS compilation
|
|
53
49
|
|
|
54
50
|
ARCHITECTURE:
|
|
55
51
|
- Plugin becomes AUTONOMOUS with local scripts
|
|
@@ -78,7 +74,6 @@ function main() {
|
|
|
78
74
|
|
|
79
75
|
// Parse arguments
|
|
80
76
|
const noConfirm = args.includes('--no') || args.includes('-n');
|
|
81
|
-
const sassFlag = args.includes('--sass');
|
|
82
77
|
const dryRun = args.includes('--dry-run');
|
|
83
78
|
const pathArg = args.find(arg => !arg.startsWith('-'));
|
|
84
79
|
|
|
@@ -93,7 +88,6 @@ function main() {
|
|
|
93
88
|
|
|
94
89
|
console.log(`🎯 Obsidian Plugin Config - Global Injection`);
|
|
95
90
|
console.log(`📁 Target: ${targetPath}`);
|
|
96
|
-
console.log(`🎨 SASS: ${sassFlag ? 'Enabled' : 'Disabled'}`);
|
|
97
91
|
console.log(`❓ Confirmation: ${noConfirm ? 'Disabled (auto-confirm)' : 'Enabled'}`);
|
|
98
92
|
console.log(`📦 From: ${packageRoot}\n`);
|
|
99
93
|
|
|
@@ -139,7 +133,6 @@ function main() {
|
|
|
139
133
|
}
|
|
140
134
|
|
|
141
135
|
// Check if tsx is available locally in target
|
|
142
|
-
let tsxCommand = 'npx tsx';
|
|
143
136
|
try {
|
|
144
137
|
execSync('npx tsx --version', {
|
|
145
138
|
cwd: targetPath,
|
|
@@ -164,10 +157,9 @@ function main() {
|
|
|
164
157
|
}
|
|
165
158
|
|
|
166
159
|
// Execute the injection script with tsx
|
|
167
|
-
const sassOption = sassFlag ? ' --sass' : '';
|
|
168
160
|
const yesOption = noConfirm ? ' --yes' : '';
|
|
169
161
|
const dryRunOption = dryRun ? ' --dry-run' : '';
|
|
170
|
-
const command = `npx tsx "${injectScriptPath}" "${targetPath}"${yesOption}${
|
|
162
|
+
const command = `npx tsx "${injectScriptPath}" "${targetPath}"${yesOption}${dryRunOption}`;
|
|
171
163
|
|
|
172
164
|
execSync(command, {
|
|
173
165
|
stdio: 'inherit',
|
|
@@ -1,137 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Injection interactive
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
L'injection est **interactive par défaut** : elle compare chaque fichier du template
|
|
4
|
+
avec le fichier existant de la cible et ne demande confirmation que lorsque le contenu
|
|
5
|
+
diffère.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Points d'entrée
|
|
6
8
|
|
|
7
|
-
## Utilisation
|
|
8
|
-
|
|
9
|
-
### Mode par défaut (tout injecter)
|
|
10
|
-
```bash
|
|
11
|
-
obsidian-inject ../my-plugin
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Mode interactif (choisir quoi injecter)
|
|
15
|
-
```bash
|
|
16
|
-
obsidian-inject ../my-plugin --interactive
|
|
17
|
-
# ou
|
|
18
|
-
obsidian-inject ../my-plugin -i
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Presets rapides
|
|
22
9
|
```bash
|
|
23
|
-
#
|
|
24
|
-
obsidian-inject
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
10
|
+
# CLI globale
|
|
11
|
+
obsidian-inject # Injection dans le dossier courant
|
|
12
|
+
obsidian-inject ../my-plugin # Injection par chemin
|
|
13
|
+
|
|
14
|
+
# Scripts locaux (développement de ce repo)
|
|
15
|
+
yarn inject-prompt # Demande le chemin du plugin cible, puis injecte
|
|
16
|
+
yarn inject-path ../my-plugin # Injection directe par chemin
|
|
17
|
+
yarn check-plugin ../my-plugin # Dry-run (vérification seule, aucune modification)
|
|
31
18
|
```
|
|
32
19
|
|
|
33
|
-
##
|
|
34
|
-
|
|
35
|
-
Le mode interactif permet de choisir :
|
|
20
|
+
## Comportement fichier par fichier
|
|
36
21
|
|
|
37
|
-
|
|
38
|
-
2. **packageJson** - package.json (scripts & dependencies)
|
|
39
|
-
3. **tsconfig** - tsconfig.json
|
|
40
|
-
4. **eslint** - eslint.config.mts
|
|
41
|
-
5. **prettier** - .prettierrc & .prettierignore
|
|
42
|
-
6. **editorconfig** - .editorconfig
|
|
43
|
-
7. **vscode** - .vscode/ (settings.json, tasks.json, extensions.json)
|
|
44
|
-
8. **github** - .github/workflows/ (release workflow)
|
|
45
|
-
9. **gitignore** - .gitignore
|
|
46
|
-
10. **env** - .env (template)
|
|
22
|
+
Pendant l'injection, chaque fichier est traité ainsi :
|
|
47
23
|
|
|
48
|
-
|
|
24
|
+
- **La cible n'existe pas encore** → le fichier est injecté sans demander.
|
|
25
|
+
- **Contenu identique** → ignoré silencieusement (`✅ ... (unchanged)`).
|
|
26
|
+
- **Contenu différent** → l'outil demande `Update <fichier>? (content differs)`.
|
|
27
|
+
- `y` → le fichier est remplacé.
|
|
28
|
+
- `n` → le fichier existant est conservé (`⏭️ Kept existing ...`).
|
|
49
29
|
|
|
50
|
-
|
|
51
|
-
- ✅ scripts
|
|
52
|
-
- ✅ packageJson
|
|
53
|
-
- ✅ env
|
|
54
|
-
- ❌ Tout le reste
|
|
30
|
+
Cas particuliers :
|
|
55
31
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-
|
|
32
|
+
- `.env` est toujours **fusionné** : le template est réécrit en préservant les
|
|
33
|
+
valeurs déjà renseignées (chemins de vault, etc.).
|
|
34
|
+
- `.npmrc` est toujours injecté (protection Yarn).
|
|
35
|
+
- `eslint.config.mts` est approuvé automatiquement si un ancien `.eslintrc*`
|
|
36
|
+
est détecté (migration depuis l'ancien format).
|
|
59
37
|
|
|
60
|
-
|
|
61
|
-
- ✅ tsconfig
|
|
62
|
-
- ✅ eslint
|
|
63
|
-
- ✅ prettier
|
|
64
|
-
- ✅ editorconfig
|
|
65
|
-
- ✅ vscode
|
|
66
|
-
- ✅ gitignore
|
|
67
|
-
- ❌ scripts, packageJson, github, env
|
|
68
|
-
|
|
69
|
-
## Exemple d'Utilisation
|
|
38
|
+
## Options
|
|
70
39
|
|
|
71
40
|
```bash
|
|
72
|
-
#
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
Use default options (inject everything)? [Y/n]: n
|
|
79
|
-
|
|
80
|
-
📋 Select individual options:
|
|
81
|
-
|
|
82
|
-
Inject Scripts (esbuild.config.ts, acp.ts, utils.ts, etc.)? [Y/n]: y
|
|
83
|
-
Inject package.json (scripts & dependencies)? [Y/n]: y
|
|
84
|
-
Inject tsconfig.json? [Y/n]: n
|
|
85
|
-
Inject eslint.config.mts? [Y/n]: n
|
|
86
|
-
Inject .prettierrc & .prettierignore? [Y/n]: y
|
|
87
|
-
Inject .editorconfig? [Y/n]: y
|
|
88
|
-
Inject .vscode/ (settings.json, tasks.json, extensions.json)? [Y/n]: y
|
|
89
|
-
Inject .github/workflows/ (release workflow)? [Y/n]: n
|
|
90
|
-
Inject .gitignore? [Y/n]: y
|
|
91
|
-
Inject .env (template)? [Y/n]: y
|
|
92
|
-
|
|
93
|
-
📋 Selected options:
|
|
94
|
-
✅ Scripts (esbuild.config.ts, acp.ts, utils.ts, etc.)
|
|
95
|
-
✅ package.json (scripts & dependencies)
|
|
96
|
-
❌ tsconfig.json
|
|
97
|
-
❌ eslint.config.mts
|
|
98
|
-
✅ .prettierrc & .prettierignore
|
|
99
|
-
✅ .editorconfig
|
|
100
|
-
✅ .vscode/ (settings.json, tasks.json, extensions.json)
|
|
101
|
-
❌ .github/workflows/ (release workflow)
|
|
102
|
-
✅ .gitignore
|
|
103
|
-
✅ .env (template)
|
|
104
|
-
|
|
105
|
-
Proceed with these options? [Y/n]: y
|
|
41
|
+
# Auto-confirmer tous les remplacements (aucune question)
|
|
42
|
+
obsidian-inject ../my-plugin --no # CLI globale : --no / -n
|
|
43
|
+
yarn inject-path ../my-plugin --yes # Scripts locaux : --yes / -y
|
|
44
|
+
|
|
45
|
+
# Vérification seule (n'écrit rien)
|
|
46
|
+
obsidian-inject ../my-plugin --dry-run
|
|
106
47
|
```
|
|
107
48
|
|
|
108
|
-
|
|
49
|
+
| Option | Effet |
|
|
50
|
+
| ---------------- | -------------------------------------------------- |
|
|
51
|
+
| `--no`, `-n` | (CLI globale) auto-confirme tous les remplacements |
|
|
52
|
+
| `--yes`, `-y` | (scripts locaux) auto-confirme tous les remplacements |
|
|
53
|
+
| `--dry-run` | vérification seule, aucune modification |
|
|
109
54
|
|
|
110
|
-
|
|
111
|
-
2. **scripts/inject-core.ts** - Ajout paramètre `options` aux fonctions
|
|
112
|
-
3. **scripts/inject-path.ts** - Ajout flags `--interactive` et `--preset`
|
|
55
|
+
## Ce qui est injecté
|
|
113
56
|
|
|
114
|
-
|
|
57
|
+
Tous les fichiers du template sont pris en compte à chaque injection (pas de
|
|
58
|
+
sélection par composant) :
|
|
115
59
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
60
|
+
- `templates/scripts/*` → `<cible>/scripts/`
|
|
61
|
+
- `templates/tsconfig.json`, `eslint.config.mts`, `.editorconfig`,
|
|
62
|
+
`.prettierrc`, `.prettierignore`, `.npmrc`, `.env`
|
|
63
|
+
- `templates/.vscode/*`
|
|
64
|
+
- `templates/.github/workflows/*`
|
|
65
|
+
- `templates/gitignore.template` → `<cible>/.gitignore`
|
|
121
66
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Tout sauf GitHub workflows
|
|
128
|
-
```bash
|
|
129
|
-
obsidian-inject ../my-plugin -i
|
|
130
|
-
# Répondre 'n' uniquement à ".github/workflows/"
|
|
131
|
-
```
|
|
67
|
+
La confirmation fichier par fichier permet de conserver un fichier existant
|
|
68
|
+
(par exemple un `esbuild.config.ts` personnalisé) en répondant `n` lorsque la
|
|
69
|
+
question apparaît.
|
|
132
70
|
|
|
133
|
-
##
|
|
71
|
+
## Fichiers concernés
|
|
134
72
|
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
-
|
|
73
|
+
1. **scripts/inject-core.ts** — logique d'injection (`diffAndPromptFiles`,
|
|
74
|
+
`injectScripts`, `updatePackageJson`, `performInjection`).
|
|
75
|
+
2. **scripts/inject-prompt.ts** — entrée interactive (demande le chemin).
|
|
76
|
+
3. **scripts/inject-path.ts** — entrée CLI (parse `--yes`, `--dry-run`).
|
package/docs/LLM-GUIDE.md
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
|
|
15
15
|
- `templates/scripts/` — scripts copied into `<target>/scripts/`
|
|
16
16
|
- `templates/package.json` — base deps/scripts merged into `<target>/package.json`
|
|
17
|
-
- `templates/package-sass.json` — additional deps merged when `--sass` flag is used
|
|
18
17
|
- `templates/tsconfig.json` — TypeScript config injected as `<target>/tsconfig.json`
|
|
19
18
|
- `templates/eslint.config.mts` — ESLint config injected into target
|
|
20
19
|
- `templates/.editorconfig`, `templates/.prettierrc`, etc. — config files injected into target
|
|
@@ -38,7 +37,7 @@
|
|
|
38
37
|
|
|
39
38
|
### 1. Package.json merge
|
|
40
39
|
|
|
41
|
-
`inject-core.ts → updatePackageJson()` reads `templates/package.json`
|
|
40
|
+
`inject-core.ts → updatePackageJson()` reads `templates/package.json` and merges into the target plugin's `package.json`:
|
|
42
41
|
|
|
43
42
|
- All `scripts` are overwritten with template values
|
|
44
43
|
- All `devDependencies` from template are added/updated
|
|
@@ -66,22 +65,31 @@ Creates `.injection-info.json` in target with version and date.
|
|
|
66
65
|
|
|
67
66
|
Scripts in `templates/scripts/` that get copied to target plugins:
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
**Build system (modular):**
|
|
69
|
+
- `esbuild.config.ts` — build entry point, orchestrates all build modules
|
|
70
|
+
- `constants.ts` — shared constants (external deps list, banner, REST port)
|
|
71
|
+
- `env.ts` — environment validation, manifest check, build path resolution
|
|
72
|
+
- `reload.ts` — Obsidian hot-reload via Local REST API
|
|
73
|
+
- `typingsPlugin.ts` — esbuild plugin for obsidian-typings resolution
|
|
74
|
+
- `utils.ts` — shared utilities (readline, file ops, git, vault path helpers)
|
|
75
|
+
|
|
76
|
+
**Workflow scripts:**
|
|
70
77
|
- `acp.ts` — add, commit, push workflow
|
|
71
78
|
- `update-version.ts` — version bump utility
|
|
72
79
|
- `release.ts` — GitHub release automation
|
|
73
|
-
- `utils.ts` — shared utilities
|
|
74
80
|
- `help.ts` — help documentation
|
|
75
81
|
|
|
76
82
|
---
|
|
77
83
|
|
|
78
84
|
## SASS support
|
|
79
85
|
|
|
80
|
-
|
|
86
|
+
SCSS is handled automatically by the injected `esbuild.config.ts`:
|
|
87
|
+
|
|
88
|
+
1. The build detects `.scss` files (e.g. `src/styles.scss`)
|
|
89
|
+
2. When found, it dynamically imports `esbuild-sass-plugin` and compiles the SCSS
|
|
90
|
+
3. The generated `main.css` is cleaned up after compilation
|
|
81
91
|
|
|
82
|
-
|
|
83
|
-
2. Adds `esbuild-sass-plugin` dependency
|
|
84
|
-
3. The injected `esbuild.config.ts` automatically detects `.scss` files and uses the plugin
|
|
92
|
+
The `esbuild-sass-plugin` dependency is **not** injected automatically. If a plugin uses SCSS, install it once with `yarn add -D esbuild-sass-plugin` (the build prints a clear warning if it is missing). Plugins without `.scss` files build normally with no extra dependency.
|
|
85
93
|
|
|
86
94
|
---
|
|
87
95
|
|
|
@@ -90,6 +98,7 @@ When `--sass` flag is used:
|
|
|
90
98
|
- ❌ Do not hardcode deps/scripts in `inject-core.ts` — they must come from `templates/package.json`
|
|
91
99
|
- ❌ Do not modify root config files thinking it will affect injected plugins — always modify `templates/`
|
|
92
100
|
- ❌ Do not add `obsidian-plugin-config` as a dependency in `templates/package.json` — injected plugins are standalone
|
|
101
|
+
- ❌ Do not inject `esbuild.config.ts` without its dependencies (`constants.ts`, `env.ts`, `reload.ts`, `typingsPlugin.ts`, `utils.ts`) — they are all required
|
|
93
102
|
|
|
94
103
|
---
|
|
95
104
|
|
package/eslint.config.mts
CHANGED
|
@@ -1,64 +1,63 @@
|
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"no-unused-vars": "
|
|
36
|
-
"@typescript-eslint/
|
|
37
|
-
"
|
|
38
|
-
"no-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"@typescript-eslint/explicit-
|
|
46
|
-
"@typescript-eslint/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"@typescript-eslint/no-unsafe-
|
|
51
|
-
"@typescript-eslint/no-unsafe-
|
|
52
|
-
"@typescript-eslint/no-unsafe-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export default configs;
|
|
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
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
files: ["**/*.ts"],
|
|
16
|
+
ignores: [
|
|
17
|
+
"dist/**",
|
|
18
|
+
"node_modules/**",
|
|
19
|
+
"main.js"
|
|
20
|
+
],
|
|
21
|
+
languageOptions: {
|
|
22
|
+
parser: typescriptEslintParser,
|
|
23
|
+
sourceType: "module",
|
|
24
|
+
parserOptions: {
|
|
25
|
+
project: "./tsconfig.json",
|
|
26
|
+
ecmaVersion: 2023
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
plugins: {
|
|
30
|
+
"@typescript-eslint": typescriptEslintPlugin as any // Type assertion to bypass type checking
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
// Base rules
|
|
34
|
+
"no-unused-vars": "off",
|
|
35
|
+
"@typescript-eslint/no-unused-vars": ["error", { "args": "none", "varsIgnorePattern": "^_" }],
|
|
36
|
+
"@typescript-eslint/ban-ts-comment": "warn",
|
|
37
|
+
"no-prototype-builtins": "off",
|
|
38
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
39
|
+
|
|
40
|
+
// Useful rules but not too strict
|
|
41
|
+
"semi": "error",
|
|
42
|
+
"eqeqeq": ["error", "always"],
|
|
43
|
+
"prefer-const": "error",
|
|
44
|
+
"@typescript-eslint/explicit-function-return-type": ["warn", { "allowExpressions": true }],
|
|
45
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
46
|
+
"@typescript-eslint/consistent-type-imports": ["warn", { "prefer": "type-imports" }],
|
|
47
|
+
|
|
48
|
+
// Disable overly strict rules
|
|
49
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
50
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
51
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
52
|
+
"@typescript-eslint/no-unsafe-argument": "off"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
files: ["src/**/*.ts"],
|
|
57
|
+
rules: {
|
|
58
|
+
"no-console": ["warn", { "allow": ["warn", "error", "debug"] }]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export default configs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obsidian-plugin-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Global CLI injection tool for Obsidian plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
"v": "tsx scripts/update-version-config.ts",
|
|
21
21
|
"lint": "eslint . --ext .ts",
|
|
22
22
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
23
|
+
"prettier": "prettier --check '**/*.{ts,json}'",
|
|
24
|
+
"prettier:fix": "prettier --write '**/*.{ts,json}'",
|
|
23
25
|
"inject-path": "tsx scripts/inject-path.ts",
|
|
24
|
-
"inject-sass": "tsx scripts/inject-path.ts --sass",
|
|
25
26
|
"inject-prompt": "tsx scripts/inject-prompt.ts",
|
|
26
27
|
"inject": "tsx scripts/inject-prompt.ts",
|
|
27
28
|
"check-plugin": "tsx scripts/inject-path.ts --dry-run",
|
|
@@ -31,7 +32,6 @@
|
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/eslint": "latest",
|
|
33
34
|
"@types/node": "^22.15.26",
|
|
34
|
-
"@types/semver": "^7.7.0",
|
|
35
35
|
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
36
36
|
"@typescript-eslint/parser": "^8.58.0",
|
|
37
37
|
"dedent": "^1.6.0",
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"eslint-import-resolver-typescript": "latest",
|
|
40
40
|
"jiti": "latest",
|
|
41
41
|
"prettier": "^3.4.0",
|
|
42
|
-
"semver": "^7.7.2",
|
|
43
42
|
"tsx": "^4.21.0",
|
|
44
43
|
"typescript": "^5.8.2"
|
|
45
44
|
},
|