Auto-saving is cool - as long as you never make mistakes!

Alright,

there is a simple hack you can use to disable auto-rebuilding :slight_smile: it won’t disable auto-saving, but it will make sure that changes to the code don’t trigger a restart.

Create a file named .trigger-rebuild and a watch.json file and put this code in it:

{
  "install": {
    "include": [
      "^package\\.json$",
      "^\\.env$"
    ]
  },
  "restart": {
    "include": [
      "^.trigger-rebuild$"
    ]
  },
  "throttle": 100
}

The only change that will trigger a rebuild is a change to a file named .trigger-rebuild. Changes to .env and package.json will still trigger a reinstall + rebuild. If you don’t like that, you can remove those from the file. Beware: changes to watch.json will always trigger a rebuild.

Caveat: this only works during the editing session. If you close the editor and stay out of the project for long enough (around 10 minutes) the project will be stopped and then rebuilt and restarted the next time it is visited.

I acknowledge it is an hack, but I think it delivers what you want – at least until we implement proper branching and rollbacks :slight_smile:

UPDATE: since it is a bit cumbersome to always go to that .trigger-rebuild file and edit it to trigger a rebuild, you can also put this bookmarklet in your bookmark bar, and name it “Rebuild!”:

javascript:(function() { var currFile = application.selectedFile(); var triggerFile = application.files().filter(function (file) { return file.path() === ".trigger-rebuild"; })[0]; if (!triggerFile) { alert("Please create a file named '.trigger-rebuild'."); return; } application.writeToFile(triggerFile, `restart-${Date.now()}`); })()

Make sure you have a file named .trigger-rebuild in your project, otherwise this script won’t work.

6 Likes