@frui.ts/generator
Advanced tools
Comparing version 0.15.0-beta.2 to 0.15.0-beta.3
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -41,9 +60,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -50,0 +62,0 @@ var path_1 = __importDefault(require("path")); |
#!/usr/bin/env node | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -42,9 +61,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -51,0 +63,0 @@ var commander_1 = require("commander"); |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_1 = require("lodash"); | ||
var uniqBy_1 = __importDefault(require("lodash/uniqBy")); | ||
var ts_morph_1 = require("ts-morph"); | ||
@@ -27,3 +30,3 @@ var ExportsAnalyzer = (function () { | ||
}); | ||
return lodash_1.uniqBy(registrations, function (x) { return x.declaration; }); | ||
return uniqBy_1.default(registrations, function (x) { return x.declaration; }); | ||
}; | ||
@@ -30,0 +33,0 @@ return ExportsAnalyzer; |
@@ -26,2 +26,21 @@ "use strict"; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -66,9 +85,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -75,0 +87,0 @@ var generatorBase_1 = __importDefault(require("../generatorBase")); |
@@ -14,2 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.unwrapType = exports.getImportDeclaration = exports.importType = exports.toSingleArray = void 0; | ||
function toSingleArray(item) { | ||
@@ -16,0 +17,0 @@ return item ? [item] : undefined; |
@@ -15,2 +15,21 @@ "use strict"; | ||
})(); | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -55,9 +74,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -64,0 +76,0 @@ var generatorBase_1 = __importDefault(require("../generatorBase")); |
@@ -23,3 +23,3 @@ "use strict"; | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -26,0 +26,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isSchemaObject = exports.isArraySchemaObject = exports.isReferenceObject = exports.isOpenAPIv3 = exports.isOpenAPIv2 = void 0; | ||
function isOpenAPIv2(api) { | ||
@@ -4,0 +5,0 @@ return api.swagger === "2.0"; |
@@ -37,4 +37,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_1 = require("lodash"); | ||
var util_1 = require("util"); | ||
var helpers_1 = require("../../helpers"); | ||
var apiModel_1 = __importDefault(require("../models/apiModel")); | ||
@@ -86,3 +86,4 @@ var entityProperty_1 = __importDefault(require("../models/entityProperty")); | ||
}; | ||
OpenApi2Parser.prototype.parseEntity = function (name, definition) { | ||
OpenApi2Parser.prototype.parseEntity = function (rawName, definition) { | ||
var name = helpers_1.pascalCase(rawName); | ||
if (definition.enum) { | ||
@@ -113,3 +114,3 @@ new enum_1.default(name, definition.enum); | ||
if (type.enumValues) { | ||
type.name = entityName + lodash_1.upperFirst(name); | ||
type.name = entityName + helpers_1.pascalCase(name); | ||
} | ||
@@ -116,0 +117,0 @@ var property = new entityProperty_1.default(name, type); |
@@ -37,3 +37,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_1 = require("lodash"); | ||
var helpers_1 = require("../../helpers"); | ||
var apiModel_1 = __importDefault(require("../models/apiModel")); | ||
@@ -45,3 +45,3 @@ var entityProperty_1 = __importDefault(require("../models/entityProperty")); | ||
var typeEntity_1 = __importDefault(require("../models/typeEntity")); | ||
var helpers_1 = require("./helpers"); | ||
var helpers_2 = require("./helpers"); | ||
var OpenApi3Parser = (function () { | ||
@@ -59,3 +59,3 @@ function OpenApi3Parser() { | ||
var _e = __read(_d.value, 2), name_1 = _e[0], definition = _e[1]; | ||
if (helpers_1.isReferenceObject(definition)) { | ||
if (helpers_2.isReferenceObject(definition)) { | ||
continue; | ||
@@ -92,3 +92,4 @@ } | ||
}; | ||
OpenApi3Parser.prototype.parseEntity = function (name, definition) { | ||
OpenApi3Parser.prototype.parseEntity = function (rawName, definition) { | ||
var name = helpers_1.pascalCase(rawName); | ||
if (definition.enum) { | ||
@@ -119,6 +120,6 @@ new enum_1.default(name, definition.enum); | ||
if (type.enumValues) { | ||
type.name = entityName + lodash_1.upperFirst(name); | ||
type.name = entityName + helpers_1.pascalCase(name); | ||
} | ||
var property = new entityProperty_1.default(name, type); | ||
if (helpers_1.isSchemaObject(definition)) { | ||
if (helpers_2.isSchemaObject(definition)) { | ||
property.description = definition.description; | ||
@@ -140,3 +141,3 @@ property.example = definition.example; | ||
var _this = this; | ||
if (helpers_1.isReferenceObject(definition)) { | ||
if (helpers_2.isReferenceObject(definition)) { | ||
return { | ||
@@ -148,3 +149,3 @@ name: getReferencedEntityName(definition.$ref), | ||
var typeName = definition.type; | ||
if (helpers_1.isArraySchemaObject(definition)) { | ||
if (helpers_2.isArraySchemaObject(definition)) { | ||
var type = this.parseType(definition.items); | ||
@@ -151,0 +152,0 @@ type.isArray = true; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_1 = require("lodash"); | ||
var camelCase_1 = __importDefault(require("lodash/camelCase")); | ||
var generatorBase_1 = __importDefault(require("../../generatorBase")); | ||
@@ -15,3 +15,3 @@ var messages_json_1 = require("../../messages.json"); | ||
EnumWriter.prototype.write = function (definition) { | ||
var fileName = lodash_1.camelCase(definition.name) + ".ts"; | ||
var fileName = camelCase_1.default(definition.name) + ".ts"; | ||
if (!generatorBase_1.default.canOverwiteFile(this.parentDirectory, fileName)) { | ||
@@ -34,2 +34,3 @@ return undefined; | ||
_this.writeTypeAlias(writer, definition); | ||
writer.newLineIfLastNot(); | ||
writer.writeLine("export default " + definition.name + ";"); | ||
@@ -40,3 +41,3 @@ }, { overwrite: true }); | ||
var items = definition.items.map(function (x) { return "\"" + x + "\""; }).join(" | "); | ||
writer.writeLine("type " + definition.name + " = " + items + ";"); | ||
writer.write("type " + definition.name + " = " + items + ";"); | ||
}; | ||
@@ -43,0 +44,0 @@ return EnumWriter; |
@@ -26,3 +26,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_1 = require("lodash"); | ||
var camelCase_1 = __importDefault(require("lodash/camelCase")); | ||
var uniq_1 = __importDefault(require("lodash/uniq")); | ||
var generatorBase_1 = __importDefault(require("../../generatorBase")); | ||
@@ -37,3 +38,3 @@ var messages_json_1 = require("../../messages.json"); | ||
ObjectEntityWriter.prototype.write = function (definition) { | ||
var fileName = lodash_1.camelCase(definition.name) + ".ts"; | ||
var fileName = camelCase_1.default(definition.name) + ".ts"; | ||
if (!generatorBase_1.default.canOverwiteFile(this.parentDirectory, fileName)) { | ||
@@ -65,5 +66,5 @@ return undefined; | ||
if (requiredImports.length) { | ||
lodash_1.uniq(requiredImports) | ||
uniq_1.default(requiredImports) | ||
.sort() | ||
.forEach(function (x) { return writer.writeLine("import " + x + " from \"./" + lodash_1.camelCase(x) + "\";"); }); | ||
.forEach(function (x) { return writer.writeLine("import " + x + " from \"./" + camelCase_1.default(x) + "\";"); }); | ||
writer.blankLine(); | ||
@@ -152,3 +153,3 @@ } | ||
function writeConversionFunction(writer, entity) { | ||
var identifier = lodash_1.camelCase(entity.name); | ||
var identifier = camelCase_1.default(entity.name); | ||
var statements = entity.properties.map(function (x) { return getConversionStatement(identifier, x); }).filter(function (x) { return x; }); | ||
@@ -155,0 +156,0 @@ if (statements.length) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_1 = require("lodash"); | ||
var camelCase_1 = __importDefault(require("lodash/camelCase")); | ||
var generatorBase_1 = __importDefault(require("../../generatorBase")); | ||
@@ -15,3 +15,3 @@ var messages_json_1 = require("../../messages.json"); | ||
TypeEntityWriter.prototype.write = function (definition) { | ||
var fileName = lodash_1.camelCase(definition.name) + ".ts"; | ||
var fileName = camelCase_1.default(definition.name) + ".ts"; | ||
if (!generatorBase_1.default.canOverwiteFile(this.parentDirectory, fileName)) { | ||
@@ -34,3 +34,3 @@ return undefined; | ||
if (requiredImport) { | ||
writer.writeLine("import " + requiredImport + " from \"./" + lodash_1.camelCase(requiredImport) + "\";"); | ||
writer.writeLine("import " + requiredImport + " from \"./" + camelCase_1.default(requiredImport) + "\";"); | ||
writer.blankLine(); | ||
@@ -40,2 +40,3 @@ } | ||
_this.writeTypeAlias(writer, definition); | ||
writer.newLineIfLastNot(); | ||
writer.writeLine("export default " + definition.name + ";"); | ||
@@ -45,3 +46,3 @@ }, { overwrite: true }); | ||
TypeEntityWriter.prototype.writeTypeAlias = function (writer, definition) { | ||
writer.writeLine("type " + definition.name + " = " + definition.type.name + (definition.type.isArray ? "[]" : "") + ";"); | ||
writer.write("type " + definition.name + " = " + definition.type.name + (definition.type.isArray ? "[]" : "") + ";"); | ||
}; | ||
@@ -48,0 +49,0 @@ return TypeEntityWriter; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createProgressBar = exports.getProgressOptions = void 0; | ||
var cli_progress_1 = require("cli-progress"); | ||
@@ -4,0 +5,0 @@ function getProgressOptions(name, fixedLength) { |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.15.0-beta.2", | ||
"version": "0.15.0-beta.3", | ||
"description": "Frui.ts code generator", | ||
@@ -37,18 +37,17 @@ "keywords": [ | ||
"build": "tsc", | ||
"postbuild": "cpr dist/src dist -o && rimraf dist/src && rimraf dist/package.json" | ||
"postbuild": "ncp dist/src dist -o && rimraf dist/src && rimraf dist/package.json" | ||
}, | ||
"dependencies": { | ||
"@apidevtools/swagger-parser": "^9.0.1", | ||
"cli-progress": "^3.7.0", | ||
"commander": "^5.0.0", | ||
"cli-progress": "^3.8.2", | ||
"commander": "^5.1.0", | ||
"lodash": "^4.17.15", | ||
"openapi-types": "^1.3.5", | ||
"ts-morph": "^7.0.2" | ||
"ts-morph": "^7.1.2" | ||
}, | ||
"devDependencies": { | ||
"@types/cli-progress": "^3.4.2", | ||
"@types/lodash": "^4.14.149", | ||
"@types/node": "^13.11.1", | ||
"cpr": "^3.0.1", | ||
"cpy-cli": "^3.1.0", | ||
"@types/cli-progress": "^3.7.0", | ||
"@types/lodash": "^4.14.155", | ||
"@types/node": "^14.0.13", | ||
"ncp": "^2.0.0", | ||
"nodemon": "^2.0.3", | ||
@@ -58,3 +57,3 @@ "rimraf": "^3.0.2", | ||
}, | ||
"gitHead": "a1950d8a2f4b4b2bfddbca22972c322b2586c33d" | ||
"gitHead": "a50c956e5476cce829dec2d2a976eeebb336ad1b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
208525
7
111
2311
Updatedcli-progress@^3.8.2
Updatedcommander@^5.1.0
Updatedts-morph@^7.1.2