@zenorm/generate 1.7.0 → 1.8.1
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/CHANGELOG.md +6 -0
- package/dist/generate.js +4 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/generate.js
CHANGED
|
@@ -18,7 +18,6 @@ async function generate(tables, cfg) {
|
|
|
18
18
|
await (0, utils_1.checkFileDir)(outputDir);
|
|
19
19
|
console.log('database:', config.database);
|
|
20
20
|
const remark = [
|
|
21
|
-
`// @ts-nocheck`,
|
|
22
21
|
'// zenorm 自动生成文件',
|
|
23
22
|
'// 请不要修改此文件,因为此文件在每次重新生成数据库结构时会被覆盖',
|
|
24
23
|
`// create at: ${(0, utils_1.currentDatetime)()}`,
|
|
@@ -67,12 +66,11 @@ async function generate(tables, cfg) {
|
|
|
67
66
|
structs.push(` static columns = ${JSON.stringify(columns)};`);
|
|
68
67
|
structs.push(...props);
|
|
69
68
|
structs.push('');
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
for (const c of columns) {
|
|
74
|
-
structs.push(` this.${c} = data.${c};`);
|
|
69
|
+
structs.push(` constructor(data?: object) {`);
|
|
70
|
+
if (config.globalFilename) {
|
|
71
|
+
structs.push(` super();`);
|
|
75
72
|
}
|
|
73
|
+
structs.push(` data && Object.assign(this, data);`);
|
|
76
74
|
structs.push(` }`);
|
|
77
75
|
structs.push('}');
|
|
78
76
|
structs.push('');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenorm/generate",
|
|
3
3
|
"description": "Easy ORM, easy query. easy typing! Auto generate typescript declaration.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.1",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"homepage": "https://zenorm.node.ltd",
|