opencode-manifold 0.5.15 → 0.5.17
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/dist/index.js +17 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -104,7 +104,19 @@ import { homedir } from "os";
|
|
|
104
104
|
import { createRequire as createRequire2 } from "module";
|
|
105
105
|
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
106
106
|
var require2 = createRequire2(import.meta.url);
|
|
107
|
-
|
|
107
|
+
function getBundledTemplatesDir() {
|
|
108
|
+
const possiblePaths = [
|
|
109
|
+
join(__dirname2, "..", "src", "templates"),
|
|
110
|
+
join(__dirname2, "templates"),
|
|
111
|
+
join(__dirname2, "..", "templates")
|
|
112
|
+
];
|
|
113
|
+
for (const p of possiblePaths) {
|
|
114
|
+
if (existsSync(p))
|
|
115
|
+
return p;
|
|
116
|
+
}
|
|
117
|
+
return possiblePaths[0];
|
|
118
|
+
}
|
|
119
|
+
var bundledTemplatesDir = getBundledTemplatesDir();
|
|
108
120
|
var globalTemplatesDir = join(homedir(), ".config", "opencode", "manifold");
|
|
109
121
|
async function copyFiles(src, dest) {
|
|
110
122
|
if (!existsSync(src))
|
|
@@ -154,6 +166,10 @@ async function ensureGlobalTemplates(ctx) {
|
|
|
154
166
|
});
|
|
155
167
|
return;
|
|
156
168
|
}
|
|
169
|
+
if (existsSync(globalTemplatesDir)) {
|
|
170
|
+
const { rm } = await import("fs/promises");
|
|
171
|
+
await rm(globalTemplatesDir, { recursive: true, force: true });
|
|
172
|
+
}
|
|
157
173
|
await copyFiles(bundledTemplatesDir, globalTemplatesDir);
|
|
158
174
|
const globalCommandsDir = join(homedir(), ".config", "opencode", "commands");
|
|
159
175
|
const initCommandSrc = join(bundledTemplatesDir, "commands", "manifold-init.md");
|