{"name":"@putout/plugin-package-json","version":"8.3.0","type":"module","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin for package.json","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-package-json#readme","main":"lib/index.js","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git+https://github.com/coderaiser/putout.git"},"scripts":{"test":"madrun test","watch:test":"madrun watch:test","lint":"madrun lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","fix:lint":"madrun fix:lint","coverage":"madrun coverage","report":"madrun report"},"dependencies":{},"keywords":["putout","putout-plugin","plugin","package-json"],"devDependencies":{"@putout/test":"^11.0.0","c8":"^10.0.0","eslint":"^9.0.0","eslint-plugin-n":"^17.0.0","eslint-plugin-putout":"^23.0.0","lerna":"^6.0.1","madrun":"^10.0.0","nodemon":"^3.0.1"},"peerDependencies":{"putout":">=36"},"license":"MIT","engines":{"node":">=18"},"publishConfig":{"access":"public"},"_id":"@putout/plugin-package-json@8.3.0","gitHead":"384457410fd822ed0e224a33617f84bff1531961","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"22.8.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-tnz9vlOdU28YtIbuAhTSh6AgDxhVOLiRDCN2VQtHEJIBtN+dExb9YaUuE7oB5au5wpCXilpdPwYnWDwUjzCbHA==","shasum":"5030b47d3892921e85315ded60764421674f4b55","tarball":"http://registry-npm.ywwl.com/@putout/plugin-package-json/download/@putout/plugin-package-json-8.3.0.tgz","fileCount":13,"unpackedSize":15599,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICJ9LPHJL5WzOZccdcTao8abvLtJLXSYEOhL3RP3HvhrAiEAiET6luaYnpV5UrX67cl/OKNKKcgOt1NJPV8ByDcLSTk="}],"size":5208,"noattachment":false,"key":"/@putout/plugin-package-json/-/@putout/plugin-package-json-8.3.0.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-package-json_8.3.0_1727950488047_0.1915703800575792"},"_hasShrinkwrap":false,"readme":"# @putout/plugin-package-json [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-package-json.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-package-json\"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin helps to automate fixing `package.json`.\n\n## Install\n\n```\nnpm i @putout/plugin-package-json -D\n```\n\n## Rules\n\n- ✅ [add-type](#add-type);\n- ✅ [apply-https-to-repository-url](#apply-https-to-repository-url);\n- ✅ [find-file](#find-file);\n- ✅ [remove-nyc](#remove-nyc);\n- ✅ [remove-commit-type](#remove-commit-type);\n- ✅ [remove-exports-with-missing-files](#remove-exports-with-missing-files);\n\n## Config\n\n```json\n{\n    \"rules\": {\n        \"package-json/add-type\": \"on\",\n        \"package-json/apply-https-to-repository-url\": \"on\",\n        \"package-json/remove-nyc\": \"on\",\n        \"package-json/remove-commit-type\": \"on\",\n        \"package-json/remove-exports-with-missing-files\": \"off\",\n        \"package-json/find-file\": \"off\"\n    }\n}\n```\n\n## add-type\n\nAdd [`type`](https://nodejs.org/dist/latest-v17.x/docs/api/packages.html#type) field to `package.json`:\n\n```diff\n{\n    \"name\": \"hello\",\n    \"version\": \"1.0.0\",\n+   \"type\": \"commonjs\"\n}\n```\n\n## apply-https-to-repository-url\n\nThe `git://` protocol for GitHub repos should not be used due [security concerns](https://github.blog/security/application-security/improving-git-protocol-security-github/).\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/63ab077723e3ff368fa4e3472f9a36f3/048984adbf078a7d153ea44100d3f03676aa02d5).\n\n```diff\n{\n  \"repository\": {\n    \"type\": \"git\",\n-   \"url\": \"git://github.com/coderaiser/putout.git\"\n+   \"url\": \"git+https://github.com/coderaiser/putout.git\"\n  }\n```\n\n## remove-nyc\n\n- additional fields in `package.json` produces more traffic then users of your package really need;\n- [c8](https://github.com/bcoe/c8) uses [same config name and format](https://github.com/bcoe/c8/blob/v7.3.5/lib/parse-args.js#L8) so transition between tools will be much easier;\n\n### ❌ Example of incorrect code\n\n`nyc` section in `package.json`:\n\n```json\n{\n    \"nyc\": {\n        \"check-coverage\": \"on\",\n        \"all\": \"on\",\n        \"exclude\": [\n            \"**/*.spec.js\",\n            \"**/fixture\",\n            \"test\",\n            \".*.js\"\n        ],\n        \"branches\": 100,\n        \"lines\": 100,\n        \"functions\": 100,\n        \"statements\": 100\n    }\n}\n```\n\n### ✅ Example of correct code\n\nFile `.nycrc.json`:\n\n```json\n{\n    \"check-coverage\": \"on\",\n    \"all\": \"on\",\n    \"exclude\": [\n        \"**/*.spec.js\",\n        \"**/fixture\",\n        \"test\",\n        \".*.js\"\n    ],\n    \"branches\": 100,\n    \"lines\": 100,\n    \"functions\": 100,\n    \"statements\": 100\n}\n```\n\n## remove-commit-type\n\nSince 🎁**Wisdom** [v14](https://github.com/coderaiser/wisdom/releases/tag/v14.0.0) `commitType` set to `colon` be default, so it can be dropped from `package.json` if it's value not `paren`:\nCheck out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/eb12c902c8e99effc91ae44119d625d7/8e60d60b2c2e7bb28ca5b2eba61715a062ac5319).\n\n```diff\n{\n    \"name\": \"hello\",\n    \"version\": \"1.0.0\",\n    \"commitType\": \"colon\"\n}\n```\n\n## find-file\n\nFind `package.json` inside of `.filesystem.json` and applies all other `package-json` rules.\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/325233d19fde0acacadbcf1f42dd3bb2/124a50fe0e92c6c3cab24f8b87c33b202dc3e540).\n\n```diff\n{\n    \"name\": \"hello\",\n    \"version\": \"1.0.0\",\n+   \"type\": \"commonjs\"\n}\n```\n\n## remove-exports-with-missing-files\n\nFind `package.json` inside of `.filesystem.json` and removes `exports` with missing files.\n\nCheckout in 🐊**Putout Editor**:\n\n- [`remove-exports-with-missing-files`](https://putout.cloudcmd.io/#/gist/c79a69b797ccd2d94499349150e65f7c/37a48a054b98299cb15e71c3eaeb23b0b919d62c);\n- [`find-keys`](https://putout.cloudcmd.io/#/gist/b138e991aa21ad0ffb562b4c6fe6290f/cca92b8b87ca9d91c0a280991a1558a5e3fc260b);\n- [`remove-keys`](https://putout.cloudcmd.io/#/gist/b2fa6fba917a22bfc676f01532b4794e/e5970eb901ef5b29f7c143f76df9a10148b69d9e);\n\n```diff\n__putout_processor_filesystem([\n    \"/\",\n    [\"/package.json\", `{\n        \"exports\": {\n            \"./parse-options\": \"./lib/parse-options/index.js\",\n-            \"./loader\": \"./lib/loader.mjs\"\n        }\n    }`],\n    \"/lib/\",\n    \"/lib/parse-options/\",\n    [\"/lib/parse-options/index.js\", \"export const a = 5\"],\n]);\n```\n\n## License\n\nMIT\n","publish_time":1727950488276,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1727950488276,"dist-tags":{"latest":"11.3.0"}}