Skip to content
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

Add grunt task for "refresh and sync my codebase" #405

Closed
zepumph opened this issue Nov 7, 2024 · 10 comments
Closed

Add grunt task for "refresh and sync my codebase" #405

zepumph opened this issue Nov 7, 2024 · 10 comments

Comments

@zepumph
Copy link
Member

zepumph commented Nov 7, 2024

Form #370, there are a variety of scripts in perennial/js/scripts that do something like this. We should add this to the main and public API via a grunt task. This will:

  1. pull perennial
  2. clone-missing repos from active-repos
  3. pull all
  4. npm update in chipper/perennial(-alias).

Similar scripts already exist called main-pull-status and start-dev.

Other features of those that we likely want an option for:

  • pull all branches of all repos with an option
  • start the transpiler watch process in a sub process
  • start an http-server (likely shouldn't be added here).
@zepumph
Copy link
Member Author

zepumph commented Feb 4, 2025

I will call it grunt sync-codebase to start.

zepumph added a commit that referenced this issue Feb 5, 2025
zepumph added a commit that referenced this issue Feb 5, 2025
zepumph added a commit that referenced this issue Feb 5, 2025
@zepumph
Copy link
Member Author

zepumph commented Feb 5, 2025

grunt sync-codebase now exists. You can still run without using grunt of course with sage run js/grunt/tasks/sync-codebase.ts.

I also added a feature where cd friction; grunt sync-codebase will npm update in friction also. That seems nice as we decide to use this more as a one stop shop for more inexperienced devs to get started. I'm going to mark this for dev meeting to check in with people. My understanding is that there are a lot of different ways people are pulling and cloning repos, and I believe it would be best if there was just a single spot for all this to happen.

zepumph added a commit that referenced this issue Feb 5, 2025
zepumph added a commit that referenced this issue Feb 5, 2025
zepumph added a commit that referenced this issue Feb 5, 2025
@zepumph
Copy link
Member Author

zepumph commented Feb 6, 2025

TODO List from initial discussion during dev meeting today:

  • We need to update documentation that mentions posting to dev public
  • What documentation changes should be done for outside collaborators? Currently it would clone all phet repos, so this isn't a good "getting started" script.
  • Add "-p" option equivalent for omitting private repos while cloning.
  • It would be nice if each section logged the time it took (pulling/npm update/transpiling)
  • An option that can turn off npm updates would be nice, just like --transpile for opting into that
  • It would be good to know if it clones a new repo, print that
  • Since pulling takes a while (no parallel on Windows), lets add an option to print repos as it pulls.
  • Option for opting out of status
  • When contents were pulled, let's show those results, like pull-all.js
  • assertion when --all --status=false are used together
  • pull/status progress print should not be red if all it printed was the pull results (and no incorrect status). This also happens if just printing green status's with "--all".
  • The new factored out logging doesn't correctly tab the branch status over to the right.

@zepumph
Copy link
Member Author

zepumph commented Feb 6, 2025

Here is what the cloning message looks like on my working copy:

Image

zepumph added a commit that referenced this issue Feb 6, 2025
zepumph added a commit that referenced this issue Feb 6, 2025
…tor out cloning+logging, slowPull logs immediately when done, #405
zepumph added a commit that referenced this issue Feb 6, 2025
zepumph added a commit that referenced this issue Feb 6, 2025
zepumph added a commit that referenced this issue Feb 6, 2025
zepumph added a commit that referenced this issue Feb 6, 2025
@zepumph
Copy link
Member Author

zepumph commented Feb 6, 2025

Ok. This is probably a good stopping point here. We'll talk next week after dev meeting.

zepumph added a commit that referenced this issue Feb 6, 2025
zepumph added a commit that referenced this issue Feb 6, 2025
zepumph added a commit to phetsims/phet-info that referenced this issue Feb 13, 2025
zepumph added a commit to phetsims/chipper that referenced this issue Feb 13, 2025
zepumph added a commit that referenced this issue Feb 13, 2025
zepumph added a commit that referenced this issue Feb 13, 2025
@zepumph zepumph self-assigned this Feb 13, 2025
@zepumph
Copy link
Member Author

zepumph commented Feb 13, 2025

Next steps for this issue:

  • Rename to sync
  • Implement pull-all.sh and status.sh using this script
  • slowPull should not always print everything, it should only print everything for --all
  • Use sync in daily-grunt-work
  • Delete these

perennial/bin/clone-missing-repos.sh
perennial/js/grunt/tasks/clone-missing-repos.ts
perennial/js/scripts/main-pull-status.js
perennial/js/scripts/pull-all.js

@zepumph
Copy link
Member Author

zepumph commented Feb 21, 2025

Alright. I can't really think of much else to do here. @samreid can you please take a look at sync.ts and let me know if you have any thoughts? Please don't spend more than 30 minutes on this review without us synchronizing, as I hope this is pretty much complete.

@zepumph zepumph assigned samreid and unassigned zepumph Feb 21, 2025
samreid added a commit that referenced this issue Feb 21, 2025
@samreid
Copy link
Member

samreid commented Feb 21, 2025

Fixed one small typo. Two questions:

  1. Why do we cloneMissingRepos on updateRepo? Maybe document it.
  2. Should this return an error code if something didn't work out correctly?

@samreid samreid assigned zepumph and unassigned samreid Feb 21, 2025
@zepumph
Copy link
Member Author

zepumph commented Feb 21, 2025

Great suggestions.

Note how cool process.exitCode = X is, I just found that. Seems like it could help a bunch of our other tasks that export promises. Thoughts?

I also updated doc about cloneMissingRepo and made for better logging with --pull=false --status-false.

@zepumph zepumph assigned samreid and unassigned zepumph Feb 21, 2025
@zepumph
Copy link
Member Author

zepumph commented Feb 21, 2025

Ready to close?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants