obsidian-plugin-config 1.1.1 → 1.1.2

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.
@@ -78,16 +78,49 @@ function main() {
78
78
  console.log(`📦 Depuis: ${packageRoot}\n`);
79
79
 
80
80
  try {
81
+ // Check if target directory has package.json
82
+ const targetPackageJson = join(targetPath, 'package.json');
83
+ if (!fs.existsSync(targetPackageJson)) {
84
+ console.error(`❌ Erreur: package.json non trouvé dans ${targetPath}`);
85
+ console.error(` Assurez-vous que c'est un projet Node.js valide.`);
86
+ process.exit(1);
87
+ }
88
+
89
+ // Check if tsx is available locally in target
90
+ let tsxCommand = 'npx tsx';
91
+ try {
92
+ execSync('npx tsx --version', {
93
+ cwd: targetPath,
94
+ stdio: 'pipe'
95
+ });
96
+ console.log(`✅ tsx disponible localement`);
97
+ } catch {
98
+ console.log(`⚠️ tsx non trouvé, installation en cours...`);
99
+
100
+ // Install tsx locally in target directory
101
+ try {
102
+ execSync('yarn add -D tsx', {
103
+ cwd: targetPath,
104
+ stdio: 'inherit'
105
+ });
106
+ console.log(`✅ tsx installé avec succès`);
107
+ } catch (installError) {
108
+ console.error(`❌ Échec de l'installation de tsx:`, installError.message);
109
+ console.error(` Essayez d'installer tsx manuellement: cd "${targetPath}" && yarn add -D tsx`);
110
+ process.exit(1);
111
+ }
112
+ }
113
+
81
114
  // Execute the injection script with tsx
82
115
  const command = `npx tsx "${injectScriptPath}" "${targetPath}"`;
83
116
 
84
117
  execSync(command, {
85
118
  stdio: 'inherit',
86
- cwd: userCwd // Use user's current directory, not package directory
119
+ cwd: targetPath // Use target directory to ensure tsx is available
87
120
  });
88
-
121
+
89
122
  console.log(`\n✅ Injection terminée avec succès !`);
90
-
123
+
91
124
  } catch (error) {
92
125
  console.error(`\n❌ Erreur lors de l'injection:`, error.message);
93
126
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-plugin-config",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Système d'injection pour plugins Obsidian autonomes",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",