obsidian-plugin-config 1.4.8 β†’ 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.
@@ -101,7 +101,7 @@
101
101
  {
102
102
  "label": "NPM Publish",
103
103
  "type": "shell",
104
- "command": "yarn npm-publish",
104
+ "command": "yarn npm-publish --auto-update",
105
105
  "group": "build",
106
106
  "presentation": { "reveal": "always", "panel": "shared" },
107
107
  "problemMatcher": []
package/README.md CHANGED
@@ -1,192 +1,147 @@
1
- # Obsidian Plugin Config
2
-
3
- 🎯 Injection system for standalone Obsidian plugins.
4
-
5
- [![NPM Version](https://img.shields.io/npm/v/obsidian-plugin-config)](https://www.npmjs.com/package/obsidian-plugin-config)
6
- [![License](https://img.shields.io/npm/l/obsidian-plugin-config)](LICENSE)
7
-
8
- ## Installation
9
-
10
- ```bash
11
- npm install -g obsidian-plugin-config
12
- ```
13
-
14
- ## Update
15
-
16
- ```bash
17
- npm update -g obsidian-plugin-config
18
- ```
19
-
20
- ## Commands
21
-
22
- ### For Plugin Config Development
23
-
24
- ```bash
25
- # Installation & Setup
26
- yarn i, install # Install dependencies
27
- yarn update-exports # Update package.json exports
28
-
29
- # Git & Version Management
30
- yarn acp # Add, commit, push
31
- yarn bacp # Build + add, commit, push
32
- yarn v # Update version
33
-
34
- # Build & Testing
35
- yarn build # TypeScript check (no build needed)
36
- yarn dev # Development build (watch mode)
37
- yarn real # Build to real vault
38
- yarn lint, lint:fix # ESLint verification/correction
39
-
40
- # Injection (Development phase)
41
- yarn inject-prompt # Interactive injection
42
- yarn inject-path # Direct injection
43
- yarn inject, check-plugin # Injection shortcuts
44
-
45
- # NPM Publishing
46
- yarn npm-publish # Complete NPM workflow
47
- yarn build-npm # Alias for npm-publish
48
-
49
- # Help
50
- yarn help # Show help
51
- ```
52
-
53
- ### For Plugin Injection
54
-
55
- ```bash
56
- # Interactive injection (recommended)
57
- obsidian-inject
58
- obsidian-inject ../my-plugin
59
- yarn inject-prompt "../my-plugin"
60
-
61
- # Automatic injection
62
- obsidian-inject ../my-plugin --yes
63
- yarn inject-path ../my-plugin --yes
64
-
65
- # SASS injection (includes esbuild-sass-plugin)
66
- yarn inject-sass ../my-plugin --yes
67
-
68
- # Verification only
69
- yarn check-plugin ../my-plugin
70
- ```
71
-
72
- ## What is injected
73
-
74
- - βœ… **Standalone local scripts**: `esbuild.config.ts`, `acp.ts`, `update-version.ts`, etc.
75
- - βœ… **package.json configuration**: scripts, dependencies, yarn protection
76
- - βœ… **tsconfig.json template**: modern optimized TypeScript configuration
77
- - βœ… **Automatic installation** of dependencies with yarn
78
- - βœ… **Traceability file**: `.injection-info.json` (version, injection date)
79
- - 🎨 **SASS support**: Optional SASS/SCSS compilation with `--sass` option
80
-
81
- ## Commands available after injection
82
-
83
- ```bash
84
- yarn build # Production build
85
- yarn dev # Development build + watch
86
- yarn start # Install dependencies + start dev
87
- yarn real # Build to real vault
88
- yarn acp # Add-commit-push
89
- yarn bacp # Build + add-commit-push
90
- yarn v # Update version
91
- yarn release # GitHub release
92
- yarn help # Full help
93
- ```
94
-
95
- ## SASS Support
96
-
97
- For plugins that use SASS/SCSS styling:
98
-
99
- ```bash
100
- # Inject with SASS support
101
- yarn inject-sass ../my-plugin --yes
102
-
103
- # What gets added:
104
- # - esbuild-sass-plugin dependency
105
- # - SASS compilation in esbuild.config.ts
106
- # - Automatic .scss file detection
107
- # - CSS cleanup after compilation
108
- ```
109
-
110
- **SASS Features:**
111
-
112
- - βœ… **Automatic detection** of `.scss` files in `src/` directory
113
- - βœ… **Priority order**: `src/styles.scss` > `src/styles.css` > `styles.css`
114
- - βœ… **Clean compilation** with automatic main.css removal
115
- - βœ… **Error handling** with helpful messages
116
-
117
- ## Architecture
118
-
119
- The plugin becomes **100% STANDALONE** after injection:
120
-
121
- - ❌ **No external dependencies** required
122
- - βœ… **Scripts integrated locally**
123
- - βœ… **Updatable** via re-injection
124
- - βœ… **Yarn protection** maintained
125
- - βœ… **Compatible with all Obsidian plugins**
126
-
127
- ## Local Development (for contributors)
128
-
129
- ### Installation
130
-
131
- ```bash
132
- git clone https://github.com/3C0D/obsidian-plugin-config
133
- cd obsidian-plugin-config
134
- yarn install
135
- ```
136
-
137
- ### As a Plugin (for testing NPM exports)
138
-
139
- ```bash
140
- # Setup vault paths in .env
141
- echo "TEST_VAULT=C:/path/to/test/vault" >> .env
142
- echo "REAL_VAULT=C:/path/to/real/vault" >> .env
143
-
144
- # Development mode
145
- yarn start # Start development mode
146
- yarn dev # Watch mode for development
147
- yarn real # Install to real vault
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
+ [![NPM Version](https://img.shields.io/npm/v/obsidian-plugin-config)](https://www.npmjs.com/package/obsidian-plugin-config)
6
+ [![License](https://img.shields.io/npm/l/obsidian-plugin-config)](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`.
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * Obsidian Plugin Config - CLI Entry Point
5
5
  * Global command: obsidian-inject
6
- * Version: 1.4.8
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)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-plugin-config",
3
- "version": "1.4.8",
3
+ "version": "1.5.0",
4
4
  "description": "SystΓ¨me d'injection pour plugins Obsidian autonomes",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",