Siteglide CLI is a tool that enables you to work on your project from your local editor and has similar behaviours to that of using FTP, in that you can sync up and pull down changes from your website. You will be required to use some terminal commands to use this feature.

Dependencies

The CLI is distributed via Node Package Manager (NPM) and so you will need NodeJS installed on your machine. The easiest way to get this is to visit https://nodejs.org/ and download the LTS version as this has better support.

Siteglide CLI requires a minimum of NodeJS version 10

Installing & Updating

You can use the following to install Siteglide CLI.

npm i -g @siteglide/siteglide-cli 

When an update is released for the CLI, you can use the same command as above to install the updated version.

Installing on Windows

The following video will give you a complete walkthrough guide for setting up Siteglide CLI on a Windows machine. Feel free to skip ahead to the parts you find the most useful.

Installing on Mac

The following video will give you a complete walkthrough guide for setting up Siteglide CLI on a Mac. Feel free to skip ahead to the parts you find the most useful.

The steps I follow in the video can be found here. If you are using zsh as your shell then the commands here will have to be run against the ~/.zshrc file, not ~/.profile

Commands

These commands should be run from within the project folder.  Commands follow the format of siteglide-cli <command> <env> <flags> , so for example if you would like to sync to your production environment with direct asset upload you would run:
siteglide-cli sync production -d  

Add

The first time you use the CLI with a project on your device, you will need to create an environment. This is essentially a config file that authorises your connection.

siteglide-cli add <env> --email me@mydomain.com --url https://my_great_site.com

You must use the email of your Siteglide partner account to replace me@mydomain.com and the development domain of the website you are connecting with to replace https://my_great_site.com

After your site goes live, you will only be able to add the development domain to an environment, not your main user-facing domain.

Replace <env> with a chosen name for the environment, for example production. On larger projects you may have more than one environment to allow you to interact with both staging and production websites.

Sync

siteglide-cli sync <env>

This command will setup a watcher that will automatically sync up files when you hit save in your IDE. To stop the sync running, enter use the shortcut control + c in your terminal.

Flags:
-d : Direct asset upload to AWS S3 CDN with increased file size limits of 5GB per file.

Logs

siteglide-cli logs <env> 

This command will output the last 20 logs and then a live list of logs from your site. Logs are written by using the log liquid code, for example: {% log 'Hello World!' -%} . To stop the logs running, enter use the shortcut control + c in your terminal

Flags:
-f : Filter log types
-q : Quiet mode

GraphQL

siteglide-cli graphql <env>

This command will open up the GraphiQL editor locally. This will let you run Graph queries and mutations to test them out before creating them within your site. Also good for quickly getting data out of the database to check. To stop the GraphiQL running, enter use the shortcut control + c in your terminal

Flags:
-o  : Automatically open GraphiQL in default browser

Pull

siteglide-cli pull <env> 

This will pull down all files from the site in to a folder named marketplace_builder within your current directory. During this process it will also overwrite any local versions of files if they already exist. If you have made any changes locally that you have not synced they WILL be overwritten. 

Note: The Assets folder is not downloaded as part of CLI Pull

Init

siteglide-cli init 

This will create a blank folder structure within the folder you run the command, which includes all folders that are automatically created for you when making a new website on Siteglide. If these folders already exist, you will receive an error and so it will not overwrite existing files.

Deploy

siteglide-cli deploy <env> 

If you have made a lot of changes in your codebase, then you can use deploy to re-send all files to your site at once.  Deploy is a single command that will create a .zip  file of your site and then upload that to your website.

Flags:

-w : With assets, also deploys your sites assets folder, supports total assets of up to 5GB.

Export

siteglide-cli export <env> 

Export is very similar to Pull, but it will also grab all data.  This command will first grab all data from the site and export it into a data.json  file, then it will run a pull to grab your code base.

Flags:
-w  : With assets, also download asset files from your instance such as images and PDFs.

Migrate

siteglide-cli migrate <env> --url <existing url>

Download and migrate an existing site to Siteglide using our site import tool. This tool will scrape the existing site, download all of the publicly accessible pages and assets, compress CSS/JS/images and then deploy as a static site to Siteglide.

Note: If you are using a Mac, running migrate in your “home” folder may fail. Please move into a different folder in terminal and then try again.

Flags:

--url : Existing sites URL, usually the homepage. This flag is mandatory

-n: No Optimization, skips the CSS/JS and Image optimization

Changelog

To see the latest changes to the CLI, we have our changelog here

Did this answer your question?