@compodoc/ngd-transformer
Advanced tools
Comparing version
@@ -31,10 +31,10 @@ export interface IOptions { | ||
generateGraph(deps: any): Promise<any[]>; | ||
private cleanGeneratedFiles(); | ||
private preprocessTemplates(options?); | ||
private generateJSON(deps); | ||
private escape(deps); | ||
private generateDot(template, deps); | ||
private generateSVG(); | ||
private generateHTML(); | ||
private generatePNG(); | ||
private cleanGeneratedFiles; | ||
private preprocessTemplates; | ||
private generateJSON; | ||
private escape; | ||
private generateDot; | ||
private generateSVG; | ||
private generateHTML; | ||
private generatePNG; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DotEngine = void 0; | ||
var path = require("path"); | ||
@@ -7,3 +8,2 @@ var ngd_core_1 = require("@compodoc/ngd-core"); | ||
var fs = require('fs-extra'); | ||
var Viz = require('viz.js'); | ||
var cleanDot = false; | ||
@@ -19,3 +19,3 @@ var cleanSvg = false; | ||
this.files = { | ||
component: null | ||
component: null, | ||
}; | ||
@@ -27,3 +27,3 @@ this.paths = { | ||
svg: null, | ||
html: null | ||
html: null, | ||
}; | ||
@@ -42,4 +42,4 @@ this.options = {}; | ||
//http://www.graphviz.org/doc/info/colors.html | ||
colorScheme: 'set312' | ||
} | ||
colorScheme: 'set312', | ||
}, | ||
}; | ||
@@ -57,3 +57,3 @@ if (options.output) { | ||
png: path.join(this.options.output, '/dependencies.png'), | ||
html: path.join(this.options.output, '/dependencies.html') | ||
html: path.join(this.options.output, '/dependencies.html'), | ||
}; | ||
@@ -70,3 +70,3 @@ if (typeof options.silent !== 'undefined') { | ||
png: path.join(output, '/dependencies.png'), | ||
html: path.join(output, '/dependencies.html') | ||
html: path.join(output, '/dependencies.html'), | ||
}; | ||
@@ -79,3 +79,5 @@ }; | ||
// Handle svg dependency with dot, and html with svg | ||
if (this.options.outputFormats.indexOf('dot') > -1 && this.options.outputFormats.indexOf('svg') === -1 && this.options.outputFormats.indexOf('html') === -1) { | ||
if (this.options.outputFormats.indexOf('dot') > -1 && | ||
this.options.outputFormats.indexOf('svg') === -1 && | ||
this.options.outputFormats.indexOf('html') === -1) { | ||
generators.push(this.generateDot(template, deps)); | ||
@@ -93,3 +95,5 @@ } | ||
if (this.options.outputFormats.indexOf('html') > -1) { | ||
generators.push(this.generateDot(template, deps).then(function (_) { return _this.generateSVG(); }).then(function (_) { return _this.generateHTML(); })); | ||
generators.push(this.generateDot(template, deps) | ||
.then(function (_) { return _this.generateSVG(); }) | ||
.then(function (_) { return _this.generateHTML(); })); | ||
if (this.options.outputFormats.indexOf('html') > -1 && this.options.outputFormats.indexOf('svg') === -1) { | ||
@@ -104,6 +108,6 @@ cleanSvg = true; | ||
/* | ||
if (this.options.outputFormats.indexOf('png') > -1) { | ||
generators.push(this.generatePNG()); | ||
} | ||
*/ | ||
if (this.options.outputFormats.indexOf('png') > -1) { | ||
generators.push(this.generatePNG()); | ||
} | ||
*/ | ||
return Promise.all(generators).then(function (_) { return _this.cleanGeneratedFiles(); }); | ||
@@ -168,6 +172,6 @@ }; | ||
else if (typeof a === 'string') { | ||
a = a.replace(/"/g, '\"'); | ||
a = a.replace(/'/g, "\'"); | ||
a = a.replace(/\{/g, "\{"); | ||
a = a.replace(/\)/g, "\)"); | ||
a = a.replace(/"/g, '"'); | ||
a = a.replace(/'/g, "'"); | ||
a = a.replace(/\{/g, '{'); | ||
a = a.replace(/\)/g, ')'); | ||
} | ||
@@ -185,3 +189,3 @@ } | ||
fs.outputFile(_this.paths.dot, template({ | ||
modules: deps | ||
modules: deps, | ||
}), function (error) { | ||
@@ -200,6 +204,4 @@ if (error) { | ||
var _this = this; | ||
var vizSvg = Viz(fs.readFileSync(this.paths.dot).toString(), { | ||
format: 'svg', | ||
engine: 'dot' | ||
}, { totalMemory: 32 * 1024 * 1024 }); | ||
var vizRenderStringSync = require('@aduh95/viz.js/sync'); | ||
var vizSvg = vizRenderStringSync(fs.readFileSync(this.paths.dot).toString()); | ||
return new Promise(function (resolve, reject) { | ||
@@ -206,0 +208,0 @@ fs.outputFile(_this.paths.svg, vizSvg, function (error) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DOT_TEMPLATE = exports.LEGEND = void 0; | ||
exports.LEGEND = "<\n<table BORDER=\"0\">\n <tr>\n <td colspan=\"5\" align=\"center\"><b>Legend</b></td>\n </tr>\n <tr>\n <td>\n <table BORDER=\"0\">\n <tr>\n <td bgcolor=\"#ffffb3\" width=\"20\"></td>\n <td> Declarations</td>\n </tr>\n </table>\n </td>\n <td>\n <table BORDER=\"0\">\n <tr>\n <td bgcolor=\"#8dd3c7\" width=\"20\"></td>\n <td> Module</td>\n </tr>\n </table>\n </td>\n <td>\n <table BORDER=\"0\">\n <tr>\n <td bgcolor=\"#80b1d3\" width=\"20\"></td>\n <td> Bootstrap</td>\n </tr>\n </table>\n </td>\n <td>\n <table BORDER=\"0\">\n <tr>\n <td bgcolor=\"#fdb462\" width=\"20\"></td>\n <td> Providers</td>\n </tr>\n </table>\n </td>\n <td>\n <table BORDER=\"0\">\n <tr>\n <td bgcolor=\"#fb8072\" width=\"20\"></td>\n <td> Exports</td>\n </tr>\n </table>\n </td>\n </tr>\n</table>\n>"; | ||
@@ -4,0 +5,0 @@ var loopBlock = function (symbols, attrs, edge) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DotEngine = void 0; | ||
var dot_1 = require("./engines/dot/dot"); | ||
exports.DotEngine = dot_1.DotEngine; | ||
Object.defineProperty(exports, "DotEngine", { enumerable: true, get: function () { return dot_1.DotEngine; } }); |
{ | ||
"name": "@compodoc/ngd-transformer", | ||
"version": "2.0.0", | ||
"description": "A set of transformers for @compodoc/ngd", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"prextest": "npm run compile:src && npm run compile:tests", | ||
"xtest": "mocha --opts test/mocha.opts", | ||
"compile:tests": "tsc -p test/tsconfig-test.json", | ||
"compile:src": "tsc --newLine LF", | ||
"prexpublish": "npm run compile:src && npm run xtest", | ||
"deploy": "npm run compile:src && npm xpublish" | ||
}, | ||
"homepage": "https://github.com/compodoc/ngd", | ||
"bugs": "https://github.com/compodoc/ngd/issues", | ||
"author": "Wassim CHEGHAM", | ||
"engines": { | ||
"node": ">= 6.0.0" | ||
}, | ||
"contributors": [ | ||
"vogloblinsky" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/compodoc/ngd.git" | ||
}, | ||
"private": false, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@compodoc/ngd-core": "~2.0.0", | ||
"dot": "^1.1.1", | ||
"fs-extra": "^4.0.1", | ||
"viz.js": "^1.8.0" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.0.4", | ||
"@types/mocha": "^2.2.32", | ||
"@types/node": "^8.0.24", | ||
"chai": "^4.1.1", | ||
"mocha": "^3.1.2" | ||
}, | ||
"types": "dist/index.d.ts" | ||
"name": "@compodoc/ngd-transformer", | ||
"version": "2.1.0", | ||
"description": "A set of transformers for @compodoc/ngd", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"compile:src": "tsc --newLine LF", | ||
"prexpublish": "npm run compile:src", | ||
"deploy": "npm run compile:src && npm xpublish" | ||
}, | ||
"homepage": "https://github.com/compodoc/ngd", | ||
"bugs": "https://github.com/compodoc/ngd/issues", | ||
"author": "Wassim CHEGHAM", | ||
"engines": { | ||
"node": ">= 10.0.0" | ||
}, | ||
"contributors": [ | ||
"vogloblinsky" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/compodoc/ngd.git" | ||
}, | ||
"private": false, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@compodoc/ngd-core": "~2.1.0", | ||
"dot": "^1.1.3", | ||
"fs-extra": "^9.0.1", | ||
"@aduh95/viz.js": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.11.8" | ||
}, | ||
"types": "dist/index.d.ts" | ||
} |
@@ -6,17 +6,17 @@ import * as path from 'path'; | ||
export interface IOptions { | ||
name?: string; | ||
output?: string; | ||
displayLegend?: boolean; | ||
outputFormats?: string; | ||
name?: string; | ||
output?: string; | ||
displayLegend?: boolean; | ||
outputFormats?: string; | ||
silent?: boolean; | ||
dot?: { | ||
shapeModules: string | ||
shapeProviders: string | ||
shapeDirectives: string | ||
colorScheme: string | ||
}; | ||
dot?: { | ||
shapeModules: string; | ||
shapeProviders: string; | ||
shapeDirectives: string; | ||
colorScheme: string; | ||
}; | ||
} | ||
let fs = require('fs-extra'); | ||
let Viz = require('viz.js'); | ||
let cleanDot: boolean = false; | ||
@@ -29,106 +29,109 @@ let cleanSvg: boolean = false; | ||
export class DotEngine { | ||
// http://www.graphviz.org/doc/info/shapes.html | ||
template = DOT_TEMPLATE; | ||
// http://www.graphviz.org/doc/info/shapes.html | ||
template = DOT_TEMPLATE; | ||
cwd = process.cwd(); | ||
cwd = process.cwd(); | ||
files = { | ||
component: null, | ||
}; | ||
files = { | ||
component: null | ||
}; | ||
paths = { | ||
dot: null, | ||
json: null, | ||
png: null, | ||
svg: null, | ||
html: null, | ||
}; | ||
paths = { | ||
dot: null, | ||
json: null, | ||
png: null, | ||
svg: null, | ||
html: null | ||
}; | ||
options: IOptions = {}; | ||
options: IOptions = {}; | ||
constructor(options: IOptions) { | ||
let baseDir = `./${appName}/`; | ||
constructor(options: IOptions) { | ||
this.options = { | ||
name: `${appName}`, | ||
output: options.output, | ||
displayLegend: options.displayLegend, | ||
outputFormats: options.outputFormats, | ||
dot: { | ||
shapeModules: 'component', | ||
shapeProviders: 'ellipse', | ||
shapeDirectives: 'cds', | ||
let baseDir = `./${appName}/`; | ||
//http://www.graphviz.org/doc/info/colors.html | ||
colorScheme: 'set312', | ||
}, | ||
}; | ||
this.options = { | ||
name: `${appName}`, | ||
output: options.output, | ||
displayLegend: options.displayLegend, | ||
outputFormats: options.outputFormats, | ||
dot: { | ||
shapeModules: 'component', | ||
shapeProviders: 'ellipse', | ||
shapeDirectives: 'cds', | ||
if (options.output) { | ||
if (typeof this.options.output !== 'string') { | ||
logger.fatal('Option "output" has been provided but it is not a valid name.'); | ||
process.exit(1); | ||
} | ||
} | ||
//http://www.graphviz.org/doc/info/colors.html | ||
colorScheme: 'set312' | ||
} | ||
}; | ||
this.paths = { | ||
dot: path.join(this.options.output, '/dependencies.dot'), | ||
json: path.join(this.options.output, '/dependencies.json'), | ||
svg: path.join(this.options.output, '/dependencies.svg'), | ||
png: path.join(this.options.output, '/dependencies.png'), | ||
html: path.join(this.options.output, '/dependencies.html'), | ||
}; | ||
if (options.output) { | ||
if (typeof this.options.output !== 'string') { | ||
logger.fatal('Option "output" has been provided but it is not a valid name.'); | ||
process.exit(1); | ||
} | ||
if (typeof options.silent !== 'undefined') { | ||
logger.silent = options.silent; | ||
} | ||
} | ||
this.paths = { | ||
dot: path.join(this.options.output, '/dependencies.dot'), | ||
json: path.join(this.options.output, '/dependencies.json'), | ||
svg: path.join(this.options.output, '/dependencies.svg'), | ||
png: path.join(this.options.output, '/dependencies.png'), | ||
html: path.join(this.options.output, '/dependencies.html') | ||
}; | ||
if (typeof options.silent !== 'undefined') { | ||
logger.silent = options.silent; | ||
updateOutput(output: string) { | ||
this.paths = { | ||
dot: path.join(output, '/dependencies.dot'), | ||
json: path.join(output, '/dependencies.json'), | ||
svg: path.join(output, '/dependencies.svg'), | ||
png: path.join(output, '/dependencies.png'), | ||
html: path.join(output, '/dependencies.html'), | ||
}; | ||
} | ||
} | ||
updateOutput(output: string) { | ||
this.paths = { | ||
dot: path.join(output, '/dependencies.dot'), | ||
json: path.join(output, '/dependencies.json'), | ||
svg: path.join(output, '/dependencies.svg'), | ||
png: path.join(output, '/dependencies.png'), | ||
html: path.join(output, '/dependencies.html') | ||
}; | ||
} | ||
generateGraph(deps) { | ||
let template = this.preprocessTemplates(this.options); | ||
let generators = []; | ||
generateGraph(deps) { | ||
let template = this.preprocessTemplates(this.options); | ||
let generators = []; | ||
// Handle svg dependency with dot, and html with svg | ||
if ( | ||
this.options.outputFormats.indexOf('dot') > -1 && | ||
this.options.outputFormats.indexOf('svg') === -1 && | ||
this.options.outputFormats.indexOf('html') === -1 | ||
) { | ||
generators.push(this.generateDot(template, deps)); | ||
} | ||
// Handle svg dependency with dot, and html with svg | ||
if (this.options.outputFormats.indexOf('dot') > -1 && this.options.outputFormats.indexOf('svg') === -1 && this.options.outputFormats.indexOf('html') === -1) { | ||
generators.push(this.generateDot(template, deps)); | ||
} | ||
if (this.options.outputFormats.indexOf('svg') > -1 && this.options.outputFormats.indexOf('html') === -1) { | ||
generators.push(this.generateDot(template, deps).then((_) => this.generateSVG())); | ||
if (this.options.outputFormats.indexOf('svg') > -1 && this.options.outputFormats.indexOf('dot') === -1) { | ||
cleanDot = true; | ||
} | ||
} | ||
if (this.options.outputFormats.indexOf('svg') > -1 && this.options.outputFormats.indexOf('html') === -1) { | ||
generators.push(this.generateDot(template, deps).then(_ => this.generateSVG())); | ||
if (this.options.outputFormats.indexOf('svg') > -1 && this.options.outputFormats.indexOf('dot') === -1) { | ||
cleanDot = true; | ||
} | ||
} | ||
if (this.options.outputFormats.indexOf('json') > -1) { | ||
generators.push(this.generateJSON(deps)); | ||
} | ||
if (this.options.outputFormats.indexOf('json') > -1) { | ||
generators.push(this.generateJSON(deps)); | ||
} | ||
if (this.options.outputFormats.indexOf('html') > -1) { | ||
generators.push( | ||
this.generateDot(template, deps) | ||
.then((_) => this.generateSVG()) | ||
.then((_) => this.generateHTML()) | ||
); | ||
if (this.options.outputFormats.indexOf('html') > -1 && this.options.outputFormats.indexOf('svg') === -1) { | ||
cleanSvg = true; | ||
} | ||
if (this.options.outputFormats.indexOf('html') > -1 && this.options.outputFormats.indexOf('dot') === -1) { | ||
cleanDot = true; | ||
} | ||
} | ||
if (this.options.outputFormats.indexOf('html') > -1) { | ||
generators.push(this.generateDot(template, deps).then(_ => this.generateSVG()).then(_ => this.generateHTML())); | ||
if (this.options.outputFormats.indexOf('html') > -1 && this.options.outputFormats.indexOf('svg') === -1) { | ||
cleanSvg = true; | ||
} | ||
if (this.options.outputFormats.indexOf('html') > -1 && this.options.outputFormats.indexOf('dot') === -1) { | ||
cleanDot = true; | ||
} | ||
} | ||
// todo(WCH): disable PNG creation due to some errors with phantomjs | ||
/* | ||
// todo(WCH): disable PNG creation due to some errors with phantomjs | ||
/* | ||
if (this.options.outputFormats.indexOf('png') > -1) { | ||
@@ -139,133 +142,119 @@ generators.push(this.generatePNG()); | ||
return Promise.all(generators).then(_ => this.cleanGeneratedFiles()); | ||
} | ||
return Promise.all(generators).then((_) => this.cleanGeneratedFiles()); | ||
} | ||
private cleanGeneratedFiles() { | ||
let removeFile = (path) => { | ||
return new Promise((resolve, reject) => { | ||
fs.unlink(path, (error) => { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(); | ||
} | ||
private cleanGeneratedFiles() { | ||
let removeFile = (path) => { | ||
return new Promise((resolve, reject) => { | ||
fs.unlink(path, (error) => { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
}); | ||
}; | ||
let cleaners = []; | ||
if (cleanDot) { | ||
cleaners.push(removeFile(this.paths.dot)); | ||
}; | ||
let cleaners = []; | ||
if (cleanDot) { | ||
cleaners.push(removeFile(this.paths.dot)); | ||
} | ||
if (cleanSvg) { | ||
cleaners.push(removeFile(this.paths.svg)); | ||
} | ||
return Promise.all(cleaners); | ||
} | ||
if (cleanSvg) { | ||
cleaners.push(removeFile(this.paths.svg)); | ||
private preprocessTemplates(options?) { | ||
let doT = require('dot'); | ||
let result; | ||
if (options.displayLegend === 'true' || options.displayLegend === true) { | ||
result = this.template.replace(/###legend###/g, LEGEND); | ||
} else { | ||
result = this.template.replace(/###legend###/g, '""'); | ||
} | ||
return doT.template(result.replace(/###scheme###/g, options.dot.colorScheme)); | ||
} | ||
return Promise.all(cleaners); | ||
} | ||
private preprocessTemplates(options?) { | ||
let doT = require('dot'); | ||
let result; | ||
if (options.displayLegend === 'true' || options.displayLegend === true) { | ||
result = this.template.replace(/###legend###/g, LEGEND); | ||
} else { | ||
result = this.template.replace(/###legend###/g, '""'); | ||
private generateJSON(deps) { | ||
return new Promise((resolve, reject) => { | ||
fs.outputFile(this.paths.json, JSON.stringify(deps, null, 2), (error) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
logger.info('creating JSON', this.paths.json); | ||
resolve(this.paths.json); | ||
}); | ||
}); | ||
} | ||
return doT.template(result.replace(/###scheme###/g, options.dot.colorScheme)); | ||
} | ||
private generateJSON(deps) { | ||
return new Promise((resolve, reject) => { | ||
fs.outputFile( | ||
this.paths.json, | ||
JSON.stringify(deps, null, 2), | ||
(error) => { | ||
if (error) { | ||
reject(error); | ||
// @not-used | ||
private escape(deps) { | ||
return deps.map((d) => { | ||
for (let prop in d) { | ||
if (d.hasOwnProperty(prop)) { | ||
let a = d[prop]; | ||
console.log(a); | ||
if (Array.isArray(a)) { | ||
return this.escape(a); | ||
} else if (typeof a === 'string') { | ||
a = a.replace(/"/g, '"'); | ||
a = a.replace(/'/g, "'"); | ||
a = a.replace(/\{/g, '{'); | ||
a = a.replace(/\)/g, ')'); | ||
} | ||
} | ||
} | ||
logger.info('creating JSON', this.paths.json); | ||
resolve(this.paths.json); | ||
} | ||
); | ||
}); | ||
} | ||
// @not-used | ||
private escape(deps) { | ||
return deps.map(d => { | ||
for (let prop in d) { | ||
if (d.hasOwnProperty(prop)) { | ||
let a = d[prop]; | ||
console.log(a); | ||
return d; | ||
}); | ||
} | ||
if (Array.isArray(a)) { | ||
return this.escape(a); | ||
} | ||
else if (typeof a === 'string') { | ||
a = a.replace(/"/g, '\"'); | ||
a = a.replace(/'/g, "\'"); | ||
a = a.replace(/\{/g, "\{"); | ||
a = a.replace(/\)/g, "\)"); | ||
} | ||
} | ||
} | ||
private generateDot(template, deps) { | ||
// todo(wch) | ||
//deps = this.escape(deps); | ||
return d; | ||
}); | ||
} | ||
return new Promise((resolve, reject) => { | ||
fs.outputFile( | ||
this.paths.dot, | ||
template({ | ||
modules: deps, | ||
}), | ||
(error) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
private generateDot(template, deps) { | ||
if (cleanDot === false) { | ||
logger.info('creating DOT', this.paths.dot); | ||
} | ||
// todo(wch) | ||
//deps = this.escape(deps); | ||
resolve(this.paths.dot); | ||
} | ||
); | ||
}); | ||
} | ||
return new Promise((resolve, reject) => { | ||
fs.outputFile( | ||
this.paths.dot, | ||
template({ | ||
modules: deps | ||
}), | ||
(error) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
private generateSVG() { | ||
const vizRenderStringSync = require('@aduh95/viz.js/sync'); | ||
let vizSvg = vizRenderStringSync(fs.readFileSync(this.paths.dot).toString()); | ||
return new Promise((resolve, reject) => { | ||
fs.outputFile(this.paths.svg, vizSvg, (error) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
if (cleanDot === false) { | ||
logger.info('creating DOT', this.paths.dot); | ||
} | ||
if (cleanSvg === false) { | ||
logger.info('creating SVG', this.paths.svg); | ||
} | ||
resolve(this.paths.dot); | ||
} | ||
); | ||
}); | ||
} | ||
resolve(this.paths.svg); | ||
}); | ||
}); | ||
} | ||
private generateSVG() { | ||
let vizSvg = Viz( | ||
fs.readFileSync(this.paths.dot).toString(), { | ||
format: 'svg', | ||
engine: 'dot' | ||
}, { totalMemory: 32 * 1024 * 1024 }); | ||
return new Promise((resolve, reject) => { | ||
fs.outputFile( | ||
this.paths.svg, | ||
vizSvg, | ||
(error) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
if (cleanSvg === false) { | ||
logger.info('creating SVG', this.paths.svg); | ||
} | ||
resolve(this.paths.svg); | ||
} | ||
); | ||
}); | ||
} | ||
private generateHTML() { | ||
let svgContent = fs.readFileSync(this.paths.svg).toString(); | ||
let cssContent = ` | ||
private generateHTML() { | ||
let svgContent = fs.readFileSync(this.paths.svg).toString(); | ||
let cssContent = ` | ||
<style> | ||
@@ -287,33 +276,25 @@ .edge { | ||
</style>`; | ||
let htmlContent = ` | ||
let htmlContent = ` | ||
${svgContent} | ||
`; | ||
return new Promise((resolve, reject) => { | ||
fs.outputFile( | ||
this.paths.html, | ||
htmlContent, | ||
(error) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
logger.info('creating HTML', this.paths.html); | ||
resolve(this.paths.html); | ||
} | ||
); | ||
}); | ||
} | ||
return new Promise((resolve, reject) => { | ||
fs.outputFile(this.paths.html, htmlContent, (error) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
logger.info('creating HTML', this.paths.html); | ||
resolve(this.paths.html); | ||
}); | ||
}); | ||
} | ||
private generatePNG() { | ||
let svgToPng = require('svg-to-png'); | ||
return new Promise((resolve, reject) => { | ||
svgToPng.convert( | ||
this.paths.svg, | ||
this.paths.png | ||
).then(function () { | ||
logger.info('creating PNG', this.paths.png); | ||
resolve(this.paths.image); | ||
private generatePNG() { | ||
let svgToPng = require('svg-to-png'); | ||
return new Promise((resolve, reject) => { | ||
svgToPng.convert(this.paths.svg, this.paths.png).then(function () { | ||
logger.info('creating PNG', this.paths.png); | ||
resolve(this.paths.image); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
} |
32990
1.52%1
-80%11
-21.43%780
-3.11%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated