Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DaneTheory/0292f9ea41d152151072b5d201f1ccf5 to your computer and use it in GitHub Desktop.
Save DaneTheory/0292f9ea41d152151072b5d201f1ccf5 to your computer and use it in GitHub Desktop.
The Package (dot) JSON: A story of love, triumph, and general witchcraft/wizardry - InitFields: Publish Config
[{
"npm:current": {
"ref": "",
"source": [
]
},
"npm:legacy": {
"ref": "",
"source": [
]
},
"yarn:current": {
"ref": "https://yarnpkg.com/configuration/manifest#publishConfig",
"source": [
"This field contains various settings that are only taken into consideration when a package is generated from your local sources (either through 'yarn pack' or one of the publish commands like 'yarn npm publish').",
"('access') Defines the package access level to use when publishing packages to the npm registry. Valid values are public and restricted, but restricted usually requires to register for a paid plan (this is up to the registry you use).",
"('bin') If present, the top-level 'bin' field from the manifest will be set to this new value before the package is packed to be shipped to remote registries. This won't modify the real manifest, just the one stored within the tarball.",
"('browser') Same principle as the 'publishConfig.bin' property; this value will be used instead of the top-level 'browser' field when generating the workspace tarball.",
"('executableFiles') By default, for portability reasons, no files except those listed in the bin field will be marked as executable in the resulting package archive. The executableFiles field lets you declare additional fields that must have the executable flag (+x) set even if they aren't directly accessible through the bin field.",
"('main') Same principle as the 'publishConfig.bin' property; this value will be used instead of the top-level 'main' field when generating the workspace tarball.",
"('module') Same principle as the `publishConfig.bin` property; this value will be used instead of the top-level `module` field when generating the workspace tarball.",
"('registry') If present, will replace whatever registry is defined in the configuration when the package is about to be pushed to a remote location.",
"_example_:{ \n \"publishConfig\": { \n \"access\": \"public\", \n \"bin\": \"./build/bin.js\", \n \"browser\": \"./build/browser.js\", \n \"executableFiles\": [ \n \"./dist/shim.js\" \n ], \n \"main\": \"./build/index.js\", \n \"module\": \"./build/index.mjs\", \n \"registry\": \"https://npm.pkg.github.com\" \n }:_example_"
]
},
"yarn:legacy": {
"ref": "https://classic.yarnpkg.com/en/docs/package-json/#toc-publishconfig",
"source": [
"These configuration values will be used when publishing your package. You can tag your package, for example.",
"_example_:{ \n \"publishConfig\": {} \n }:_example_"
]
}
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment