Entry

directus-to-data: basic usage

Solution

The following example. You can replace the yarn command with npm run

# package.json
{
  "scripts": {
    "data": "directus-to-data -c CollectionOne -c CollectionTwo --collection-output src/_data/{{collectionName}}.json",
    "_schema": "directus-to-data -c CollectionOne -c CollectionTwo --collection-output NO_WRITE --assets-output NO_WRITE",
    "schema:backup": "yarn _schema --backup-schema .directus.schema.json",
    "schema:restore": "yarn _schema --restore-schema .directus.schema.json",
    "schema:apply": "yarn schema:restore --apply-schema"
  }
}

# .directus.json
{
    "cmsUrl": "https://cms.example.com",
    "staticToken": "DAE_DOJ?1-edOJQHDS"
}

To install, use the following command:

# npm
npm install --save-dev directus-to-data
# Yarn
yarn add -D directus-to-data