Comparing version 2.3.2 to 2.3.3
@@ -10,10 +10,11 @@ #!/usr/bin/env node | ||
var glob_1 = __importDefault(require("glob")); | ||
var http_1 = __importDefault(require("http")); | ||
var os_1 = __importDefault(require("os")); | ||
var path_1 = __importDefault(require("path")); | ||
var plantuml_encoder_1 = require("plantuml-encoder"); | ||
var typescript_1 = __importDefault(require("typescript")); | ||
var convertToPlant_1 = require("./convertToPlant"); | ||
var generateDocumentation_1 = require("./generateDocumentation"); | ||
var tplant_1 = require("./tplant"); | ||
var AVAILABLE_PLANTUML_EXTENSIONS = ['svg', 'png', 'txt']; | ||
commander_1.default | ||
.version('2.1.3') | ||
.usage('[options]') | ||
.version('2.3.3') | ||
.option('-i, --input <path>', 'Define the path of the Typescript file') | ||
@@ -33,7 +34,6 @@ .option('-o, --output <path>', 'Define the path of the output file. If not defined, it\'ll output on the STDOUT') | ||
if (err !== null) { | ||
console.error(err); | ||
return; | ||
throw err; | ||
} | ||
var tsConfigFile = findTsConfigFile(commander_1.default.input, commander_1.default.tsconfig); | ||
var output = convertToPlant_1.convertToPlant(generateDocumentation_1.generateDocumentation(matches, getCompilerOptions(tsConfigFile)), { | ||
var plantUMLDocument = tplant_1.tplant.convertToPlant(tplant_1.tplant.generateDocumentation(matches, getCompilerOptions(tsConfigFile)), { | ||
compositions: commander_1.default.compositions, | ||
@@ -43,12 +43,12 @@ onlyInterfaces: commander_1.default.onlyInterfaces | ||
if (commander_1.default.output === undefined) { | ||
console.log(output); | ||
console.log(plantUMLDocument); | ||
return; | ||
} | ||
fs_1.default.writeFile(commander_1.default.output, output, function (errNoException) { | ||
if (errNoException !== null) { | ||
console.error(errNoException); | ||
return; | ||
} | ||
console.log('The file was saved!'); | ||
}); | ||
var extension = path_1.default.extname(commander_1.default.output) | ||
.replace(/^\./gm, ''); | ||
if (AVAILABLE_PLANTUML_EXTENSIONS.includes(extension)) { | ||
requestImageFile(commander_1.default.output, plantUMLDocument, extension); | ||
return; | ||
} | ||
fs_1.default.writeFileSync(commander_1.default.output, plantUMLDocument, 'utf-8'); | ||
}); | ||
@@ -76,2 +76,3 @@ function findTsConfigFile(inputPath, tsConfigPath) { | ||
} | ||
return; | ||
} | ||
@@ -100,1 +101,14 @@ function getCompilerOptions(tsConfigFilePath) { | ||
} | ||
function requestImageFile(output, input, extension) { | ||
http_1.default.get({ | ||
host: 'www.plantuml.com', | ||
path: "/plantuml/" + extension + "/" + plantuml_encoder_1.encode(input) | ||
}, function (res) { | ||
var fileStream = fs_1.default.createWriteStream(output); | ||
res.setEncoding('utf-8'); | ||
res.pipe(fileStream); | ||
res.on('error', function (err) { | ||
throw err; | ||
}); | ||
}); | ||
} |
{ | ||
"name": "tplant", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "Typescript to PlantUML", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
89130
57
1178
2