-
Notifications
You must be signed in to change notification settings - Fork 2
feat(shell): default Patchright for Playwright via NODE_PATH alias #1266
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,3 +28,15 @@ fi | |||||||
| if [ -f "$HOME/ppv/pillars/dotfiles/flywire-notes/bash-config.sh" ]; then | ||||||||
| source "$HOME/ppv/pillars/dotfiles/flywire-notes/bash-config.sh" | ||||||||
| fi | ||||||||
|
|
||||||||
| # Default Patchright backend for Playwright (global, non-intrusive) | ||||||||
| # If a user-level module alias exists at ~/.config/node-module-alias/node_modules, | ||||||||
| # add it to NODE_PATH so that require('playwright') resolves to Patchright. | ||||||||
| # This avoids wrapper scripts and per-repo code changes. | ||||||||
| export PATCHRIGHT_MODULE_ROOT="$HOME/.config/node-module-alias/node_modules" | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using |
||||||||
| if [ -d "$PATCHRIGHT_MODULE_ROOT" ]; then | ||||||||
|
Comment on lines
+36
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 [Security Risk]: Modifying NODE_PATH globally to inject modules can pose security risks1. Consider using project-level configurations or npm's package aliasing instead. This approach could lead to unintended module resolution and potential supply chain attacks. Footnotes
|
||||||||
| case :$NODE_PATH: in | ||||||||
| *:$PATCHRIGHT_MODULE_ROOT:*) ;; | ||||||||
| *) export NODE_PATH="$PATCHRIGHT_MODULE_ROOT:${NODE_PATH}" ;; | ||||||||
|
Comment on lines
+39
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider handling the case where NODE_PATH is unset. The current approach might result in a trailing colon when NODE_PATH is empty. A more robust approach would be to use parameter expansion with default values.
Suggested change
|
||||||||
| esac | ||||||||
| fi | ||||||||
Uh oh!
There was an error while loading. Please reload this page.