obsidian-plugin-config 1.3.3 β 1.3.6
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/inject-core.ts +49 -29
- package/templates/env.template +10 -0
- package/templates/gitignore.template +34 -0
- package/templates/npmrc.template +2 -0
- package/templates/tsconfig.json +2 -2
- package/tsconfig.json +2 -2
- package/versions.json +4 -1
package/bin/obsidian-inject.js
CHANGED
package/package.json
CHANGED
package/scripts/inject-core.ts
CHANGED
|
@@ -293,17 +293,25 @@ export async function injectScripts(targetPath: string, useSass: boolean = false
|
|
|
293
293
|
"templates/scripts/help.ts"
|
|
294
294
|
];
|
|
295
295
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
"templates
|
|
301
|
-
"templates
|
|
302
|
-
"templates
|
|
303
|
-
"templates/.
|
|
304
|
-
"templates/.
|
|
305
|
-
"templates
|
|
306
|
-
|
|
296
|
+
// Files with .template suffix are renamed by NPM
|
|
297
|
+
// exclusion rules (.gitignore, .npmrc, .env)
|
|
298
|
+
// Map: { source: targetName }
|
|
299
|
+
const configFileMap: Record<string, string> = {
|
|
300
|
+
"templates/tsconfig.json": "tsconfig.json",
|
|
301
|
+
"templates/gitignore.template": ".gitignore",
|
|
302
|
+
"templates/eslint.config.mts": "eslint.config.mts",
|
|
303
|
+
"templates/.editorconfig": ".editorconfig",
|
|
304
|
+
"templates/.prettierrc": ".prettierrc",
|
|
305
|
+
"templates/npmrc.template": ".npmrc",
|
|
306
|
+
"templates/env.template": ".env",
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const configVscodeMap: Record<string, string> = {
|
|
310
|
+
"templates/.vscode/settings.json":
|
|
311
|
+
".vscode/settings.json",
|
|
312
|
+
"templates/.vscode/tasks.json":
|
|
313
|
+
".vscode/tasks.json",
|
|
314
|
+
};
|
|
307
315
|
|
|
308
316
|
const workflowFiles = [
|
|
309
317
|
"templates/.github/workflows/release.yml",
|
|
@@ -324,33 +332,45 @@ export async function injectScripts(targetPath: string, useSass: boolean = false
|
|
|
324
332
|
}
|
|
325
333
|
}
|
|
326
334
|
|
|
327
|
-
console.log(`\nπ₯ Copying config files
|
|
335
|
+
console.log(`\nπ₯ Copying config files...`);
|
|
328
336
|
|
|
329
|
-
|
|
337
|
+
// Copy root config files
|
|
338
|
+
for (const [src, destName] of Object.entries(
|
|
339
|
+
configFileMap
|
|
340
|
+
)) {
|
|
330
341
|
try {
|
|
331
|
-
const content = copyFromLocal(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
342
|
+
const content = copyFromLocal(src);
|
|
343
|
+
const targetFile = path.join(
|
|
344
|
+
targetPath, destName
|
|
345
|
+
);
|
|
346
|
+
fs.writeFileSync(targetFile, content, "utf8");
|
|
347
|
+
console.log(` β
${destName}`);
|
|
348
|
+
} catch (error) {
|
|
349
|
+
console.error(
|
|
350
|
+
` β Failed to inject ${destName}: ${error}`
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
344
354
|
|
|
355
|
+
// Copy .vscode config files
|
|
356
|
+
for (const [src, destName] of Object.entries(
|
|
357
|
+
configVscodeMap
|
|
358
|
+
)) {
|
|
359
|
+
try {
|
|
360
|
+
const content = copyFromLocal(src);
|
|
361
|
+
const targetFile = path.join(
|
|
362
|
+
targetPath, destName
|
|
363
|
+
);
|
|
345
364
|
const targetDir = path.dirname(targetFile);
|
|
346
365
|
if (!await isValidPath(targetDir)) {
|
|
347
366
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
348
367
|
}
|
|
349
|
-
|
|
350
368
|
fs.writeFileSync(targetFile, content, "utf8");
|
|
351
|
-
console.log(` β
${
|
|
369
|
+
console.log(` β
${destName}`);
|
|
352
370
|
} catch (error) {
|
|
353
|
-
console.error(
|
|
371
|
+
console.error(
|
|
372
|
+
` β Failed to inject ${destName}: ${error}`
|
|
373
|
+
);
|
|
354
374
|
}
|
|
355
375
|
}
|
|
356
376
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Environment variables for plugin development
|
|
2
|
+
# Update these paths to match your setup
|
|
3
|
+
|
|
4
|
+
# Path to test vault (for development)
|
|
5
|
+
TEST_VAULT=
|
|
6
|
+
|
|
7
|
+
# Path to real vault (for production testing)
|
|
8
|
+
REAL_VAULT=
|
|
9
|
+
|
|
10
|
+
# Note: Run 'yarn version' to update these paths interactively
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Intellij
|
|
2
|
+
*.iml
|
|
3
|
+
.idea
|
|
4
|
+
|
|
5
|
+
# npm
|
|
6
|
+
node_modules
|
|
7
|
+
package-lock.json
|
|
8
|
+
|
|
9
|
+
# yarn - keep yarn.lock for version consistency
|
|
10
|
+
# yarn.lock
|
|
11
|
+
|
|
12
|
+
# Don't include the compiled main.js file in the repo.
|
|
13
|
+
# They should be uploaded to GitHub releases instead.
|
|
14
|
+
main.js
|
|
15
|
+
|
|
16
|
+
# Exclude sourcemaps
|
|
17
|
+
*.map
|
|
18
|
+
|
|
19
|
+
# obsidian
|
|
20
|
+
data.json
|
|
21
|
+
|
|
22
|
+
# Exclude macOS Finder (System Explorer) View States
|
|
23
|
+
.DS_Store
|
|
24
|
+
|
|
25
|
+
# scss result
|
|
26
|
+
main.css
|
|
27
|
+
|
|
28
|
+
# VSCode - keep settings.json for yarn protection
|
|
29
|
+
.vscode/*
|
|
30
|
+
!.vscode/settings.json
|
|
31
|
+
!.vscode/tasks.json
|
|
32
|
+
|
|
33
|
+
# Keep injection info for traceability
|
|
34
|
+
# .injection-info.json should be committed to track injection version
|
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/implementations.d.
|
|
9
|
-
"./node_modules/obsidian-typings/dist/implementations.
|
|
8
|
+
"./node_modules/obsidian-typings/dist/cjs/implementations.d.cts",
|
|
9
|
+
"./node_modules/obsidian-typings/dist/esm/implementations.mjs"
|
|
10
10
|
]
|
|
11
11
|
},
|
|
12
12
|
"inlineSourceMap": true,
|
package/tsconfig.json
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
],
|
|
6
6
|
"paths": {
|
|
7
7
|
"obsidian-typings/implementations": [
|
|
8
|
-
"./node_modules/obsidian-typings/dist/implementations.d.
|
|
9
|
-
"./node_modules/obsidian-typings/dist/implementations.
|
|
8
|
+
"./node_modules/obsidian-typings/dist/cjs/implementations.d.cts",
|
|
9
|
+
"./node_modules/obsidian-typings/dist/esm/implementations.mjs"
|
|
10
10
|
]
|
|
11
11
|
},
|
|
12
12
|
"inlineSourceMap": true,
|