@donkeylabs/cli 0.1.0 → 0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donkeylabs/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "CLI for @donkeylabs/server - project scaffolding and code generation",
6
6
  "main": "./src/index.ts",
@@ -206,17 +206,21 @@ export async function generateCommand(_args: string[]): Promise<void> {
206
206
  // Check if adapter provides a custom generator
207
207
  if (config.adapter) {
208
208
  try {
209
- // Dynamically import adapter's generator
210
- const adapterModule = await import(`${config.adapter}/generator`);
211
- if (adapterModule.generateClient) {
212
- await adapterModule.generateClient(config, serverRoutes, clientOutput);
213
- generated.push(`client (${config.adapter})`);
214
- console.log(pc.green("Generated:"), generated.map(g => pc.dim(g)).join(", "));
215
- return;
209
+ // Resolve the adapter path from the project's node_modules
210
+ const adapterPath = join(process.cwd(), "node_modules", config.adapter, "src/generator/index.ts");
211
+ if (existsSync(adapterPath)) {
212
+ const adapterModule = await import(adapterPath);
213
+ if (adapterModule.generateClient) {
214
+ await adapterModule.generateClient(config, serverRoutes, clientOutput);
215
+ generated.push(`client (${config.adapter})`);
216
+ console.log(pc.green("Generated:"), generated.map(g => pc.dim(g)).join(", "));
217
+ return;
218
+ }
216
219
  }
217
- } catch (e) {
220
+ } catch (e: any) {
218
221
  // Adapter doesn't provide generator or import failed, fall back to default
219
222
  console.log(pc.dim(`Note: Adapter ${config.adapter} has no custom generator, using default`));
223
+ console.log(pc.dim(`Error: ${e.message}`));
220
224
  }
221
225
  }
222
226
 
@@ -232,10 +236,14 @@ async function generateRegistry(
232
236
  outPath: string
233
237
  ) {
234
238
  const importLines = plugins
235
- .map(
236
- (p) =>
237
- `import { ${p.exportName} } from "${join(process.cwd(), p.path).replace(/\.ts$/, "")}";`
238
- )
239
+ .map((p) => {
240
+ // Calculate relative path from outPath to plugin
241
+ const pluginAbsPath = join(process.cwd(), p.path).replace(/\.ts$/, "");
242
+ const relativePath = relative(outPath, pluginAbsPath);
243
+ // Ensure path starts with ./ or ../
244
+ const importPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
245
+ return `import { ${p.exportName} } from "${importPath}";`;
246
+ })
239
247
  .join("\n");
240
248
 
241
249
  const pluginRegistryEntries = plugins
package/src/index.ts CHANGED
File without changes
@@ -9,13 +9,13 @@
9
9
  "gen:types": "donkeylabs generate"
10
10
  },
11
11
  "dependencies": {
12
- "@donkeylabs/server": "*",
12
+ "@donkeylabs/server": "latest",
13
13
  "kysely": "^0.27.0",
14
14
  "kysely-bun-sqlite": "^0.3.0",
15
15
  "zod": "^3.24.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@donkeylabs/cli": "*",
18
+ "@donkeylabs/cli": "latest",
19
19
  "@types/bun": "latest"
20
20
  }
21
- }
21
+ }