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

User-specified package.json #18

Open
namuol opened this issue May 2, 2014 · 2 comments
Open

User-specified package.json #18

namuol opened this issue May 2, 2014 · 2 comments

Comments

@namuol
Copy link

namuol commented May 2, 2014

Since napa is meant to be used with libraries that don't supply package.json, it could be useful to allow the user to specify their own custom file to integrate more naturally with node.js.

My use case is simple: I don't want to have to require the absolute path to the "index" file of a library.

In other words, this is what I'm doing now:

var lib = require('lib/bin/index.js');

...when I'd much rather just be able to do this:

var lib = require('lib');

So my suggestion is to allow the user to specify a package.json body along with any URL.

Example:

package.json:

{
  ...
  "napa": {
    "lib": {
      "url": "user/lib",
      "package.json": {
        "main": "bin/index.js"
      }
    }
  }
}

Another use-case might be a package that needs to be built ahead-of-time:

package.json:

{
  ...
  "napa": {
    "lib": {
      "url": "user/lib",
      "package.json": {
        "main": "bin/index.js",
        "scripts": {
          "install": "make"
        }
      }
    }
  }
}

I realize all of this could technically be achieved through scripts, but this would offer a more localized configuration.

Thoughts?

@shama
Copy link
Owner

shama commented May 2, 2014

That is a really cool idea. I am +1 for that.

Also, I created this package some time ago metamorph which will transform one meta file into another (but is in serious need of an update). It might be cool to detect other common meta files and create a package.json from one of those, if a specific user overridden package.json key is not supplied.

@giggio
Copy link

giggio commented Jul 18, 2015

+1 to the idea. This would be really useful.
I don't know if you need a a full package.json. It would be enough for me to enable to specify the default main.

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

No branches or pull requests

3 participants