File tree Expand file tree Collapse file tree 5 files changed +11
-14
lines changed Expand file tree Collapse file tree 5 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 4
4
"package-nochrome" : " npm run package-prepare && zip -rq ../package.zip ." ,
5
5
"package-prepare" : " npm run lint && npm run babel && cp -r package.json dist && cd dist && PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 npm install --production" ,
6
6
"babel" : " rm -rf dist && mkdir dist && ./node_modules/.bin/babel src --out-dir dist" ,
7
- "local" : " npm run babel && cp -r node_modules dist && node dist/local.js" ,
7
+ "local" : " npm run babel && cp -r node_modules dist && node dist/starter-kit/ local.js" ,
8
8
"lint" : " ./node_modules/.bin/eslint src"
9
9
},
10
10
"dependencies" : {
Original file line number Diff line number Diff line change 1
1
const puppeteer = require ( 'puppeteer' ) ;
2
- const config = require ( './config' ) ;
3
- const util = require ( './util' ) ;
2
+ const config = require ( './starter-kit/ config' ) ;
3
+ const util = require ( './starter-kit/ util' ) ;
4
4
5
5
exports . handler = async ( event , context , callback ) => {
6
6
exports . run ( {
7
7
headless : true ,
8
- chromePath : await util . setupChrome ( ) ,
8
+ executablePath : await util . setupChrome ( ) ,
9
+ args : config . launchOptionForLambda ,
10
+ dumpio : ! ! util . DEBUG ,
9
11
} ) . then (
10
12
( result ) => callback ( null , result )
11
13
) . catch (
12
14
( err ) => callback ( err )
13
15
) ;
14
16
} ;
15
17
16
- exports . run = async ( option ) => {
17
- const browser = await puppeteer . launch ( {
18
- headless : option . headless ,
19
- executablePath : option . chromePath ,
20
- slowMo : option . slowMoMs ,
21
- args : config . launchOptionForLambda ,
22
- dumpio : ! ! util . DEBUG ,
23
- } ) ;
18
+ exports . run = async ( launchOption ) => {
19
+ const browser = await puppeteer . launch ( launchOption ) ;
24
20
25
21
util . debugLog ( `Chrome launched, version ${ await browser . version ( ) } ` ) ;
26
22
File renamed without changes.
Original file line number Diff line number Diff line change 1
- const index = require ( './index' ) ;
1
+ const index = require ( '.. /index' ) ;
2
2
3
3
index . run ( {
4
4
headless : false ,
5
- slowMoMs : 250 ,
5
+ slowMo : 250 ,
6
+ dumpio : ! ! util . DEBUG ,
6
7
// use chrome installed by puppeteer
7
8
} ) . then (
8
9
( result ) => console . log ( result )
File renamed without changes.
You can’t perform that action at this time.
0 commit comments