Skip to content

Commit c801726

Browse files
authored
merge dev to main (v3.5.0) (#2513)
2 parents 6ae3bcb + dbca9ed commit c801726

File tree

169 files changed

+18344
-4351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+18344
-4351
lines changed

.github/workflows/build-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
env:
1010
TELEMETRY_TRACKING_TOKEN: ${{ secrets.TELEMETRY_TRACKING_TOKEN }}
11+
VSCODE_TELEMETRY_TRACKING_TOKEN: ${{ secrets.VSCODE_TELEMETRY_TRACKING_TOKEN }}
1112
DO_NOT_TRACK: '1'
1213

1314
permissions:

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ZenStack is a TypeScript database toolkit for developing full-stack or backend N
3434
- 🧩 Designed for extensibility and flexibility
3535
- ⚙️ Automatic CRUD web APIs with adapters for popular frameworks
3636
- 🏖️ Automatic [TanStack Query](https://github.com/TanStack/query) hooks for easy CRUD from the frontend
37+
- 💎 [Zod](https://zod.dev) schema generation
3738

3839
# What's New in V3
3940

@@ -111,3 +112,23 @@ Thank you for your generous support!
111112
# Community
112113

113114
Join our [discord server](https://discord.gg/Ykhr738dUe) for chat and updates!
115+
116+
# Contributors
117+
118+
Thanks to all the contributors who have helped make ZenStack better!
119+
120+
### Source
121+
122+
<a href="https://github.com/zenstackhq/zenstack/graphs/contributors">
123+
<img src="https://contrib.rocks/image?repo=zenstackhq/zenstack" />
124+
</a>
125+
126+
### Docs
127+
128+
<a href="https://github.com/zenstackhq/zenstack-docs/graphs/contributors">
129+
<img src="https://contrib.rocks/image?repo=zenstackhq/zenstack-docs" />
130+
</a>
131+
132+
## License
133+
134+
[MIT](LICENSE)

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.4.6",
3+
"version": "3.5.0",
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.4.6",
3+
"version": "3.5.0",
44
"description": "ZenStack Better Auth Adapter. This adapter is modified from better-auth's Prisma adapter.",
55
"type": "module",
66
"scripts": {

packages/cli/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# @zenstackhq/cli
2+
3+
The command-line interface for ZenStack. Provides commands for initializing projects, generating TypeScript code from ZModel schemas, managing database migrations, and etc.
4+
5+
## Key Commands
6+
7+
- `zenstack init` — Initialize ZenStack in an existing project
8+
- `zenstack generate` — Compile ZModel schema to TypeScript
9+
- `zenstack db push` — Sync schema to the database
10+
- `zenstack db pull` — Pull database schema changes into ZModel
11+
- `zenstack migrate dev` — Create and apply database migrations
12+
- `zenstack migrate deploy` — Deploy migrations to production
13+
- `zenstack format` — Format ZModel schema files
14+
- `zenstack proxy|studio` — Start a database proxy server for using studio
15+
16+
## Installation
17+
18+
```bash
19+
npm install -D @zenstackhq/cli
20+
```
21+
22+
## Learn More
23+
24+
- [ZenStack Documentation](https://zenstack.dev/docs)

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
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.4.6",
6+
"version": "3.5.0",
77
"type": "module",
88
"author": {
99
"name": "ZenStack Team"

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,14 @@ export async function loadPluginModule(provider: string, basePath: string) {
291291
}
292292
}
293293

294+
// try jiti import for bare package specifiers (handles workspace packages)
295+
try {
296+
const result = (await jiti.import(moduleSpec, { default: true })) as CliPlugin;
297+
return result;
298+
} catch {
299+
// fall through to last resort
300+
}
301+
294302
// last resort, try to import as esm directly
295303
try {
296304
const mod = await import(moduleSpec);

packages/cli/src/actions/check.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ async function checkPluginResolution(schemaFile: string, model: Model) {
2929
for (const plugin of plugins) {
3030
const provider = getPluginProvider(plugin);
3131
if (!provider.startsWith('@core/')) {
32-
await loadPluginModule(provider, path.dirname(schemaFile));
32+
const pluginSourcePath =
33+
plugin.$cstNode?.parent?.element.$document?.uri?.fsPath ?? schemaFile;
34+
await loadPluginModule(provider, path.dirname(pluginSourcePath));
3335
}
3436
}
3537
}

packages/cli/src/actions/generate.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,11 @@ async function runPlugins(schemaFile: string, model: Model, outputPath: string,
186186
throw new CliError(`Unknown core plugin: ${provider}`);
187187
}
188188
} else {
189-
cliPlugin = await loadPluginModule(provider, path.dirname(schemaFile));
189+
// resolve relative plugin paths against the schema file where the plugin is declared,
190+
// not the entry schema file
191+
const pluginSourcePath =
192+
plugin.$cstNode?.parent?.element.$document?.uri?.fsPath ?? schemaFile;
193+
cliPlugin = await loadPluginModule(provider, path.dirname(pluginSourcePath));
190194
}
191195

192196
if (cliPlugin) {
@@ -252,7 +256,7 @@ async function runPlugins(schemaFile: string, model: Model, outputPath: string,
252256
spinner?.succeed();
253257
} catch (err) {
254258
spinner?.fail();
255-
console.error(err);
259+
throw err;
256260
}
257261
}
258262
}

packages/cli/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import 'dotenv/config';
21
import { ZModelLanguageMetaData } from '@zenstackhq/language';
32
import colors from 'colors';
43
import { Command, CommanderError, Option } from 'commander';
4+
import 'dotenv/config';
55
import * as actions from './actions';
66
import { CliError } from './cli-error';
77
import { telemetry } from './telemetry';

0 commit comments

Comments
 (0)