obsidian-plugin-config 1.0.6 → 1.1.1
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/README.md +80 -4
- package/eslint.config.mts +54 -0
- package/package.json +96 -87
- package/scripts/acp.ts +5 -1
- package/scripts/build-npm.ts +9 -11
- package/scripts/help.ts +37 -138
- package/scripts/inject-path.ts +385 -25
- package/scripts/inject-prompt.ts +119 -5
- package/scripts/release.ts +9 -2
- package/scripts/update-version-config.ts +1 -1
- package/scripts/update-version.ts +4 -1
- package/scripts/utils.ts +26 -0
- package/templates/.github/workflows/release-body.md +14 -0
- package/templates/.github/workflows/release.yml +47 -0
- package/templates/{eslint.config.ts → eslint.config.mts} +6 -3
- package/templates/help-plugin.ts +43 -31
- package/{test-plugin → templates}/scripts/acp.ts +6 -2
- package/templates/scripts/esbuild.config.ts +320 -0
- package/templates/scripts/help.ts +51 -0
- package/{test-plugin → templates}/scripts/release.ts +10 -3
- package/{test-plugin-v2 → templates}/scripts/update-version.ts +5 -2
- package/{test-plugin → templates}/scripts/utils.ts +26 -0
- package/templates/{tsconfig.json → tsconfig-template.json} +4 -0
- package/tsconfig.json +40 -37
- package/versions.json +5 -1
- package/obsidian-plugin-config-1.0.2.tgz +0 -0
- package/src/main_test.ts +0 -106
- package/test-plugin/manifest.json +0 -10
- package/test-plugin/package.json +0 -38
- package/test-plugin/scripts/esbuild.config.ts +0 -165
- package/test-plugin/scripts/help.ts +0 -29
- package/test-plugin/scripts/update-version.ts +0 -102
- package/test-plugin/src/main.ts +0 -11
- package/test-plugin/yarn.lock +0 -386
- package/test-plugin-v2/main.js +0 -5
- package/test-plugin-v2/manifest.json +0 -10
- package/test-plugin-v2/package.json +0 -40
- package/test-plugin-v2/scripts/acp.ts +0 -71
- package/test-plugin-v2/scripts/esbuild.config.ts +0 -165
- package/test-plugin-v2/scripts/help.ts +0 -29
- package/test-plugin-v2/scripts/release.ts +0 -97
- package/test-plugin-v2/scripts/utils.ts +0 -117
- package/test-plugin-v2/src/main.ts +0 -11
- package/test-plugin-v2/tsconfig.json +0 -31
- package/test-plugin-v2/yarn.lock +0 -1986
package/README.md
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
# Obsidian Plugin Config
|
|
2
2
|
|
|
3
|
+
<!-- Test modification pour vérifier auto-commit -->
|
|
4
|
+
|
|
3
5
|
🎯 Système d'injection pour plugins Obsidian autonomes.
|
|
4
6
|
|
|
7
|
+
[](https://www.npmjs.com/package/obsidian-plugin-config)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
**Version actuelle : 1.0.6**
|
|
11
|
+
|
|
5
12
|
## Installation Globale
|
|
6
13
|
|
|
7
14
|
```bash
|
|
@@ -24,6 +31,14 @@ obsidian-inject ../mon-plugin
|
|
|
24
31
|
obsidian-inject "C:\chemin\vers\plugin"
|
|
25
32
|
```
|
|
26
33
|
|
|
34
|
+
### Vérification (sans injection)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Vérifier si un plugin est déjà injecté (avec info de version)
|
|
38
|
+
yarn check-plugin ../mon-plugin
|
|
39
|
+
yarn verify-plugin ../mon-plugin # alias
|
|
40
|
+
```
|
|
41
|
+
|
|
27
42
|
### Aide
|
|
28
43
|
|
|
29
44
|
```bash
|
|
@@ -33,10 +48,41 @@ obsidian-inject --help
|
|
|
33
48
|
## Ce qui est injecté
|
|
34
49
|
|
|
35
50
|
- ✅ **Scripts locaux autonomes** : `esbuild.config.ts`, `acp.ts`, `update-version.ts`, `utils.ts`, `help.ts`, `release.ts`
|
|
36
|
-
- ✅ **Configuration package.json** : scripts, dépendances, protection yarn obligatoire
|
|
37
|
-
- ✅ **Template tsconfig.json** : configuration TypeScript optimisée
|
|
51
|
+
- ✅ **Configuration package.json** : scripts, dépendances, protection yarn obligatoire, `"type": "module"` pour ESM
|
|
52
|
+
- ✅ **Template tsconfig.json** : configuration TypeScript moderne optimisée
|
|
38
53
|
- ✅ **Installation automatique** des dépendances avec yarn
|
|
39
54
|
- ✅ **Analyse des imports centralisés** avec avertissements
|
|
55
|
+
- ✅ **Fichier de traçabilité** : `.injection-info.json` (version, date d'injection)
|
|
56
|
+
|
|
57
|
+
## 📋 Suivi des versions d'injection
|
|
58
|
+
|
|
59
|
+
Le système crée un fichier `.injection-info.json` dans chaque plugin injecté pour tracer :
|
|
60
|
+
|
|
61
|
+
- **Version de l'injecteur** utilisée
|
|
62
|
+
- **Date d'injection**
|
|
63
|
+
- **Nom de l'injecteur** (`obsidian-plugin-config`)
|
|
64
|
+
|
|
65
|
+
> ⚠️ **Important** : Le fichier `.injection-info.json` est **commité avec le plugin** pour assurer la traçabilité sur GitHub et permettre de voir facilement qu'un plugin a été injecté et avec quelle version.
|
|
66
|
+
|
|
67
|
+
### Statuts possibles lors de la vérification
|
|
68
|
+
|
|
69
|
+
- ✅ **Plugin injecté** : Affiche version, date et détecte les mises à jour disponibles
|
|
70
|
+
- ⚠️ **Plugin injecté (legacy)** : Injecté avec l'ancien système, re-injection recommandée
|
|
71
|
+
- ❌ **Plugin non injecté** : Aucune injection détectée
|
|
72
|
+
|
|
73
|
+
## ⚠️ Configuration ESM Moderne
|
|
74
|
+
|
|
75
|
+
Le système utilise une configuration TypeScript moderne avec ESM. Si votre plugin a des imports relatifs, vous devrez peut-être les corriger :
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// ❌ Ancien format
|
|
79
|
+
import { helper } from "./MyHelper";
|
|
80
|
+
|
|
81
|
+
// ✅ Format ESM requis
|
|
82
|
+
import { helper } from "./MyHelper.js";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Cette correction est nécessaire une seule fois après l'injection.
|
|
40
86
|
|
|
41
87
|
## Commandes disponibles après injection
|
|
42
88
|
|
|
@@ -67,15 +113,45 @@ Le plugin devient **100% AUTONOME** après injection :
|
|
|
67
113
|
|
|
68
114
|
## Développement Local (pour contributeurs)
|
|
69
115
|
|
|
116
|
+
### Installation
|
|
117
|
+
|
|
70
118
|
```bash
|
|
71
119
|
git clone https://github.com/3C0D/obsidian-plugin-config
|
|
72
120
|
cd obsidian-plugin-config
|
|
73
121
|
yarn install
|
|
122
|
+
```
|
|
74
123
|
|
|
75
|
-
|
|
124
|
+
### Test injection locale
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Injection automatique
|
|
76
128
|
yarn inject ../mon-plugin --yes
|
|
129
|
+
|
|
130
|
+
# Injection avec prompts
|
|
77
131
|
yarn inject-prompt "../mon-plugin"
|
|
132
|
+
```
|
|
78
133
|
|
|
79
|
-
|
|
134
|
+
### Workflow complet : Local → NPM
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# 1. Développement local
|
|
138
|
+
yarn inject ../test-plugin --yes
|
|
139
|
+
|
|
140
|
+
# 2. Corriger imports ESM si nécessaire
|
|
141
|
+
# Exemple: "./utils.ts" → "./utils.js"
|
|
142
|
+
|
|
143
|
+
# 3. Build et publication NPM
|
|
80
144
|
yarn build-npm
|
|
145
|
+
yarn update-version
|
|
146
|
+
npm login
|
|
147
|
+
npm publish
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Commandes de maintenance
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
yarn acp # Add, commit, push
|
|
154
|
+
yarn update-version # Mise à jour version
|
|
155
|
+
yarn build-npm # Build package NPM
|
|
156
|
+
yarn help # Aide complète
|
|
81
157
|
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as typescriptEslintParser from "@typescript-eslint/parser";
|
|
2
|
+
import typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
|
|
3
|
+
import "eslint-import-resolver-typescript";
|
|
4
|
+
import type {
|
|
5
|
+
Linter
|
|
6
|
+
} from "eslint";
|
|
7
|
+
|
|
8
|
+
const configs: Linter.Config[] = [
|
|
9
|
+
{
|
|
10
|
+
ignores: [
|
|
11
|
+
"eslint.config.mts",
|
|
12
|
+
"templates/**"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
files: ["**/*.ts"],
|
|
17
|
+
ignores: [
|
|
18
|
+
"dist/**",
|
|
19
|
+
"node_modules/**",
|
|
20
|
+
"main.js"
|
|
21
|
+
],
|
|
22
|
+
languageOptions: {
|
|
23
|
+
parser: typescriptEslintParser,
|
|
24
|
+
sourceType: "module",
|
|
25
|
+
parserOptions: {
|
|
26
|
+
project: "./tsconfig.json",
|
|
27
|
+
ecmaVersion: 2023
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
plugins: {
|
|
31
|
+
"@typescript-eslint": typescriptEslintPlugin as any // Type assertion to bypass type checking
|
|
32
|
+
},
|
|
33
|
+
rules: {
|
|
34
|
+
// Base rules
|
|
35
|
+
"no-unused-vars": "off",
|
|
36
|
+
"@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }],
|
|
37
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
38
|
+
"no-prototype-builtins": "off",
|
|
39
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
40
|
+
|
|
41
|
+
// Useful rules but not too strict
|
|
42
|
+
"semi": "error",
|
|
43
|
+
"@typescript-eslint/explicit-function-return-type": "warn",
|
|
44
|
+
|
|
45
|
+
// Disable overly strict rules
|
|
46
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
47
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
48
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
49
|
+
"@typescript-eslint/no-unsafe-argument": "off"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export default configs;
|
package/package.json
CHANGED
|
@@ -1,88 +1,97 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
2
|
+
"name": "obsidian-plugin-config",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "Système d'injection pour plugins Obsidian autonomes",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"obsidian-inject": "./bin/obsidian-inject.js"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"obsidian",
|
|
13
|
+
"obsidian-plugin",
|
|
14
|
+
"typescript",
|
|
15
|
+
"injection",
|
|
16
|
+
"autonomous",
|
|
17
|
+
"cli",
|
|
18
|
+
"development-tools",
|
|
19
|
+
"plugin-utilities"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"start": "yarn install && yarn run update-exports",
|
|
23
|
+
"update-exports": "node scripts/update-exports.js",
|
|
24
|
+
"acp": "tsx scripts/acp.ts",
|
|
25
|
+
"update-version": "tsx scripts/update-version-config.ts",
|
|
26
|
+
"v": "tsx scripts/update-version-config.ts",
|
|
27
|
+
"inject-path": "tsx scripts/inject-path.ts",
|
|
28
|
+
"inject": "tsx scripts/inject-path.ts",
|
|
29
|
+
"inject-prompt": "tsx scripts/inject-prompt.ts",
|
|
30
|
+
"check-plugin": "tsx scripts/inject-path.ts --dry-run",
|
|
31
|
+
"build-npm": "tsx scripts/build-npm.ts",
|
|
32
|
+
"publish-npm": "tsx scripts/build-npm.ts",
|
|
33
|
+
"help": "tsx scripts/help.ts",
|
|
34
|
+
"h": "tsx scripts/help.ts",
|
|
35
|
+
"lint": "eslint . --ext .ts",
|
|
36
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
37
|
+
"dev": "tsx scripts/esbuild.config.ts",
|
|
38
|
+
"build": "tsc -noEmit -skipLibCheck",
|
|
39
|
+
"real": "tsx scripts/esbuild.config.ts production real",
|
|
40
|
+
"bacp": "tsx scripts/acp.ts -b",
|
|
41
|
+
"release": "tsx scripts/release.ts",
|
|
42
|
+
"r": "tsx scripts/release.ts"
|
|
43
|
+
},
|
|
44
|
+
"exports": {
|
|
45
|
+
".": "./src/index.ts",
|
|
46
|
+
"./scripts/*": "./scripts/*",
|
|
47
|
+
"./modals": "./src/modals/index.ts",
|
|
48
|
+
"./tools": "./src/tools/index.ts",
|
|
49
|
+
"./utils": "./src/utils/index.ts"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/eslint": "latest",
|
|
53
|
+
"@types/node": "^22.15.26",
|
|
54
|
+
"@types/semver": "^7.7.0",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "latest",
|
|
56
|
+
"@typescript-eslint/parser": "latest",
|
|
57
|
+
"builtin-modules": "3.3.0",
|
|
58
|
+
"dedent": "^1.6.0",
|
|
59
|
+
"dotenv": "^16.4.5",
|
|
60
|
+
"esbuild": "latest",
|
|
61
|
+
"eslint": "latest",
|
|
62
|
+
"eslint-import-resolver-typescript": "latest",
|
|
63
|
+
"fs-extra": "^11.2.0",
|
|
64
|
+
"jiti": "latest",
|
|
65
|
+
"obsidian": "*",
|
|
66
|
+
"obsidian-typings": "^3.9.5",
|
|
67
|
+
"semver": "^7.7.2",
|
|
68
|
+
"tsx": "^4.19.4",
|
|
69
|
+
"typescript": "^5.8.2"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@types/lodash": "^4.17.17",
|
|
73
|
+
"@types/node": "^22.15.26",
|
|
74
|
+
"@types/semver": "^7.7.0",
|
|
75
|
+
"builtin-modules": "3.3.0",
|
|
76
|
+
"dedent": "^1.6.0",
|
|
77
|
+
"dotenv": "^16.4.5",
|
|
78
|
+
"esbuild": "latest",
|
|
79
|
+
"fs-extra": "^11.2.0",
|
|
80
|
+
"lodash": "^4.17.21",
|
|
81
|
+
"obsidian": "*",
|
|
82
|
+
"obsidian-typings": "^3.9.5",
|
|
83
|
+
"semver": "^7.7.2",
|
|
84
|
+
"tsx": "^4.19.4",
|
|
85
|
+
"typescript": "^5.8.2"
|
|
86
|
+
},
|
|
87
|
+
"engines": {
|
|
88
|
+
"npm": "please-use-yarn",
|
|
89
|
+
"yarn": ">=1.22.0",
|
|
90
|
+
"node": ">=16.0.0"
|
|
91
|
+
},
|
|
92
|
+
"repository": {
|
|
93
|
+
"type": "git",
|
|
94
|
+
"url": "https://github.com/3C0D/obsidian-plugin-config.git"
|
|
95
|
+
},
|
|
96
|
+
"author": "3C0D"
|
|
97
|
+
}
|
package/scripts/acp.ts
CHANGED
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
askQuestion,
|
|
6
6
|
cleanInput,
|
|
7
7
|
createReadlineInterface,
|
|
8
|
-
gitExec
|
|
8
|
+
gitExec,
|
|
9
|
+
ensureGitSync
|
|
9
10
|
} from "./utils.js";
|
|
10
11
|
|
|
11
12
|
const rl = createReadlineInterface();
|
|
@@ -49,6 +50,9 @@ async function main(): Promise<void> {
|
|
|
49
50
|
// get current branch name
|
|
50
51
|
const currentBranch = execSync("git rev-parse --abbrev-ref HEAD").toString().trim();
|
|
51
52
|
|
|
53
|
+
// Ensure Git is synchronized before pushing
|
|
54
|
+
await ensureGitSync();
|
|
55
|
+
|
|
52
56
|
try {
|
|
53
57
|
gitExec(`git push origin ${currentBranch}`);
|
|
54
58
|
console.log("Commit and push successful.");
|
package/scripts/build-npm.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
2
|
|
|
3
3
|
import fs from "fs";
|
|
4
|
-
import path from "path";
|
|
5
4
|
import { execSync } from "child_process";
|
|
6
5
|
import {
|
|
7
|
-
askQuestion,
|
|
8
6
|
askConfirmation,
|
|
9
7
|
createReadlineInterface
|
|
10
8
|
} from "./utils.js";
|
|
@@ -20,10 +18,10 @@ async function buildNpmPackage(): Promise<void> {
|
|
|
20
18
|
try {
|
|
21
19
|
// Step 1: Verify all scripts are ready
|
|
22
20
|
console.log(`\n📋 Verifying scripts...`);
|
|
23
|
-
|
|
21
|
+
|
|
24
22
|
const requiredScripts = [
|
|
25
23
|
"scripts/inject-path.ts",
|
|
26
|
-
"scripts/inject-prompt.ts",
|
|
24
|
+
"scripts/inject-prompt.ts",
|
|
27
25
|
"scripts/utils.ts",
|
|
28
26
|
"scripts/esbuild.config.ts",
|
|
29
27
|
"scripts/acp.ts",
|
|
@@ -42,7 +40,7 @@ async function buildNpmPackage(): Promise<void> {
|
|
|
42
40
|
// Step 2: Update bin/obsidian-inject.js if needed
|
|
43
41
|
console.log(`\n📦 Checking bin/obsidian-inject.js...`);
|
|
44
42
|
const binPath = "bin/obsidian-inject.js";
|
|
45
|
-
|
|
43
|
+
|
|
46
44
|
if (fs.existsSync(binPath)) {
|
|
47
45
|
console.log(` ✅ ${binPath} exists`);
|
|
48
46
|
} else {
|
|
@@ -52,7 +50,7 @@ async function buildNpmPackage(): Promise<void> {
|
|
|
52
50
|
// Step 3: Verify package.json is ready for NPM
|
|
53
51
|
console.log(`\n📄 Verifying package.json for NPM...`);
|
|
54
52
|
const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
|
55
|
-
|
|
53
|
+
|
|
56
54
|
const requiredFields = {
|
|
57
55
|
name: packageJson.name,
|
|
58
56
|
version: packageJson.version,
|
|
@@ -74,7 +72,7 @@ async function buildNpmPackage(): Promise<void> {
|
|
|
74
72
|
try {
|
|
75
73
|
const whoami = execSync('npm whoami', { encoding: 'utf8' }).trim();
|
|
76
74
|
console.log(` ✅ Logged in as: ${whoami}`);
|
|
77
|
-
} catch
|
|
75
|
+
} catch {
|
|
78
76
|
console.log(` ❌ Not logged into NPM`);
|
|
79
77
|
console.log(` 💡 Run: npm login`);
|
|
80
78
|
throw new Error("NPM authentication required");
|
|
@@ -85,15 +83,15 @@ async function buildNpmPackage(): Promise<void> {
|
|
|
85
83
|
try {
|
|
86
84
|
execSync('yarn build', { stdio: 'inherit' });
|
|
87
85
|
console.log(` ✅ Build test passed`);
|
|
88
|
-
} catch
|
|
86
|
+
} catch {
|
|
89
87
|
throw new Error("Build test failed");
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
console.log(`\n✅ Package is ready for NPM publication!`);
|
|
93
|
-
|
|
91
|
+
|
|
94
92
|
// Step 6: Ask for confirmation
|
|
95
93
|
const shouldPublish = await askConfirmation(`\nProceed with NPM publication?`, rl);
|
|
96
|
-
|
|
94
|
+
|
|
97
95
|
if (!shouldPublish) {
|
|
98
96
|
console.log(`❌ Publication cancelled`);
|
|
99
97
|
return;
|
|
@@ -102,7 +100,7 @@ async function buildNpmPackage(): Promise<void> {
|
|
|
102
100
|
// Step 7: Publish to NPM
|
|
103
101
|
console.log(`\n📤 Publishing to NPM...`);
|
|
104
102
|
execSync('npm publish', { stdio: 'inherit' });
|
|
105
|
-
|
|
103
|
+
|
|
106
104
|
console.log(`\n🎉 Package published successfully!`);
|
|
107
105
|
console.log(`\n📋 Next steps:`);
|
|
108
106
|
console.log(` 1. npm install -g ${packageJson.name}`);
|
package/scripts/help.ts
CHANGED
|
@@ -1,162 +1,61 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
2
|
|
|
3
3
|
console.log(`
|
|
4
|
-
🎯 Obsidian Plugin Config -
|
|
5
|
-
|
|
4
|
+
🎯 Obsidian Plugin Config - Quick Help
|
|
5
|
+
Injection system for autonomous Obsidian plugins
|
|
6
6
|
|
|
7
7
|
═══════════════════════════════════════════════════════════════════
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
📋 MAIN COMMANDS
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
cd mon-plugin && obsidian-inject
|
|
16
|
-
obsidian-inject ../autre-plugin
|
|
17
|
-
obsidian-inject "C:\\chemin\\vers\\plugin"
|
|
18
|
-
|
|
19
|
-
═══════════════════════════════════════════════════════════════════
|
|
20
|
-
|
|
21
|
-
🔧 DÉVELOPPEMENT LOCAL
|
|
22
|
-
|
|
23
|
-
Structure recommandée:
|
|
24
|
-
mes-plugins/
|
|
25
|
-
├── obsidian-plugin-config/ # Ce repo
|
|
26
|
-
├── mon-plugin-1/
|
|
27
|
-
├── mon-plugin-2/
|
|
28
|
-
└── test-sample-plugin/ # Pour tests
|
|
29
|
-
|
|
30
|
-
Installation:
|
|
31
|
-
git clone https://github.com/3C0D/obsidian-plugin-config
|
|
32
|
-
cd obsidian-plugin-config
|
|
33
|
-
yarn install
|
|
34
|
-
|
|
35
|
-
Test injection locale:
|
|
36
|
-
yarn inject ../mon-plugin --yes
|
|
37
|
-
yarn inject-prompt "../mon-plugin"
|
|
38
|
-
|
|
39
|
-
═══════════════════════════════════════════════════════════════════
|
|
40
|
-
|
|
41
|
-
📦 WORKFLOW COMPLET : Local → NPM Package
|
|
42
|
-
|
|
43
|
-
ÉTAPE 1 - Développement Local:
|
|
44
|
-
cd obsidian-plugin-config
|
|
45
|
-
# Modifier scripts/ selon vos besoins
|
|
46
|
-
yarn inject ../test-plugin --yes
|
|
47
|
-
|
|
48
|
-
ÉTAPE 2 - Corrections Obligatoires:
|
|
49
|
-
# Corriger TOUS les imports dans scripts/
|
|
50
|
-
# Changer .ts → .js dans les imports
|
|
51
|
-
# Exemple: "./utils.ts" → "./utils.js"
|
|
52
|
-
|
|
53
|
-
ÉTAPE 3 - Build NPM:
|
|
54
|
-
yarn build-npm # Corrige automatiquement
|
|
55
|
-
yarn update-version # Choisir p/min/maj
|
|
56
|
-
|
|
57
|
-
ÉTAPE 4 - Test Local Package:
|
|
58
|
-
npm pack
|
|
59
|
-
npm install -g ./obsidian-plugin-config-X.X.X.tgz
|
|
60
|
-
obsidian-inject ../test-plugin # Tester commande globale
|
|
61
|
-
|
|
62
|
-
ÉTAPE 5 - Publication NPM:
|
|
63
|
-
npm login # OBLIGATOIRE !
|
|
64
|
-
npm publish # Après connexion réussie
|
|
65
|
-
|
|
66
|
-
═══════════════════════════════════════════════════════════════════
|
|
67
|
-
|
|
68
|
-
🔑 CONNEXION NPM - Points Critiques
|
|
69
|
-
|
|
70
|
-
PRÉREQUIS OBLIGATOIRES:
|
|
71
|
-
✅ Compte NPM sur https://www.npmjs.com
|
|
72
|
-
✅ Email vérifié
|
|
73
|
-
✅ 2FA activé (obligatoire pour publier)
|
|
74
|
-
✅ Nom de package disponible
|
|
75
|
-
|
|
76
|
-
RÉSOLUTION PROBLÈMES:
|
|
77
|
-
npm logout
|
|
78
|
-
npm login --registry https://registry.npmjs.org/
|
|
79
|
-
npm whoami # Vérifier connexion
|
|
80
|
-
npm profile enable-2fa auth-and-writes
|
|
81
|
-
|
|
82
|
-
CONTOURNEMENTS TESTÉS:
|
|
83
|
-
✅ Développement local : Fonctionne sans connexion
|
|
84
|
-
✅ Test npm pack : Fonctionne sans connexion
|
|
85
|
-
❌ Publication : Connexion NPM OBLIGATOIRE (pas de contournement)
|
|
86
|
-
|
|
87
|
-
═══════════════════════════════════════════════════════════════════
|
|
88
|
-
|
|
89
|
-
🔄 WORKFLOW MISE À JOUR
|
|
90
|
-
|
|
91
|
-
Pour futures modifications:
|
|
92
|
-
1. cd obsidian-plugin-config
|
|
93
|
-
2. Modifier scripts/...
|
|
94
|
-
3. yarn inject ../test-plugin --yes
|
|
95
|
-
4. Corriger imports (.ts → .js)
|
|
96
|
-
5. yarn build-npm
|
|
97
|
-
6. yarn update-version
|
|
98
|
-
7. npm pack && npm install -g ./package.tgz
|
|
99
|
-
8. npm publish
|
|
100
|
-
|
|
101
|
-
═══════════════════════════════════════════════════════════════════
|
|
102
|
-
|
|
103
|
-
🏗️ ADAPTATION PERSONNALISÉE
|
|
11
|
+
INJECTION:
|
|
12
|
+
yarn inject <path> --yes # Automatic injection
|
|
13
|
+
yarn inject-prompt <path> # Injection with prompts
|
|
14
|
+
yarn check-plugin <path> # Verification without injection
|
|
104
15
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
16
|
+
DEVELOPMENT:
|
|
17
|
+
yarn acp # Add, commit, push (with Git sync)
|
|
18
|
+
yarn bacp # Build + add, commit, push
|
|
19
|
+
yarn v, update-version # Update version
|
|
20
|
+
yarn release, r # GitHub release with tag
|
|
21
|
+
yarn build-npm # Build NPM package
|
|
22
|
+
yarn lint, lint:fix # ESLint verification/correction
|
|
23
|
+
yarn run help, h # This help
|
|
112
24
|
|
|
113
25
|
═══════════════════════════════════════════════════════════════════
|
|
114
26
|
|
|
115
|
-
|
|
27
|
+
🔧 LOCAL INJECTION
|
|
116
28
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
29
|
+
Recommended structure:
|
|
30
|
+
my-plugins/
|
|
31
|
+
├── obsidian-plugin-config/ # This repo
|
|
32
|
+
├── my-plugin-1/
|
|
33
|
+
└── my-plugin-2/
|
|
120
34
|
|
|
121
|
-
|
|
122
|
-
yarn
|
|
123
|
-
yarn
|
|
124
|
-
yarn build-npm # Build package NPM
|
|
125
|
-
yarn help, h # Cette aide
|
|
35
|
+
Usage:
|
|
36
|
+
yarn inject ../my-plugin --yes
|
|
37
|
+
yarn check-plugin ../my-plugin # Verification only
|
|
126
38
|
|
|
127
39
|
═══════════════════════════════════════════════════════════════════
|
|
128
40
|
|
|
129
|
-
✅
|
|
130
|
-
|
|
131
|
-
Scripts locaux autonomes:
|
|
132
|
-
✅ esbuild.config.ts (build production/dev)
|
|
133
|
-
✅ acp.ts (add-commit-push)
|
|
134
|
-
✅ update-version.ts (gestion versions)
|
|
135
|
-
✅ release.ts (releases GitHub)
|
|
136
|
-
✅ help.ts (aide locale)
|
|
137
|
-
✅ utils.ts (utilitaires partagés)
|
|
41
|
+
✅ WHAT IS INJECTED
|
|
138
42
|
|
|
139
|
-
|
|
140
|
-
✅
|
|
141
|
-
✅
|
|
142
|
-
✅
|
|
43
|
+
Autonomous scripts:
|
|
44
|
+
✅ utils.ts, acp.ts, release.ts, update-version.ts
|
|
45
|
+
✅ esbuild.config.ts, help.ts
|
|
46
|
+
✅ TypeScript and ESLint configuration
|
|
47
|
+
✅ GitHub Actions workflows (Yarn)
|
|
48
|
+
✅ Automatic Git sync verification
|
|
143
49
|
|
|
144
|
-
|
|
145
|
-
✅ Plugin 100% AUTONOME
|
|
146
|
-
✅ Aucune dépendance externe
|
|
147
|
-
✅ Mise à jour via re-injection
|
|
148
|
-
✅ Compatible tous plugins Obsidian
|
|
50
|
+
Result: 100% autonomous plugin, no external dependencies
|
|
149
51
|
|
|
150
52
|
═══════════════════════════════════════════════════════════════════
|
|
151
53
|
|
|
152
|
-
|
|
54
|
+
📦 NPM WORKFLOW (when stable)
|
|
153
55
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
- Sauvegarder vos modifications avant re-injection
|
|
158
|
-
- Utiliser yarn (protection intégrée)
|
|
56
|
+
1. yarn build-npm # Build package
|
|
57
|
+
2. yarn v # Update version
|
|
58
|
+
3. npm publish # Publish (requires npm login)
|
|
159
59
|
|
|
160
|
-
|
|
161
|
-
VERSION: 1.0.4
|
|
60
|
+
CURRENT VERSION: 1.0.6
|
|
162
61
|
`);
|