Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

ability to alias dependencies in component.json #141

Closed
andrewrk opened this issue Nov 7, 2012 · 7 comments
Closed

ability to alias dependencies in component.json #141

andrewrk opened this issue Nov 7, 2012 · 7 comments

Comments

@andrewrk
Copy link

andrewrk commented Nov 7, 2012

This would save you from having to use if statements to check for the window object and save people from making repositories like https://github.com/juliangruber/events which simply wraps the component/events component and names it identically to the node one.

For example this would solve component/inherit#2

@juliangruber
Copy link

What exactly do you propose?

@andrewrk
Copy link
Author

andrewrk commented Nov 7, 2012

Option 1. You could optionally supply an object instead of a string to a dependency:

{
  "dependencies": {
    "juliangruber/events": {version: "*", alias: "foo-events"}
    "component/inherit": "*"
  }
}

In this example, require('events') would not work, but require('foo-events') would work.

Option 2. Explicitly list aliases.

{
  "dependencies": {
    "juliangruber/events": {version: "*", alias: "foo-events"}
    "component/inherit": "*"
  },
  "dependencyAliases": {
    "foo-events": "juliangruber/events"
  }
}

In this example, require('events') and require('foo-events') would both work.

@avetisk
Copy link

avetisk commented Nov 7, 2012

In this example, require('events') would not work, but require('events') would work.

Something's wrong here.

@andrewrk
Copy link
Author

andrewrk commented Nov 7, 2012

Oops. Edited.

@tj
Copy link
Contributor

tj commented Nov 7, 2012

-1 from me, I still want to pretend node doesn't exist. We've also been annoyed by -component in npm, but there's no reason we should be tweaking components to fix npm's fault. a try/catch works fine though it is ugly. Recent npm supports name/proj as deps though BTW that might help a bit

@tj tj closed this as completed Nov 7, 2012
@andrewrk
Copy link
Author

andrewrk commented Nov 7, 2012

component already solves 95% of the problem of creating components that work both in node.js and component. Can't we gently push it the rest of the way?

@tj
Copy link
Contributor

tj commented Nov 7, 2012

it doesn't have anything to do with node, npm's namespacing issue is its own deal, we need to keep things focused

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

4 participants