The Insites CLI Tool is a command line interface that helps you deploy configuration files and assets to your Insites instance. It expects you to follow a certain file structure to communicate correctly with Insites API's.
The Insites CLI Tool requires Node.js in at least the latest LTS version to work properly. https://www.npmjs.com/package/@insites/insites-cli
Open your terminal and enter the following command:
npm i -g @insites/insites-cli
To verify that the installation was successful, type:
insites-cli
Run all commands in the project root directory - one level above the app or modules directory.
For effective integration between your codebase and its associated instance you will need to authenticate your environement via instance-uuid
.
In order to get the Instance UUID, follow the steps below:
- Login to Insites Console.
- Go to Instances page
- Find and select your instance to view Instance Details page
- Under the General tab, get the Instance UUID
In order to connect your codebase to your instance, open your project in your terminal. Since you can connect multiple instances to a single codebase, to have different environments for development and production, you need to give your instance a name in the parameter.
Enter the following command to authenticate your instance:
insites-cli env add <environment-name> --email <console-user-email> --instance-uuid <instance-uuid>
- Verify that your instance has been added by typing this which will display all the available environments:
insites-cli env list
To deploy changes to your instance, enter the following command to your project's terminal:
insites-cli deploy <environment-name>
To ensure that the instance promptly mirrors the code changes you make on a daily basis with minimal manual intervention and upload code changes automatically when you save the file, enter the following command on the project root directory:
insites-cli sync <environment-name>
This command offers an integrated development environment for drafting and executing your GraphQL queries
and Liquid snippets
as well as an option to view your data
, constants
, and logs
. This command establishes a direct connection to your environment thus you gain access to a live preview of data derived from your application.
This direct communication eliminates the potential for errors that might arise when data traverses other layers and features within the system.
insites-cli gui serve <environment-name>
Runs statical analysis on files in your current application directory to check your code for deprecations, recommendations, or syntax errors.
insites-cli audit
Lists all installed modules on a given environment. This command will not list modules that you deployed via the modules/
directory.
insites-cli module list <environment-name>
Create a new module based on module starter repository.
insites-cli modules init <module-name>
Download the installed modules from a given environment.
insites-cli modules pull <environment-name>
Removes a module from your application.
insites-cli modules remove [environment] <module name>
Exports data from the environment to a given file in JSON format.
insites-cli data export staging --path=data.json
Options:
-
--path
(short:-p
): A file path to a JSON file which will be created by the CLI and where the exported data is stored. -
--export-internal-ids
: By default, export will use the autogenerated external_id for the id field. When this option is set, it will use the normal id from the object.
Imports data from a given JSON file with proper data structure.
insites-cli data import staging --path=data.json
Option:
-
--path
(short: -p): A path to a JSON or ZIP files to be imported
Cleans data on an Instance. Keep in mind that this only removes rows of data, not the structure definition.
For example, if you have a model schema car
and there are 10 entries of type car
, those will be deleted, but the model schema car
will remain intact.
This is useful for testing your imports/exports or resetting your database to a pristine state between tests.
This operation is irreversible. insites-cli
will ask you twice if you are sure you want to do it.
insites-cli data clean staging
Need to use CMD as administrator
npm update -g @insites/insites-cli
-
.insitesignore
- specifies intentionally untracked files to ignore -
.insites
- contains the environment credentials to connect to the instance -
.insites.legacy
- configuration file for legacy instances