powersync
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

PowerSync CLI

Programmatically manage your PowerSync environment.

For an overview, see the docs here.

Table of contents:

Usage

$ npx powersync
$ npx powersync COMMAND
running command...
powersync/0.4.0 linux-x64 node-v20.11.1
$ npx powersync --help [COMMAND]
USAGE
  $ npx powersync COMMAND
...

Inject ENV variables

The following environment variables can be injected:

  • AUTH_TOKEN - The access token used to authenticate with the PowerSync service. Learn more.
  • ORG_ID - The PowerSync organization ID. This is the first UUID in your project's dashboard URL. 123 in this example: https://powersync.journeyapps.com/org/123/app/456.
  • PROJECT_ID - The PowerSync project ID. This is the second UUID in your project's dashboard URL. 456 in this example: https://powersync.journeyapps.com/org/123/app/456.
  • INSTANCE_ID - The PowerSync instance ID. Get this by running npx powersync instances.

Example:

ORG_ID=123 PROJECT_ID=456 INSTANCE_ID=789 npx powersync instance status

Commands

powersync help [COMMANDS]

Display help for powersync.

USAGE
  $ npx powersync help [COMMANDS] [-n]

ARGUMENTS
  COMMANDS  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for powersync.

See code: @oclif/plugin-help

powersync init

Initialize the CLI. Requires an access token. Learn how to generate these here.

USAGE
  $ npx powersync init

DESCRIPTION
  Initialize the CLI.

EXAMPLES
  $ npx powersync init

See code: src/commands/init.ts

powersync instance config

Display the instance config.

USAGE
  $ npx powersync instance config

DESCRIPTION
  Display the instance config.

EXAMPLES
  $ npx powersync instance config

See code: src/commands/instance/config.ts

powersync instance create

Create a new instance.

USAGE
  $ npx powersync instance create [--databaseName <value>] [--hostname <value>] [--name <value>] [--port <value>]
    [--region US|EU] [--useSupabaseAuth]

FLAGS
  --databaseName=<value>  Name of the database.
  --hostname=<value>      Hostname to connect to database.
  --name=<value>          Name of the instance.
  --port=<value>          Port number to connect to database.
  --region=<option>       Region to deploy instance to.
                          <options: US|EU>
  --useSupabaseAuth       Use Supabase for auth.

DESCRIPTION
  Create a new instance.

EXAMPLES
  $ npx powersync instance create

See code: src/commands/instance/create.ts

powersync instance deploy

Deploy changes to an existing instance.

USAGE
  $ npx powersync instance deploy [--databaseName <value>] [--hostname <value>] [--name <value>] [--port <value>]
    [--useSupabaseAuth]

FLAGS
  --databaseName=<value>  Name of the database.
  --hostname=<value>      Hostname to connect to database.
  --name=<value>          Name of the instance.
  --port=<value>          Port number to connect to database.
  --useSupabaseAuth       Use Supabase auth.

DESCRIPTION
  Deploy changes to an existing instance.

EXAMPLES
  $ npx powersync instance deploy

See code: src/commands/instance/deploy.ts

powersync instance destroy

Destroy the current instance - THIS CANNOT BE UNDONE.

USAGE
  $ npx powersync instance destroy [-s]

FLAGS
  -s, --skipConfirmation  Ignore confirmation question.

DESCRIPTION
  Destroy the current instance - THIS CANNOT BE UNDONE.

EXAMPLES
  $ npx powersync instance destroy

See code: src/commands/instance/destroy.ts

powersync instance schema

View the schema of the current instance.

USAGE
  $ npx powersync instance schema

DESCRIPTION
  View the schema of the current instance.

EXAMPLES
  $ npx powersync instance schema

See code: src/commands/instance/schema.ts

powersync instance set

Set the current instance.

USAGE
  $ npx powersync instance set [-i <value>]

FLAGS
  -i, --instanceId=<value>  Instance ID to change to.

DESCRIPTION
  Set the current instance.

EXAMPLES
  $ npx powersync instance set

  $ npx powersync instance set --instanceId=1234

See code: src/commands/instance/set.ts

powersync instance status

View the status of the current instance. View the status of a different instance by using flags.

USAGE
  $ npx powersync instance status [-t <value>] [-i <value>] [-o <value>] [-p <value>]

FLAGS
  -i, --instanceId=<value>  Override current instance by providing the ID of a different instance.
  -o, --orgId=<value>       Override current organization by providing the ID of a different organization.
  -p, --projectId=<value>   Override current project by providing the ID of a different project.
  -t, --authToken=<value>   Override current auth token.

DESCRIPTION
  View the status of the current instance. View the status of a different instance by using flags.

EXAMPLES
  $ npx powersync instance status

  $ npx powersync instance status --orgId=1234 --projectId=1234 --instanceId=1234 --authToken=1234

See code: src/commands/instance/status.ts

powersync instance stop

Stop the current instance.

USAGE
  $ npx powersync instance stop [-s]

FLAGS
  -s, --skipConfirmation  Ignore confirmation question.

DESCRIPTION
  Stop the current instance.

EXAMPLES
  $ npx powersync instance stop

See code: src/commands/instance/stop.ts

powersync instance sync-rules deploy

Deploy sync rules from a local sync rules config file to the current instance.

USAGE
  $ npx powersync instance sync-rules deploy -f <value> [-s]

FLAGS
  -f, --filePath=<value>  (required) Path to the sync rules config file.
  -s, --skipConfirmation  Ignore confirmation question.

DESCRIPTION
  Deploy sync rules from a local sync rules config file to the current instance.

EXAMPLES
  $ npx powersync instance sync-rules deploy

  $ npx powersync instance sync-rules deploy --filePath path/to/file

  $ npx powersync instance sync-rules deploy -f path/to/file

See code: src/commands/instance/sync-rules/deploy.ts

powersync instance sync-rules generate-schema

Generate schema in your language from your sync rules config file.

USAGE
  $ npx powersync instance sync-rules generate-schema -f <value> [-l js|dart]

FLAGS
  -f, --filePath=<value>   (required) Path to the sync rules config file.
  -l, --language=<option>  Choose language for output.
                           <options: js|dart>

DESCRIPTION
  Generate schema in your language from your sync rules config file.

EXAMPLES
  $ npx powersync instance sync-rules generate-schema

  $ npx powersync instance sync-rules generate-schema --filePath path/to/file

  $ npx powersync instance sync-rules generate-schema -f path/to/file

See code: src/commands/instance/sync-rules/generate-schema.ts

powersync instance sync-rules validate

Validate sync rules from a local sync rules config file.

USAGE
  $ npx powersync instance sync-rules validate -f <value>

FLAGS
  -f, --filePath=<value>  (required) Path to the sync rules config file.

DESCRIPTION
  Validate sync rules from a local sync rules config file.

EXAMPLES
  $ npx powersync instance sync-rules validate

  $ npx powersync instance sync-rules validate --filePath path/to/file

  $ npx powersync instance sync-rules validate -f path/to/file

See code: src/commands/instance/sync-rules/validate.ts

powersync instances

View list of instances.

USAGE
  $ npx powersync instances

DESCRIPTION
  View list of instances.

EXAMPLES
  $ npx powersync instances

See code: src/commands/instances.ts

Readme

Keywords

none

Package Sidebar

Install

npm i powersync

Weekly Downloads

2

Version

0.4.0

License

UNLICENSED

Unpacked Size

2 MB

Total Files

43

Last publish

Collaborators

  • journeyapps-platform