LaWebcapsule / directus9

directus9 - openSource maintenance of directus
GNU General Public License v3.0
60 stars 8 forks source link

Incompability with directus-extension-schema-management-module? #62

Open saerdnaer opened 3 weeks ago

saerdnaer commented 3 weeks ago

Describe the Bug

Hi, the readme states

All classic Directus versions 9 extensions should work without any hurdle with this open source branch.

but when I try to add the directus-extension-schema-management-module via npm i directus-extension-schema-management-module it does not appear in the project/system settings as described in there readme. https://github.com/rezo-labs/directus-extension-schema-management-module?tab=readme-ov-file#get-started

When starting directus9 I get following error message:

"@directus/extensions-sdk" is imported by "node_modules/directus-extension-schema-management-module/dist/index.js", but could not be resolved – treating it as an external dependency.

Do I need to modify the code or tsconfig.json so this extension also works with this fork?

Directus Version

v9.26.11

Hosting Strategy

Self-Hosted (Custom)

adussarps commented 3 weeks ago

Hello @saerdnaer,

The limitation you're encountering with Directus 9 is known. Native Directus extensions typically require the main Directus modules, so installing them directly via npm install often fails. Here's a straightforward workaround, whether you prefer installing the extension via npm install or by adding the compiled code directly to the Directus extension folder.

Follow these steps for the directus-extension-schema-management-module:

  1. Fork the extension or create a new branch.

  2. Update the package.json dependencies:

    Change:

    "devDependencies": {
       "@directus/extensions-sdk": "9.18.1",
       "sass": "^1.55.0",
       "typescript": "^4.8.4",
       "vue": "^3.2.40"
    }

    To:

    "devDependencies": {
       "@wbce-d9/extensions-sdk": "9.26.4",  // Updated to the latest version
       "sass": "^1.55.0",
       "typescript": "^4.8.4",
       "vue": "^3.2.40"
    }
  3. Replace all @directus references with @wbce-d9 in the code (use find and replace).

  4. Build the extension and add the .cjs file to your Directus repo, typically at /extensions/modules/directus-extension-schema-management-module/index.cjs.

    Alternatively, you could rename the npm package and publish it for easier installation via npm.

  5. Restart Directus.

This should help you switch to a Directus 9-compatible extension. Let us know if you have any more questions!