-
Notifications
You must be signed in to change notification settings - Fork 935
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
Override any package.json key in overrides #1865
Comments
Implemented on #1890 as described above. |
…re (#1890) * validate package.json values entered by users against npm specs * merge package.json props from a more general rule to a specific one
@KutnerUri @qballer now we can implement benv as a component :)))))))) |
@itaymendel - so cool!! |
it's not yet GA, so docs are not public... But it should look like this (in your project's
If you want to play with it, you should clone Bit and build from master. |
SOO NICE! |
@itaymendel @GiladShoham: @davidfirst probably wiser would be to wrap in an object to avoid collisions with npm attributes. E.g. if npm decide to add "exclude" as a valid package property. |
@Tallyb but we don't want to wrap it because there are features on the root keys. |
overrides: {
"someRule/*": {
"env": {...},
"devDeps": {},
"exclude": true,
"package": {
"bin": "...",
"something": {}
}
}
} alternatively, you should put all internal variables (propagate, exclude) on some
|
@Tallyb. Ok understand. Make a total sense.. We will change it. |
@Tallyb Can you open a new issue for this improvement? if we keep it here we will forget it. |
Description
A developer should have better control over the component's
package.json
and its contents. At the moment the ability to so is limited due to the fact thatoverrides
only allows for modifications on thedependencies
,peerDependencies
anddevDependncies
fields. So if a developer wants to have abin
for the component - it is not possible.This hurts the component's flexibility.
Describe the solution you'd like
overrides
should allow setting ANY key/value pair in the component'spackage.json
. Bit should then take all values and set them to the calculatedpackage.json
.Blacklisted keys
There are some keys that the developer must not be able to override:
name
version
main
Input validation to package.json keys
Bit has to make sure that the calculated
package.json
will be a valid one. Meaning that if a specific key is used (for examplebin
) - its type should be according to the specs (perhaps using something like this?).In case the outcome for a component is not valid, Bit should not allow tagging the component and prompt with a message saying that the key is not set according to the
package.json
specs.Merging values of similar keys
The
overrides
feature supports merging fordependencies
,peerDependencies
anddevDependencies
in case that the same component fit more than one overriding rule. Bit should keep this behavior (and still ensure that the more specific rule wins).In cases where a merge is not possible (the value in either override rules is not of the same type) - the more specific rule should "win".
Adding keys outside of the package.json specs
Bit should allow developers to add any key they want, even if its not in the specs, as long as the output is still a valid json file. Additionally, all merge rules should support it as well.
The text was updated successfully, but these errors were encountered: