CLI
Introducing Siteglide CLI
27min
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 please note that the flags for commands below are not available on all versions of the cli, updating to the latest version will allow you to use all of them 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 zsh is the default for macs since macos catalina, to find out which shell you are using you can run echo ${shell} in terminal if the / profile or / zshrc files do not already exist then you may need to create them first before running the export path command 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 view the logs of your production environment in "quiet mode", you would run siteglide cli logs production q please note that some commands may fail if you run them in your users home directory we recommend a folder structure such as siteglide/ and then give each project/site it's own folder command flags such as \<command> \<env> and \<flags> should be replaced with the relevant data for example, \<env> should be replaced with the chosen name for the environment such as production 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 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 file saves and deletions when that action happens on your machine to stop the sync running, enter use the shortcut control + c in your terminal flags l turns on the live reload server this enables automatic browser reloading of a page when a file is saved in your ide 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 version siteglide cli v check the current version of siteglide cli you are running see the siteglide cli changelog to find the latest version number if you need to update, see the "installing & updating" command section above help siteglide cli help generates a list of valid siteglide cli commands available to you graphql deprecated please see the gui command below gui siteglide cli gui \<env> this command will open up the graphiql and liquid evaluator editors 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 the liquid evaluator tool lets you quickly test liquid from the cli, without having to create and save a page in siteglide admin to stop the gui command 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 flags i ignore assets such as css and js as part of the pull m provide the name of a module to download note that this will only download that module and not the site as well this will only download the public folder within the module, if the module only contains a private folder then nothing will be downloaded note assets such as images and videos are 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 \ csv export the data files as csv instead of json please note that these csv's are currently not compatible with the ones that are exported/imported from siteglide admin a only export assets and not the sites codebase this by default will only export code related assets (css/js etc) within the /assets folder it can be mixed with w above to export all assets 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 the migrate command will also convert any existing forms (using the \<form> tag) to a "form to email" in siteglide when filled in, this will email the user who triggered the cli migration with an autoresponder these forms can then optionally be updated at a later date within siteglide admin 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 m a number to set the level of recursion that the scraper will search through the site for example setting m 1 will only follow 1 link deep from the entry page i a string to send to the scraper that if found in the url it will ignore downloading that page for example if your blog posts are links such as site com/post/post name and you wanted to ignore them, you could use the flag i /post/ this flag can be used multiple time such as i /blog i /posts/ list siteglide cli list output a list of environments you have previously added and their relative urls for the current folder modules siteglide cli modules \<env> provides a list of modules installed onto the instance these names can then be used in the pull command to download the contents of that module debug mode somtimes siteglide support may ask you to run the cli in "debug mode" this provides more output into your terminal so that we can use it to aid in supporting you to do this, you need to prefix the command you are running with some extra information this prefix differs slightly on macos, linux and windows, for example if you were to want to sync to a site with debug mode on debug=true siteglide cli sync productiondebug=true siteglide cli sync production//command prompt set debug=true && siteglide cli sync production //powershell $env\ debug='true'; siteglide cli sync production note, for macos and linux, debugging will be turned on for that one command that you prefix for windows, debugging will be turned on for as long as command prompt or powershell is open closing command prompt or powershell and re opening it will turn debug mode off changelog to see the latest changes to the cli, we have our changelog here