npm publish

पैकेज और रनटाइम

इस्तेमाल

npm publish [--access public] [--tag <tag>]

package को registry पर चढ़ाता है; scoped नाम डिफ़ॉल्ट रूप से निजी होता है इसलिए --access public चाहिए, और कोई भी version संख्या दोबारा काम नहीं आती, सो पहले --dry-run से फ़ाइल सूची देख लें।

आम विकल्प

विकल्पअर्थ
--access publicrequired for a scoped package, which is private by default
--tag <tag>publish under a tag such as next, leaving latest alone
--dry-runshow the file list and version without uploading
--otp <code>pass a two-factor code
--provenanceattach a signed build statement from CI

उदाहरण

npm publish --dry-run

shows exactly which files would ship

npm publish --access public

publishes @scope/name so anyone can install it

npm publish --tag next

a prerelease that npm install does not pick up

सवाल हमेशा यही है कि क्या कहाँ जाए: इस प्रोजेक्ट के भीतर, या पूरी मशीन पर।

कैसे पढ़ें

  • बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
  • तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
  • विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।

आम सवाल

Q. npm publish क्या करता है?

package को registry पर चढ़ाता है; scoped नाम डिफ़ॉल्ट रूप से निजी होता है इसलिए --access public चाहिए, और कोई भी version संख्या दोबारा काम नहीं आती, सो पहले --dry-run से फ़ाइल सूची देख लें।

Q. इसे कैसे लिखें?

npm publish [--access public] [--tag <tag>] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

Q. कितने विकल्प जानने लायक़ हैं?

यहाँ 5 दिए हैं; पूरी सूची man npm में है। यह कमांड पैकेज और रनटाइम में आती है।

मिलती-जुलती कमांड

man पेज: man npm-publish