zenstack 1.0.0-alpha.125 → 1.0.0-alpha.126
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/README.md +7 -4
- package/package.json +5 -5
- package/plugins/plugin-utils.js +12 -2
- package/plugins/plugin-utils.js.map +1 -1
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ The following diagram gives a high-level overview of how it works.
|
|
|
116
116
|
|
|
117
117
|
- Prisma schema generator
|
|
118
118
|
- Zod schema generator
|
|
119
|
-
-
|
|
119
|
+
- [SWR](https://github.com/vercel/swr) and [TanStack Query](https://github.com/TanStack/query) hooks generator
|
|
120
120
|
- OpenAPI specification generator
|
|
121
121
|
- [tRPC](https://trpc.io) router generator
|
|
122
122
|
- 🙋🏻 [Request for a plugin](https://go.zenstack.dev/chat)
|
|
@@ -135,14 +135,17 @@ The following diagram gives a high-level overview of how it works.
|
|
|
135
135
|
- [Custom attributes and functions](https://zenstack.dev/docs/reference/zmodel-language#custom-attributes-and-functions)
|
|
136
136
|
- [Multi-file schema and model inheritance](https://zenstack.dev/docs/guides/multiple-schema)
|
|
137
137
|
- Strong-typed JSON field (coming soon)
|
|
138
|
+
- Polymorphism (future)
|
|
138
139
|
- 🙋🏻 [Request for an extension](https://go.zenstack.dev/chat)
|
|
139
140
|
|
|
140
141
|
## Examples
|
|
141
142
|
|
|
142
|
-
Check out the [Collaborative Todo App](https://zenstack-todo.vercel.app/) for a running example. You can find
|
|
143
|
+
Check out the [Collaborative Todo App](https://zenstack-todo.vercel.app/) for a running example. You can find different implementations below:
|
|
143
144
|
|
|
144
|
-
- [Next.js +
|
|
145
|
-
- [Next.js +
|
|
145
|
+
- [Next.js + SWR hooks](https://github.com/zenstackhq/sample-todo-nextjs)
|
|
146
|
+
- [Next.js + TanStack Query](https://github.com/zenstackhq/sample-todo-nextjs-tanstack)
|
|
147
|
+
- [Next.js + tRPC](https://github.com/zenstackhq/sample-todo-trpc)
|
|
148
|
+
- [SvelteKit + TanStack Query](https://github.com/zenstackhq/sample-todo-sveltekit)
|
|
146
149
|
|
|
147
150
|
## Community
|
|
148
151
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publisher": "zenstack",
|
|
4
4
|
"displayName": "ZenStack Language Tools",
|
|
5
5
|
"description": "A toolkit for building secure CRUD apps with Next.js + Typescript",
|
|
6
|
-
"version": "1.0.0-alpha.
|
|
6
|
+
"version": "1.0.0-alpha.126",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "ZenStack Team"
|
|
9
9
|
},
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"vscode-uri": "^3.0.6",
|
|
96
96
|
"zod": "3.21.1",
|
|
97
97
|
"zod-validation-error": "^0.2.1",
|
|
98
|
-
"@zenstackhq/language": "1.0.0-alpha.
|
|
99
|
-
"@zenstackhq/sdk": "1.0.0-alpha.
|
|
98
|
+
"@zenstackhq/language": "1.0.0-alpha.126",
|
|
99
|
+
"@zenstackhq/sdk": "1.0.0-alpha.126"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@types/async-exit-hook": "^2.0.0",
|
|
@@ -128,8 +128,8 @@
|
|
|
128
128
|
"tsc-alias": "^1.7.0",
|
|
129
129
|
"typescript": "^4.8.4",
|
|
130
130
|
"vitest": "^0.29.7",
|
|
131
|
-
"@zenstackhq/runtime": "1.0.0-alpha.
|
|
132
|
-
"@zenstackhq/testtools": "1.0.0-alpha.
|
|
131
|
+
"@zenstackhq/runtime": "1.0.0-alpha.126",
|
|
132
|
+
"@zenstackhq/testtools": "1.0.0-alpha.126"
|
|
133
133
|
},
|
|
134
134
|
"scripts": {
|
|
135
135
|
"vscode:publish": "vsce publish --no-dependencies",
|
package/plugins/plugin-utils.js
CHANGED
|
@@ -12,7 +12,10 @@ exports.ALL_OPERATION_KINDS = ['create', 'update', 'postUpdate', 'read', 'delete
|
|
|
12
12
|
*/
|
|
13
13
|
function getNodeModulesFolder(startPath) {
|
|
14
14
|
startPath = startPath !== null && startPath !== void 0 ? startPath : process.cwd();
|
|
15
|
-
if (
|
|
15
|
+
if (startPath.endsWith('node_modules')) {
|
|
16
|
+
return startPath;
|
|
17
|
+
}
|
|
18
|
+
else if (fs_1.default.existsSync(path_1.default.join(startPath, 'node_modules'))) {
|
|
16
19
|
return path_1.default.join(startPath, 'node_modules');
|
|
17
20
|
}
|
|
18
21
|
else if (startPath !== '/') {
|
|
@@ -30,7 +33,14 @@ exports.getNodeModulesFolder = getNodeModulesFolder;
|
|
|
30
33
|
*/
|
|
31
34
|
function getDefaultOutputFolder() {
|
|
32
35
|
// Find the real runtime module path, it might be a symlink in pnpm
|
|
33
|
-
|
|
36
|
+
let runtimeModulePath = require.resolve('@zenstackhq/runtime');
|
|
37
|
+
if (runtimeModulePath) {
|
|
38
|
+
// start with the parent folder of @zenstackhq, supposed to be a node_modules folder
|
|
39
|
+
while (!runtimeModulePath.endsWith('@zenstackhq') && runtimeModulePath !== '/') {
|
|
40
|
+
runtimeModulePath = path_1.default.join(runtimeModulePath, '..');
|
|
41
|
+
}
|
|
42
|
+
runtimeModulePath = path_1.default.join(runtimeModulePath, '..');
|
|
43
|
+
}
|
|
34
44
|
const modulesFolder = getNodeModulesFolder(runtimeModulePath);
|
|
35
45
|
return modulesFolder ? path_1.default.join(modulesFolder, '.zenstack') : undefined;
|
|
36
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-utils.js","sourceRoot":"","sources":["../../src/plugins/plugin-utils.ts"],"names":[],"mappings":";;;;;;AACA,4CAAoB;AACpB,gDAAwB;AAEX,QAAA,mBAAmB,GAA0B,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE/G;;GAEG;AACH,SAAgB,oBAAoB,CAAC,SAAkB;IACnD,SAAS,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,OAAO,CAAC,GAAG,E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