Created
June 24, 2021 16:39
-
-
Save DaneTheory/b2a5f4329458ac8600a12be636eafea7 to your computer and use it in GitHub Desktop.
The Package (dot) JSON: A story of love, triumph, and general witchcraft/wizardry - InitFields: Optional Dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{ | |
| "npm:current": { | |
| "ref": "", | |
| "source": [ | |
| ] | |
| }, | |
| "npm:legacy": { | |
| "ref": "", | |
| "source": [ | |
| ] | |
| }, | |
| "yarn:current": { | |
| "ref": "https://yarnpkg.com/configuration/manifest#optionalDependencies", | |
| "source": [ | |
| "Similar to the 'dependencies' field, except that these entries will not be required to build properly should they have any build script. Note that such dependencies must still be resolvable and fetchable (otherwise we couldn't store it in the lockfile, which could lead to non-reproducible installs) - only the build step is optional.", | |
| "This field is usually not what you're looking for, unless you depend on the 'fsevents' package. If you need a package to be required only when a specific feature is used then use an optional peer dependency. Your users will have to satisfy it should they use the feature, but it won't cause the build errors to be silently swallowed when the feature is needed.", | |
| "_example_:{ \n \"optionalDependencies\": { \n \"fsevents\": \"^5.0.0\" \n } \n }:_example_" | |
| ] | |
| }, | |
| "yarn:legacy": { | |
| "ref": "https://classic.yarnpkg.com/en/docs/package-json/#toc-optionaldependencies", | |
| "source": [ | |
| "Optional dependencies can be used with your package, but are not required. If the optional package is not found, installation still continues.", | |
| "You can specify an exact version, a minimum version (e.g., '>=') or a range of versions (e.g. '>= ... <').", | |
| "_example_:{ \n \"optionalDependencies\": { \n \"package-5\": \"^1.6.1\" \n } \n }:_example_" | |
| ] | |
| } | |
| }] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment