mobiletto-orm-typedef-gen 2.1.30 → 2.1.32
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/lib/cjs/generate.js +13 -1
- package/lib/cjs/package.json +3 -3
- package/lib/esm/generate.js +13 -1
- package/package.json +2 -2
package/lib/cjs/generate.js
CHANGED
|
@@ -146,7 +146,19 @@ export const generate = (typeDef, templatePath, opts) => {
|
|
|
146
146
|
if (!templatePath.endsWith(".ts.hbs")) {
|
|
147
147
|
throw new MobilettoOrmError(`invalid template path: ${templatePath}`);
|
|
148
148
|
}
|
|
149
|
-
const
|
|
149
|
+
const localTemplate = __dirname + "/" + templatePath;
|
|
150
|
+
let template;
|
|
151
|
+
try {
|
|
152
|
+
template = fs.readFileSync(localTemplate).toString("utf8");
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
try {
|
|
156
|
+
template = fs.readFileSync(templatePath).toString("utf8");
|
|
157
|
+
}
|
|
158
|
+
catch (e2) {
|
|
159
|
+
throw new MobilettoOrmError(`template path not found: ${templatePath}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
150
162
|
const data = Handlebars.compile(template)(preparedContext);
|
|
151
163
|
allData = data + allData;
|
|
152
164
|
}
|
package/lib/cjs/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "mobiletto-orm-typedef",
|
|
2
|
+
"name": "mobiletto-orm-typedef-gen",
|
|
3
3
|
"type": "commonjs",
|
|
4
4
|
"main": "./index.js",
|
|
5
|
-
"homepage": "https://github.com/cobbzilla/mobiletto-orm-typedef",
|
|
5
|
+
"homepage": "https://github.com/cobbzilla/mobiletto-orm-typedef-gen",
|
|
6
6
|
"author": "Jonathan Cobb <udo9jqld@duck.com> (https://github.com/cobbzilla)",
|
|
7
7
|
"funding": {
|
|
8
8
|
"type": "patreon",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/cobbzilla/mobiletto-orm-typedef.git"
|
|
13
|
+
"url": "https://github.com/cobbzilla/mobiletto-orm-typedef-gen.git"
|
|
14
14
|
},
|
|
15
15
|
"license": "Apache-2.0"
|
|
16
16
|
}
|
package/lib/esm/generate.js
CHANGED
|
@@ -146,7 +146,19 @@ export const generate = (typeDef, templatePath, opts) => {
|
|
|
146
146
|
if (!templatePath.endsWith(".ts.hbs")) {
|
|
147
147
|
throw new MobilettoOrmError(`invalid template path: ${templatePath}`);
|
|
148
148
|
}
|
|
149
|
-
const
|
|
149
|
+
const localTemplate = __dirname + "/" + templatePath;
|
|
150
|
+
let template;
|
|
151
|
+
try {
|
|
152
|
+
template = fs.readFileSync(localTemplate).toString("utf8");
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
try {
|
|
156
|
+
template = fs.readFileSync(templatePath).toString("utf8");
|
|
157
|
+
}
|
|
158
|
+
catch (e2) {
|
|
159
|
+
throw new MobilettoOrmError(`template path not found: ${templatePath}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
150
162
|
const data = Handlebars.compile(template)(preparedContext);
|
|
151
163
|
allData = data + allData;
|
|
152
164
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobiletto-orm-typedef-gen",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./lib/esm/index.js",
|
|
6
6
|
"description": "generate various files based on mobiletto-orm-typedef definitions",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"copyfiles": "^2.4.1",
|
|
50
50
|
"eslint": "^8.44.0",
|
|
51
51
|
"eslint-config-prettier": "^8.8.0",
|
|
52
|
-
"mobiletto-orm-typedef": "^2.1.
|
|
52
|
+
"mobiletto-orm-typedef": "^2.1.34",
|
|
53
53
|
"mocha": "^10.2.0",
|
|
54
54
|
"prettier": "^3.0.0",
|
|
55
55
|
"tslint-config-prettier": "^1.18.0",
|