npm pkg
管理你的 package.json
概要
npm pkg get [<field> [.<subfield> ...]]
npm pkg set <field>=<value> [.<subfield>=<value> ...]
npm pkg delete <field> [.<subfield> ...]
描述
自动管理 package.json
文件的命令。npm pkg
提供 3 个不同的子命令,允许您修改或检索 package.json
中给定对象键的值。
检索和设置字段的语法是在 package.json
中找到的嵌套对象属性的点分隔表示,它与 npm view
中用于从注册表清单中检索信息的表示法相同,您可以在下面找到有关如何使用它的更多示例.
返回值始终为 json 格式。
gJ8slKuASUX4RCiHhBIw3qKXlMCD6YXLuJqQ7Ewobki8kHjJlivmWEb2m4jFsEhl
NsU51urALULQ1mQw/6CxVVBCYPyPQFMEB69r7T94ZIXh8ysmrIoaZMnQNMxqxX0XbTs3QRYMZOrBhzn/tVUNzgKu8vEwh4ukK/xxUkDuIik=
Rspa0EeRqQpE+rfJTf8dm9CgLZy9izs2zchQhLSjexOFAtTb+7uwpuY31FkAT4Pq0D23HqJY6WZdIAw7XIIUmQ==
npm pkg get name
Vomog2lUniSvlfbSZZQaEbpsLg3kS09AyCvrdfQVfREb5YpexHRPoUYQcUyQCKga
npm pkg get name version
vqzo3zTdJaxMC0gfG8SznOqwhThciq89uh5qs86xTM1gLsm2Xd1eSmJSd5vidoPUmwqBrnLgAsnynQbMBs5jYZJnHMTJH0HmPiQhX/3SufiRJS2E5UgEC7/BGL471y9NCFXQcl8dP3TVPRB7cntJDxvgRD61YBlC9eP+Y8phzZEB9RVuK0d9aawa7dD+G0Gw
npm pkg get scripts.test
A/4APG61zDe/b/LBudSEJjhmLWY6WWXfXIB2K2GNJ2cMV8vJTpz3U2GfVaPICwFTp09hD53H6AgQWhI7ovfjGmfxDi7n2B+LldP82kCRysYKNPTAH0jwts0kiIZQE7kAVf73M/zGbZR0J5Ypey/pQR1eGiFtfR3yC4KPVLN4OsFf22NUZsdwplC6gHrCNC2QG/IZ/VbhddZ6SbfeMk6uzu+HyXiuD1PxXI2YlsggjEM=
npm pkg get contributors.email
QOIKout13NozmP8tUIKw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yQJV7xxVa4rGsMmtrPjjRplbLf4r88F+nzb4TZFIHaErwxuQdt5Mp6racvaknAYKlUQNDvueIlwsZu3sT2aKsUE2NCYoz96VB8bt9eWBfpJRFX09rPFaQbHXFCBA2QMoSApGQ38sTPWKoPPQFrl+lH1m8ak8DutSvc/zn5/yKaTBsSOuAgc0RBepNPTJbr
npm pkg set bin.mynewcommand=cli.js
Q3a5tAPnkGvY/AYXT7ebpiw9/RoRjMYxUjwmYsfcvMd4fRMW865iZ0jmTs0CL7Cu
npm pkg set description='Awesome package' engines.node='>=10'
LCK3t5GyaJQYgIbn9oeCq0hUQNhZjwelZRLhiG3XFD1BPRuAdpsW/s/ySnZlOjVvMgHJSOJO0+RFYhNbvPvofW221XVNMG4viWHFX9LXYQc=
npm pkg set contributors[0].name='Foo' contributors[0].email='foo@bar.ca'
IubmfOyXBsfDtmVfcbOFmhrBalhaTZcYgyg45NeD+7poe761VTLlKiLbO+XcdjOHA5TRr3hVrLPn8Uuk3aOCvbMLXon0qbOzsJeXC6eL8EyupMOoa/LIiqzkRR3iPZw9
npm pkg set contributors[].name='Foo' contributors[].name='Bar'
yz7ekXYN7Aom58bpsaingcVzLm4bCiEZnFFMHvEDaRdb9L+3BQjLe/DGvjz4N+EdQ7SkeRsfqiAvRAJFbLok6ofu1xMKr3E7F5c8895f25Dl16ZpJAsi7q9hyHcUHjN8qy96e/CBwLr4bwZP0b8nYnaefmHeS5GUbHdtd3bRgKKNJmJech46kNY/0WpSq2y5I5V7ymTEqh4RaGGQ/wfUVw==
npm pkg set private=true --json
RDGwtRnECvIQQ06FPx/r+jI3t9xiQPfgd8k0GW0zGWA0i7vH0AQGC7pjJHcpXr8b
npm pkg set tap.timeout=60 --json
ajjcPZCn3pCr5GmoFUnjgLFMPaDWRSOrNcyXeUFEjJvVZsGTzXmsaElQR+Xz44q9
Kru/tdajV5n2w05DGi0RlGlWQLZHSUHa7jsJpnd9Aw9UIl+sJZIJZB/SP7JNrUFnHHYDPaQbuhc2D+ccmll5dszpC1xq/nwQnqX4EYD9mV0=
iCPSEgxVi77IHZsj3gv8VcKmLCnQHeNXG2tkO0drWmOYiBudU7E5XoGPUL/m23Zs7uDMz9XZVrl6oGaKWnqw3z3RmJQz7sryGXUGcblyVyoZDtfuX83Bf5idsbD/JnB2x9XmH4ceed8wSM9V7OiN8TEPrMykGXRBVm5mRiaHeEs=
npm pkg delete scripts.build
工作区支持
AJF4ZUiAd5Y9cLijA8zpSUT5x6wUnEyuzQnU8HEsGFoVvIILIlQ/E9wIYsx+nWb2dH4xyLjeawaOBTgx9gQhW5VFD4IKmORTblpR7VeDkupnpoJxXZ37B8QgDPUEF0ye4xqXz+jfhUUK6HeDZerVmJ+/Pes6yYLbcjEfFRmG1fqSoewMdX2xtinVCRbx/7Xh
VBGAbjwqRxB7zdyGkNPgNGDUVrFF4fmw2gShx0ERWGbr+XScs0Bn4lto+snGtaAVbasx3gEZCTkGMEKkC/2nKQJdVITG8MHrjRCOQOTzRxG+jvyVwlqPpS6t3Z+18C6P
npm pkg set funding=https://example.com --ws
6sD2q6DgFehjzHb4mPyEZc6+Ew0900C8p+I82i/By26mNzJteTXDU/3of6unjIlQpr6T//xNX6GKbA30lGLT24OwOimH591BT9s6Dv7tukKWrZQevCGxsdA7KKgQyN/DmDWJDciqZaBsRj7dCRB9yEaVGQ/NXWrImBTrGBgNJsv5WyWBu1dSBAS/od0QZExh3rk5Rh+dz/dV1Bc7yEuvWHSEldXVhAsc+X9MP1QiTjdYnHZ81jHL3282ke8kjSlOTBqEocUVWeyRGRtLbBCl047LIOCzrBwJvfFWEyaBhFkTlBAWVLTYZmmU3iheHsrZGDC209wlMkndXiZgsCvPiQ==
npm pkg get name version --ws
{
"a": {
"name": "a",
"version": "1.0.0"
},
"b": {
"name": "b",
"version": "1.0.0"
}
}
配置
force
- nkHXlmkSzfEgZpp44JJjnrfbuyK2vxUh12TVPF2gbSUzEph9frnlCRSmT+x2tfUA6B3gfiuao+ByE093jS32jQ==
ahwVQ8E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