obsidian-plugin-config 1.7.0 → 1.7.2
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/README.md +205 -209
- package/bin/obsidian-inject.js +2 -10
- package/docs/INTERACTIVE_INJECTION.md +55 -116
- package/docs/LLM-GUIDE.md +130 -131
- package/package.json +1 -2
- package/scripts/acp.ts +1 -1
- package/scripts/build-npm.ts +393 -384
- package/scripts/help.ts +87 -90
- package/scripts/inject-core.ts +897 -973
- package/scripts/inject-path.ts +156 -162
- package/scripts/inject-prompt.ts +104 -107
- package/scripts/utils.ts +151 -151
- package/tsconfig.json +2 -2
- package/templates/package-sass.json +0 -5
package/README.md
CHANGED
|
@@ -1,209 +1,205 @@
|
|
|
1
|
-
# Obsidian Plugin Config
|
|
2
|
-
|
|
3
|
-
🎯 Global CLI injection tool for 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
|
-
# Prompts for confirmation before replacing each existing file
|
|
25
|
-
obsidian-inject
|
|
26
|
-
|
|
27
|
-
# Inject by path
|
|
28
|
-
# Prompts for confirmation before replacing each existing file
|
|
29
|
-
obsidian-inject ../my-plugin
|
|
30
|
-
|
|
31
|
-
# Inject without confirmation
|
|
32
|
-
# Auto-confirms all file replacements (no prompts)
|
|
33
|
-
obsidian-inject ../my-plugin --no
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
obsidian-inject ../my-plugin --
|
|
38
|
-
|
|
39
|
-
#
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
- ✅ **
|
|
56
|
-
|
|
57
|
-
- ✅ **
|
|
58
|
-
- ✅ **
|
|
59
|
-
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
yarn
|
|
70
|
-
yarn
|
|
71
|
-
yarn
|
|
72
|
-
yarn
|
|
73
|
-
yarn
|
|
74
|
-
yarn
|
|
75
|
-
yarn
|
|
76
|
-
yarn
|
|
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
|
-
yarn
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
- **
|
|
144
|
-
- **
|
|
145
|
-
- **
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
yarn
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
yarn
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
#
|
|
204
|
-
#
|
|
205
|
-
|
|
206
|
-
# 4. Commit + push
|
|
207
|
-
# 5. Publish to NPM
|
|
208
|
-
# 6. Update global CLI (optional)
|
|
209
|
-
```
|
|
1
|
+
# Obsidian Plugin Config
|
|
2
|
+
|
|
3
|
+
🎯 Global CLI injection tool for 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
|
+
# Prompts for confirmation before replacing each existing file
|
|
25
|
+
obsidian-inject
|
|
26
|
+
|
|
27
|
+
# Inject by path
|
|
28
|
+
# Prompts for confirmation before replacing each existing file
|
|
29
|
+
obsidian-inject ../my-plugin
|
|
30
|
+
|
|
31
|
+
# Inject without confirmation
|
|
32
|
+
# Auto-confirms all file replacements (no prompts)
|
|
33
|
+
obsidian-inject ../my-plugin --no
|
|
34
|
+
|
|
35
|
+
# Verification only (dry-run)
|
|
36
|
+
# Shows what would be injected without making any changes
|
|
37
|
+
obsidian-inject ../my-plugin --dry-run
|
|
38
|
+
|
|
39
|
+
# Help
|
|
40
|
+
obsidian-inject --help
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## CLI Options
|
|
44
|
+
|
|
45
|
+
- `--no`, `-n` - Skip confirmation prompts (auto-confirm)
|
|
46
|
+
- `--dry-run` - Verification only (no changes)
|
|
47
|
+
|
|
48
|
+
## What is injected
|
|
49
|
+
|
|
50
|
+
- ✅ **Standalone local scripts**: `esbuild.config.ts`, `acp.ts`,
|
|
51
|
+
`update-version.ts`, `release.ts`, `help.ts`, `utils.ts`
|
|
52
|
+
- ✅ **package.json**: scripts, dependencies, yarn protection
|
|
53
|
+
- ✅ **tsconfig.json**: modern optimized TypeScript configuration
|
|
54
|
+
- ✅ **eslint.config.mts**: ESLint flat config
|
|
55
|
+
- ✅ **Config files**: `.editorconfig`, `.prettierrc`, `.npmrc`,
|
|
56
|
+
`.env`, `.vscode/settings.json`, `.vscode/tasks.json`
|
|
57
|
+
- ✅ **GitHub Actions**: release workflow
|
|
58
|
+
- ✅ **Traceability**: `.injection-info.json` (version, date)
|
|
59
|
+
- 🎨 **SCSS support**: automatic detection in the injected `esbuild.config.ts`
|
|
60
|
+
|
|
61
|
+
## Commands available after injection
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
yarn start # Install dependencies + start dev
|
|
65
|
+
yarn dev # Development build (watch mode)
|
|
66
|
+
yarn build # Production build
|
|
67
|
+
yarn real # Build + install to real vault
|
|
68
|
+
yarn acp # Add, commit, push
|
|
69
|
+
yarn bacp # Build + add, commit, push
|
|
70
|
+
yarn v # Update version
|
|
71
|
+
yarn r # GitHub release
|
|
72
|
+
yarn lint # ESLint check
|
|
73
|
+
yarn lint:fix # ESLint fix
|
|
74
|
+
yarn prettier # Prettier check
|
|
75
|
+
yarn prettier:fix # Prettier format all
|
|
76
|
+
yarn h # Full help
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Updating Dependencies
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
yarn upgrade # Update all dependencies to latest
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## SASS Support
|
|
86
|
+
|
|
87
|
+
SCSS is detected automatically by the injected `esbuild.config.ts`:
|
|
88
|
+
|
|
89
|
+
- ✅ Automatic `.scss` detection (`src/styles.scss` priority)
|
|
90
|
+
- ✅ CSS cleanup after compilation
|
|
91
|
+
|
|
92
|
+
If your plugin uses SCSS, install the plugin once:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
yarn add -D esbuild-sass-plugin
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Architecture
|
|
99
|
+
|
|
100
|
+
Target plugins become **100% standalone** after injection:
|
|
101
|
+
|
|
102
|
+
- ✅ Scripts integrated locally (no external runtime dependency)
|
|
103
|
+
- ✅ Updatable via re-injection
|
|
104
|
+
- ✅ Yarn protection enforced
|
|
105
|
+
- ✅ Compatible with all Obsidian plugins
|
|
106
|
+
|
|
107
|
+
## Development Workflow (for injected plugins)
|
|
108
|
+
|
|
109
|
+
After injection, your plugin has a complete development setup:
|
|
110
|
+
|
|
111
|
+
### Environment Setup
|
|
112
|
+
|
|
113
|
+
**In-place development** (inside vault):
|
|
114
|
+
- Develop directly in `.obsidian/plugins/your-plugin`
|
|
115
|
+
- Run `yarn dev` - builds automatically to current location
|
|
116
|
+
|
|
117
|
+
**External development** (outside vault):
|
|
118
|
+
- Develop anywhere on your system
|
|
119
|
+
- Configure `.env` file with vault paths:
|
|
120
|
+
```bash
|
|
121
|
+
TEST_VAULT=/path/to/test/vault
|
|
122
|
+
REAL_VAULT=/path/to/production/vault
|
|
123
|
+
```
|
|
124
|
+
- Run `yarn dev` - builds to TEST_VAULT
|
|
125
|
+
- Run `yarn real` - builds to REAL_VAULT
|
|
126
|
+
|
|
127
|
+
### Development Commands
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
yarn start # Install dependencies + start dev
|
|
131
|
+
yarn dev # Watch mode (auto-rebuild on changes)
|
|
132
|
+
yarn build # Production build
|
|
133
|
+
yarn real # Build to production vault
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### VSCode Tasks (Ctrl+Shift+P → "Run Task")
|
|
137
|
+
|
|
138
|
+
After injection, VSCode tasks are available for quick access:
|
|
139
|
+
|
|
140
|
+
- **Build** - Production build
|
|
141
|
+
- **Lint** / **Lint: Fix** - ESLint check/fix
|
|
142
|
+
- **Prettier: Check** / **Prettier: Fix** - Format check/fix
|
|
143
|
+
- **Obsidian Inject** - Re-inject configuration (with confirmation)
|
|
144
|
+
- **Obsidian Inject (no confirm)** - Re-inject without confirmation
|
|
145
|
+
- **Cleanup: Lint + Prettier + Build** - Full cleanup sequence
|
|
146
|
+
|
|
147
|
+
💡 **Tip**: Use `Ctrl+Shift+B` (Windows/Linux) or `Cmd+Shift+B` (Mac) for the default Build task.
|
|
148
|
+
|
|
149
|
+
### Version & Release
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
yarn v # Update version (prompts for type)
|
|
153
|
+
yarn acp # Add, commit, push changes
|
|
154
|
+
yarn bacp # Build + add, commit, push
|
|
155
|
+
yarn r # Create GitHub release
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Code Quality
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
yarn lint # Check for linting errors
|
|
162
|
+
yarn lint:fix # Auto-fix linting errors
|
|
163
|
+
yarn prettier # Check formatting
|
|
164
|
+
yarn prettier:fix # Auto-format all files
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Recommended Workflow
|
|
168
|
+
|
|
169
|
+
1. `yarn start` - Install and start development
|
|
170
|
+
2. Make changes, test in Obsidian
|
|
171
|
+
3. `yarn bacp` - Build and commit changes
|
|
172
|
+
4. `yarn v` - Update version
|
|
173
|
+
5. `yarn r` - Create release
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Development (for contributors)
|
|
178
|
+
|
|
179
|
+
### Setup
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
git clone https://github.com/3C0D/obsidian-plugin-config
|
|
183
|
+
cd obsidian-plugin-config
|
|
184
|
+
yarn install
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Local injection commands
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
yarn inject-prompt # Interactive injection
|
|
191
|
+
yarn inject-path ../my-plugin # Direct injection
|
|
192
|
+
yarn check-plugin ../my-plugin # Dry-run only
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Publish workflow
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
yarn npm-publish # All-in-one:
|
|
199
|
+
# 1. Version bump
|
|
200
|
+
# 2. Generate bin/obsidian-inject.js
|
|
201
|
+
# 3. Verify package
|
|
202
|
+
# 4. Commit + push
|
|
203
|
+
# 5. Publish to NPM
|
|
204
|
+
# 6. Update global CLI (optional)
|
|
205
|
+
```
|
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.7.
|
|
6
|
+
* Version: 1.7.2
|
|
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',
|