obsidian-plugin-config 1.3.2 → 1.3.3

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.
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * Obsidian Plugin Config - CLI Entry Point
5
5
  * Global command: obsidian-inject
6
- * Version: 1.3.2
6
+ * Version: 1.3.3
7
7
  */
8
8
 
9
9
  import { execSync } from 'child_process';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-plugin-config",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Système d'injection pour plugins Obsidian autonomes",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -97,36 +97,66 @@ export function copyFromLocal(filePath: string): string {
97
97
  */
98
98
  export async function ensurePluginConfigClean(): Promise<void> {
99
99
  const configRoot = findPluginConfigRoot();
100
+ const gitDir = path.join(configRoot, ".git");
101
+
102
+ // Skip git check if not a git repo
103
+ // (e.g. NPM global install)
104
+ if (!fs.existsSync(gitDir)) {
105
+ console.log(
106
+ `✅ Plugin-config repo is clean` +
107
+ ` (NPM install, no git check)`
108
+ );
109
+ return;
110
+ }
111
+
100
112
  const originalCwd = process.cwd();
101
113
 
102
114
  try {
103
115
  process.chdir(configRoot);
104
- const gitStatus = execSync("git status --porcelain", { encoding: "utf8" }).trim();
116
+ const gitStatus = execSync(
117
+ "git status --porcelain",
118
+ { encoding: "utf8" }
119
+ ).trim();
105
120
 
106
121
  if (gitStatus) {
107
- console.log(`\n⚠️ Plugin-config has uncommitted changes:`);
122
+ console.log(
123
+ `\n⚠️ Plugin-config has uncommitted changes:`
124
+ );
108
125
  console.log(gitStatus);
109
- console.log(`\n🔧 Auto-committing changes with yarn bacp...`);
126
+ console.log(
127
+ `\n🔧 Auto-committing changes...`
128
+ );
110
129
 
111
- const commitMessage = "🔧 Update plugin-config templates and scripts";
130
+ const msg =
131
+ "🔧 Update plugin-config templates";
112
132
  gitExec("git add -A");
113
- gitExec(`git commit -m "${commitMessage}"`);
133
+ gitExec(`git commit -m "${msg}"`);
114
134
 
115
135
  try {
116
- const currentBranch = execSync("git rev-parse --abbrev-ref HEAD", {
117
- encoding: "utf8"
118
- }).trim();
119
- gitExec(`git push origin ${currentBranch}`);
120
- console.log(`✅ Changes committed and pushed successfully`);
136
+ const branch = execSync(
137
+ "git rev-parse --abbrev-ref HEAD",
138
+ { encoding: "utf8" }
139
+ ).trim();
140
+ gitExec(`git push origin ${branch}`);
141
+ console.log(
142
+ `✅ Changes committed and pushed`
143
+ );
121
144
  } catch {
122
145
  try {
123
- const currentBranch = execSync("git rev-parse --abbrev-ref HEAD", {
124
- encoding: "utf8"
125
- }).trim();
126
- gitExec(`git push --set-upstream origin ${currentBranch}`);
127
- console.log(`✅ New branch pushed with upstream set`);
146
+ const branch = execSync(
147
+ "git rev-parse --abbrev-ref HEAD",
148
+ { encoding: "utf8" }
149
+ ).trim();
150
+ gitExec(
151
+ `git push --set-upstream origin ${branch}`
152
+ );
153
+ console.log(
154
+ `✅ New branch pushed with upstream`
155
+ );
128
156
  } catch {
129
- console.log(`⚠️ Changes committed locally but push failed. Continue with injection.`);
157
+ console.log(
158
+ `⚠️ Committed locally, push failed`
159
+ );
130
160
  }
131
161
  }
132
162
  } else {
package/versions.json CHANGED
@@ -28,5 +28,6 @@
28
28
  "1.2.0": "1.8.9",
29
29
  "1.3.0": "1.8.9",
30
30
  "1.3.1": "1.8.9",
31
- "1.3.2": "1.8.9"
31
+ "1.3.2": "1.8.9",
32
+ "1.3.3": "1.8.9"
32
33
  }