obsidian-plugin-config 1.3.6 β 1.3.8
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/bin/obsidian-inject.js +1 -1
- package/package.json +1 -1
- package/scripts/build-npm.ts +39 -20
- package/scripts/inject-core.ts +16 -3
- package/templates/tsconfig.json +2 -2
- package/versions.json +3 -1
package/bin/obsidian-inject.js
CHANGED
package/package.json
CHANGED
package/scripts/build-npm.ts
CHANGED
|
@@ -199,44 +199,63 @@ main();
|
|
|
199
199
|
*/
|
|
200
200
|
function buildAndPublishNpm(): void {
|
|
201
201
|
console.log(`π Obsidian Plugin Config - Complete NPM Workflow`);
|
|
202
|
-
console.log(
|
|
202
|
+
console.log(
|
|
203
|
+
`Full automation: version β exports β bin β commit β publish\n`
|
|
204
|
+
);
|
|
203
205
|
|
|
204
206
|
try {
|
|
205
|
-
// Step 1: Update version
|
|
207
|
+
// Step 1: Update version in package.json only
|
|
208
|
+
// (no commit yet - we'll do one big commit after)
|
|
206
209
|
console.log(`π Step 1/6: Updating version...`);
|
|
207
|
-
execSync('tsx scripts/update-version-config.ts', {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
console.log(`\nπ€ Step 2/6: Committing and pushing changes...`);
|
|
211
|
-
try {
|
|
212
|
-
execSync('echo "Prepare NPM package publication" | tsx scripts/acp.ts -b', { stdio: 'inherit' });
|
|
213
|
-
} catch {
|
|
214
|
-
console.log(` βΉοΈ No additional changes to commit`);
|
|
215
|
-
}
|
|
210
|
+
execSync('tsx scripts/update-version-config.ts', {
|
|
211
|
+
stdio: 'inherit'
|
|
212
|
+
});
|
|
216
213
|
|
|
217
|
-
// Step
|
|
218
|
-
console.log(`\nπ¦ Step
|
|
214
|
+
// Step 2: Update exports automatically
|
|
215
|
+
console.log(`\nπ¦ Step 2/6: Updating exports...`);
|
|
219
216
|
execSync('yarn update-exports', { stdio: 'inherit' });
|
|
220
217
|
|
|
221
|
-
// Step
|
|
222
|
-
console.log(`\nπ§ Step
|
|
218
|
+
// Step 3: Generate bin file (uses updated version)
|
|
219
|
+
console.log(`\nπ§ Step 3/6: Generating bin/obsidian-inject.js...`);
|
|
223
220
|
generateBinFile();
|
|
224
221
|
|
|
225
|
-
// Step
|
|
226
|
-
|
|
222
|
+
// Step 4: Verify package and sync versions.json
|
|
223
|
+
// (must happen before commit so versions.json is included)
|
|
224
|
+
console.log(`\nπ Step 4/6: Verifying package...`);
|
|
227
225
|
verifyPackage();
|
|
228
226
|
|
|
227
|
+
// Step 5: Commit and push ALL changes together
|
|
228
|
+
// (package.json version, bin/, versions.json, exports)
|
|
229
|
+
console.log(`\nπ€ Step 5/6: Committing and pushing changes...`);
|
|
230
|
+
try {
|
|
231
|
+
execSync(
|
|
232
|
+
'echo "Publish NPM package" | tsx scripts/acp.ts -b',
|
|
233
|
+
{ stdio: 'inherit' }
|
|
234
|
+
);
|
|
235
|
+
} catch {
|
|
236
|
+
console.log(` βΉοΈ No additional changes to commit`);
|
|
237
|
+
}
|
|
238
|
+
|
|
229
239
|
// Step 6: Publish to NPM
|
|
230
240
|
console.log(`\nπ€ Step 6/6: Publishing to NPM...`);
|
|
231
|
-
execSync(
|
|
241
|
+
execSync(
|
|
242
|
+
'npm publish --registry https://registry.npmjs.org/',
|
|
243
|
+
{ stdio: 'inherit' }
|
|
244
|
+
);
|
|
232
245
|
|
|
233
246
|
console.log(`\nπ Complete workflow successful!`);
|
|
234
247
|
console.log(`\nπ Next steps:`);
|
|
235
248
|
console.log(` 1. npm install -g obsidian-plugin-config`);
|
|
236
|
-
console.log(
|
|
249
|
+
console.log(
|
|
250
|
+
` 2. Test injection: cd any-plugin && obsidian-inject`
|
|
251
|
+
);
|
|
237
252
|
|
|
238
253
|
} catch (error) {
|
|
239
|
-
console.error(
|
|
254
|
+
console.error(
|
|
255
|
+
`\nβ Workflow failed: ${
|
|
256
|
+
error instanceof Error ? error.message : String(error)
|
|
257
|
+
}`
|
|
258
|
+
);
|
|
240
259
|
process.exit(1);
|
|
241
260
|
}
|
|
242
261
|
}
|
package/scripts/inject-core.ts
CHANGED
|
@@ -293,8 +293,11 @@ export async function injectScripts(targetPath: string, useSass: boolean = false
|
|
|
293
293
|
"templates/scripts/help.ts"
|
|
294
294
|
];
|
|
295
295
|
|
|
296
|
-
// Files
|
|
297
|
-
//
|
|
296
|
+
// Files that should NOT be overwritten if they
|
|
297
|
+
// already exist (contain user-specific config)
|
|
298
|
+
const skipIfExists = new Set([".env"]);
|
|
299
|
+
|
|
300
|
+
// Files with .template suffix (NPM excludes dotfiles)
|
|
298
301
|
// Map: { source: targetName }
|
|
299
302
|
const configFileMap: Record<string, string> = {
|
|
300
303
|
"templates/tsconfig.json": "tsconfig.json",
|
|
@@ -339,10 +342,20 @@ export async function injectScripts(targetPath: string, useSass: boolean = false
|
|
|
339
342
|
configFileMap
|
|
340
343
|
)) {
|
|
341
344
|
try {
|
|
342
|
-
const content = copyFromLocal(src);
|
|
343
345
|
const targetFile = path.join(
|
|
344
346
|
targetPath, destName
|
|
345
347
|
);
|
|
348
|
+
// Skip if file exists and is user-specific
|
|
349
|
+
if (
|
|
350
|
+
skipIfExists.has(destName) &&
|
|
351
|
+
fs.existsSync(targetFile)
|
|
352
|
+
) {
|
|
353
|
+
console.log(
|
|
354
|
+
` βοΈ ${destName} (kept existing)`
|
|
355
|
+
);
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
const content = copyFromLocal(src);
|
|
346
359
|
fs.writeFileSync(targetFile, content, "utf8");
|
|
347
360
|
console.log(` β
${destName}`);
|
|
348
361
|
} catch (error) {
|
package/templates/tsconfig.json
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
],
|
|
6
6
|
"paths": {
|
|
7
7
|
"obsidian-typings/implementations": [
|
|
8
|
-
"./node_modules/obsidian-typings/dist/
|
|
9
|
-
"./node_modules/obsidian-typings/dist/
|
|
8
|
+
"./node_modules/obsidian-typings/dist/implementations.d.ts",
|
|
9
|
+
"./node_modules/obsidian-typings/dist/implementations.cjs"
|
|
10
10
|
]
|
|
11
11
|
},
|
|
12
12
|
"inlineSourceMap": true,
|