-
Notifications
You must be signed in to change notification settings - Fork 208
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: env-doctor script #10078
feat: env-doctor script #10078
Conversation
I checked out this PR and ran it to see what it would do for me.
after a few more warnings about ava and vercel, it reported
|
Deploying agoric-sdk with Cloudflare Pages
|
"Build repo" \ | ||
"yarn build" \ | ||
"Clean, reinstall dependencies, and rebuild" \ | ||
"git clean -fdx "**/node_modules" "**/bundles" && yarn install && yarn build" |
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.
I didn't know glob patterns were supported by git cli, but that makes sense!
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.
learned this from @kriskowal
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.
Apparently globs are not working for me. Where can I find info on how it's supposed to work?
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.
Ok I found that globs may not be enabled by default. Also I think that glob pattern doesn't actually work. What worked for me (more aggressive version with more things cleaned):
-- ':(glob)**/node_modules/**' ':(glob)**/bundles/**' ':(glob)**/dist/**' ':(glob)**/build/**'
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.
Also I tend to do bin/agd build
these days instead as that also builds the golang stuff for those of use who care. However it has its own "download deps" logic which may not be desirable here.
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.
We could also try using exclusions instead of inclusions. But I'll leave this as an exercise for whoever runs into the problem next. This is meant to be a crowdsourced solution set
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.
Inclusions is probably safer. It's just that I don't understand how this line even works given the quoting, and that glob patterns are not enabled by default.
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.
I reviewed rapidly, ran shellcheck, and asked ChatGPT4o for a code review. Feedback is a mix of all of that.
None of the feedback is required to be acted on before merging or really ever.
package.json
Outdated
@@ -53,6 +53,7 @@ | |||
"docs:markdown-for-agoric-documentation-repo": "run-s docs:markdown-build 'docs:update-functions-path md'", | |||
"docs:markdown-build": "typedoc --plugin typedoc-plugin-markdown --tsconfig tsconfig.build.json", | |||
"docs:update-functions-path": "node ./scripts/update-typedoc-functions-path.cjs", | |||
"doctor": "scripts/env-doctor.sh", |
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.
low priority:
The rest of the values in this JSON object reference the scripts directory with a leading .
. Worth doing here?
@@ -0,0 +1,121 @@ | |||
#!/bin/bash |
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.
low priority:
ChatGPT suggested:
command -v brew >/dev/null 2>&1 || { echo "brew is required but not installed. Exiting."; exit 1; }
command -v yarn >/dev/null 2>&1 || { echo "yarn is required but not installed. Exiting."; exit 1; }
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.
ChatGPT also suggests:
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# bail with error
fi
echo -e "${RED}✗ Failed${NC}" | ||
echo -e "${YELLOW}Remedy:${NC} $remedy_description" | ||
if [[ $AUTO_YES != "true" ]]; then | ||
read -p "Do you want to apply this remedy? (Yes/No/All) " answer |
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.
Do you think we should explicitly initialize AUTO_YES
with false
at the start of the script?
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.
Cool Stuff!
# Check if running on macOS | ||
if [[ "$(uname)" != "Darwin" ]]; then | ||
echo "Error: This script only works on macOS." | ||
echo "Your current operating system is: $(uname)" | ||
exit 1 | ||
fi |
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.
Why is this MacOS only? A decent chunk of us are on Linux
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.
Because some remedies use Homebrew. Also Linux uses are less likely to need it. ;-) But feel free to improve the script.
"Build repo" \ | ||
"yarn build" \ | ||
"Clean, reinstall dependencies, and rebuild" \ | ||
"git clean -fdx "**/node_modules" "**/bundles" && yarn install && yarn build" |
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.
Apparently globs are not working for me. Where can I find info on how it's supposed to work?
incidental
Description
Adds
yarn doctor
which callsscripts/env-doctor.sh
to diagnose and repair common problems with the development environment.I made this using Aider:
I wish Aider would include the chat message in the commit. Aider-AI/aider@16856bb looks like it was supposed to.
Security Considerations
n/a
Scaling Considerations
n/a
Documentation Considerations
Maybe docs.agoric.com gets some advice to use
yarn doctor
. It could save some of the setup steps.Testing Considerations
Needs some testing on different machines. Though it doesn't have to be perfect. I expect it will get iterated upon whenever someone runs into a problem.
I've tried it a few times locally. Once I had
"build": "exit 1"
to test the build remedy.Upgrade Considerations
n/a