obsidian-plugin-config 1.6.13 → 1.6.15

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/docs/modifs.md DELETED
@@ -1,434 +0,0 @@
1
- # Mise à jour du readme auto
2
-
3
- vérifier si section ## Development (Add this to your README) ou ## Development
4
- si ## Development (Add this to your README)
5
- - remplacer le contenu de la section par le nouveau contenu
6
- si ## Development
7
- - ajouter le nouveau contenu à la suite du contenu existant
8
- On va évidemment générer ce nouveau contenu en fonction du projet actuel.
9
-
10
-
11
- voici un ancien exemple à mettre à jour:
12
- ## Development (Add this to your README)
13
-
14
- Automate the development and publication processes on github, including releases. You are supposed to git clone your plugin out of the vault and set the right path in the .env file (1 for your trying vault, 1 for the real vault).
15
-
16
- If you want more options like sass, check out other branches
17
-
18
- ### Environment Setup
19
-
20
- - **Development in the plugins folder of your vault:**
21
- - Set the `REAL` variable to `-1` in the `.env` file. Or delete the file. Run the usual npm commands.
22
-
23
- - **Development outside the vault:**
24
- - If your plugin's source code is outside the vault, the necessary files will be automatically copied to the targeted vault. Set the paths in the .env file. Use TestVault for the development vault and RealVault to simulate production.
25
-
26
- - **other steps:**
27
- - You can then do `npm run version` to update the version and do the push of the changed files (package, manifest, version). Prompts will guide you.
28
-
29
- - You can then do `npm run release` to create the release. Few seconds later you can see the created release in the GitHub releases.
30
-
31
- ### Available Commands
32
-
33
- *I recommend a `npm run start` then `npm run bacp` then `npm run version` then `npm run release`. Super fast and easy.*
34
-
35
- - **`npm run dev` and `npm start`**: For development.
36
- `npm start` opens Visual Studio Code, runs `npm install`, and then `npm run dev`
37
-
38
- - **`npm run build`**: Builds the project in the folder containing the source code.
39
-
40
- - **`npm run real`**: Equivalent to a traditional installation of the plugin in your REAL vault.
41
-
42
- - **`npm run bacp`** & **`npm run acp`**: `b` stands for build, and `acp` stands for add, commit, push. You will be prompted for the commit message.
43
-
44
- - **`npm run version`**: Asks for the type of version update, modifies the relevant files, and then performs an add, commit, push.
45
-
46
- - **`npm run release`**: Asks for the release title, creates the release. This command works with the configurations in the `.github` folder. The release title can be multiline by using `\n`.
47
-
48
- --- fin
49
-
50
- Autre chose Ajouter `yarn upgrade` au readme pour les mises à jour libs.
51
-
52
- # exemple config dernier plugin réalisé ok
53
-
54
- je vais ajouter des configs qui sont ok Vérifiez avec ce qu'il y a dans Templates pour mettre à jour
55
-
56
- ts-config
57
-
58
- ```json
59
- {
60
- "compilerOptions": {
61
- "types": ["obsidian-typings"],
62
- "paths": {
63
- "obsidian-typings/implementations": [
64
- "./node_modules/obsidian-typings/dist/cjs/implementations.d.cts",
65
- "./node_modules/obsidian-typings/dist/esm/implementations.mjs"
66
- ]
67
- },
68
- "module": "NodeNext",
69
- "moduleResolution": "NodeNext",
70
- "target": "ES2021",
71
- "inlineSourceMap": true,
72
- "inlineSources": true,
73
- "allowJs": true,
74
- "noImplicitAny": true,
75
- "importHelpers": true,
76
- "isolatedModules": true,
77
- "allowImportingTsExtensions": true,
78
- "noEmit": true,
79
- "allowSyntheticDefaultImports": true,
80
- "verbatimModuleSyntax": true,
81
- "forceConsistentCasingInFileNames": true,
82
- "strictNullChecks": true,
83
- "resolveJsonModule": true,
84
- "lib": ["DOM", "ES2021"]
85
- },
86
- "include": ["./src/**/*.ts", "./scripts/**/*.ts"],
87
- "exclude": ["node_modules", "eslint.config.ts", "templates"]
88
- }
89
- ```
90
-
91
-
92
- package
93
- ```json
94
- {
95
- "name": "obsidian-code-files-modif",
96
- "version": "1.0.0",
97
- "description": "Code Files Modif",
98
- "type": "module",
99
- "main": "src/index.ts",
100
- "license": "MIT",
101
- "keywords": [
102
- "obsidian",
103
- "obsidian-plugin",
104
- "typescript"
105
- ],
106
- "scripts": {
107
- "start": "yarn install && yarn dev",
108
- "dev": "tsx scripts/esbuild.config.ts",
109
- "build": "tsc -noEmit -skipLibCheck && tsx scripts/esbuild.config.ts production",
110
- "real": "tsx scripts/esbuild.config.ts production real",
111
- "acp": "tsx scripts/acp.ts",
112
- "bacp": "tsx scripts/acp.ts -b",
113
- "v": "tsx scripts/update-version.ts",
114
- "r": "tsx scripts/release.ts",
115
- "h": "tsx scripts/help.ts",
116
- "lint": "eslint . --ext .ts",
117
- "lint:fix": "eslint . --ext .ts --fix",
118
- "prettier": "prettier --check '**/*.{ts,json}'",
119
- "prettier:fix": "prettier --write '**/*.{ts,json}'"
120
- },
121
- "devDependencies": {
122
- "@types/eslint": "latest",
123
- "@types/node": "latest",
124
- "@typescript-eslint/eslint-plugin": "latest",
125
- "@typescript-eslint/parser": "latest",
126
- "builtin-modules": "latest",
127
- "dedent": "latest",
128
- "dotenv": "latest",
129
- "esbuild": "latest",
130
- "eslint": "latest",
131
- "eslint-import-resolver-typescript": "latest",
132
- "jiti": "latest",
133
- "obsidian": "*",
134
- "obsidian-typings": "latest",
135
- "prettier": "^3.8.1",
136
- "tslib": "2.4.0",
137
- "tsx": "^4.21.0",
138
- "typescript": "^5.8.2"
139
- },
140
- "dependencies": {
141
- },
142
- "engines": {
143
- "npm": "please-use-yarn",
144
- "yarn": ">=1.22.0",
145
- "node": ">=16.0.0"
146
- },
147
- "repository": {
148
- "type": "git",
149
- "url": "https://github.com/3C0D/obsidian-plugin-config.git"
150
- },
151
- "author": "3C0D"
152
- }
153
- ```
154
-
155
- Bon, normalement j'ai laissé que les bibliothèques utiles Si je me suis pas trompé, mais bon tu verras Si y a des différences ou si y a des trucs à ajouter. Avec discernement bien sûr
156
-
157
- eslint.config.mts
158
- ```ts
159
- import * as typescriptEslintParser from "@typescript-eslint/parser";
160
- import typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
161
- import "eslint-import-resolver-typescript";
162
- import type {
163
- Linter
164
- } from "eslint";
165
-
166
- const configs: Linter.Config[] = [
167
- {
168
- ignores: ["eslint.config.mts", "templates/**"]
169
- },
170
- {
171
- files: ["**/*.ts"],
172
- ignores: [
173
- "dist/**",
174
- "node_modules/**",
175
- "main.js"
176
- ],
177
- languageOptions: {
178
- parser: typescriptEslintParser,
179
- sourceType: "module",
180
- parserOptions: {
181
- project: "./tsconfig.json",
182
- ecmaVersion: 2023
183
- }
184
- },
185
- plugins: {
186
- "@typescript-eslint": typescriptEslintPlugin as any // Type assertion to bypass type checking
187
- },
188
- rules: {
189
- // Base rules
190
- "no-unused-vars": "off",
191
- "@typescript-eslint/no-unused-vars": ["error", { "args": "none", "varsIgnorePattern": "^_" }],
192
- "@typescript-eslint/ban-ts-comment": "warn",
193
- "no-prototype-builtins": "off",
194
- "@typescript-eslint/no-empty-function": "off",
195
-
196
- // Useful rules but not too strict
197
- "semi": "error",
198
- "eqeqeq": ["error", "always"],
199
- "prefer-const": "error",
200
- "@typescript-eslint/explicit-function-return-type": ["warn", { "allowExpressions": true }],
201
- "@typescript-eslint/no-explicit-any": "warn",
202
- "@typescript-eslint/consistent-type-imports": ["warn", { "prefer": "type-imports" }],
203
-
204
- // Disable overly strict rules
205
- "@typescript-eslint/no-unsafe-assignment": "off",
206
- "@typescript-eslint/no-unsafe-call": "off",
207
- "@typescript-eslint/no-unsafe-member-access": "off",
208
- "@typescript-eslint/no-unsafe-argument": "off"
209
- }
210
- }
211
- ];
212
-
213
- export default configs;
214
-
215
- ```
216
-
217
- .pettrierrc
218
- ```json
219
- {
220
- "useTabs": true,
221
- "tabWidth": 4,
222
- "printWidth": 90,
223
- "endOfLine": "lf",
224
- "trailingComma": "none",
225
- "semi": true,
226
- "singleQuote": true,
227
- "arrowParens": "always",
228
- "overrides": [
229
- {
230
- "files": ["*.json"],
231
- "options": {
232
- "useTabs": false,
233
- "tabWidth": 2
234
- }
235
- }
236
- ]
237
- }
238
- ```
239
-
240
- .prettierignore
241
- ```py
242
- # Build output
243
- dist/
244
- main.js
245
-
246
- # Dependencies
247
- node_modules/
248
- ```
249
-
250
- .gitattributes
251
- ```py
252
- # On Windows, git defaults to core.autocrlf=true which converts LF to CRLF and creates false modifications
253
- * text=auto eol=lf
254
- *.ts text eol=lf
255
- *.json text eol=lf
256
- ```
257
-
258
- editorconfig
259
- ```py
260
- # top-most EditorConfig file
261
- root = true
262
-
263
- [*]
264
- charset = utf-8
265
- end_of_line = lf
266
- insert_final_newline = true
267
- indent_style = tab
268
- indent_size = 4
269
- tab_width = 4
270
-
271
- [*.json]
272
- indent_style = space
273
- indent_size = 2
274
- ```
275
-
276
- dans package:
277
- En fait, d'après ce que je sais, c'est une extension vsc que j'ai activée. Donc il faudrait dire dans les extensions de suggéré de l'installer. Sinon, peut-être que il y a directement un module dans package?
278
-
279
- dans docs j'ai mis le esbuild.config.ts De ce même autre plugin Le truc c'est que la logique pour SASS a été retirée parce que il y en avait pas besoin. Par contre, la logique par rapport au fait que si on est en train de faire Un développement extérieur ou in place A été amélioré. Du coup, le fichier Utils.ts A été joint parce que peut-être que y a eu aussi des modifications Si tu as besoin d'autres fichiers, tu me le dis Normalement, les autres scripts n'ont pas été touchés.
280
-
281
- En fait, il faut bien comprendre que je viens de faire un autre plugin et que j'ai retouché plusieurs choses par rapport au Template initial Donc je te donne un peu l'actualité pour que tu puisses améliorer le template
282
-
283
- dans .vscode/settings
284
- ```json
285
- {
286
- "npm.packageManager": "yarn",
287
- // "js/ts.preferences.includePackageJsonAutoImports": "off",
288
- "[typescript]": {
289
- "editor.defaultFormatter": "esbenp.prettier-vscode"
290
- },
291
- "[markdown]": {
292
- "editor.defaultFormatter": "yzhang.markdown-all-in-one"
293
- },
294
- "editor.formatOnSave": true,
295
- }
296
- ```
297
-
298
- Là peut-être suggérer d'utiliser. Editor Config. Sauf si Une extension a été installée dans package bien sûr.
299
-
300
- tasks.json
301
- ```json
302
- {
303
- "version": "2.0.0",
304
- "tasks": [
305
- {
306
- "label": "Lint",
307
- "type": "shell",
308
- "command": "yarn lint",
309
- "group": "test",
310
- "presentation": { "reveal": "always", "panel": "shared" },
311
- "problemMatcher": ["$eslint-stylish"]
312
- },
313
- {
314
- "label": "Lint: Fix",
315
- "type": "shell",
316
- "command": "yarn lint:fix",
317
- "group": "test",
318
- "presentation": { "reveal": "always", "panel": "shared" },
319
- "problemMatcher": ["$eslint-stylish"]
320
- },
321
- {
322
- "label": "Prettier: Check",
323
- "type": "shell",
324
- "command": "yarn prettier",
325
- "group": "test",
326
- "presentation": { "reveal": "always", "panel": "shared" },
327
- "problemMatcher": []
328
- },
329
- {
330
- "label": "Prettier: Fix",
331
- "type": "shell",
332
- "command": "yarn prettier:fix",
333
- "group": "test",
334
- "presentation": { "reveal": "always", "panel": "shared" },
335
- "problemMatcher": []
336
- },
337
- {
338
- "label": "Build",
339
- "type": "shell",
340
- "command": "yarn build",
341
- "group": { "kind": "build", "isDefault": true },
342
- "presentation": { "reveal": "always", "panel": "shared" },
343
- "problemMatcher": ["$tsc"]
344
- },
345
- {
346
- "label": "Obsidian Inject",
347
- "type": "shell",
348
- "command": "obsidian-inject",
349
- "group": "build",
350
- "presentation": { "reveal": "always", "panel": "shared" },
351
- "problemMatcher": []
352
- },
353
- {
354
- "label": "Cleanup: Lint + Prettier + Build",
355
- "dependsOrder": "sequence",
356
- "dependsOn": ["Lint: Fix", "Prettier: Fix", "Build"],
357
- "group": "build",
358
- "presentation": { "reveal": "always", "panel": "shared" },
359
- "problemMatcher": []
360
- }
361
- ]
362
- }
363
- ```
364
-
365
- .github/workflows/release
366
- ````yaml
367
- name: Release Obsidian Plugin
368
-
369
- on:
370
- push:
371
- tags:
372
- - "*"
373
-
374
- jobs:
375
- build:
376
- runs-on: ubuntu-latest
377
- permissions:
378
- contents: write
379
-
380
- steps:
381
- - uses: actions/checkout@v3
382
- - name: Use Node.js
383
- uses: actions/setup-node@v3
384
- with:
385
- node-version: "22.x"
386
-
387
- # Setup Yarn
388
- - name: Setup Yarn
389
- run: |
390
- corepack enable
391
- yarn --version
392
-
393
- # Build the plugin
394
- - name: Build
395
- id: build
396
- run: |
397
- yarn install
398
- yarn build
399
-
400
- # Package all necessary files into a zip
401
- - name: Package release files
402
- run: |
403
- mkdir release-package
404
- cp manifest.json main.js styles.css monacoEditor.html monacoHtml.js monacoHtml.css release-package/
405
- cp -r vs monaco-themes formatters release-package/
406
- cd release-package && zip -r ../obsidian-code-files-modif.zip .
407
-
408
- # Create the release on GitHub
409
- - name: Create Release
410
- id: create_release
411
- uses: ncipollo/release-action@v1.13.0
412
- env:
413
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
414
- VERSION: ${{ github.ref }}
415
- with:
416
- allowUpdates: true
417
- generateReleaseNotes: true
418
- artifactErrorsFailBuild: false
419
- makeLatest: true
420
- artifacts: "manifest.json,main.js,styles.css,obsidian-code-files-modif.zip"
421
- bodyFile: ".github/workflows/release-body.md"
422
- ```
423
-
424
- # Bon ça je pense que ça a été fait. J'avais noté ça dans mes notes:
425
- - ajouter command format all `prettier --write` installer `yarn add -D prettier`
426
-
427
- - lancer un yarn install après injection?
428
-
429
- - Ah oui, j'avais eu un problème avec la configuration, c'est qu'ils n'installaient pas obsidian-typing latest. Mais bon, je t'ai donné un package qui marchait au dessus.
430
- npx(pas besoin) prettier → yarn exec prettier pour résoudre le problème de PATH sur Windows
431
-
432
- @types/lodash et lodash sont en dependencies — @types/lodash devrait être en devDependencies (c'est uniquement des types TypeScript, rien de runtime). Et lodash lui-même, est-ce qu'il est vraiment utilisé dans le plugin ? Parce que si c'est juste pour les scripts de build, il devrait aussi être en -D.
433
-
434
-
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env tsx
2
-
3
- import type { Interface } from 'readline';
4
-
5
- export interface InjectionOptions {
6
- scripts: boolean;
7
- packageJson: boolean;
8
- tsconfig: boolean;
9
- eslint: boolean;
10
- prettier: boolean;
11
- editorconfig: boolean;
12
- vscode: boolean;
13
- github: boolean;
14
- gitignore: boolean;
15
- env: boolean;
16
- }
17
-
18
- export const DEFAULT_OPTIONS: InjectionOptions = {
19
- scripts: true,
20
- packageJson: true,
21
- tsconfig: true,
22
- eslint: true,
23
- prettier: true,
24
- editorconfig: true,
25
- vscode: true,
26
- github: true,
27
- gitignore: true,
28
- env: true
29
- };
30
-
31
- const OPTION_DESCRIPTIONS: Record<keyof InjectionOptions, string> = {
32
- scripts: 'Scripts (esbuild.config.ts, acp.ts, utils.ts, etc.)',
33
- packageJson: 'package.json (scripts & dependencies)',
34
- tsconfig: 'tsconfig.json',
35
- eslint: 'eslint.config.mts',
36
- prettier: '.prettierrc & .prettierignore',
37
- editorconfig: '.editorconfig',
38
- vscode: '.vscode/ (settings.json, tasks.json, extensions.json)',
39
- github: '.github/workflows/ (release workflow)',
40
- gitignore: '.gitignore',
41
- env: '.env (template)'
42
- };
43
-
44
- /**
45
- * Ask user to select which files to inject
46
- */
47
- export async function askInjectionOptions(
48
- rl: Interface
49
- ): Promise<InjectionOptions> {
50
- const { askConfirmation } = await import('./utils.js');
51
-
52
- console.log(`\n🎯 Injection Options`);
53
- console.log(`Select what you want to inject (default: all)\n`);
54
-
55
- const useDefaults = await askConfirmation(
56
- 'Use default options (inject everything)?',
57
- rl
58
- );
59
-
60
- if (useDefaults) {
61
- console.log(`✅ Using default options (all files will be injected)`);
62
- return DEFAULT_OPTIONS;
63
- }
64
-
65
- console.log(`\n📋 Select individual options:\n`);
66
-
67
- const options: InjectionOptions = { ...DEFAULT_OPTIONS };
68
-
69
- for (const [key, description] of Object.entries(OPTION_DESCRIPTIONS)) {
70
- const optionKey = key as keyof InjectionOptions;
71
- const answer = await askConfirmation(`Inject ${description}?`, rl);
72
- options[optionKey] = answer;
73
- }
74
-
75
- // Display summary
76
- console.log(`\n📋 Selected options:`);
77
- for (const [key, value] of Object.entries(options)) {
78
- const optionKey = key as keyof InjectionOptions;
79
- const icon = value ? '✅' : '❌';
80
- console.log(` ${icon} ${OPTION_DESCRIPTIONS[optionKey]}`);
81
- }
82
-
83
- const confirm = await askConfirmation('\nProceed with these options?', rl);
84
- if (!confirm) {
85
- console.log('❌ Injection cancelled');
86
- process.exit(0);
87
- }
88
-
89
- return options;
90
- }
91
-
92
- /**
93
- * Get quick preset options
94
- */
95
- export function getPresetOptions(preset: string): InjectionOptions {
96
- switch (preset) {
97
- case 'minimal':
98
- return {
99
- scripts: true,
100
- packageJson: true,
101
- tsconfig: false,
102
- eslint: false,
103
- prettier: false,
104
- editorconfig: false,
105
- vscode: false,
106
- github: false,
107
- gitignore: false,
108
- env: true
109
- };
110
- case 'scripts-only':
111
- return {
112
- scripts: true,
113
- packageJson: false,
114
- tsconfig: false,
115
- eslint: false,
116
- prettier: false,
117
- editorconfig: false,
118
- vscode: false,
119
- github: false,
120
- gitignore: false,
121
- env: false
122
- };
123
- case 'config-only':
124
- return {
125
- scripts: false,
126
- packageJson: false,
127
- tsconfig: true,
128
- eslint: true,
129
- prettier: true,
130
- editorconfig: true,
131
- vscode: true,
132
- github: false,
133
- gitignore: true,
134
- env: false
135
- };
136
- default:
137
- return DEFAULT_OPTIONS;
138
- }
139
- }