obsidian-plugin-config 1.0.5 → 1.0.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/package.json +1 -1
- package/scripts/inject-path.ts +18 -0
- package/versions.json +2 -1
package/package.json
CHANGED
package/scripts/inject-path.ts
CHANGED
|
@@ -129,6 +129,24 @@ function findPluginConfigRoot(): string {
|
|
|
129
129
|
return parentPath;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
// Option 5: Check if we're running from NPM package (global installation)
|
|
133
|
+
// Get the directory of this script file
|
|
134
|
+
const scriptDir = path.dirname(new URL(import.meta.url).pathname);
|
|
135
|
+
const npmPackageRoot = path.resolve(scriptDir, "..");
|
|
136
|
+
|
|
137
|
+
// Check if we're in an NPM package structure
|
|
138
|
+
const npmPackageJson = path.join(npmPackageRoot, "package.json");
|
|
139
|
+
if (fs.existsSync(npmPackageJson)) {
|
|
140
|
+
try {
|
|
141
|
+
const packageContent = JSON.parse(fs.readFileSync(npmPackageJson, 'utf8'));
|
|
142
|
+
if (packageContent.name === "obsidian-plugin-config") {
|
|
143
|
+
return npmPackageRoot;
|
|
144
|
+
}
|
|
145
|
+
} catch (error) {
|
|
146
|
+
// Ignore parsing errors
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
132
150
|
// Fallback to current directory (original behavior)
|
|
133
151
|
return process.cwd();
|
|
134
152
|
}
|