dominictarr / rc

The non-configurable configuration loader for lazy people.
Other
1.02k stars 97 forks source link

Parsing of package.name for organizations #93

Closed danosaure closed 7 years ago

danosaure commented 7 years ago

Hi,

I have been starting to use organization packages from npmjs.

Most of my code are in the following format:

const packageJson = require('./package.json');
const config = rc(packageJson.name, {});

If I have the following in package.json:

  "name": "@someOrg/core",

I need to create the file .@someOrg/corerc which is not what I would expect. The following package would have created someOrg-core tarball from npm pack. Would it make sense to also have the same formula to find the rc file? I would prefer to create the file as .someOrg-corerc or even better .someOrg-core.rc.

Thanks,

dominictarr commented 7 years ago

Okay, so firstly, what you should do is write a module that parses the name they way you like it and start using it. rc(myOrgNameParser(packageJson.name), ...)

A lot of people use rc so we are very cautious about making changes and you have to make a really good case for it. A change that rewrites the name might be a breaking change for someone, because i don't really know what people are passing in.

I hadn't thought of passing in the name from the package.json, though, that is a good idea.

danosaure commented 7 years ago

I'm trying to suggest for you to find the rc file with another filename, not to break your current implementation (if the file .@org/namerc does not exist, then look for .org-namerc). That would not be a breaking change.

I was going to write a PR for it, but seems like i'll just write it for myself now.

thanks.