0.0.269 • Published 4 days ago

appwrite-utils-cli v0.0.269

Weekly downloads
-
License
-
Repository
github
Last release
4 days ago

appwrite-utils-cli

Overview

appwrite-utils-cli is a powerful command-line interface tool designed for Appwrite developers who need to manage database migrations, schema generation, data import, and much more. This CLI tool facilitates complex tasks like setting up databases, running migrations, generating schemas, and managing backups efficiently, making it an indispensable part of your Appwrite project management.

Features

  • Easy Configuration: Initialize your Appwrite project configurations and setup directly from the command line.
  • Database Migrations: Control the migration process with options to target production, staging, or development environments.
  • Schema Generation: Generate and manage TypeScript schemas directly from your Appwrite database schemas.
  • Data Import: Facilitate the import of data into your Appwrite databases with comprehensive command-line support.
  • Backup Management: Create backups of your Appwrite databases to ensure data integrity and safety.
  • Flexible Database Management: Includes commands to wipe databases, documents, or user data, providing flexibility in managing your database state during development or testing.

Installation

To use appwrite-utils-cli, you can install it globally via npm to make it accessible from anywhere in your command line:

npm install -g appwrite-utils-cli

However, due to the nature of the speed at which I am developing this project, I would recommend the following command:

npx --package=appwrite-utils-cli@latest appwrite-migrate -- --arg1 --arg2 --arg3

DO NOT INSTALL THIS LOCALLY INTO YOUR PROJECT, IT IS MEANT TO BE USED AS A COMMAND LINE TOOL ONLY

Usage

After installation, you can access the tool directly from your command line using the provided commands. Here's how you can use the different functionalities:

Initialization

Set up your Appwrite project with necessary configurations:

npx --package=appwrite-utils-cli@latest appwrite-setup

To generate an example configuration file:

appwrite-setup --example

To synchronize your appwriteConfig.yaml with your Appwrite Database, first you must run the setup command and enter your Appwrite instances details in the projectId, endpoint, and apiKey, then run the following

npx --package=appwrite-utils-cli@latest appwrite-migrate -- --sync

This will initialize your config and generate schemas for your database using ZOD to src/appwrite/schemas

Running Migrations and Tasks

Run migration and management tasks with specific flags according to your needs:

npx --package=appwrite-utils-cli@latest appwrite-migrate --args

Replace --args with the appropriate options:

  • --prod: Run tasks in the production environment.
  • --staging: Run tasks in the staging environment.
  • --dev: Run tasks in the development environment.
  • --wipe: Wipe all databases.
  • --wipe-docs or --wipeDocs: Wipe all documents in the databases.
  • --generate: Generate TypeScript schemas from database schemas.
  • --import: Import data into your databases.
  • --backup: Perform a backup of your databases.
  • --wipe-users or --wipeUsers: Wipe all user data.
  • --write-data or --writeData: Write converted imported data to file
  • --sync: Synchronize your project's config and generate schema for your database

For example, to run migrations in a development environment and import data:

npx --package=appwrite-utils-cli@latest appwrite-migrate --dev --import

To initialize your project, generate schemas, but not import data:

npx --package=appwrite-utils-cli@latest appwrite-migrate --init

This setup ensures that developers have robust tools at their fingertips to manage complex Appwrite projects effectively from the command line. I also have added logging automatically for information and errors as the console can be hard to keep up with.

Roadmap

  • Syncing configuration
  • Better file format for config (potentially)
  • Separation of collections and import configuration from main config

Changelog

  • 0.0.254: Added --sync to synchronize your Appwrite instance with your local appwriteConfig.yaml and generate schemas
  • 0.0.253: Added --writeData (or --write-data) to command to write the output of the import data to a file called dataLoaderOutput in your root dir
  • 0.0.23: Added batching to user deletion
  • 0.0.22: Converted all import processes except postImportActions and Relationship Resolution to the local data import, so it should be much faster.
  • 0.0.6: Added setTargetFieldFromOtherCollectionDocumentsByMatchingField for the below, but setting a different field than the field you matched. The names are long, but at least you know what's going on lmao.
  • 0.0.5: Added setFieldFromOtherCollectionDocuments to set an array of ID's for instance from another collection as a postImportAction
0.0.269

4 days ago

0.0.268

7 days ago

0.0.267

7 days ago

0.0.266

9 days ago

0.0.265

9 days ago

0.0.264

9 days ago

0.0.263

15 days ago

0.0.262

17 days ago

0.0.259

18 days ago

0.0.258

18 days ago

0.0.257

18 days ago

0.0.22

18 days ago

0.0.23

18 days ago

0.0.24

18 days ago

0.0.252

18 days ago

0.0.251

18 days ago

0.0.250

18 days ago

0.0.256

18 days ago

0.0.255

18 days ago

0.0.254

18 days ago

0.0.253

18 days ago

0.0.249

18 days ago

0.0.247

18 days ago

0.0.246

18 days ago

0.0.241

18 days ago

0.0.261

18 days ago

0.0.260

18 days ago

0.0.245

18 days ago

0.0.244

18 days ago

0.0.243

18 days ago

0.0.242

18 days ago

0.0.20

20 days ago

0.0.21

20 days ago

0.0.10

21 days ago

0.0.11

21 days ago

0.0.12

21 days ago

0.0.13

21 days ago

0.0.14

21 days ago

0.0.15

21 days ago

0.0.9

21 days ago

0.0.16

21 days ago

0.0.8

21 days ago

0.0.17

21 days ago

0.0.18

20 days ago

0.0.19

20 days ago

0.0.5

21 days ago

0.0.4

21 days ago

0.0.7

21 days ago

0.0.6

21 days ago

0.0.3

22 days ago

0.0.2

22 days ago

0.0.1

22 days ago