mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
* Adding the JS SDK to the core repo * Create tough-crews-shout.md * cleaning up some files * Removed generated files * updated tests to vitest * migrating to vitest * updated api mocking * updated api mocking for tfa * updated comments and fields tests * updated the rest of the handler tests * updated the rest of the tests * fix build output * update license year * moved package to packages/sdk * updated package lock * Move vitest config to 'vitest.config.ts' As we have it in the api (since no vite only vitest) * Sort package.json file As we did for the other packages * remove argon2 dependency --------- Co-authored-by: rijkvanzanten <rijkvanzanten@me.com> Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
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 / Prettierpnpm 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
- Create a new version / tag by running
pnpm version <version>. Tip: usepnpm version patch|minor|majorto auto-bump the version number - 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.