mobiletto-orm-typedef-gen 2.2.6 → 2.2.8
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 +3 -1
- package/lib/esm/generate.js +3 -1
- package/package.json +2 -2
package/lib/cjs/generate.js
CHANGED
|
@@ -106,6 +106,8 @@ const defaultPrepareContext = (typeDef, ctx) => {
|
|
|
106
106
|
ctx.curlyClose = "}";
|
|
107
107
|
return ctx;
|
|
108
108
|
};
|
|
109
|
+
const VALID_TEMPLATE_FILE_EXT = [".ts.hbs", ".vue.hbs"];
|
|
110
|
+
const validTemplateFile = (path) => !!VALID_TEMPLATE_FILE_EXT.find((ext) => path.endsWith(ext));
|
|
109
111
|
export const generate = (typeDef, templatePath, opts) => {
|
|
110
112
|
if (!(typeDef instanceof MobilettoOrmTypeDef)) {
|
|
111
113
|
typeDef = new MobilettoOrmTypeDef(typeDef);
|
|
@@ -148,7 +150,7 @@ export const generate = (typeDef, templatePath, opts) => {
|
|
|
148
150
|
if (endPath !== templatePath) {
|
|
149
151
|
throw new MobilettoOrmError(`invalid template path: ${templatePath}`);
|
|
150
152
|
}
|
|
151
|
-
if (!templatePath
|
|
153
|
+
if (!validTemplateFile(templatePath)) {
|
|
152
154
|
throw new MobilettoOrmError(`invalid template path: ${templatePath}`);
|
|
153
155
|
}
|
|
154
156
|
const localTemplate = __dirname + "/" + templatePath;
|
package/lib/esm/generate.js
CHANGED
|
@@ -106,6 +106,8 @@ const defaultPrepareContext = (typeDef, ctx) => {
|
|
|
106
106
|
ctx.curlyClose = "}";
|
|
107
107
|
return ctx;
|
|
108
108
|
};
|
|
109
|
+
const VALID_TEMPLATE_FILE_EXT = [".ts.hbs", ".vue.hbs"];
|
|
110
|
+
const validTemplateFile = (path) => !!VALID_TEMPLATE_FILE_EXT.find((ext) => path.endsWith(ext));
|
|
109
111
|
export const generate = (typeDef, templatePath, opts) => {
|
|
110
112
|
if (!(typeDef instanceof MobilettoOrmTypeDef)) {
|
|
111
113
|
typeDef = new MobilettoOrmTypeDef(typeDef);
|
|
@@ -148,7 +150,7 @@ export const generate = (typeDef, templatePath, opts) => {
|
|
|
148
150
|
if (endPath !== templatePath) {
|
|
149
151
|
throw new MobilettoOrmError(`invalid template path: ${templatePath}`);
|
|
150
152
|
}
|
|
151
|
-
if (!templatePath
|
|
153
|
+
if (!validTemplateFile(templatePath)) {
|
|
152
154
|
throw new MobilettoOrmError(`invalid template path: ${templatePath}`);
|
|
153
155
|
}
|
|
154
156
|
const localTemplate = __dirname + "/" + templatePath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobiletto-orm-typedef-gen",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "generate various files based on mobiletto-orm-typedef definitions",
|
|
6
6
|
"keywords": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"eslint": "^8.44.0",
|
|
53
53
|
"eslint-config-prettier": "^8.8.0",
|
|
54
54
|
"handlebars": "^4.7.7",
|
|
55
|
-
"mobiletto-orm-typedef": "^2.3.
|
|
55
|
+
"mobiletto-orm-typedef": "^2.3.7",
|
|
56
56
|
"mocha": "^10.2.0",
|
|
57
57
|
"prettier": "^3.0.0",
|
|
58
58
|
"tslint-config-prettier": "^1.18.0",
|