Skip to content
This repository has been archived by the owner on Aug 2, 2018. It is now read-only.

Dependency naming trouble with a component.json #301

Closed
micky2be opened this issue Sep 8, 2014 · 7 comments
Closed

Dependency naming trouble with a component.json #301

micky2be opened this issue Sep 8, 2014 · 7 comments

Comments

@micky2be
Copy link

micky2be commented Sep 8, 2014

I realize this is mainly a problem of compatibility with Component but here I am.
In many of my component.json files I may have something like:

{
    "dependencies": {
        "user/repo-name": "*"
    }
}

But the actual name of the component could be "repoName".
Which mean requiring it from JavaScript will give var repoName = require('repoName');

Duo doesn't seem to install the component if this is the case, nor output an error or warning.
To avoid myself and others to rename components already out there is it possible for Duo to manage it like Component does?

@stephenmathieson
Copy link
Contributor

Duo doesn't seem to install the component if this is the case

yeah, duo (by design) only includes what you actually require. the "name": "..." isn't respected from component.json, so you'll have to require('foo') when you need to require the foo module.

@matthewmueller
Copy link
Contributor

@micky2be ah yah, I don't think the name indirection makes much sense to be honest, especially when they're different. Are you running into this a lot? Which components?

Note: you can run DEBUG=duo* duo ... to see which components do not resolve.

@micky2be
Copy link
Author

micky2be commented Sep 9, 2014

For now the repos causing trouble with naming are ours.

Just started to switch to Duo so will see how it goes.

@micky2be
Copy link
Author

Closing since this is more an issue on my side than within Duo

@micky2be
Copy link
Author

Just noticed satazor/SparkMD5 suffer from the same problem.
The name of the component being md5 it makes it impossible to use it in Duo through a manifest file.

@matthewmueller
Copy link
Contributor

@micky2be I think this would work:

component.json

{
  "dependencies": {
    "satazor/SparkMD5": "*"
  }
}

index.js

var md5 = require("SparkMD5");

@micky2be
Copy link
Author

require("SparkMD5"); will work indeed.
but with component it was require("md5");

So within my app I can deal with it, but let's say an other component has SparkMD5 as dependency, it won't work until that component update.

I closed the issue because, personally I can deal with it in my projects but it can be a problem people are gonna run into.
Not being fully Component compatible makes the switch a bit difficult.

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

No branches or pull requests

3 participants