obsidian-plugin-config 1.4.7 → 1.5.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/.editorconfig +13 -13
- package/.injection-info.json +5 -5
- package/.vscode/settings.json +11 -11
- package/.vscode/tasks.json +118 -118
- package/README.md +147 -192
- package/bin/obsidian-inject.js +8 -1
- package/eslint.config.mts +64 -64
- package/package.json +1 -1
- package/scripts/build-npm.ts +357 -346
- package/scripts/esbuild.config.ts +268 -268
- package/scripts/help.ts +152 -152
- package/scripts/inject-core.ts +725 -725
- package/scripts/inject-path.ts +10 -0
- package/scripts/inject-prompt.ts +11 -0
- package/scripts/utils.ts +151 -151
- package/tsconfig.json +30 -30
- package/versions.json +3 -1
package/.editorconfig
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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 = tab
|
|
9
|
-
indent_size = 4
|
|
10
|
-
tab_width = 4
|
|
11
|
-
|
|
12
|
-
[*.json]
|
|
13
|
-
indent_style = space
|
|
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 = tab
|
|
9
|
+
indent_size = 4
|
|
10
|
+
tab_width = 4
|
|
11
|
+
|
|
12
|
+
[*.json]
|
|
13
|
+
indent_style = space
|
|
14
14
|
indent_size = 2
|
package/.injection-info.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"injectorVersion": "1.1.20",
|
|
3
|
-
"injectionDate": "2025-07-18T22:04:30.392Z",
|
|
4
|
-
"injectorName": "obsidian-plugin-config"
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"injectorVersion": "1.1.20",
|
|
3
|
+
"injectionDate": "2025-07-18T22:04:30.392Z",
|
|
4
|
+
"injectorName": "obsidian-plugin-config"
|
|
5
|
+
}
|
package/.vscode/settings.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"npm.packageManager": "yarn",
|
|
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
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"npm.packageManager": "yarn",
|
|
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
|
|
11
|
+
}
|
package/.vscode/tasks.json
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
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": "yarn prettier",
|
|
49
|
-
"group": "test",
|
|
50
|
-
"presentation": { "reveal": "always", "panel": "shared" },
|
|
51
|
-
"problemMatcher": []
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"label": "Prettier: Fix",
|
|
55
|
-
"type": "shell",
|
|
56
|
-
"command": "yarn prettier:fix",
|
|
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": "Upgrade All (yarn upgrade + sync templates)",
|
|
95
|
-
"type": "shell",
|
|
96
|
-
"command": "yarn upgrade-all",
|
|
97
|
-
"group": "build",
|
|
98
|
-
"presentation": { "reveal": "always", "panel": "shared" },
|
|
99
|
-
"problemMatcher": []
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"label": "NPM Publish",
|
|
103
|
-
"type": "shell",
|
|
104
|
-
"command": "yarn npm-publish",
|
|
105
|
-
"group": "build",
|
|
106
|
-
"presentation": { "reveal": "always", "panel": "shared" },
|
|
107
|
-
"problemMatcher": []
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"label": "Cleanup: Lint + Prettier + Build",
|
|
111
|
-
"dependsOrder": "sequence",
|
|
112
|
-
"dependsOn": ["Lint: Fix", "Prettier: Fix", "Build"],
|
|
113
|
-
"group": "build",
|
|
114
|
-
"presentation": { "reveal": "always", "panel": "shared" },
|
|
115
|
-
"problemMatcher": []
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
}
|
|
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": "yarn prettier",
|
|
49
|
+
"group": "test",
|
|
50
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
51
|
+
"problemMatcher": []
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"label": "Prettier: Fix",
|
|
55
|
+
"type": "shell",
|
|
56
|
+
"command": "yarn prettier:fix",
|
|
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": "Upgrade All (yarn upgrade + sync templates)",
|
|
95
|
+
"type": "shell",
|
|
96
|
+
"command": "yarn upgrade-all",
|
|
97
|
+
"group": "build",
|
|
98
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
99
|
+
"problemMatcher": []
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"label": "NPM Publish",
|
|
103
|
+
"type": "shell",
|
|
104
|
+
"command": "yarn npm-publish --auto-update",
|
|
105
|
+
"group": "build",
|
|
106
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
107
|
+
"problemMatcher": []
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"label": "Cleanup: Lint + Prettier + Build",
|
|
111
|
+
"dependsOrder": "sequence",
|
|
112
|
+
"dependsOn": ["Lint: Fix", "Prettier: Fix", "Build"],
|
|
113
|
+
"group": "build",
|
|
114
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
115
|
+
"problemMatcher": []
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
package/README.md
CHANGED
|
@@ -1,192 +1,147 @@
|
|
|
1
|
-
# Obsidian Plugin Config
|
|
2
|
-
|
|
3
|
-
🎯 Injection system for standalone Obsidian plugins.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/obsidian-plugin-config)
|
|
6
|
-
[](LICENSE)
|
|
7
|
-
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npm install -g obsidian-plugin-config
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Update
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
#
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
yarn
|
|
60
|
-
|
|
61
|
-
#
|
|
62
|
-
|
|
63
|
-
yarn
|
|
64
|
-
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- ✅
|
|
76
|
-
- ✅
|
|
77
|
-
- ✅
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
#
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
yarn
|
|
147
|
-
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Local injection test
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
# Automatic injection
|
|
154
|
-
yarn inject ../my-plugin --yes
|
|
155
|
-
|
|
156
|
-
# Injection with prompts
|
|
157
|
-
yarn inject-prompt "../my-plugin"
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Development Workflow
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
# Standard workflow
|
|
164
|
-
1. yarn i # Install dependencies
|
|
165
|
-
2. Make changes to obsidian-plugin-config
|
|
166
|
-
3. yarn update-exports # Update exports if needed
|
|
167
|
-
4. yarn lint:fix # Fix any linting issues
|
|
168
|
-
5. yarn v # Update version + commit + push GitHub
|
|
169
|
-
6. yarn npm-publish # Complete NPM workflow
|
|
170
|
-
|
|
171
|
-
# Testing as plugin (optional)
|
|
172
|
-
yarn dev # Watch mode for development
|
|
173
|
-
yarn real # Install to real vault
|
|
174
|
-
|
|
175
|
-
# Injection testing (development phase)
|
|
176
|
-
yarn inject ../test-plugin --yes
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### Key Commands Summary
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
# Essential workflow
|
|
183
|
-
yarn i # Install dependencies
|
|
184
|
-
yarn update-exports # Update exports
|
|
185
|
-
yarn v # Update version + commit + push
|
|
186
|
-
yarn npm-publish # Complete NPM workflow
|
|
187
|
-
|
|
188
|
-
# Development & testing
|
|
189
|
-
yarn dev # Test as plugin (watch mode)
|
|
190
|
-
yarn lint:fix # Fix code issues
|
|
191
|
-
yarn help # Full help
|
|
192
|
-
```
|
|
1
|
+
# Obsidian Plugin Config
|
|
2
|
+
|
|
3
|
+
🎯 Injection system for standalone Obsidian plugins.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/obsidian-plugin-config)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g obsidian-plugin-config
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Update
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g obsidian-plugin-config@latest --force
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage (global CLI)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Inject in current plugin directory
|
|
24
|
+
obsidian-inject
|
|
25
|
+
|
|
26
|
+
# Inject by path
|
|
27
|
+
obsidian-inject ../my-plugin
|
|
28
|
+
|
|
29
|
+
# Inject with SASS support (adds esbuild-sass-plugin)
|
|
30
|
+
obsidian-inject ../my-plugin --sass
|
|
31
|
+
|
|
32
|
+
# Verification only (no changes)
|
|
33
|
+
obsidian-inject ../my-plugin --dry-run
|
|
34
|
+
|
|
35
|
+
# Help
|
|
36
|
+
obsidian-inject --help
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## What is injected
|
|
40
|
+
|
|
41
|
+
- ✅ **Standalone local scripts**: `esbuild.config.ts`, `acp.ts`,
|
|
42
|
+
`update-version.ts`, `release.ts`, `help.ts`, `utils.ts`
|
|
43
|
+
- ✅ **package.json**: scripts, dependencies, yarn protection
|
|
44
|
+
- ✅ **tsconfig.json**: modern optimized TypeScript configuration
|
|
45
|
+
- ✅ **eslint.config.mts**: ESLint flat config
|
|
46
|
+
- ✅ **Config files**: `.editorconfig`, `.prettierrc`, `.npmrc`,
|
|
47
|
+
`.env`, `.vscode/settings.json`, `.vscode/tasks.json`
|
|
48
|
+
- ✅ **GitHub Actions**: release workflow
|
|
49
|
+
- ✅ **Traceability**: `.injection-info.json` (version, date)
|
|
50
|
+
- 🎨 **SASS support**: optional, via `--sass` flag
|
|
51
|
+
|
|
52
|
+
## Commands available after injection
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
yarn start # Install dependencies + start dev
|
|
56
|
+
yarn dev # Development build (watch mode)
|
|
57
|
+
yarn build # Production build
|
|
58
|
+
yarn real # Build + install to real vault
|
|
59
|
+
yarn acp # Add, commit, push
|
|
60
|
+
yarn bacp # Build + add, commit, push
|
|
61
|
+
yarn v # Update version
|
|
62
|
+
yarn release # GitHub release
|
|
63
|
+
yarn lint # ESLint check
|
|
64
|
+
yarn lint:fix # ESLint fix
|
|
65
|
+
yarn help # Full help
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## SASS Support
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
obsidian-inject ../my-plugin --sass
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
What gets added:
|
|
75
|
+
- ✅ `esbuild-sass-plugin` dependency
|
|
76
|
+
- ✅ Automatic `.scss` detection (`src/styles.scss` priority)
|
|
77
|
+
- ✅ CSS cleanup after compilation
|
|
78
|
+
|
|
79
|
+
## Architecture
|
|
80
|
+
|
|
81
|
+
The plugin becomes **100% standalone** after injection:
|
|
82
|
+
|
|
83
|
+
- ✅ Scripts integrated locally (no external runtime dependency)
|
|
84
|
+
- ✅ Updatable via re-injection
|
|
85
|
+
- ✅ Yarn protection enforced
|
|
86
|
+
- ✅ Compatible with all Obsidian plugins
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Local Development (for contributors)
|
|
91
|
+
|
|
92
|
+
This repo has **two roles**:
|
|
93
|
+
|
|
94
|
+
1. **Injection system** — `templates/` + `scripts/inject-*.ts`
|
|
95
|
+
2. **Snippet development** — `src/` is a local Obsidian plugin
|
|
96
|
+
used to develop and export reusable code (modals, helpers)
|
|
97
|
+
|
|
98
|
+
### Setup
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git clone https://github.com/3C0D/obsidian-plugin-config
|
|
102
|
+
cd obsidian-plugin-config
|
|
103
|
+
yarn install
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Configure vault paths
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Edit .env
|
|
110
|
+
TEST_VAULT=C:/path/to/test/vault
|
|
111
|
+
REAL_VAULT=C:/path/to/real/vault
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Development commands
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
yarn dev # Watch mode (test as local plugin)
|
|
118
|
+
yarn real # Install to real vault
|
|
119
|
+
yarn lint:fix # Fix linting issues
|
|
120
|
+
yarn update-exports # Regenerate src/index.ts exports
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Injection commands (local)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
yarn inject-prompt # Interactive injection
|
|
127
|
+
yarn inject-path ../my-plugin # Direct injection
|
|
128
|
+
yarn inject ../my-plugin --sass # With SASS support
|
|
129
|
+
yarn check-plugin ../my-plugin # Dry-run only
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Publish workflow
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
yarn npm-publish # All-in-one (7 steps):
|
|
136
|
+
# 0. NPM auth check
|
|
137
|
+
# 1. Version bump
|
|
138
|
+
# 2. Update exports
|
|
139
|
+
# 3. Generate bin/obsidian-inject.js
|
|
140
|
+
# 4. Verify package
|
|
141
|
+
# 5. Commit + push
|
|
142
|
+
# 6. Publish to NPM
|
|
143
|
+
# 7. Update global CLI (ask, or auto with --auto-update)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
> `yarn acp` is only needed for intermediate commits —
|
|
147
|
+
> not required before `yarn npm-publish`.
|
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.5.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { execSync } from 'child_process';
|
|
@@ -95,6 +95,13 @@ function main() {
|
|
|
95
95
|
process.exit(1);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
// Prevent injecting into obsidian-plugin-config itself
|
|
99
|
+
const pkg = JSON.parse(fs.readFileSync(targetPackageJson, 'utf8'));
|
|
100
|
+
if (pkg.name === 'obsidian-plugin-config') {
|
|
101
|
+
console.error(`❌ Cannot inject into obsidian-plugin-config itself.`);
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
|
|
98
105
|
// Clean NPM artifacts if package-lock.json exists
|
|
99
106
|
const packageLockPath = join(targetPath, 'package-lock.json');
|
|
100
107
|
if (fs.existsSync(packageLockPath)) {
|