export-table-plugin-typescript 1.0.15 → 1.0.17
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 +25 -25
- package/dist/ExportJson.d.ts +8 -8
- package/dist/ExportJson.js +61 -61
- package/dist/ExportTS.d.ts +7 -7
- package/dist/ExportTS.d.ts.map +1 -1
- package/dist/ExportTS.js +209 -202
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/json.js +1 -1
- package/package.json +1 -1
- package/src/ExportJson.ts +41 -41
- package/src/ExportTS.ts +40 -33
- package/src/index.ts +8 -8
- package/test/test-json.bat +1 -1
- package/test/test-ts.bat +1 -1
- package/tsconfig.json +104 -104
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
# 使用说明
|
|
3
|
-
|
|
4
|
-
## 导出ts
|
|
5
|
-
### 安装依赖
|
|
6
|
-
|
|
7
|
-
```shell
|
|
8
|
-
npm install -g export-table-pulgin-typescript
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### 导表
|
|
12
|
-
quicktable export $配表路径 $导出路径 --tags typescript:ts
|
|
13
|
-
|
|
14
|
-
## 导出json
|
|
15
|
-
### 安装依赖
|
|
16
|
-
|
|
17
|
-
```shell
|
|
18
|
-
npm install -g export-table-pulgin-typescript
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### 导表
|
|
22
|
-
```shell
|
|
23
|
-
quicktable export $配表路径 $导出路径 --tags typescript:json
|
|
24
|
-
```
|
|
25
|
-
|
|
1
|
+
|
|
2
|
+
# 使用说明
|
|
3
|
+
|
|
4
|
+
## 导出ts
|
|
5
|
+
### 安装依赖
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm install -g export-table-pulgin-typescript
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### 导表
|
|
12
|
+
quicktable export $配表路径 $导出路径 --tags typescript:ts
|
|
13
|
+
|
|
14
|
+
## 导出json
|
|
15
|
+
### 安装依赖
|
|
16
|
+
|
|
17
|
+
```shell
|
|
18
|
+
npm install -g export-table-pulgin-typescript
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 导表
|
|
22
|
+
```shell
|
|
23
|
+
quicktable export $配表路径 $导出路径 --tags typescript:json
|
|
24
|
+
```
|
|
25
|
+
|
package/dist/ExportJson.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { HandleSheetParams, PluginBase } from "export-table-lib";
|
|
2
|
-
export declare function export_stuff(paras: HandleSheetParams): string | null;
|
|
3
|
-
export declare class ExportJsonPlugin extends PluginBase {
|
|
4
|
-
name: string;
|
|
5
|
-
tags: string[];
|
|
6
|
-
handleSheet(paras: HandleSheetParams): string | null;
|
|
7
|
-
}
|
|
8
|
-
export declare const ExportPlugins: ExportJsonPlugin[];
|
|
1
|
+
import { HandleSheetParams, PluginBase } from "export-table-lib";
|
|
2
|
+
export declare function export_stuff(paras: HandleSheetParams): string | null;
|
|
3
|
+
export declare class ExportJsonPlugin extends PluginBase {
|
|
4
|
+
name: string;
|
|
5
|
+
tags: string[];
|
|
6
|
+
handleSheet(paras: HandleSheetParams): string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const ExportPlugins: ExportJsonPlugin[];
|
|
9
9
|
//# sourceMappingURL=ExportJson.d.ts.map
|
package/dist/ExportJson.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ExportPlugins = exports.ExportJsonPlugin = exports.export_stuff = void 0;
|
|
27
|
-
const export_table_lib_1 = require("export-table-lib");
|
|
28
|
-
const fs = __importStar(require("fs-extra"));
|
|
29
|
-
function export_stuff(paras) {
|
|
30
|
-
var _a;
|
|
31
|
-
let { datas, fields, name, objects, } = paras;
|
|
32
|
-
let mainField = (_a = fields.find(f => f.type == "uid")) !== null && _a !== void 0 ? _a : fields[0];
|
|
33
|
-
let temp = `
|
|
34
|
-
{
|
|
35
|
-
${(0, export_table_lib_1.foreach)(objects, obj => `
|
|
36
|
-
"${obj[mainField.name]}" : ${JSON.stringify(obj)}
|
|
37
|
-
`, ",\n")}
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
return temp;
|
|
41
|
-
}
|
|
42
|
-
exports.export_stuff = export_stuff;
|
|
43
|
-
class ExportJsonPlugin extends export_table_lib_1.PluginBase {
|
|
44
|
-
constructor() {
|
|
45
|
-
super(...arguments);
|
|
46
|
-
this.name = "json";
|
|
47
|
-
this.tags = ["json"];
|
|
48
|
-
}
|
|
49
|
-
handleSheet(paras) {
|
|
50
|
-
let content = export_stuff(paras);
|
|
51
|
-
if (content != null) {
|
|
52
|
-
let savePath = new export_table_lib_1.OutFilePath(paras.outPath, paras.table.name, ".json").fullPath;
|
|
53
|
-
fs.outputFileSync(savePath, content, "utf-8");
|
|
54
|
-
}
|
|
55
|
-
return content;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.ExportJsonPlugin = ExportJsonPlugin;
|
|
59
|
-
exports.ExportPlugins = [
|
|
60
|
-
new ExportJsonPlugin(),
|
|
61
|
-
];
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ExportPlugins = exports.ExportJsonPlugin = exports.export_stuff = void 0;
|
|
27
|
+
const export_table_lib_1 = require("export-table-lib");
|
|
28
|
+
const fs = __importStar(require("fs-extra"));
|
|
29
|
+
function export_stuff(paras) {
|
|
30
|
+
var _a;
|
|
31
|
+
let { datas, fields, name, objects, } = paras;
|
|
32
|
+
let mainField = (_a = fields.find(f => f.type == "uid")) !== null && _a !== void 0 ? _a : fields[0];
|
|
33
|
+
let temp = `
|
|
34
|
+
{
|
|
35
|
+
${(0, export_table_lib_1.foreach)(objects, obj => `
|
|
36
|
+
"${obj[mainField.name]}" : ${JSON.stringify(obj)}
|
|
37
|
+
`, ",\n")}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
return temp;
|
|
41
|
+
}
|
|
42
|
+
exports.export_stuff = export_stuff;
|
|
43
|
+
class ExportJsonPlugin extends export_table_lib_1.PluginBase {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(...arguments);
|
|
46
|
+
this.name = "json";
|
|
47
|
+
this.tags = ["json"];
|
|
48
|
+
}
|
|
49
|
+
handleSheet(paras) {
|
|
50
|
+
let content = export_stuff(paras);
|
|
51
|
+
if (content != null) {
|
|
52
|
+
let savePath = new export_table_lib_1.OutFilePath(paras.outPath, paras.table.name, ".json").fullPath;
|
|
53
|
+
fs.outputFileSync(savePath, content, "utf-8");
|
|
54
|
+
}
|
|
55
|
+
return content;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.ExportJsonPlugin = ExportJsonPlugin;
|
|
59
|
+
exports.ExportPlugins = [
|
|
60
|
+
new ExportJsonPlugin(),
|
|
61
|
+
];
|
package/dist/ExportTS.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HandleSheetParams, PluginBase } from "export-table-lib";
|
|
2
|
-
export declare function export_stuff(paras: HandleSheetParams): string | null;
|
|
3
|
-
export declare class ExportTSPlugin extends PluginBase {
|
|
4
|
-
name: string;
|
|
5
|
-
tags: string[];
|
|
6
|
-
handleSheet(paras: HandleSheetParams): string | null;
|
|
7
|
-
}
|
|
1
|
+
import { HandleSheetParams, PluginBase } from "export-table-lib";
|
|
2
|
+
export declare function export_stuff(paras: HandleSheetParams): string | null;
|
|
3
|
+
export declare class ExportTSPlugin extends PluginBase {
|
|
4
|
+
name: string;
|
|
5
|
+
tags: string[];
|
|
6
|
+
handleSheet(paras: HandleSheetParams): string | null;
|
|
7
|
+
}
|
|
8
8
|
//# sourceMappingURL=ExportTS.d.ts.map
|
package/dist/ExportTS.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportTS.d.ts","sourceRoot":"","sources":["../src/ExportTS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAmF,MAAM,kBAAkB,CAAA;AAGnL,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"ExportTS.d.ts","sourceRoot":"","sources":["../src/ExportTS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAmF,MAAM,kBAAkB,CAAA;AAGnL,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAwOpE;AAED,qBAAa,cAAe,SAAQ,UAAU;IAC7C,IAAI,SAAe;IACnB,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAQpC"}
|
package/dist/ExportTS.js
CHANGED
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ExportTSPlugin = exports.export_stuff = void 0;
|
|
30
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
-
const export_table_lib_1 = require("export-table-lib");
|
|
32
|
-
const fs = __importStar(require("fs-extra"));
|
|
33
|
-
function export_stuff(paras) {
|
|
34
|
-
var _a;
|
|
35
|
-
let { datas, fields, name, objects, tables, table, } = paras;
|
|
36
|
-
let RowClass = (0, export_table_lib_1.makeFirstLetterUpper)(name) + "Row";
|
|
37
|
-
let initFunc = name + "Init";
|
|
38
|
-
let mapfield = fields.find(a => a.type == "key"); //如果是map,则生成对应的map
|
|
39
|
-
let mapName = name + "Map";
|
|
40
|
-
let getFieldType = function (f) {
|
|
41
|
-
let t = f.type;
|
|
42
|
-
if (t == "object") {
|
|
43
|
-
return "object";
|
|
44
|
-
}
|
|
45
|
-
else if (t == "object[]") {
|
|
46
|
-
return "object[]";
|
|
47
|
-
}
|
|
48
|
-
else if (t == "number" || t == "int" || t == "long") {
|
|
49
|
-
return "number";
|
|
50
|
-
}
|
|
51
|
-
else if (t == "number[]" || t == "int[]" || t == "long[]") {
|
|
52
|
-
return "number[]";
|
|
53
|
-
}
|
|
54
|
-
else if (t == "uid") {
|
|
55
|
-
return "uid";
|
|
56
|
-
}
|
|
57
|
-
else if (t == "bool") {
|
|
58
|
-
return "boolean";
|
|
59
|
-
}
|
|
60
|
-
else if (t == "bool[]") {
|
|
61
|
-
return "boolean[]";
|
|
62
|
-
}
|
|
63
|
-
else if (t == "string") {
|
|
64
|
-
return "string";
|
|
65
|
-
}
|
|
66
|
-
else if (t == "string[]") {
|
|
67
|
-
return "string[]";
|
|
68
|
-
}
|
|
69
|
-
else if (t == "fk") {
|
|
70
|
-
let ffk = table.getFKField(f);
|
|
71
|
-
let fkType = getFieldType(ffk);
|
|
72
|
-
return fkType;
|
|
73
|
-
// return "number";
|
|
74
|
-
}
|
|
75
|
-
else if (t == "fk[]") {
|
|
76
|
-
let ffk = table.getFKField(f);
|
|
77
|
-
let fkType = getFieldType(ffk);
|
|
78
|
-
if (typeof (fkType) == "string") {
|
|
79
|
-
if (fkType.match(/\w+/)) {
|
|
80
|
-
return `${fkType}[]`;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return `(${fkType})[]`;
|
|
84
|
-
// return "number[]";
|
|
85
|
-
}
|
|
86
|
-
else if (t == "any") {
|
|
87
|
-
return "any";
|
|
88
|
-
}
|
|
89
|
-
else if (t == "key") {
|
|
90
|
-
return "string";
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
console.error(chalk_1.default.red(`invalid type ${f.name}:<unkown>`));
|
|
94
|
-
return "never";
|
|
95
|
-
}
|
|
96
|
-
return t;
|
|
97
|
-
};
|
|
98
|
-
let getFieldName = function (n) {
|
|
99
|
-
if (n == "object" || n == "any") {
|
|
100
|
-
return n + "?";
|
|
101
|
-
}
|
|
102
|
-
return n;
|
|
103
|
-
};
|
|
104
|
-
let getFieldDefault = function (f) {
|
|
105
|
-
let t = f.type;
|
|
106
|
-
if (t == "any") {
|
|
107
|
-
return "undefined";
|
|
108
|
-
}
|
|
109
|
-
else if (t == "uid") {
|
|
110
|
-
return 0;
|
|
111
|
-
}
|
|
112
|
-
else if (t == "number" || t == "int" || t == "long") {
|
|
113
|
-
return 0;
|
|
114
|
-
}
|
|
115
|
-
else if (t == "bool") {
|
|
116
|
-
return "false";
|
|
117
|
-
}
|
|
118
|
-
else if (t == "string") {
|
|
119
|
-
return "\"\"";
|
|
120
|
-
}
|
|
121
|
-
else if (t == "string*") {
|
|
122
|
-
return "\"\"";
|
|
123
|
-
}
|
|
124
|
-
else if (t == "object") {
|
|
125
|
-
return "null as any";
|
|
126
|
-
}
|
|
127
|
-
else if (t == "fk") {
|
|
128
|
-
// return 0;
|
|
129
|
-
let ffk = table.getFKField(f);
|
|
130
|
-
let defaultValue = getFieldDefault(ffk);
|
|
131
|
-
return defaultValue;
|
|
132
|
-
}
|
|
133
|
-
else if (t == "key") {
|
|
134
|
-
return "\"\"";
|
|
135
|
-
}
|
|
136
|
-
else if (t.endsWith("[]")) {
|
|
137
|
-
return "[]";
|
|
138
|
-
}
|
|
139
|
-
return "undefined";
|
|
140
|
-
};
|
|
141
|
-
let getFkFieldType = function (field) {
|
|
142
|
-
return tables.find(a => a.name == field.fkTableName).fields.find(a => a.name == field.fkFieldName).type;
|
|
143
|
-
};
|
|
144
|
-
let formatDescribe = function (field, tabCount) {
|
|
145
|
-
let tabs = " ".repeat(tabCount);
|
|
146
|
-
let lines = `${field.describe}`.split("\n").map(l => `${tabs + " * " + l}`);
|
|
147
|
-
let line = tabs + "/**\n" + lines.join("\n") + "\n" + tabs + " **/";
|
|
148
|
-
return line;
|
|
149
|
-
};
|
|
150
|
-
let mainField = (_a = fields.find(f => f.type == "uid")) !== null && _a !== void 0 ? _a : fields[0];
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ExportTSPlugin = exports.export_stuff = void 0;
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const export_table_lib_1 = require("export-table-lib");
|
|
32
|
+
const fs = __importStar(require("fs-extra"));
|
|
33
|
+
function export_stuff(paras) {
|
|
34
|
+
var _a;
|
|
35
|
+
let { datas, fields, name, objects, tables, table, } = paras;
|
|
36
|
+
let RowClass = (0, export_table_lib_1.makeFirstLetterUpper)(name) + "Row";
|
|
37
|
+
let initFunc = name + "Init";
|
|
38
|
+
let mapfield = fields.find(a => a.type == "key"); //如果是map,则生成对应的map
|
|
39
|
+
let mapName = name + "Map";
|
|
40
|
+
let getFieldType = function (f) {
|
|
41
|
+
let t = f.type;
|
|
42
|
+
if (t == "object") {
|
|
43
|
+
return "object";
|
|
44
|
+
}
|
|
45
|
+
else if (t == "object[]") {
|
|
46
|
+
return "object[]";
|
|
47
|
+
}
|
|
48
|
+
else if (t == "number" || t == "int" || t == "long") {
|
|
49
|
+
return "number";
|
|
50
|
+
}
|
|
51
|
+
else if (t == "number[]" || t == "int[]" || t == "long[]") {
|
|
52
|
+
return "number[]";
|
|
53
|
+
}
|
|
54
|
+
else if (t == "uid") {
|
|
55
|
+
return "uid";
|
|
56
|
+
}
|
|
57
|
+
else if (t == "bool") {
|
|
58
|
+
return "boolean";
|
|
59
|
+
}
|
|
60
|
+
else if (t == "bool[]") {
|
|
61
|
+
return "boolean[]";
|
|
62
|
+
}
|
|
63
|
+
else if (t == "string") {
|
|
64
|
+
return "string";
|
|
65
|
+
}
|
|
66
|
+
else if (t == "string[]") {
|
|
67
|
+
return "string[]";
|
|
68
|
+
}
|
|
69
|
+
else if (t == "fk") {
|
|
70
|
+
let ffk = table.getFKField(f);
|
|
71
|
+
let fkType = getFieldType(ffk);
|
|
72
|
+
return fkType;
|
|
73
|
+
// return "number";
|
|
74
|
+
}
|
|
75
|
+
else if (t == "fk[]") {
|
|
76
|
+
let ffk = table.getFKField(f);
|
|
77
|
+
let fkType = getFieldType(ffk);
|
|
78
|
+
if (typeof (fkType) == "string") {
|
|
79
|
+
if (fkType.match(/\w+/)) {
|
|
80
|
+
return `${fkType}[]`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return `(${fkType})[]`;
|
|
84
|
+
// return "number[]";
|
|
85
|
+
}
|
|
86
|
+
else if (t == "any") {
|
|
87
|
+
return "any";
|
|
88
|
+
}
|
|
89
|
+
else if (t == "key") {
|
|
90
|
+
return "string";
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
console.error(chalk_1.default.red(`invalid type ${f.name}:<unkown>`));
|
|
94
|
+
return "never";
|
|
95
|
+
}
|
|
96
|
+
return t;
|
|
97
|
+
};
|
|
98
|
+
let getFieldName = function (n) {
|
|
99
|
+
if (n == "object" || n == "any") {
|
|
100
|
+
return n + "?";
|
|
101
|
+
}
|
|
102
|
+
return n;
|
|
103
|
+
};
|
|
104
|
+
let getFieldDefault = function (f) {
|
|
105
|
+
let t = f.type;
|
|
106
|
+
if (t == "any") {
|
|
107
|
+
return "undefined";
|
|
108
|
+
}
|
|
109
|
+
else if (t == "uid") {
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
else if (t == "number" || t == "int" || t == "long") {
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
else if (t == "bool") {
|
|
116
|
+
return "false";
|
|
117
|
+
}
|
|
118
|
+
else if (t == "string") {
|
|
119
|
+
return "\"\"";
|
|
120
|
+
}
|
|
121
|
+
else if (t == "string*") {
|
|
122
|
+
return "\"\"";
|
|
123
|
+
}
|
|
124
|
+
else if (t == "object") {
|
|
125
|
+
return "null as any";
|
|
126
|
+
}
|
|
127
|
+
else if (t == "fk") {
|
|
128
|
+
// return 0;
|
|
129
|
+
let ffk = table.getFKField(f);
|
|
130
|
+
let defaultValue = getFieldDefault(ffk);
|
|
131
|
+
return defaultValue;
|
|
132
|
+
}
|
|
133
|
+
else if (t == "key") {
|
|
134
|
+
return "\"\"";
|
|
135
|
+
}
|
|
136
|
+
else if (t.endsWith("[]")) {
|
|
137
|
+
return "[]";
|
|
138
|
+
}
|
|
139
|
+
return "undefined";
|
|
140
|
+
};
|
|
141
|
+
let getFkFieldType = function (field) {
|
|
142
|
+
return tables.find(a => a.name == field.fkTableName).fields.find(a => a.name == field.fkFieldName).type;
|
|
143
|
+
};
|
|
144
|
+
let formatDescribe = function (field, tabCount) {
|
|
145
|
+
let tabs = " ".repeat(tabCount);
|
|
146
|
+
let lines = `${field.describe}`.split("\n").map(l => `${tabs + " * " + l}`);
|
|
147
|
+
let line = tabs + "/**\n" + lines.join("\n") + "\n" + tabs + " **/";
|
|
148
|
+
return line;
|
|
149
|
+
};
|
|
150
|
+
let mainField = (_a = fields.find(f => f.type == "uid")) !== null && _a !== void 0 ? _a : fields[0];
|
|
151
151
|
let temp = `
|
|
152
152
|
${(0, export_table_lib_1.foreach)(fields, f => `
|
|
153
153
|
${(0, export_table_lib_1.iff)((f.type == "fk" || f.type == "fk[]") && f.fkTableName != name, () => `
|
|
@@ -222,62 +222,69 @@ ${(0, export_table_lib_1.iff)(f.type == "fk[]", () => `
|
|
|
222
222
|
`)}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
export class ${RowClass} {
|
|
226
|
+
public static readonly I = new ${RowClass}();
|
|
226
227
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
228
|
+
readonly Configs: ${RowClass}Row[] = [];
|
|
229
|
+
|
|
230
|
+
protected LoadDefaultConfigs() {
|
|
231
|
+
|
|
232
|
+
let rowData:any[]=
|
|
233
|
+
[
|
|
234
|
+
${(0, export_table_lib_1.foreach)(datas, d => `
|
|
235
|
+
${JSON.stringify(d)},
|
|
236
|
+
`)}
|
|
237
|
+
]
|
|
238
|
+
|
|
239
|
+
let tableData: ${RowClass}[] = []
|
|
240
|
+
for (let record of rowData) {
|
|
241
|
+
let obj = new ${RowClass} () as any
|
|
242
|
+
for(let i = 0;i<fields.length;i++) {
|
|
243
|
+
let key = fields[i]
|
|
244
|
+
obj[key] = record[i]
|
|
245
|
+
}
|
|
246
|
+
tableData.push(obj)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
${(0, export_table_lib_1.iff)(mapfield, () => `
|
|
250
|
+
export let ${mapName}:{
|
|
251
|
+
${(0, export_table_lib_1.foreach)(objects, o => `
|
|
252
|
+
/** ${JSON.stringify(o)} */
|
|
253
|
+
["${o[mapfield.name]}"]:${RowClass}
|
|
254
|
+
`)}
|
|
255
|
+
}={} as any
|
|
256
|
+
`)}
|
|
257
|
+
|
|
258
|
+
for(let r of tableData){
|
|
259
|
+
${name}s.push(r);
|
|
260
|
+
${(0, export_table_lib_1.iff)(mapfield, () => `
|
|
261
|
+
(${mapName} as any)[r.${mapfield.name}] = r;
|
|
262
|
+
`)}
|
|
263
|
+
}
|
|
233
264
|
|
|
234
|
-
let tableData: ${RowClass}[] = []
|
|
235
|
-
for (let record of rowData) {
|
|
236
|
-
let obj = new ${RowClass} () as any
|
|
237
|
-
for(let i = 0;i<fields.length;i++) {
|
|
238
|
-
let key = fields[i]
|
|
239
|
-
obj[key] = record[i]
|
|
240
265
|
}
|
|
241
|
-
|
|
266
|
+
|
|
242
267
|
}
|
|
243
268
|
|
|
244
|
-
${
|
|
245
|
-
export let ${mapName}:{
|
|
246
|
-
${(0, export_table_lib_1.foreach)(objects, o => `
|
|
247
|
-
/** ${JSON.stringify(o)} */
|
|
248
|
-
["${o[mapfield.name]}"]:${RowClass}
|
|
249
|
-
`)}
|
|
250
|
-
}={} as any
|
|
251
|
-
`)}
|
|
269
|
+
${RowClass}.I['LoadDefaultConfigs']()
|
|
252
270
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
${(0, export_table_lib_1.iff)(mapfield, () => `
|
|
256
|
-
(${mapName} as any)[r.${mapfield.name}] = r;
|
|
257
|
-
`)}
|
|
271
|
+
`;
|
|
272
|
+
return temp;
|
|
258
273
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if (content != null) {
|
|
277
|
-
let savePath = new export_table_lib_1.OutFilePath(paras.outPath, paras.table.name, ".ts").fullPath;
|
|
278
|
-
fs.outputFileSync(savePath, content, "utf-8");
|
|
279
|
-
}
|
|
280
|
-
return content;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
exports.ExportTSPlugin = ExportTSPlugin;
|
|
274
|
+
exports.export_stuff = export_stuff;
|
|
275
|
+
class ExportTSPlugin extends export_table_lib_1.PluginBase {
|
|
276
|
+
constructor() {
|
|
277
|
+
super(...arguments);
|
|
278
|
+
this.name = "typescript";
|
|
279
|
+
this.tags = ["ts"];
|
|
280
|
+
}
|
|
281
|
+
handleSheet(paras) {
|
|
282
|
+
let content = export_stuff(paras);
|
|
283
|
+
if (content != null) {
|
|
284
|
+
let savePath = new export_table_lib_1.OutFilePath(paras.outPath, paras.table.name, ".ts").fullPath;
|
|
285
|
+
fs.outputFileSync(savePath, content, "utf-8");
|
|
286
|
+
}
|
|
287
|
+
return content;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
exports.ExportTSPlugin = ExportTSPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportJsonPlugin } from "./ExportJson";
|
|
2
|
-
import { ExportTSPlugin } from "./ExportTS";
|
|
3
|
-
export declare const ExportPlugins: (ExportJsonPlugin | ExportTSPlugin)[];
|
|
1
|
+
import { ExportJsonPlugin } from "./ExportJson";
|
|
2
|
+
import { ExportTSPlugin } from "./ExportTS";
|
|
3
|
+
export declare const ExportPlugins: (ExportJsonPlugin | ExportTSPlugin)[];
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExportPlugins = void 0;
|
|
4
|
-
const ExportJson_1 = require("./ExportJson");
|
|
5
|
-
const ExportTS_1 = require("./ExportTS");
|
|
6
|
-
exports.ExportPlugins = [
|
|
7
|
-
new ExportTS_1.ExportTSPlugin(),
|
|
8
|
-
new ExportJson_1.ExportJsonPlugin(),
|
|
9
|
-
];
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExportPlugins = void 0;
|
|
4
|
+
const ExportJson_1 = require("./ExportJson");
|
|
5
|
+
const ExportTS_1 = require("./ExportTS");
|
|
6
|
+
exports.ExportPlugins = [
|
|
7
|
+
new ExportTS_1.ExportTSPlugin(),
|
|
8
|
+
new ExportJson_1.ExportJsonPlugin(),
|
|
9
|
+
];
|
package/dist/json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
package/package.json
CHANGED
package/src/ExportJson.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
import { cmm, HandleSheetParams, Field, foreach, IPlugin, st, PluginBase, HandleBatchParams, OutFilePath } from "export-table-lib"
|
|
3
|
-
import * as fs from "fs-extra"
|
|
4
|
-
|
|
5
|
-
export function export_stuff(paras: HandleSheetParams): string | null {
|
|
6
|
-
let {
|
|
7
|
-
datas,
|
|
8
|
-
fields,
|
|
9
|
-
name,
|
|
10
|
-
objects,
|
|
11
|
-
} = paras;
|
|
12
|
-
|
|
13
|
-
let mainField: Field = fields.find(f => f.type == "uid") ?? fields[0]
|
|
14
|
-
let temp = `
|
|
15
|
-
{
|
|
16
|
-
${foreach(objects, obj => `
|
|
17
|
-
"${obj[mainField.name]}" : ${JSON.stringify(obj)}
|
|
18
|
-
`, ",\n")}
|
|
19
|
-
}
|
|
20
|
-
`
|
|
21
|
-
return temp
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class ExportJsonPlugin extends PluginBase {
|
|
26
|
-
name = "json"
|
|
27
|
-
tags: string[] = ["json"]
|
|
28
|
-
|
|
29
|
-
handleSheet(paras: HandleSheetParams) {
|
|
30
|
-
let content = export_stuff(paras)
|
|
31
|
-
if (content != null) {
|
|
32
|
-
let savePath = new OutFilePath(paras.outPath, paras.table.name, ".json").fullPath
|
|
33
|
-
fs.outputFileSync(savePath, content, "utf-8")
|
|
34
|
-
}
|
|
35
|
-
return content
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const ExportPlugins = [
|
|
40
|
-
new ExportJsonPlugin(),
|
|
41
|
-
]
|
|
1
|
+
|
|
2
|
+
import { cmm, HandleSheetParams, Field, foreach, IPlugin, st, PluginBase, HandleBatchParams, OutFilePath } from "export-table-lib"
|
|
3
|
+
import * as fs from "fs-extra"
|
|
4
|
+
|
|
5
|
+
export function export_stuff(paras: HandleSheetParams): string | null {
|
|
6
|
+
let {
|
|
7
|
+
datas,
|
|
8
|
+
fields,
|
|
9
|
+
name,
|
|
10
|
+
objects,
|
|
11
|
+
} = paras;
|
|
12
|
+
|
|
13
|
+
let mainField: Field = fields.find(f => f.type == "uid") ?? fields[0]
|
|
14
|
+
let temp = `
|
|
15
|
+
{
|
|
16
|
+
${foreach(objects, obj => `
|
|
17
|
+
"${obj[mainField.name]}" : ${JSON.stringify(obj)}
|
|
18
|
+
`, ",\n")}
|
|
19
|
+
}
|
|
20
|
+
`
|
|
21
|
+
return temp
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class ExportJsonPlugin extends PluginBase {
|
|
26
|
+
name = "json"
|
|
27
|
+
tags: string[] = ["json"]
|
|
28
|
+
|
|
29
|
+
handleSheet(paras: HandleSheetParams) {
|
|
30
|
+
let content = export_stuff(paras)
|
|
31
|
+
if (content != null) {
|
|
32
|
+
let savePath = new OutFilePath(paras.outPath, paras.table.name, ".json").fullPath
|
|
33
|
+
fs.outputFileSync(savePath, content, "utf-8")
|
|
34
|
+
}
|
|
35
|
+
return content
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const ExportPlugins = [
|
|
40
|
+
new ExportJsonPlugin(),
|
|
41
|
+
]
|
package/src/ExportTS.ts
CHANGED
|
@@ -186,45 +186,52 @@ ${iff(f.type == "fk[]", () => `
|
|
|
186
186
|
`)}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
export class ${RowClass} {
|
|
190
|
+
public static readonly I = new ${RowClass}();
|
|
191
|
+
|
|
192
|
+
readonly Configs: ${RowClass}Row[] = [];
|
|
193
|
+
|
|
194
|
+
protected LoadDefaultConfigs() {
|
|
195
|
+
|
|
196
|
+
let rowData:any[]=
|
|
197
|
+
[
|
|
198
|
+
${foreach(datas, d => `
|
|
199
|
+
${JSON.stringify(d)},
|
|
200
|
+
`)}
|
|
201
|
+
]
|
|
202
|
+
|
|
203
|
+
let tableData: ${RowClass}[] = []
|
|
204
|
+
for (let record of rowData) {
|
|
205
|
+
let obj = new ${RowClass} () as any
|
|
206
|
+
for(let i = 0;i<fields.length;i++) {
|
|
207
|
+
let key = fields[i]
|
|
208
|
+
obj[key] = record[i]
|
|
209
|
+
}
|
|
210
|
+
tableData.push(obj)
|
|
211
|
+
}
|
|
190
212
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
${foreach(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
213
|
+
${iff(mapfield, () => `
|
|
214
|
+
export let ${mapName}:{
|
|
215
|
+
${foreach(objects, o => `
|
|
216
|
+
/** ${JSON.stringify(o)} */
|
|
217
|
+
["${o[mapfield!.name]}"]:${RowClass}
|
|
218
|
+
`)}
|
|
219
|
+
}={} as any
|
|
220
|
+
`)}
|
|
221
|
+
|
|
222
|
+
for(let r of tableData){
|
|
223
|
+
${name}s.push(r);
|
|
224
|
+
${iff(mapfield, () => `
|
|
225
|
+
(${mapName} as any)[r.${mapfield!.name}] = r;
|
|
226
|
+
`)}
|
|
227
|
+
}
|
|
197
228
|
|
|
198
|
-
let tableData: ${RowClass}[] = []
|
|
199
|
-
for (let record of rowData) {
|
|
200
|
-
let obj = new ${RowClass} () as any
|
|
201
|
-
for(let i = 0;i<fields.length;i++) {
|
|
202
|
-
let key = fields[i]
|
|
203
|
-
obj[key] = record[i]
|
|
204
229
|
}
|
|
205
|
-
tableData.push(obj)
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
${iff(mapfield, () => `
|
|
209
|
-
export let ${mapName}:{
|
|
210
|
-
${foreach(objects, o => `
|
|
211
|
-
/** ${JSON.stringify(o)} */
|
|
212
|
-
["${o[mapfield!.name]}"]:${RowClass}
|
|
213
|
-
`)}
|
|
214
|
-
}={} as any
|
|
215
|
-
`)}
|
|
216
230
|
|
|
217
|
-
for(let r of tableData){
|
|
218
|
-
${name}.push(r);
|
|
219
|
-
${iff(mapfield, () => `
|
|
220
|
-
(${mapName} as any)[r.${mapfield!.name}] = r;
|
|
221
|
-
`)}
|
|
222
231
|
}
|
|
223
232
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
*/
|
|
227
|
-
export default ${name}
|
|
233
|
+
${RowClass}.I['LoadDefaultConfigs']()
|
|
234
|
+
|
|
228
235
|
`
|
|
229
236
|
return temp
|
|
230
237
|
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { ExportJsonPlugin } from "./ExportJson";
|
|
3
|
-
import { ExportTSPlugin } from "./ExportTS";
|
|
4
|
-
|
|
5
|
-
export const ExportPlugins = [
|
|
6
|
-
new ExportTSPlugin(),
|
|
7
|
-
new ExportJsonPlugin(),
|
|
8
|
-
]
|
|
1
|
+
|
|
2
|
+
import { ExportJsonPlugin } from "./ExportJson";
|
|
3
|
+
import { ExportTSPlugin } from "./ExportTS";
|
|
4
|
+
|
|
5
|
+
export const ExportPlugins = [
|
|
6
|
+
new ExportTSPlugin(),
|
|
7
|
+
new ExportJsonPlugin(),
|
|
8
|
+
]
|
package/test/test-json.bat
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
node E:\DATA\Projects\netease\quicktable\export-table export src dist --tags typescript:json --libs E:\DATA\Projects\netease\quicktable
|
|
1
|
+
node E:\DATA\Projects\netease\quicktable\export-table export src dist --tags typescript:json --libs E:\DATA\Projects\netease\quicktable
|
package/test/test-ts.bat
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
node E:\DATA\Projects\netease\quicktable\export-table\dist\launch.js export src dist --tags typescript:ts --libs E:\DATA\Projects\netease\quicktable %*
|
|
1
|
+
node E:\DATA\Projects\netease\quicktable\export-table\dist\launch.js export src dist --tags typescript:ts --libs E:\DATA\Projects\netease\quicktable %*
|
package/tsconfig.json
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
|
|
26
|
-
/* Modules */
|
|
27
|
-
"module": "commonjs", /* Specify what module code is generated. */
|
|
28
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
29
|
-
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
30
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
31
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
32
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
33
|
-
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
34
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
36
|
-
// "resolveJsonModule": true, /* Enable importing .json files */
|
|
37
|
-
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
38
|
-
|
|
39
|
-
/* JavaScript Support */
|
|
40
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
41
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
42
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
43
|
-
|
|
44
|
-
/* Emit */
|
|
45
|
-
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
46
|
-
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
47
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
48
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
49
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
50
|
-
"outDir": "./dist/", /* Specify an output folder for all emitted files. */
|
|
51
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
52
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
53
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
54
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
55
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
56
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
57
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
60
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
61
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
62
|
-
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
63
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
64
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
65
|
-
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
66
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
67
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
68
|
-
|
|
69
|
-
/* Interop Constraints */
|
|
70
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
71
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
72
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
|
73
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
74
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
75
|
-
|
|
76
|
-
/* Type Checking */
|
|
77
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
78
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
79
|
-
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
80
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
81
|
-
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
82
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
83
|
-
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
84
|
-
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
85
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
86
|
-
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
87
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
88
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
89
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
90
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
91
|
-
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
92
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
93
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
94
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
95
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
96
|
-
|
|
97
|
-
/* Completeness */
|
|
98
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
-
},
|
|
101
|
-
"include": [
|
|
102
|
-
"./src/**/*.ts"
|
|
103
|
-
]
|
|
104
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
|
|
26
|
+
/* Modules */
|
|
27
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
28
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
29
|
+
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
30
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
31
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
32
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
33
|
+
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
34
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
36
|
+
// "resolveJsonModule": true, /* Enable importing .json files */
|
|
37
|
+
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
38
|
+
|
|
39
|
+
/* JavaScript Support */
|
|
40
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
41
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
42
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
43
|
+
|
|
44
|
+
/* Emit */
|
|
45
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
46
|
+
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
47
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
48
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
49
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
50
|
+
"outDir": "./dist/", /* Specify an output folder for all emitted files. */
|
|
51
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
52
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
53
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
54
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
55
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
56
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
57
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
60
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
61
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
62
|
+
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
63
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
64
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
65
|
+
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
66
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
67
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
68
|
+
|
|
69
|
+
/* Interop Constraints */
|
|
70
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
71
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
72
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
|
73
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
74
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
75
|
+
|
|
76
|
+
/* Type Checking */
|
|
77
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
78
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
79
|
+
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
80
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
81
|
+
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
82
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
83
|
+
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
84
|
+
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
85
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
86
|
+
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
87
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
88
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
89
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
90
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
91
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
92
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
93
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
94
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
95
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
96
|
+
|
|
97
|
+
/* Completeness */
|
|
98
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
+
},
|
|
101
|
+
"include": [
|
|
102
|
+
"./src/**/*.ts"
|
|
103
|
+
]
|
|
104
|
+
}
|