From 85807120a544f2bbd6dec147d74f9325fad82ebf Mon Sep 17 00:00:00 2001 From: Artuom Kukharenko Date: Mon, 29 Jan 2018 16:33:31 +0300 Subject: [PATCH] [-] Fix image options --- client/index.js | 10 +++++----- client/lib/api.js | 12 ++++++------ client/lib/webpackTask.js | 3 ++- client/package.json | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/client/index.js b/client/index.js index 57f2dce..551d0f1 100755 --- a/client/index.js +++ b/client/index.js @@ -33,7 +33,7 @@ module.exports = class PdfService { return getStaticFileFromHtml({ outPaths: { htmlPath, staticFilePath: `${staticFilePath}.pdf` }, - pdfOptions, + options: pdfOptions, headers, type: 'pdf', templateSystem, @@ -58,7 +58,7 @@ module.exports = class PdfService { try { return getStaticFileByContent({ - pdfOptions, + options: pdfOptions, headers, type: 'pdf', templateSystem, @@ -90,7 +90,7 @@ module.exports = class PdfService { return getStaticFileFromHtml({ outPaths: { htmlPath, staticFilePath: `${staticFilePath}.${imgOptions.type || 'png'}` }, - imgOptions, + options: imgOptions, headers, templateSystem, type: imgOptions.type || 'png', @@ -115,7 +115,7 @@ module.exports = class PdfService { try { return getStaticFileByContent({ - imgOptions, + options: imgOptions, headers, templateSystem, content, @@ -140,7 +140,7 @@ module.exports = class PdfService { const paths = await validate({ pagePath }); const watchParams = { paths, - pdfOptions, + options: pdfOptions, templateSystem, serverUrl: this.serverUrl, mode: this.mode, diff --git a/client/lib/api.js b/client/lib/api.js index 883800b..b4c0320 100644 --- a/client/lib/api.js +++ b/client/lib/api.js @@ -74,7 +74,7 @@ const isProdHtmlExists = (htmlPath) => { const getStaticFileFromHtml = async ({ outPaths, - pdfOptions, + options, headers, templateSystem, serverUrl, @@ -90,8 +90,8 @@ const getStaticFileFromHtml = async ({ } let pdfStream = type === 'pdf' - ? getPdf(html, pdfOptions, headers, serverUrl) - : getImg(html, pdfOptions, headers, serverUrl); + ? getPdf(html, options, headers, serverUrl) + : getImg(html, options, headers, serverUrl); if (mode === 'development') { await writePdf(staticFilePath, pdfStream); @@ -106,7 +106,7 @@ const getStaticFileFromHtml = async ({ const getStaticFileByContent = async ({ content, - pdfOptions, + options, headers, templateSystem, serverUrl, @@ -114,8 +114,8 @@ const getStaticFileByContent = async ({ }) => { const html = compileHtml(content, templateSystem); const pdfStream = type === 'pdf' - ? getPdf(html, pdfOptions, headers, serverUrl) - : getImg(html, pdfOptions, headers, serverUrl); + ? getPdf(html, options, headers, serverUrl) + : getImg(html, options, headers, serverUrl); return pdfStream.pipe((PassThrough())); }; diff --git a/client/lib/webpackTask.js b/client/lib/webpackTask.js index 7473d82..cc33cef 100644 --- a/client/lib/webpackTask.js +++ b/client/lib/webpackTask.js @@ -76,7 +76,7 @@ const build = ({ paths }) => { }); }; -const watch = ({ paths, templateSystem, serverUrl, buildPdf, mode }) => { +const watch = ({ paths, templateSystem, serverUrl, buildPdf, mode, options }) => { const config = getConfig({ paths }); const compiler = webpack(config); return new Promise((resolve, reject) => { @@ -89,6 +89,7 @@ const watch = ({ paths, templateSystem, serverUrl, buildPdf, mode }) => { await buildPdf({ outPaths: { htmlPath, pdfPath }, templateSystem, + options, type: 'pdf', serverUrl, mode, diff --git a/client/package.json b/client/package.json index e6a6fa1..5371e48 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "@paralect/pdf-service-client", - "version": "0.3.0", + "version": "0.3.1", "description": "Pdf service client for https://hub.docker.com/r/paralect/pdf-service/", "main": "index.js", "bin": {