-
Notifications
You must be signed in to change notification settings - Fork 378
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(javascript): allow users to run post-upgrade tasks #1476
Conversation
@Chriscbr Hey. Any ideas what's needed to move this PR along, discussion, code-change, or otherwise? |
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.
Hi, thanks for the ping. I took one more look to see if there's any quick fixes for the upgrade task not being available for escape hatching, but since I couldn't see any, I'm cool with adding this for now. Just a few small comments 🙂
src/javascript/node-project.ts
Outdated
/** | ||
* A task run after the upgrade task. | ||
*/ | ||
public get postUpgradeTask() { | ||
return this.upgradeWorkflow?.postUpgradeTask; | ||
} |
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.
Let's remove this since the upgradeWorkflow
property is public anyways - I'd prefer to minimize the API surface area we're adding.
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.
No problemo.
@@ -197,6 +208,8 @@ export class UpgradeDependencies extends Component { | |||
// run "projen" to give projen a chance to update dependencies (it will also run "yarn install") | |||
task.exec(this._project.projenCommand); | |||
|
|||
task.spawn(this.postUpgradeTask); |
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.
Can we add a unit test? I think we just want to validate that is there is some way to run things after the upgrade task.
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.
Okay, I've added a unit test that checks that the upgrade
task spawns post-upgrade
as its last step. In the test, I didn't add anything to the post-upgrade
task, but I can if you feel it's necessary.
Codecov Report
@@ Coverage Diff @@
## main #1476 +/- ##
==========================================
+ Coverage 88.06% 89.24% +1.18%
==========================================
Files 132 141 +9
Lines 5109 5781 +672
Branches 1207 1468 +261
==========================================
+ Hits 4499 5159 +660
- Misses 610 620 +10
- Partials 0 2 +2
Continue to review full report at Codecov.
|
@Chriscbr Alright - I've made changes following your review. Let me know whether you need anything else! Thanks. |
The task is named `integ:snapshot-all` and can be used together with the feat added in projen#1476.
The task is named `integ:snapshot-all` and can be used together with the feat added in #1476. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Allows users to add post-upgrade tasks. This is useful in case the user wants to run commands after the upgrade workflow, such as automatically updating integration test snapshots. Example:
Fixes #1348
Related #1256
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.