-
-
Notifications
You must be signed in to change notification settings - Fork 42
Refactor dependencies
and devDependencies
in the extensions
#234
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
base: main
Are you sure you want to change the base?
Refactor dependencies
and devDependencies
in the extensions
#234
Conversation
…n files for consistency. Added new contributor: joggienl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive dependency cleanup across all Directus extensions to resolve installation issues with pnpm install
, particularly when runtime dependencies cause conflicts (like the zod issue). The strategy is to bundle all third-party libraries into the extension's dist
output rather than requiring them at runtime.
- Moved bundleable dependencies to devDependencies: Third-party libraries like Google Maps API, Algolia SDK, Elasticsearch client, Vue utilities, etc. are now bundled during build time
- Eliminated unnecessary runtime dependencies: Most extensions now ship with zero runtime dependencies
- Removed peerDependencies where appropriate: Including collaborative-editing extension's peerDependencies
Reviewed Changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
contributors.yml | Added new contributor to the project |
packages/*/package.json (30+ files) | Moved runtime dependencies to devDependencies for bundling, eliminating unnecessary runtime deps |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
"vue-router": "4.5.0" | ||
}, | ||
"dependencies": { | ||
"vitest": "^3.1.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dependencies appear to be mixed with devDependencies in a single section. Build tools like prettier, typescript, and vitest should remain separate from runtime dependencies like @directus/memory and @directus/sdk. Consider organizing these into proper devDependencies and dependencies sections.
"vitest": "^3.1.3", | |
"vitest": "^3.1.3" | |
}, | |
"dependencies": { |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not having dependency
was the reason for this change. I am not sure about the inners of this extension in the sense of: are these dependencies actually needed at runtime?
I have actually installed this extension without installing the dependencies or devDependencies and it seems to work fine.
So perhaps the list of dependencies should be checked for if they are needed during dev or during production. But this change at least fixes the issue to be able to start Directus when manually installing it!
I took a stab at this because currently, my self-hosted Directus instances won't start after
installing certain extensions.
It happens when you use
pnpm install
to install the extensions. Note: the installation goes well,the server just won't start. It is caused by the extensions' dependencies. Particularly with zod (
see #232). This issue emerged with Directus 11.10.3.
I also noticed that installing extensions via the Marketplace works fine. This is because (if I
found out correctly) the Marketplace does not use
pnpm install
to install the extensions butrather downloads and extracts the extension's tarball.
Solution
In #232 I described that it might be useful to update the GitHub workflow to just cleanup the
package.json files to not include any dependencies (or peerDependencies) but I think the cleaner
approach would actually be to walk through the extensions and remove all runtime dependencies
(considering they are not used).
So, this PR implements a comprehensive dependency cleanup across all extensions to ensure they only
declare runtime dependencies when actually needed at runtime. The strategy is to bundle all
third-party libraries into the extension's
dist
output rather than requiring them at runtime.Key changes:
devDependencies
: Third-party libraries like Google MapsAPI, Algolia SDK, Elasticsearch client, Vue utilities, etc. are now bundled during build time
dependencies
whiteboard interface's special postinstall case) retain runtime dependencies
Impact
With these changes,
pnpm install --production
will:Extensions Updated (40+)
All extensions have been audited and updated, including popular ones like:
Exception:
whiteboard-interface
remains unchanged due to its special postinstall build processrequiring fabric at runtime.
Special note:
@directus-labs/collaborative-editing
had peerDependencies that I removed. I'mnot 100% sure if this is correct.
Verification
Each extension was built and its
dist
output inspected to ensure no unresolved external importsremain, confirming that bundling worked correctly and runtime dependencies are truly not needed.
This change aligns with the Extensions SDK's bundling capabilities and follows the principle that
extensions should be self-contained with minimal runtime footprint.
Fixes #232