ggt is the command line interface for the Gadget platform, providing additional functionality for working with your Gadget applications using your existing tools on your machine. ggt isn't required for building end-to-end Gadget apps but supports syncing files locally (and more soon) for your preferred coding experience.
Quick Start
Run the following to sync a my-app.gadget.app application to the ~/gadget/my-app on your local machine:
terminal
npx ggt@latest sync ~/gadget/my-app --app=my-app
With this running in the background, your local ~/gadget/my-app folder will become two-way synced with your application's filesystem in Gadget's cloud. Changes you make locally will be immediately reflected by your application's API and actions if you re-run them.
Install ggt
The command-line interface for Gadget
terminal
$ npm install -g ggt
$ ggt
Usage
terminal
ggt [COMMAND]
List of ggt commands
dev: Clone your local filesystem with your environment's filesystem.
status: Show the status of your local and environment's filesystem.
push: Push your local filesystem.
pull: Pull your environment's filesystem.
deploy: Deploy your environment to production.
open: Open your Gadget app in your default browser.
list: List your available applications.
login: Log in to your account.
logout: Log out of your account.
whoami: Print the currently logged in account.
version: Print this version of ggt.
Flags
-h , --help: Print command's usage
-v, --verbose: Print verbose output
--json: Print output as JSON
For more information on a specific command, use 'ggt [COMMAND] --help'
Commands
ggt dev
Clone your Gadget environment's source code to your local filesystem.
ggt dev is continually running in the background (unless it is stopped), local file changes are immediately reflected within Gadget, while files that are changed in Gadget are immediately saved to your local filesystem.
Ideal for:
Local development with editors like VSCode
Storing source code in a Git repository like GitHub
dev looks for a ".ignore" file to exclude certain files/directories from being cloned. The format is identical to a .gitignore file.
These files are always ignored:
.DS_Store
.gadget
.git
node_modules
Sync only works with your development environment
Avoid deleting/moving all your files while sync is running
Gadget only supports Yarn v1 for dependency installation
Usage
terminal
ggt dev [DIRECTORY]
Arguments
DIRECTORY: The directory to sync files to (default: ".")
Flags
-a, --app=<name>: The Gadget application to clone files to
--prefer=<filesystem>: Prefer "local" or "gadget" conflicting changes
--once: Sync once and exit
--force: Sync regardless of local filesystem state
Example
terminal
1$ ggt dev ~/gadget/example --app=example
2
3✔ Calculated file changes. 03:28:48 PM
4
5✔ Pulled files. ← 03:28:48 PM
6+ .gitignore created
7+ accessControl/filters/user/tenant.gelly created
8+ accessControl/permissions.gadget.ts created
9+ api/actions/ created
10+ api/models/session/schema.gadget.ts created
11… 32 more
12
1337 changes in total. 37 created.
14
15✔ Your files are up to date. 03:29:01 PM
16
17Application shopify-app
18Environment development
19
20Preview Editor Playground Docs
21
22Waiting for file changes… Press Ctrl+C to stop
ggt status
Shows you the current environment and git branch you're developing on.
As well as the status of your local files compared to your environment's files.
Usage
terminal
ggt status
Example
terminal
1$ ggt status
2Application shopify-app
3Environment development
4
5Preview Editor Playground Docs
6
7✔ Your files are up to date. 03:39:47 PM
ggt push
Push changes from your local filesystem to your environment's filesystem.
Changes will be calculated from the last time you ran
ggt dev, ggt push, or ggt pull on your local filesystem.
terminal
$ ggt push -help
Usage
terminal
ggt push
Flags
-a, --app=<name>: The application to pull files from
-e, -env, --env=<name>: The environment to pull files from
Your local files must match your environment's files
before you can deploy. Changes are tracked from
the last "ggt dev", "ggt push", or "ggt pull" run locally.
Usage
terminal
ggt deploy
Flags
-a, --app=<name>: The application to deploy
-e, -env, --from=<env>: The environment to deploy from
--force: Discard changes to your environment's filesystem
--allow-problems: Deploy regardless of any problems the environment has
--allow-charges: Deploy even if doing so will add charges to your account