Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
saerdnaer opened this issue Jun 11, 2024 · 1 comment
Open

Comments

@saerdnaer
Copy link

saerdnaer commented Jun 11, 2024

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
Copy link
Contributor

adussarps commented Jun 17, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants