Running npm scripts from the editor toolbar


#1

Hello :wave: First of all thank you for developing Glitch :raised_hands:

This is just another feature idea, that may be crazy and/or been discussed previously (I wasn’t able to find it though). I was thinking it could be interesting to have a “Run Script” dropdown that would allow you to run any of the npm scripts defined in your package.json. This can already be done using the advanced console, but the dropdown could be nice addition.

Some examples of npm scripts:

  • prettify: This could for example go over all the files and change them with Prettier.
  • build and deploy: For people that want advanced features such as custom domains, a site that doesn’t sleep, deploy to GitHub Pages, and similar. For example with “Create React App” we could run the development version on Glitch and deploy the optimized production version to GitHub.
  • test: Assuming the output text would be available in the Logs panel, we could even run a test suite.
  • start: If for some reason I prefer disabling auto-deploys, maybe I could exclude everything in my watch.json and click this button to trigger a rebuild.

I guess this is easier said than done :grinning: Keep up the great work!


#2

I really like this idea!


#3

Even better, if the buttons could pass some basic arguments about the users current state, (like what file they are currently on etc, that way if you wanted could have it prettify just the one file you are on atm).