This repository can be seen as an alternative proposal to the current Directus CLI.
Note: The code is a very brief work in progress. At the moment only types generation from a Directus instance is supported.
At this time, the CLI is not yet available via npm, yarn or pnpm. However, I have added an installable version to the GitHub repository.
yarn add https://github.com/aurelienbobenrieth/unofficial-directus-cli/raw/main/unofficial-directus-cli-v0.1.0.tgzunofficial-directus-cli [command]Generate types from a Directus schema.
unofficial-directus-cli typegen <directusUrl> <staticToken> [options]<directusUrl>: Directus base URL.<staticToken>: Admin user static token.
Options:
-o, --outputPath <outputPath>: Path where the generated types will be saved. Default:./directus-types.ts.-c, --collectionName <collectionName>: Custom collection name for your generated types. Default:DirectusTypes.-s, --sdkPath <sdkPath>: The path from where the unofficial SDK should be loaded. Default:directus-sdk.
Example:
unofficial-directus-cli typegen https://localhost:8055 myStaticToken -o ./types/directus-types.ts -c CustomDirectusTypesPlease note that the typegen command requires an active Directus instance.
To check the version of the CLI, you can use the -v or --vers option:
unofficial-directus-cli -vor
unofficial-directus-cli --vers