@graf-research/adf-codegen-model-typeorm 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/exec.js +1 -13
- package/package.json +2 -2
package/dist/exec.js
CHANGED
@@ -15,7 +15,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
17
17
|
const adf_core_1 = require("@graf-research/adf-core");
|
18
|
-
const axios_1 = __importDefault(require("axios"));
|
19
18
|
const _1 = require(".");
|
20
19
|
const url_regex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
|
21
20
|
if (!process.argv[2]) {
|
@@ -27,18 +26,7 @@ if (!process.argv[3]) {
|
|
27
26
|
exec(process.argv[2], process.argv[3]);
|
28
27
|
function exec(input_file_or_url, out_folder) {
|
29
28
|
return __awaiter(this, void 0, void 0, function* () {
|
30
|
-
|
31
|
-
if (url_regex.test(input_file_or_url)) {
|
32
|
-
console.log(`downloading file '${input_file_or_url}'...`);
|
33
|
-
const response = yield axios_1.default.get(input_file_or_url, { responseType: 'text' });
|
34
|
-
code = response.data;
|
35
|
-
console.log(`download complete.`);
|
36
|
-
}
|
37
|
-
else {
|
38
|
-
const readFromFile = (f) => new Promise((resolve, reject) => fs_1.default.readFile(f, 'utf-8', (err, data) => err ? reject(err) : resolve(data)));
|
39
|
-
code = yield readFromFile(input_file_or_url);
|
40
|
-
}
|
41
|
-
const result = (0, adf_core_1.parse)(code);
|
29
|
+
const result = yield (0, adf_core_1.parse)(input_file_or_url);
|
42
30
|
const typeorm_model = _1.TypeORMModel.compile([...result.list_table, ...result.list_enum]);
|
43
31
|
for (const f of typeorm_model.enum.files) {
|
44
32
|
writeFiles(f, out_folder);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graf-research/adf-codegen-model-typeorm",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.4",
|
4
4
|
"main": "dist/index.js",
|
5
5
|
"scripts": {
|
6
6
|
"build": "rm -rf dist && tsc",
|
@@ -26,7 +26,7 @@
|
|
26
26
|
"typescript": "^5.6.3"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@graf-research/adf-core": "^0.0.
|
29
|
+
"@graf-research/adf-core": "^0.0.6",
|
30
30
|
"axios": "^1.7.7",
|
31
31
|
"lodash": "^4.17.21"
|
32
32
|
}
|