-
-
Notifications
You must be signed in to change notification settings - Fork 12
merge dev to main (v3.0.0-alpha.27) #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
31e3361
fix: use z.strictObject consistently (#179)
ymc9 fb6c03e
fix: disallow distinct for sqlite (#180)
ymc9 98668e8
feat: cli plugin support (#181)
ymc9 856dc5e
update to prisma 6.14 (#182)
ymc9 9139e3f
chore: bump version 3.0.0-alpha.27 (#183)
github-actions[bot] 2ad8857
fix: support custom types in db pusher (#184)
ymc9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "zenstack-v3", | ||
| "version": "3.0.0-alpha.26", | ||
| "version": "3.0.0-alpha.27", | ||
| "description": "ZenStack", | ||
| "packageManager": "[email protected]", | ||
| "scripts": { | ||
|
|
@@ -21,7 +21,7 @@ | |
| "license": "MIT", | ||
| "devDependencies": { | ||
| "@eslint/js": "^9.29.0", | ||
| "@types/node": "^20.17.24", | ||
| "@types/node": "catalog:", | ||
| "eslint": "~9.29.0", | ||
| "glob": "^11.0.2", | ||
| "prettier": "^3.5.3", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { default as prisma } from './prisma'; | ||
| export { default as typescript } from './typescript'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { PrismaSchemaGenerator, type CliPlugin } from '@zenstackhq/sdk'; | ||
| import fs from 'node:fs'; | ||
| import path from 'node:path'; | ||
|
|
||
| const plugin: CliPlugin = { | ||
| name: 'Prisma Schema Generator', | ||
| statusText: 'Generating Prisma schema', | ||
| async generate({ model, defaultOutputPath, pluginOptions }) { | ||
| let outDir = defaultOutputPath; | ||
| if (typeof pluginOptions['output'] === 'string') { | ||
| outDir = path.resolve(defaultOutputPath, pluginOptions['output']); | ||
| if (!fs.existsSync(outDir)) { | ||
| fs.mkdirSync(outDir, { recursive: true }); | ||
| } | ||
| } | ||
| const prismaSchema = await new PrismaSchemaGenerator(model).generate(); | ||
| fs.writeFileSync(path.join(outDir, 'schema.prisma'), prismaSchema); | ||
| }, | ||
| }; | ||
|
|
||
| export default plugin; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import type { CliPlugin } from '@zenstackhq/sdk'; | ||
| import { TsSchemaGenerator } from '@zenstackhq/sdk'; | ||
| import fs from 'node:fs'; | ||
| import path from 'node:path'; | ||
|
|
||
| const plugin: CliPlugin = { | ||
| name: 'TypeScript Schema Generator', | ||
| statusText: 'Generating TypeScript schema', | ||
| async generate({ model, defaultOutputPath, pluginOptions }) { | ||
| let outDir = defaultOutputPath; | ||
| if (typeof pluginOptions['output'] === 'string') { | ||
| outDir = path.resolve(defaultOutputPath, pluginOptions['output']); | ||
| if (!fs.existsSync(outDir)) { | ||
| fs.mkdirSync(outDir, { recursive: true }); | ||
| } | ||
| } | ||
| await new TsSchemaGenerator().generate(model, outDir); | ||
| }, | ||
| }; | ||
|
|
||
| export default plugin; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import fs from 'node:fs'; | ||
| import path from 'node:path'; | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { createProject, runCli } from '../utils'; | ||
| import { execSync } from 'node:child_process'; | ||
|
|
||
| describe('Custom plugins tests', () => { | ||
| it('runs custom plugin generator', () => { | ||
| const workDir = createProject(` | ||
| plugin custom { | ||
| provider = '../my-plugin.js' | ||
| output = '../custom-output' | ||
| } | ||
|
|
||
| model User { | ||
| id String @id @default(cuid()) | ||
| } | ||
| `); | ||
|
|
||
| fs.writeFileSync( | ||
| path.join(workDir, 'my-plugin.ts'), | ||
| ` | ||
| import type { CliPlugin } from '@zenstackhq/sdk'; | ||
| import fs from 'node:fs'; | ||
| import path from 'node:path'; | ||
|
|
||
| const plugin: CliPlugin = { | ||
| name: 'Custom Generator', | ||
| statusText: 'Generating foo.txt', | ||
| async generate({ model, defaultOutputPath, pluginOptions }) { | ||
| let outDir = defaultOutputPath; | ||
| if (typeof pluginOptions['output'] === 'string') { | ||
| outDir = path.resolve(defaultOutputPath, pluginOptions['output']); | ||
| if (!fs.existsSync(outDir)) { | ||
| fs.mkdirSync(outDir, { recursive: true }); | ||
| } | ||
| } | ||
| fs.writeFileSync(path.join(outDir, 'foo.txt'), 'from my plugin'); | ||
| }, | ||
| }; | ||
|
|
||
| export default plugin; | ||
| `, | ||
| ); | ||
|
|
||
| execSync('npx tsc', { cwd: workDir }); | ||
| runCli('generate', workDir); | ||
| expect(fs.existsSync(path.join(workDir, 'custom-output/foo.txt'))).toBe(true); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.