{"name":"@putout/plugin-package-json","version":"8.2.0","keywords":["putout","putout-plugin","plugin","package-json"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/plugin-package-json@8.2.0","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-package-json#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"8bc4daca34a1352b3198c2516d18bec869b3cc80","tarball":"http://registry-npm.ywwl.com/@putout/plugin-package-json/download/@putout/plugin-package-json-8.2.0.tgz","fileCount":13,"integrity":"sha512-sqOA6IzIgjhO1hCXxQnNJF4AR46lzZ0tYNXlQ4w/+vPmi8f/kAY6gVOZ1wtjiWfBmgeOsWWqdpx6mzDHo6ckQA==","signatures":[{"sig":"MEQCIDEbDZs/iRl9+fRLKfUmSLnBJG4mO37LQpAlBARTPVHsAiBgz/5w2XsJgzQq6ZZvuy3llPUBxHg5/O3ENxixi+Is0Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14042,"size":4851,"noattachment":false,"key":"/@putout/plugin-package-json/-/@putout/plugin-package-json-8.2.0.tgz"},"main":"lib/index.js","type":"module","engines":{"node":">=18"},"gitHead":"34c58c48dd234d7ea14f2bec0da28fa865203208","release":false,"scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","coverage":"madrun coverage","fix:lint":"madrun fix:lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","watch:test":"madrun watch:test"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"changelog":false,"repository":{"url":"git+https://github.com/coderaiser/putout.git","type":"git"},"_npmVersion":"10.8.2","description":"🐊Putout plugin for package.json","directories":{},"_nodeVersion":"22.9.0","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","lerna":"^6.0.1","eslint":"^9.0.0","madrun":"^10.0.0","nodemon":"^3.0.1","@putout/test":"^11.0.0","eslint-plugin-n":"^17.0.0","eslint-plugin-putout":"^23.0.0"},"peerDependencies":{"putout":">=36"},"_npmOperationalInternal":{"tmp":"tmp/plugin-package-json_8.2.0_1727798694774_0.9968421244080972","host":"s3://npm-registry-packages"},"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":1727798694973,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1727798694973,"dist-tags":{"latest":"11.3.0"}}