You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| output | String | Output directory (relative to the path of ZModel) | No | node_modules/.zenstack |
35
-
| compile | Boolean | If the generated TS code should be compiled to JS | No | true |
36
-
| preserveTsFiles | Boolean | If the generated TS files should be preserved (after compiled to JS) | No | true if `compile` is set to false, otherwise false |
37
-
38
-
### Example
39
-
40
-
```zmodel title='/schema.zmodel'
41
-
plugin enhancer {
42
-
provider = '@core/enhancer'
43
-
output = 'src/lib/zenstack'
44
-
compile = false
45
-
}
34
+
| output | String | Output directory (relative to the path of ZModel). This option will be deprecated in future releases in favor of the "--output" CLI option of `zenstack generate`. | No | node_modules/.zenstack |
35
+
| preserveTsFiles | Boolean | If the generated TS files should be preserved (after compiled to JS) | No | false |
36
+
37
+
### Custom output directory and compilation options
38
+
39
+
You can use the "--output" option of the `zenstack generate` CLI to specify a custom output location for the generated enhancer code:
40
+
41
+
```bash
42
+
zenstack generate --output src/lib/zenstack
43
+
```
44
+
45
+
If you want to have the code generated as TypeScript (instead of compiled to JavaScript), you can add the "--no-compile" option:
| output | String | Output directory (relative to the path of ZModel) | No | node_modules/.zenstack/zod |
154
+
| output | String | Output directory (relative to the path of ZModel). This option will be deprecated in future releases in favor of the "--output" CLI option of `zenstack generate`. | No | node_modules/.zenstack/zod |
155
155
| modelOnly | Boolean | Only generate schemas for the models, but not for the Prisma CRUD input arguments | No | false |
156
156
| generateModels | String, String[] | Array or comma separated string for the models to generate routers for. | No | All models |
157
157
| compile | Boolean | If the generated TS code should be compiled to JS | No | true |
158
-
| preserveTsFiles | Boolean | If the generated TS files should be preserved (after compiled to JS) | No | true if `compile` is set to false, otherwise false |
158
+
| preserveTsFiles | Boolean | If the generated TS files should be preserved (after compiled to JS) | No | false |
159
159
| noUncheckedInput | Boolean | Disables schema generation for Prisma's ["Unchecked"](https://github.com/prisma/prisma/discussions/10121#discussioncomment-1621254) input types | No | false |
160
160
| mode | String | Controls if the generated schemas should reject, strict, or passthrough unknown fields. Possible values: "strict", "strip", "passthrough" | No | "strict" |
161
161
@@ -181,12 +181,14 @@ import { PostCreateSchema } from '@zenstackhq/runtime/zod/models';
181
181
PostCreateSchema.parse(data);
182
182
```
183
183
184
-
You can turn off the `compile` option and use a custom `output` location if you want the generated Zod schema to be compiled along with your own Typescript project:
184
+
You can use the "--output" option of the `zenstack generate` CLI to specify a custom output location for the generated Zod schemas:
185
185
186
-
```zmodel title='/schema.zmodel'
187
-
plugin zod {
188
-
provider = '@core/zod'
189
-
output = 'src/lib/zod'
190
-
compile = false
191
-
}
186
+
```bash
187
+
zenstack generate --output src/lib/zenstack
188
+
```
189
+
190
+
If you want to have the code generated as TypeScript (instead of compiled to JavaScript), you can add the "--no-compile" option:
0 commit comments