From f6a1e967a23dbcc6b0516529429792dc911cce72 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 24 Mar 2026 19:18:09 +0100 Subject: [PATCH 1/2] replace npx directus by npx d9 Signed-off-by: louis --- docs/app/faq.md | 2 +- docs/extensions/migrations.md | 10 +++--- docs/getting-started/support.md | 2 +- docs/self-hosted/cli.md | 41 +++++++++++++------------ docs/self-hosted/config-options.md | 2 +- docs/self-hosted/upgrades-migrations.md | 4 +-- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/docs/app/faq.md b/docs/app/faq.md index 4f648c52b..12793cca8 100644 --- a/docs/app/faq.md +++ b/docs/app/faq.md @@ -7,7 +7,7 @@ You can do this with the following command: ```sh -npx directus users passwd --email admin@example.com --password newpasswordhere +npx d9 users passwd --email admin@example.com --password newpasswordhere ``` ## Why isn't d9 properly saving Chinese characters or emoji? diff --git a/docs/extensions/migrations.md b/docs/extensions/migrations.md index 227a28091..14dc6bfab 100644 --- a/docs/extensions/migrations.md +++ b/docs/extensions/migrations.md @@ -59,13 +59,13 @@ directory. In general, you need the following flow: ```sh # Option 1 -npx directus bootstrap -npx directus schema apply ./path/to/snapshot.yaml +npx d9 bootstrap +npx d9 schema apply ./path/to/snapshot.yaml # Option 2 - without bootstrap, you must ensure that you run all required `bootstrap` tasks -npx directus database install -npx directus database migrate:latest -npx directus schema apply ./path/to/snapshot.yaml +npx d9 database install +npx d9 database migrate:latest +npx d9 schema apply ./path/to/snapshot.yaml ``` Take notice here - to comply with this flow, `migrations` directory **must not contain** tasks that modify the contents diff --git a/docs/getting-started/support.md b/docs/getting-started/support.md index e22259bce..f1b6aa293 100644 --- a/docs/getting-started/support.md +++ b/docs/getting-started/support.md @@ -14,7 +14,7 @@ If you're experiencing issues or think you have found a problem in d9, be sure t 1. Ensure your server and database meet the [minimum requirements](/self-hosted/docker-guide.html#supported-databases). 2. Ensure you're on the [latest version]({{GITHUB_URL}}/releases/latest) of d9. -3. Stop `CTRL+C` and restart the server `npx directus start`. +3. Stop `CTRL+C` and restart the server `npx d9 start`. 4. Run the database migration script: `directus database migrate:latest`\ _Note: backup your database first._ 5. Disable any data-caching within your project. diff --git a/docs/self-hosted/cli.md b/docs/self-hosted/cli.md index 8bcf247fb..19214cf51 100644 --- a/docs/self-hosted/cli.md +++ b/docs/self-hosted/cli.md @@ -17,12 +17,13 @@ readTime: 7 min read ## Server -For server-side CLI, all functionality can be accessed by running `npx directus ` in your project folder. +For server-side CLI, all functionality can be accessed by running `npx d9 ` in your project folder. +For legacy purposes, the CLI is also accessible via `npx directus `. ### Initialize a New Project ```bash -npx directus init +npx d9 init ``` Will install the required database driver, and create a `.env` file based on the inputted values. @@ -30,7 +31,7 @@ Will install the required database driver, and create a `.env` file based on the ### Bootstrap a Project ```bash -npx directus bootstrap +npx d9 bootstrap ``` Will use an existing `.env` file (or existing environment variables) to either install the database (if it's empty) or @@ -57,7 +58,7 @@ custom migration or an external service, for example). ### Install the Database ```bash -npx directus database install +npx d9 database install ``` Installs the initial d9 system tables on an empty database. Used internally by `bootstrap`. @@ -70,13 +71,13 @@ You may want to use `directus bootstrap` instead. ### Upgrade the Database ```bash -npx directus database migrate:latest -npx directus database migrate:up -npx directus database migrate:down +npx d9 database migrate:latest +npx d9 database migrate:up +npx d9 database migrate:down ``` Migrate the database up/down to match the versions of d9. Once you update d9 itself, make sure to run -`npx directus database migrate:latest` (or `npx directus bootstrap`) to update your database. +`npx d9 database migrate:latest` (or `npx d9 bootstrap`) to update your database. ### Migrate Schema to a different Environment @@ -90,13 +91,13 @@ collections, fields, and relations, and their configuration. This snapshot can b with your team. To generate the snapshot, run ```bash -npx directus schema snapshot ./snapshot.yaml +npx d9 schema snapshot ./snapshot.yaml ``` To run non-interactively (e.g. when running in a CI/CD workflow), run ```bash -npx directus schema snapshot --yes ./snapshot.yaml +npx d9 schema snapshot --yes ./snapshot.yaml ``` Note, that this will force overwrite existing snapshot files. @@ -107,7 +108,7 @@ To keep multiple snapshot organized by date, create a folder `snapshots` in your following custom script to your `package.json`: ```bash -"create-snapshot": "npx directus schema snapshot ./snapshots/\"$(date \"+%F\")\"-snapshot-\"$(date \"+%s\")\".yaml" +"create-snapshot": "npx d9 schema snapshot ./snapshots/\"$(date \"+%F\")\"-snapshot-\"$(date \"+%s\")\".yaml" ``` When you run the command via `npm run create-snapshot` it will create a new snapshot with the following naming schema: @@ -126,19 +127,19 @@ snapshot. To apply the generated snapshot, run ```bash -npx directus schema apply ./path/to/snapshot.yaml +npx d9 schema apply ./path/to/snapshot.yaml ``` To run non-interactively (e.g. when running in a CI/CD workflow), run ```bash -npx directus schema apply --yes ./path/to/snapshot.yaml +npx d9 schema apply --yes ./path/to/snapshot.yaml ``` To diff the schema and database and print out the planned changes, run ```bash -npx directus schema apply --dry-run ./path/to/snapshot.yaml +npx d9 schema apply --dry-run ./path/to/snapshot.yaml ``` ### Creating Users @@ -146,7 +147,7 @@ npx directus schema apply --dry-run ./path/to/snapshot.yaml To create a new user with a specific role, run ```bash -npx directus users create --email --password --role +npx d9 users create --email --password --role ``` #### Updating User Password @@ -154,7 +155,7 @@ npx directus users create --email --password --role --password +npx d9 users passwd --email --password ``` ### Creating Roles @@ -162,7 +163,7 @@ npx directus users passwd --email --password To create a new role, run ```bash -npx directus roles create --role +npx d9 roles create --role ``` These roles are created with the @@ -172,7 +173,7 @@ the App by default. To create a new role with admin access, set the `--admin` flag to `true`, such as ```bash -npx directus roles create --role --admin true +npx d9 roles create --role --admin true ``` ### Count Items in a Collection @@ -180,14 +181,14 @@ npx directus roles create --role --admin true To count the amount of items in a given collection, run ```bash -npx directus count +npx d9 count ``` --- ## Client -For the client-side CLI, all functionality can be accessed by running `npx directusctl `. You can also install +For the client-side CLI, all functionality can be accessed by running `npx d9ctl `. You can also install `@wbce-d9/cli` on your project dependencies or globally on your machine. Note that if you run `directusctl` (installed globally) in a folder containing a project that has a version of `@wbce-d9/cli` installed, the running global CLI will forward it's execution to the local installed version instead. diff --git a/docs/self-hosted/config-options.md b/docs/self-hosted/config-options.md index cfbea4e4f..4e61567d9 100644 --- a/docs/self-hosted/config-options.md +++ b/docs/self-hosted/config-options.md @@ -17,7 +17,7 @@ folder of your project) for its configuration. You can change this path and file environment variable before starting d9. For example: ```bash -CONFIG_PATH="/path/to/config.js" npx directus start +CONFIG_PATH="/path/to/config.js" npx d9 start ``` In case you prefer using a configuration file instead of environment variables, you can also use the `CONFIG_PATH` diff --git a/docs/self-hosted/upgrades-migrations.md b/docs/self-hosted/upgrades-migrations.md index 38897896f..e7dc94886 100644 --- a/docs/self-hosted/upgrades-migrations.md +++ b/docs/self-hosted/upgrades-migrations.md @@ -14,7 +14,7 @@ readTime: 4 min read 1. Backup your project 2. Run `npm update` -3. Run `npx directus database migrate:latest` to update the DB +3. Run `npx d9 database migrate:latest` to update the DB ## Backing-up a Project @@ -40,7 +40,7 @@ d9 can be reverted to an earlier version by going to your terminal, navigating i running `npm install directus@`. If you ran any database migrations for a newer version, you can revert those by running -`npx directus database migrate:down` +`npx d9 database migrate:down` ## Deleting a Project From fba34f024e88b8411ede4fa3050d3a6c842bfcd9 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 24 Mar 2026 19:19:25 +0100 Subject: [PATCH 2/2] also in readme and etc... Signed-off-by: louis --- CLAUDE.md | 2 +- api/src/cli/commands/init/index.ts | 2 +- directus/readme.md | 2 +- readme.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index bffdb3238..f9e48cfa5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -25,7 +25,7 @@ Every debugging session is a potential contribution. Run `/d9-skills:skillops` t ## Important rules -- Code identifiers `@directus/`, `directus_*`, `DIRECTUS_*`, `npx directus`, `new Directus()` must NEVER be renamed +- Code identifiers `@directus/`, `directus_*`, `DIRECTUS_*`, `npx d9`, `new Directus()` must NEVER be renamed - Plugins must be rebuilt (`pnpm build` in plugins/) before any deployment - AWS region is eu-west-3 (Paris) for all services - Contact: support@webcapsule.io diff --git a/api/src/cli/commands/init/index.ts b/api/src/cli/commands/init/index.ts index 851b2cb78..2d82dc0d5 100644 --- a/api/src/cli/commands/init/index.ts +++ b/api/src/cli/commands/init/index.ts @@ -120,7 +120,7 @@ export default async function init(): Promise { process.stdout.write(`\nThe configuration can be found in ${chalk.green(rootPath + '/.env')}\n`); process.stdout.write(`\nStart Directus by running:\n`); process.stdout.write(` ${chalk.blue('cd')} ${rootPath}\n`); - process.stdout.write(` ${chalk.blue('npx directus')} start\n`); + process.stdout.write(` ${chalk.blue('npx d9')} start\n`); process.exit(0); } diff --git a/directus/readme.md b/directus/readme.md index 2e158b472..db27f4738 100644 --- a/directus/readme.md +++ b/directus/readme.md @@ -51,7 +51,7 @@ yarn install @wbce-d9/directus9 Create a new project with our simple CLI tool: ``` -npx directus init +npx d9 init ``` The above command will create a directory with your project name, then walk you through the database configuration and diff --git a/readme.md b/readme.md index 2b3507fa0..ea71d3e8d 100644 --- a/readme.md +++ b/readme.md @@ -68,7 +68,7 @@ import { ... } from "@wbce-d9/some-package" ```bash npm update -npx directus start +npx d9 start ``` ## JS SDK