Yarn: Yarn npm_package_config equivalent

Created on 25 Mar 2017  路  7Comments  路  Source: yarnpkg/yarn

Is there an equivalent in yarn to: npm_package_config ?

For instance if I wanted to access the config object below using npm, I could access it with: $npm_package_config_base

package.json:

{
  "config": {
    "base": "/home/"
  }
}
cat-compatibility help wanted triaged

Most helpful comment

@BYK and @shankarshastri I'd like to re-open this as I don't think this is fixed.

Willing to contribute to this, but wanted to do a sanity check with you first to make sure I'm not misunderstanding something.

https://github.com/cantide5ga/yarn-npm_package_config-support demonstrates the bug.

All 7 comments

We'll be working on workspaces feature that will address multi folder projects

@bestander: This doesn't necessarily have anything to do with multi-folder projects. npm_package_config is generic mechanism for defining variables in the package.json and then referencing them in scripts in a way that users can control using npm config. From the docs:

A "config" object can be used to set configuration parameters used in package scripts that persist across upgrades. For instance, if a package had the following:

{ "name" : "foo", "config" : { "port" : "8080" } }

and then had a "start" command that then referenced the npm_package_config_port environment variable, then the user could override that by doing npm config set foo:port 8001.

@wincent, you are right, we should support it.

@bestander, This feature is so important to migrate from npm to yarn. But yarn doesnt support it still? Can you tell in which yarn version will it available?

@shankarshastri, this is a community project and this feature will be available right after you submit a PR for this feature.

This should be fixed in recent versions of Yarn. Please reopen if it is missing anything.

@BYK and @shankarshastri I'd like to re-open this as I don't think this is fixed.

Willing to contribute to this, but wanted to do a sanity check with you first to make sure I'm not misunderstanding something.

https://github.com/cantide5ga/yarn-npm_package_config-support demonstrates the bug.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danez picture danez  路  3Comments

ocolot picture ocolot  路  3Comments

catkins picture catkins  路  3Comments

sebmck picture sebmck  路  3Comments

davidmaxwaterman picture davidmaxwaterman  路  3Comments