Skip to content

Commit 826cc4e

Browse files
authored
fix(cli): regression of CLI plugin resolution (#2516)
2 parents 49e1fe6 + 9e5fd4b commit 826cc4e

File tree

25 files changed

+29
-29
lines changed

25 files changed

+29
-29
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zenstack-v3",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"description": "ZenStack",
55
"packageManager": "pnpm@10.23.0",
66
"type": "module",

packages/auth-adapters/better-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/better-auth",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"description": "ZenStack Better Auth Adapter. This adapter is modified from better-auth's Prisma adapter.",
55
"type": "module",
66
"scripts": {

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"publisher": "zenstack",
44
"displayName": "ZenStack CLI",
55
"description": "FullStack database toolkit with built-in access control and automatic API generation.",
6-
"version": "3.5.0",
6+
"version": "3.5.1",
77
"type": "module",
88
"author": {
99
"name": "ZenStack Team"
@@ -92,4 +92,4 @@
9292
"engines": {
9393
"node": ">=20"
9494
}
95-
}
95+
}

packages/cli/src/actions/action-utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export async function loadPluginModule(provider: string, basePath: string) {
244244
const importAsEsm = async (spec: string) => {
245245
try {
246246
const result = (await import(spec)).default as CliPlugin;
247-
return result;
247+
return typeof result?.generate === 'function' ? result : undefined;
248248
} catch (err) {
249249
throw new CliError(`Failed to load plugin module from ${spec}: ${(err as Error).message}`);
250250
}
@@ -254,7 +254,7 @@ export async function loadPluginModule(provider: string, basePath: string) {
254254
const importAsTs = async (spec: string) => {
255255
try {
256256
const result = (await jiti.import(spec, { default: true })) as CliPlugin;
257-
return result;
257+
return typeof result?.generate === 'function' ? result : undefined;
258258
} catch (err) {
259259
throw new CliError(`Failed to load plugin module from ${spec}: ${(err as Error).message}`);
260260
}
@@ -294,7 +294,7 @@ export async function loadPluginModule(provider: string, basePath: string) {
294294
// try jiti import for bare package specifiers (handles workspace packages)
295295
try {
296296
const result = (await jiti.import(moduleSpec, { default: true })) as CliPlugin;
297-
return result;
297+
return typeof result.generate === 'function' ? result : undefined;
298298
} catch {
299299
// fall through to last resort
300300
}
@@ -303,7 +303,7 @@ export async function loadPluginModule(provider: string, basePath: string) {
303303
try {
304304
const mod = await import(moduleSpec);
305305
// plugin may not export a generator, return undefined in that case
306-
return mod.default as CliPlugin | undefined;
306+
return typeof mod.default?.generate === 'function' ? (mod.default as CliPlugin) : undefined;
307307
} catch (err) {
308308
const errorCode = (err as NodeJS.ErrnoException)?.code;
309309
if (errorCode === 'ERR_MODULE_NOT_FOUND' || errorCode === 'MODULE_NOT_FOUND') {

packages/clients/client-helpers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/client-helpers",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"description": "Helpers for implementing clients that consume ZenStack's CRUD service",
55
"type": "module",
66
"scripts": {

packages/clients/tanstack-query/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/tanstack-query",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"description": "TanStack Query Client for consuming ZenStack v3's CRUD service",
55
"type": "module",
66
"scripts": {

packages/common-helpers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/common-helpers",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"description": "ZenStack Common Helpers",
55
"type": "module",
66
"scripts": {

packages/config/eslint-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/eslint-config",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"type": "module",
55
"private": true,
66
"license": "MIT"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/typescript-config",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"private": true,
55
"license": "MIT"
66
}

packages/config/vitest-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/vitest-config",
33
"type": "module",
4-
"version": "3.5.0",
4+
"version": "3.5.1",
55
"private": true,
66
"license": "MIT",
77
"exports": {

0 commit comments

Comments
 (0)