-
-
Notifications
You must be signed in to change notification settings - Fork 711
Feat: Extension puppeteer #1323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Extension puppeteer #1323
Conversation
🦋 Changeset detectedLatest commit: 25cac44 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThe pull request introduces a new Puppeteer extension to the package, enhancing its functionality for browser automation and testing. It includes modifications to the Changes
Possibly related PRs
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional comments not posted (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
references/v3-catalog/src/trigger/puppeteerTask.ts (1)
1-16
: LGTM! The Puppeteer task is implemented correctly.The task uses the Trigger.dev SDK and Puppeteer library to launch a browser, navigate to a URL, take a screenshot, and close the browser. The implementation looks good and follows the expected pattern.
A few suggestions for future enhancements:
- Consider parameterizing the URL and screenshot path to make the task more reusable across different scenarios.
- Review the machine preset choice (
large-1x
) based on the specific use case and resource requirements. Ensure that the selected preset provides optimal performance and cost-efficiency for the task.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
Files selected for processing (5)
- packages/build/package.json (3 hunks)
- packages/build/src/extensions/puppeteer.ts (1 hunks)
- references/v3-catalog/package.json (2 hunks)
- references/v3-catalog/src/trigger/puppeteerTask.ts (1 hunks)
- references/v3-catalog/trigger.config.ts (2 hunks)
Additional comments not posted (10)
packages/build/src/extensions/puppeteer.ts (2)
4-6
: LGTM!The
puppeteer
factory function is implemented correctly. It creates and returns a new instance ofPuppeteerExtension
.
8-34
: Excellent work!The
PuppeteerExtension
class is implemented correctly and follows best practices:
- It implements the
BuildExtension
interface correctly.- The
name
property is set to a descriptive value.- The
onBuildComplete
method adds a new layer to the build context when the target is not "dev".- The added layer includes instructions for installing Google Chrome, which is required for Puppeteer.
- The instructions follow best practices for reducing image size by cleaning up package lists.
The implementation is clean, well-structured, and follows the project's conventions.
references/v3-catalog/trigger.config.ts (2)
7-7
: LGTM!The import statement for the puppeteer extension is syntactically correct and aligns with the stated PR objective.
83-83
: Looks good! Remember to setmachine.preset
for production use.The addition of the
puppeteer()
extension to the build configuration is syntactically correct and aligns with the stated PR objective of enabling browser usage in puppeteer tasks.As you mentioned in the PR description, for production use, the
machine.preset
property should be set tolarge-1x
to ensure sufficient resources for running puppeteer tasks. Please ensure this is done before deploying to production.references/v3-catalog/package.json (2)
40-40
: LGTM!The addition of the
puppeteer
dependency aligns with the PR objectives to introduce a new "puppeteer" extension. The version specified is the latest major version, which is appropriate.
69-69
: LGTM!The addition of the
@types/fluent-ffmpeg
dependency provides TypeScript type definitions for thefluent-ffmpeg
package, which improves the development experience. The version specified matches the version of thefluent-ffmpeg
package, which is appropriate.packages/build/package.json (4)
30-31
: LGTM!The new entry for the
puppeteer
extension is added correctly in theexports
section, following the same format as other extension entries. The import path points to the correct location of the TypeScript source file for the extension.
53-55
: LGTM!The new entry for the
puppeteer
extension is added correctly in thetypesVersions
section, following the same format as other extension entries. The path points to the correct location of the TypeScript declaration file for the CommonJS build of the extension.
152-162
: LGTM!The new entry for the
puppeteer
extension is added correctly in theexports
section, following the same format as other extension entries. The import and require paths point to the correct locations of the respective files for the extension, including the TypeScript source file, TypeScript declaration files, and JavaScript files for both ESM and CommonJS builds. This ensures compatibility with different module systems.
Line range hint
1-169
: Overall assessment: The changes look good!The introduction of the new
puppeteer
extension in thepackage.json
file is a valuable addition to the@trigger.dev/build
package. It enhances the functionality of the package by providing support for browser automation using Puppeteer.The necessary entries for the
puppeteer
extension are added correctly in theexports
andtypesVersions
sections, following the existing structure and conventions of the file. The paths to the respective files for the extension, including the TypeScript source file, TypeScript declaration files, and JavaScript files for both ESM and CommonJS builds, are specified accurately. This ensures compatibility with different module systems.Overall, the changes are well-structured, consistent with the existing codebase, and contribute positively to the package's capabilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me 👍
commit: |
commit 64862db Author: Niels <info@flydev.nl> Date: Thu Sep 19 16:25:17 2024 +0200 Update dotEnv.ts to ignore OTEL_EXPORTER_OTLP_ENDPOINT as well (#1307) * Update dotEnv.ts * Create four-buttons-run.md --------- Co-authored-by: Eric Allam <eallam@icloud.com> commit c65d482 Author: Thibaut Cuchet <thibautcuchet@gmail.com> Date: Thu Sep 19 16:22:57 2024 +0200 Feat: Extension puppeteer (#1323) * feat: add puppeteer extension * chore: update package and config * feat: add puppeteer task * Create little-donkeys-protect.md --------- Co-authored-by: Eric Allam <eallam@icloud.com> commit b4be736 Author: Eric Allam <eallam@icloud.com> Date: Thu Sep 19 15:21:03 2024 +0100 prismaExtension fixes for #1325 and #1327
* Added pdf-to-image example * Copy tweak * Squashed commit of the following: commit 64862db Author: Niels <info@flydev.nl> Date: Thu Sep 19 16:25:17 2024 +0200 Update dotEnv.ts to ignore OTEL_EXPORTER_OTLP_ENDPOINT as well (#1307) * Update dotEnv.ts * Create four-buttons-run.md --------- Co-authored-by: Eric Allam <eallam@icloud.com> commit c65d482 Author: Thibaut Cuchet <thibautcuchet@gmail.com> Date: Thu Sep 19 16:22:57 2024 +0200 Feat: Extension puppeteer (#1323) * feat: add puppeteer extension * chore: update package and config * feat: add puppeteer task * Create little-donkeys-protect.md --------- Co-authored-by: Eric Allam <eallam@icloud.com> commit b4be736 Author: Eric Allam <eallam@icloud.com> Date: Thu Sep 19 15:21:03 2024 +0100 prismaExtension fixes for #1325 and #1327 * Copy tweak
Discord thread
✅ Checklist
Testing
v3-catalog
"puppeteerTask"
inv3-catalog
:"https://google.com"
machine.preset
needs to be set to"large-1x"
for it to work. I did not test for all values."puppeteerTask"
in dev mode"screenshot.png"
was successfully createdChangelog
Added a new
"puppeteer"
extension to enable browser usage in puppeteer tasks.Screenshots
[Screenshots]
💯
Summary by CodeRabbit
New Features
Bug Fixes
Documentation