Skip to content

Commit

Permalink
fix(fusuma): check to exist @fusuma/task-pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Jun 18, 2019
1 parent 4bb5e88 commit 074712e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/fusuma/src/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,19 @@ async function pdfProcess(basePath, { input: i, output: o }) {

const spinner = loader('Exporting as PDF...').start();

// TODO: fix lazy-load
const { execSync } = require('child_process');
let pdf;

try {
const { execSync } = require('child_process');
pdf = require('@fusuma/task-pdf');
} catch (e) {
execSync('npm install @fusuma/task-pdf --no-save', { stdio: 'inherit' });

const pdf = require('@fusuma/task-pdf');

await pdf(input, output, port);
} catch (e) {
console.error(e);
pdf = require('@fusuma/task-pdf');
}

await pdf(input, output, port);

spinner.stop();
}

Expand Down

0 comments on commit 074712e

Please sign in to comment.