npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

glitch-deploy-tool

v0.1.9-alpha

Published

CLI tool for deploying files to Glitch.com

Downloads

8

Readme

Glitch Deploy Tool

cover

NPM

Support me on Patreon

GitHub license

A tool that makes Glitch a bit more convenient

Introduction

Glitch is great. But for people who use Glitch to deploy their applications, it could be better.

Glitch supports importing projects from Github, but this only allows you to import from the default branch. There are tools like Sync Glitch CLI which allows you to import your Github repo to Glitch via a API call.

But what if you want to import your local files in a specific folder? What if you can build on the fly and use Glitch as a production server for your bots?

This is the tool for you.

Please note that this tool is still under heavy development. You can expect things to not work as the should.

Features

At the moment, there are two ways to upload your work to Glitch with this tool:

  1. Import from Github
  2. Upload local files

Import from Github

You can automatically import your Github repository to your Glitch project. This is done by passing the project id, Glitch user token, and the Github repository name as a query to the /project/githubImport endpoint.

Pros:

  • You can start a project without cloning anything on your local machine
  • You can specify a subdirectory within your repo
  • Works out of the box without any configuration to your project
  • Bidirectional integration if you integrate it with Github

Cons:

  • You can't publish local builds
  • You have to build everything from Glitch
  • Too much bloat and CPU overhead
  • You need both the project ID and the user token

Upload local content

All Glitch projects are encapsulated in their own git repository. With a bit of configuration, you can use your Glitch project as a remote upstream for your project. This tool allows you to clone the project, remove everything inside, replace it with your own files and push it to origin.

Pros:

  • Only upload the distribution build for maximum efficiency
  • Works well as part of your CI workflow
  • You only need your Glitch project repo URL. No tokens required
  • Use your custom build script for distributing it to different servers

Cons:

  • You need to configure your Glitch project's git settings
  • It may not work well when you're interacting with the project from the browser before the local changes are pushed
  • Potentially tamper your .env if your local changes does not include a .ignore file with .env
  • You may need to create your own build script

Installation

This is a CLI tool, so you can install it globally to use it with:

# install globally
npm install -g glitch-deploy-tool

# install locally
npm install --save glitch-deploy-tool
yarn add glitch-deploy-tool

Installing this as part of your project's dependency will allow you to directly interact with the GlitchGit and GlitchProject class.

Usage

The base command for the CLI is glitch-deploy-tool with two sub-commands: from-local and github.

This tool can read parameters as an environmental variable.

usage: glitch-deploy-tool from-local [OPTIONS]
options:
  Upload Local Folder Options:
    -r <glitch git url>, --remote=<glitch git url>
                                        Glitch project repository's remote URL.
                                        Environment: REPO_SOURCE=<glitch git
                                        url>
    -v, --verbose                       Verbose output. This will log all debug
                                        messages.
    -p PATH, --path=PATH                Folder to upload to Glitch.

  Tool Information:
    --version                           Print tool version and exit.
    -h, --help                          Print this help and exit.
usage: glitch-deploy-tool github [OPTIONS]
options:
  Import from Github Options:
    -t <glitch user token>, --token=<glitch user token>
                                        Glitch user API token used to access the
                                        account. Environment:
                                        GLITCH_USER_TOKEN=<glitch user token>
    -i <glitch user token>, --glitch-id=<glitch user token>
                                        Glitch project ID that will.
                                        Environment: GLITCH_PROJ_ID=<glitch user
                                        token>
    -r <user name/project name>, --repo=<user name/project name>
                                        Github repository name that will be
                                        imported to Glitch. Environment:
                                        REPO_SOURCE=<user name/project name>
    -p PATH, --path=PATH                Folder to upload to Glitch.

  Tool Information:
    --version                           Print tool version and exit.
    -h, --help                          Print this help and exit.

Prerequisite

Obtaining Glitch User Token

Glitch user tokens are essentially API tokens for making requests to Glitch. When you log in and edit a project, your token string will be saved in your browser local storage. So obtaining them is quite easy.

First, go to your Glitch project editor.

Second, open the developer console on your browser (either press f12 or navigate through the settings).

Third, paste the following line of code to the console.

(JSON.parse(localStorage.getItem('cachedUser'))).persistentToken

You should see your token being printed.

Enable pushing to your project

Before you start using this tool, first, you need to allow pushes to your Glitch repository. Details about this process can be found from here.

But in short, you just have to type git config receive.denyCurrentBranch updateInstead on your Glitch project terminal and copy the repository link.

Contributing

If you have suggestions for how Unity Push Checker could be improved, or want to report a bug, open an issue! We'd love all and any contributions.

For more, check out the Contributing Guide.

License

MIT © 2020 Hoon Kim [email protected]