Skip to content

Commit

Permalink
Merge branch 'next' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypnosphi authored Mar 27, 2020
2 parents 5a60eb2 + 06f0114 commit b2280af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
9 changes: 1 addition & 8 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,13 @@ object ExamplesTemplate : Template({
#!/bin/bash
set -e -x
sudo apt-get install -yq \
gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 \
libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \
fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
yarn install
rm -rf built-storybooks
mkdir -p built-storybooks
yarn build-storybooks
""".trimIndent()
dockerImage = "node:10"
dockerImage = "buildkite/puppeteer"
dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux
}
}
Expand Down
13 changes: 5 additions & 8 deletions lib/cli/src/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import getPort from 'get-port';
import { logger } from '@storybook/node-logger';

const read = async url => {
const puppeteer = await usePuppeteer();
const browser = await puppeteer.launch();
const browser = await usePuppeteerBrowser();
const page = await browser.newPage();

await page.goto(url);
Expand Down Expand Up @@ -75,20 +74,18 @@ const useLocation = async input => {
});
};

const usePuppeteer = async () => {
const usePuppeteerBrowser = async () => {
const args = ['--no-sandbox ', '--disable-setuid-sandbox'];
try {
// eslint-disable-next-line import/no-extraneous-dependencies, global-require
require('puppeteer');

return puppeteerCore;
return await puppeteerCore.launch({ args });
} catch (e) {
// it's not installed
logger.info('installing puppeteer...');
return new Promise((resolve, reject) => {
// eslint-disable-next-line global-require
require('child_process').exec(
`node ${require.resolve(path.join('puppeteer-core', 'install.js'))}`,
error => (error ? reject(error) : resolve(puppeteerCore))
error => (error ? reject(error) : resolve(puppeteerCore.launch({ args })))
);
});
}
Expand Down

0 comments on commit b2280af

Please sign in to comment.