
💯 플러그인을 통해 Puppeteer에 새로운 트릭을 가르치세요.
이곳은 puppeteer-extra를 위한 모노레포입니다. puppeteer를 위한 모듈형 플러그인 프레임워크입니다. :-)
🌟 주요 문서는 puppeteer-extra 패키지를 참조하세요.
또한 최근 Playwright 지원도 도입했습니다. 관심이 있다면 playwright-extra를 확인해 보세요.
PR과 새로운 플러그인을 환영합니다! puppeteer-extra의 플러그인 API는 깔끔하고 사용하기 재미있습니다. 시작하려면 PuppeteerExtraPlugin 기본 클래스 문서를 살펴보고 기존 플러그인을 참고하세요(최소 예시는 anonymize-ua 플러그인입니다).
우리는 Lerna(와 yarn 워크스페이스)로 구동되는 모노레포를 사용하며, 테스트에는 ava, 린팅에는 standard 스타일을 사용합니다. 또한 코드 기반 마크다운 문서를 자동 생성하기 위해 JSDoc을 적극 활용합니다. :-)
이 모노레포는 Lerna와 yarn 워크스페이스로 구동됩니다.
# Install deps
yarn
# Bootstrap the packages in the current Lerna repo.
# Installs all of their dependencies and links any cross-dependencies.
yarn bootstrap
# Build all TypeScript sources
yarn build
# Install debug in all packages
yarn lerna add debug
# Install fs-extra to puppeteer-extra-plugin-user-data-dir
yarn lerna add fs-extra --scope=puppeteer-extra-plugin-user-data-dir
# Remove dependency
# https://github.com/lerna/lerna/issues/833
yarn lerna exec --concurrency 1 'yarn remove fs-extra; echo 0'
# Run test in all packages
yarn test
# Update JSDoc based documentation in markdown files
yarn docs
# Upgrade project wide deps like puppeteer
# (We keep the devDependency version blurry)
rm -rf node_modules
rm -rf yarn.lock
yarn
yarn lerna bootstrap
# Update deps within packages (interactive)
yarn lernaupdate
# If in doubt :-(
yarn lerna exec "rm -f yarn.lock; rm -rf node_modules; echo 0"
rm -f yarn.lock && rm -rf node_modules && yarn cache clean
# Run tests of specific package
cd packages/puppeteer-extra-plugin-stealth
yarn test
# Run tests of specific stealth evasion
cd packages/puppeteer-extra-plugin-stealth
yarn ava -v ./evasions/user-agent-override/index.test.js
# Test a local monorepo package in an outside folder as it would've been installed from the registry
# Change PACKAGE_DIR to the path of this monorepo and PACKAGE to the package you wish to install
PACKAGE=puppeteer-extra PACKAGE_DIR=/Users/foo/puppeteer-extra/packages && yarn remove $(echo $PACKAGE); true && rm -f $(pwd)/$(echo $PACKAGE)-latest.tgz && yarn --cwd $(echo $PACKAGE_DIR)/$(echo $PACKAGE) pack --filename $(pwd)/$(echo $PACKAGE)-latest.tgz && YARN_CACHE_FOLDER=/tmp/yarn yarn add file:$(pwd)/$(echo $PACKAGE)-latest.tgz && rm -rf /tmp/yarn
# make sure you're signed into npm before publishing
# yarn publishing is broken so lerna uses npm
npm whoami
# ensure everything is up2date and peachy
yarn
yarn bootstrap
yarn lerna link
yarn build
yarn test
# Phew, let's publish these packages!
# - Will publish all changed packages
# - Will ask for new pkg version per package
# - Will updated inter-package dependency versions automatically
yarn lerna publish
# Fix new dependency version symlinks
yarn bootstrap && yarn lerna link