LinkedSoftwareDependencies / Components.js

🧩 A semantic dependency injection framework
https://componentsjs.readthedocs.io/
Other
41 stars 6 forks source link

Confused with an import from a node_module #25

Closed jaxoncreed closed 3 years ago

jaxoncreed commented 3 years ago

I'm currently using components.js on the Solid Community Server. Here (https://github.com/solid/community-server/blob/feat/idp-architecture-refactor/src/identity/provider/SolidOidcProvider.ts#L2) I import a class from a library installed inside node_modules.

However, when I run a build using componentsjs, I get the following error:

> @solid/community-server@0.3.0 build:components /Users/jackson/O/community-server
> componentsjs-generator -s src -c dist/components -i .componentsignore

Failed to load super class Provider of SolidOidcProvider in /Users/jackson/O/community-server/dist/identity/provider/SolidOidcProvider:
Could not load class Provider from /Users/jackson/O/community-server/dist/identity/provider/oidc-provider:
ENOENT: no such file or directory, open '/Users/jackson/O/community-server/dist/identity/provider/oidc-provider.d.ts'

It seems that componentsjs-generator thinks that 'oidc-provider' is a local file rather than an import from 'node-modules'. Any idea what's happening?

rubensworks commented 3 years ago

The generator does not support imports from other packages yet (https://github.com/LinkedSoftwareDependencies/Components-Generator.js/issues/39). In your case, the generator should not be concerned about it, so you can ignore it by adding Provider to this file: https://github.com/solid/community-server/blob/master/.componentsignore

jaxoncreed commented 3 years ago

@rubensworks I added "Provider" to components ignore so that it looked like this:

[
  "Error",
  "EventEmitter",
  "Provider"
]

But still got this error upon building:

> componentsjs-generator -s src -c dist/components -i .componentsignore

Could not load class or interface Configuration from /Users/jackson/O/community-server/dist/identity/provider/oidc-provider:
ENOENT: no such file or directory, open '/Users/jackson/O/community-server/dist/identity/provider/oidc-provider.d.ts'
rubensworks commented 3 years ago

That one should be fixable in the same way, just by adding Configuration to the ignore file.

rubensworks commented 3 years ago

Note that all of this is temporary until https://github.com/LinkedSoftwareDependencies/Components-Generator.js/issues/39 is resolved.

jaxoncreed commented 3 years ago

Ah thanks!