@wzyjs/next 0.2.41 → 0.2.43
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/dist/Base.zmodel +7 -3
- package/dist/index.js +4 -4
- package/dist/useHabitGroupCRUD.ts +2 -1
- package/package.json +4 -4
package/dist/Base.zmodel
CHANGED
|
@@ -2,6 +2,10 @@ generator client {
|
|
|
2
2
|
provider = "prisma-client-js"
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
generator json {
|
|
6
|
+
provider = "prisma-json-types-generator"
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
datasource db {
|
|
6
10
|
provider = "mysql"
|
|
7
11
|
url = env("DATABASE_URL")
|
|
@@ -35,10 +39,10 @@ plugin trpc {
|
|
|
35
39
|
generateModelActions = 'findMany, findUnique, create, update, delete, deleteMany'
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
plugin
|
|
42
|
+
plugin crud {
|
|
39
43
|
provider = '@wzyjs/next'
|
|
40
|
-
title = 'Generate
|
|
41
|
-
output = 'src/api/generated/
|
|
44
|
+
title = 'Generate useModelCRUD'
|
|
45
|
+
output = 'src/api/generated/crud'
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
abstract model Base {
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ exports.name = void 0;
|
|
|
40
40
|
exports.default = run;
|
|
41
41
|
var fs = require("node:fs");
|
|
42
42
|
var path = require("node:path");
|
|
43
|
-
exports.name = 'Generate
|
|
43
|
+
exports.name = 'Generate useModelCRUD';
|
|
44
44
|
var config = {
|
|
45
45
|
template: {
|
|
46
46
|
content: fs.readFileSync(path.resolve(__dirname, './useHabitGroupCRUD.ts'), 'utf-8'),
|
|
@@ -52,7 +52,7 @@ function run(model, options) {
|
|
|
52
52
|
return __generator(this, function (_a) {
|
|
53
53
|
// 检查配置
|
|
54
54
|
if (!options.output) {
|
|
55
|
-
throw new Error('
|
|
55
|
+
throw new Error('crud output is required');
|
|
56
56
|
}
|
|
57
57
|
modelNames = model.declarations.filter(function (item) { return item.$type === 'DataModel'; });
|
|
58
58
|
// 创建目录
|
|
@@ -68,11 +68,11 @@ function run(model, options) {
|
|
|
68
68
|
var modelName = ModelName.replace(/^./, function (s) { return s.toLowerCase(); });
|
|
69
69
|
templateContent = templateContent.replace(/habitGroup/g, modelName);
|
|
70
70
|
templateContent = templateContent.replace(/HabitGroup/g, ModelName);
|
|
71
|
-
fs.writeFileSync(options.output + "/use".concat(ModelName, "
|
|
71
|
+
fs.writeFileSync(options.output + "/use".concat(ModelName, "CRUD.ts"), templateContent);
|
|
72
72
|
});
|
|
73
73
|
indexContent = modelNames.map(function (_a) {
|
|
74
74
|
var ModelName = _a.name;
|
|
75
|
-
return "export * from './use".concat(ModelName, "
|
|
75
|
+
return "export * from './use".concat(ModelName, "CRUD'");
|
|
76
76
|
}).join('\n');
|
|
77
77
|
fs.writeFileSync(options.output + '/index.ts', indexContent + '\n');
|
|
78
78
|
return [2 /*return*/];
|
|
@@ -23,7 +23,8 @@ export const useHabitGroupCRUD = (option: Option = {}) => {
|
|
|
23
23
|
const apiUtils = api.useUtils()
|
|
24
24
|
|
|
25
25
|
const listState = api.habitGroup.findMany.useQuery(list ? list.query : {}, {
|
|
26
|
-
|
|
26
|
+
enabled: typeof list === 'boolean' ? list : true,
|
|
27
|
+
...list?.option,
|
|
27
28
|
})
|
|
28
29
|
|
|
29
30
|
const onSuccess = (tip: string) => {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wzyjs/next",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.43",
|
|
4
4
|
"description": "description",
|
|
5
5
|
"author": "wzy",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build:plugin": "tsc src/plugin/
|
|
8
|
+
"build:plugin": "tsc src/plugin/crud/index.ts --outDir dist --skipLibCheck --module CommonJS",
|
|
9
9
|
"cp1": "cp src/prisma/Base.zmodel dist/Base.zmodel",
|
|
10
|
-
"cp2": "cp src/plugin/
|
|
10
|
+
"cp2": "cp src/plugin/crud/useHabitGroupCRUD.ts dist/useHabitGroupCRUD.ts",
|
|
11
11
|
"build": "npm run build:plugin && npm run cp1 && npm run cp2"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@zenstackhq/sdk": "^2.12.3"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "3cbddeb0836445d439d13d095fbf07ce3cc3bc9e",
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
}
|