Retool - Release Automator

Reduce the number of steps to release an app version with a hotkey.

  1. // ==UserScript==
  2. // @name Retool - Release Automator
  3. // @namespace http://gofortuna.com
  4. // @license MIT
  5. // @version 2024-09-01
  6. // @description Reduce the number of steps to release an app version with a hotkey.
  7. // @author Kevin Hill
  8. // @match https://*.retool.com/editor/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=retool.com
  10. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js
  11. // @require https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.5/mousetrap.min.js
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. /* globals Mousetrap, $ */
  16. (function() {
  17. 'use strict';
  18.  
  19. Mousetrap.bind(['command+/', 'ctrl+/'], async function(e) {
  20. const panel = $('[data-testid="ReleasesAndHistoryPanel::Container"]');
  21.  
  22. const steps = [
  23. () => {
  24. if (panel && !panel.is(":visible")) {
  25. $('[data-testid="ReleaseManagement::Launcher"]').parent("button").click();
  26. }
  27. },
  28. () => panel.find('button:contains("Create")').click(),
  29. () => $("#createRelease--trigger").click(),
  30. () => $('#createReleaseBox div[role="option"]').first().click(),
  31. () => $("#CreateRelease-description").focus()
  32. ];
  33.  
  34. return runSteps(steps, 300);
  35. });
  36. })();
  37.  
  38. async function runSteps(steps, delay) {
  39. for (const step of steps) {
  40. await step();
  41. await new Promise(resolve => setTimeout(resolve, delay));
  42. }
  43. }