Files
directus/packages/sdk
Connor 5e1f02dba1 Add TypeDocs to Docs (#18867)
* Create package

* TypeDoc Init Config

* Start Config

* Configure Packages

* Generation

* Add Plugins

* Vitepress Generation

* More Generation

* Fix Lock File

* Fix Connections

* Build Step

* Deployment Testing

* Fix Sidebar

* Fix Lock File

* Deployment Fix

* Change Sidebar

* Final POC/MVP Updates

* fix commands

* fix dev deps

* fix netlify functions

* CHANGELOG: Create warm-spiders-double.md

* Fix typing

* Remove double title

---------

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2023-06-13 10:18:22 -04:00
..
2023-05-19 10:39:25 -04:00
2023-05-19 10:39:25 -04:00
2023-06-13 10:18:22 -04:00
2023-05-19 10:39:25 -04:00

Directus JS SDK

Installation

npm install @directus/sdk

Basic Usage

import { Directus } from '@directus/sdk';

const directus = new Directus('http://directus.example.com');

const items = await directus.items('articles').readOne(15);
console.log(items);
import { Directus } from '@directus/sdk';

const directus = new Directus('http://directus.example.com');

directus
	.items('articles')
	.readOne(15)
	.then((item) => {
		console.log(item);
	});

Reference

See the docs for a full usage reference and all supported methods.

Contributing

Requirements

  • NodeJS LTS
  • pnpm 7.5.0 or newer

Commands

The following pnpm scripts are available:

  • pnpm lint  Lint the code using Eslint / Prettier
  • pnpm test  Run the unit tests

Make sure that both commands pass locally before creating a Pull Request.

Pushing a Release

This applies to maintainers only

  1. Create a new version / tag by running pnpm version <version>. Tip: use pnpm version patch|minor|major to auto-bump the version number
  2. Push the version commit / tag to GitHub (git push && git push --tags)

The CI will automatically build and release to npm, and generate the release notes.