Giter Club home page Giter Club logo

directus-template-cli's Introduction

Directus Template CLI

A CLI tool to make applying or extracting Directus "templates" a little easier...well a lot easier.

Notes:

  • This is a pre-release. It is recommended for use on POC, demo, or greenfield projects only.
  • ⚠️ Known issues with using MySQL currently, please use ONLY PostgreSQL or SQLite for your database provider.
  • Templates are applied / extracted on an all or nothing basis – meaning that all the schema, content, and system settings are extracted or applied. We'd love to support more granular operations in the future. (PRs welcome 🙏)
  • If you are extracting or applying from a remote source, the script can take quite a while depending on the "size" of your instance (how many collections, how many items in each collection, number and size of assets, etc). The script applies a strict rate limit of 10 requests per second using bottleneck.

Breaking Changes in v0.4.0

  • Templates are no longer being bundled with the CLI or included in this repository. Templates are stored in this repository - https://github.com/directus-community/directus-templates.
  • When applying templates, the schema snapshot / schema diff is no longer used to create collections, fields, and relations. This allows support for loading multiple templates into a single instance.

Usage

Using the @latest tag ensures you're receiving the latest version of the packaged templates with the CLI. You can review the specific versions on NPM and use @{version} syntax to apply the templates included with that version.

Applying a Template

  1. Create a Directus instance on Directus Cloud or using self-hosted version.
  2. Login and create a Static Access Token for the admin user.
  3. Copy the static token and your Directus URL.
  4. Run the following command on the terminal and follow the prompts.
$ npx directus-template-cli@latest apply

You can choose from our templates bundled with the CLI or you can also choose a template from a local directory.

Extracting a Template

The CLI can also extract a template from a Directus instance so that it can be applied to other instances.

  1. Make sure you remove any sensitive data from the Directus instance you don't want to include in the template.
  2. Login and create a Static Access Token for the admin user.
  3. Copy the static token and your Directus URL.
  4. Run the following command on the terminal and follow the prompts.
$ npx directus-template-cli@latest extract

License

This tool is licensed under the MIT License.

directus-template-cli's People

Contributors

bryantgillespie avatar alexvdvalk avatar joggienl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.