A CLI tool to deploy an app to an existing Glitch project. The contents of the existing Glitch project are completely replaced. Use carefully!
A target Glitch project must be setup to receive deployments before you can deploy an app with glitcheroo.
Deployment is initiated from the source project. The source may be another Glitch project or a project committed to a Git repository on your local device.
Node.js is required, version 8.2.0 or higher.
Open a terminal in the root of the Glitch project that you want to deploy to. Run the following command to setup the target project:
npx glitcheroo setup-targetWARNING: This command allows the Glitch project to be completely overwritten via remote Git operations.
Open a terminal in the root of the project that you want to deploy. Run the following command to deploy the app:
npx glitcheroo deployThe first time you run this command in a project it will prompt you to provide the Git URL of the target project. Find it in the "Tools > Import and Export" panel of the Glitch project editor.
And that's it! There is no step 3. Glitch will automatically detect the project change, reinstall the dependencies, and start the deployed app.
Installation is not required. Node.js already includes the npx tool, and the npx tool automatically downloads and runs the latest version of glitcheroo every time you use it to run the commands.
If you don't want npx to re-download glitcheroo every time you run the commands you can install the glitcheroo package as a devDependency of the project you are deploying:
npm install -D glitcherooYou should continue to use npx to run glitcheroo after installing the package. The npx tool will find the version of glitcheroo installed in your project and use it instead of downloading the latest version.
As a convenience, this tool lets you remix a Glitch project to your local device. The remixed project is configured to target the original Glitch project for deployment.
Remix a target Glitch project by running the following command:
npx glitcheroo remixProvide the Git URL of the target project when prompted.
The configuration status for a project may be retrieved by running the following command:
npx glitcheroo statusThis prints whether the project has been configured as a source, a target, or both.
The configuration for a project may be reset by running the following command:
npx glitcheroo resetThis removes the Git configuration values added by the setup-target, deploy, and remix commands.
The glitcheroo deploy command will read the Git URL of the target project from the GLITCHEROO_GIT_URL environment variable if it is set.
The glitcheroo tool works by configuring and using Git.
The setup-target command:
- sets the
receive.denyCurrentBranchconfig value toignoreso that themasterbranch can be pushed to - sets the
receive.shallowUpdateconfig value totrueso that shallow checkouts can be pushed - installs a
post-receivehook that runs after deploy and refreshes the workspace and Glitch editor with the new changes
The deploy command:
- adds a remote tracked repository named
glitcheroothat points at the target - pushes
+HEAD:masterto theglitcherooremote
The remix command:
- clones the target Git repository
- renames the default remote in the new repository from
origintoglitcheroo
This project was inspired by Melissa McEwen's fascinating article Automating My Deploys From GitHub to Glitch, published on DEV on April 21, 2020.
Huge thanks to Glitch for providing a great service. This project is not affiliated with Glitch in any way.