fix(core): update
This commit is contained in:
parent
59eed53644
commit
74a0a27fc1
@ -11,7 +11,7 @@ export class SmartPdf {
|
|||||||
htmlServerInstance: Server;
|
htmlServerInstance: Server;
|
||||||
serverPort: number;
|
serverPort: number;
|
||||||
headlessBrowser: plugins.puppeteer.Browser;
|
headlessBrowser: plugins.puppeteer.Browser;
|
||||||
externalBrowser: boolean = false;
|
externalBrowserBool: boolean = false;
|
||||||
private _readyDeferred: plugins.smartpromise.Deferred<void>;
|
private _readyDeferred: plugins.smartpromise.Deferred<void>;
|
||||||
private _candidates: { [key: string]: PdfCandidate } = {};
|
private _candidates: { [key: string]: PdfCandidate } = {};
|
||||||
|
|
||||||
@ -23,7 +23,9 @@ export class SmartPdf {
|
|||||||
// lets set the external browser in case one is provided
|
// lets set the external browser in case one is provided
|
||||||
this.headlessBrowser = headlessBrowserArg
|
this.headlessBrowser = headlessBrowserArg
|
||||||
// setup puppeteer
|
// setup puppeteer
|
||||||
if (!this.headlessBrowser) {
|
if (this.headlessBrowser) {
|
||||||
|
this.externalBrowserBool = true;
|
||||||
|
} else {
|
||||||
let chromeArgs: string[] = [];
|
let chromeArgs: string[] = [];
|
||||||
if(process.env.CI) {
|
if(process.env.CI) {
|
||||||
chromeArgs = chromeArgs.concat(['--no-sandbox', '--disable-setuid-sandbox'])
|
chromeArgs = chromeArgs.concat(['--no-sandbox', '--disable-setuid-sandbox'])
|
||||||
@ -31,8 +33,6 @@ export class SmartPdf {
|
|||||||
this.headlessBrowser = await plugins.puppeteer.launch({
|
this.headlessBrowser = await plugins.puppeteer.launch({
|
||||||
args: chromeArgs
|
args: chromeArgs
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
this.externalBrowser = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup server
|
// setup server
|
||||||
@ -57,7 +57,7 @@ export class SmartPdf {
|
|||||||
done.resolve();
|
done.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.externalBrowser) {
|
if (!this.externalBrowserBool) {
|
||||||
await this.headlessBrowser.close();
|
await this.headlessBrowser.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
import * as plugins from './smartpdf.plugins';
|
import * as plugins from './smartpdf.plugins';
|
||||||
|
|
||||||
export const packageDir = plugins.path.join(__dirname, '../');
|
export const packageDir = plugins.path.join(__dirname, '../');
|
||||||
export const pdfDir = plugins.path.join(packageDir, 'assets/pdfdir');
|
|
||||||
|
|
||||||
plugins.smartfile.fs.ensureDirSync(pdfDir);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user