Upgrade to Pro — share decks privately, control downloads, hide ads and more …

npmパッケージ製作に関するあれこれ

7a505b4e9b90548d96971b37dc07e761?s=47 Tyankatsu
November 14, 2018

 npmパッケージ製作に関するあれこれ

7a505b4e9b90548d96971b37dc07e761?s=128

Tyankatsu

November 14, 2018
Tweet

More Decks by Tyankatsu

Other Decks in Technology

Transcript

  1. npmύοέʔδ੡࡞ʹؔ͢Δ ͋Ε͜Ε

  2. ͨͿΜ࣌ؒ଍Γͳ͍ͷͰ ৄࡉ͸ϒϩάʹॻ͖·͢ɻ

  3. ࣗݾ঺հ • νϟϯΧπ(@tyankatsu5) • ϑϩϯτΤϯυΤϯδχΞ • ࠷ۙGridsomeʹϋϚͬͯΔ • ޮ཰Խେ޷͖Ϛϯ

  4. cz-format-extension ΛೋਓͰ࡞ͬͯ·͢ɻ

  5. ໨࣍ • ύοέʔδ໊Λߟ͑Δ • ެ։ܗࣜΛߟ͑Δ • ϒϥοΫϦετͱϗϫΠτϦετ • npm publishͷ᠘

    • CHANGELOG.mdΛ࡞Δ • CONTRIBUTING.mdΛ࡞Δ • TemplateͰissueͱPRΛ͖Ε͍ʹग़ͤΔΑ͏ʹ͢Δ • travisͰnpmʹύοέʔδެ։ͯ͠΋Β͏ • travisͰσϓϩΠ࣌ͷnpmͷೋஈ֊ೝূͷ᠘
  6. ๻ͷpackageͷ࡞ۀͷྲྀΕ • τϐοΫϒϥϯνͰ࡞ۀ • commitʢcommitizen࢖ͬͯ΍ͬͯ·͢✌ʣ • betaϒϥϯνʹऔΓࠐΉϓϧϦΫΛग़͢ • ࠷ऴతʹbeta͔ΒmasterʹऔΓࠐΉ •

    ϦϦʔεόʔδϣϯʹ֘౰͢ΔscriptΛଧͭ • travisͰnpmʹެ։ͯ͠΋Β͏ m b t
  7. ύοέʔδ໊Λߟ͑Δ

  8. ໊લͳʔ ӳޠͳʔ

  9. ʮਥೋපશ։Ͱߟ͑ͨΒ͍͍Αʯ

  10. ͳΔ΄Ͳ

  11. ީิߟ͑ͨ • cz-customizable-format • cz-starter-format • cz-custom-format • cz-origin-format •

    cz-format-extension
  12. શ෦͔ͬͪΐ͍͍

  13. cz-format-extension • ๻Β͕࡞Γ͍ͨύοέʔδʹ߹ͬͯΔ • ໊લ͔Βਪଌ͠΍͍͢ • ࣅͨύοέʔδ໊͕ͳ͍

  14. ެ։ܗࣜΛߟ͑Δ

  15. scope͢Δ͔൱͔

  16. // scoped package yarn add @tyankatsu0105/package-name //unique name package yarn

    add package-name ҧ͍
  17. ༻్ʹΑΔ

  18. ൑அج४ scope͢Δ৔߹ • ͱΓ͋͑ͣࣗ෼͕࢖͍͍͔ͨΒ • ࢖໊͍͍ͨલطʹ͚͋ͬͨͲৡΕͳ͍ scope͠ͳ͍৔߹ • ΈΜͳʹ࢖ͬͯ΄͍͠ •

    ͳΜ͔͔ͬͪΐ͍͍✌
  19. ൑அج४ scope͢Δ৔߹ • ͱΓ͋͑ͣࣗ෼͕࢖͍͍͔ͨΒ • ࢖໊͍͍ͨલطʹ͚͋ͬͨͲৡΕͳ͍ scope͠ͳ͍৔߹ɹˡ࠾༻✌✌✌✌ • ΈΜͳʹ࢖ͬͯ΄͍͠ •

    ͳΜ͔͔ͬͪΐ͍͍✌
  20. ϒϥοΫϦετͱ ϗϫΠτϦετ

  21. .npmignore • ͍ΘΏΔϒϥοΫϦετ • publish࣌ʹআ֎͍ͨ͠ϑΝΠϧΛॻ͘

  22. package.json filesϑΟʔϧυ • ͍ΘΏΔϗϫΠτϦετ • publishͷର৅ʹ͍ͨ͠ϑΝΠϧΛॻ͘

  23. ซ༻΋Ͱ͖Δ package.jsonͷfilesͰର৅ʹͨ͠ϑΥϧμͷ த͔Βɺ
 .npmignoreͰɺର৅֎ϑΝΠϧΛࢦఆՄೳ Έ͍ͨͳ͜ͱ͕Ͱ͖Δɻ

  24. package.json files ͚ͩͰࣄ଍Γͯ·͢ɻ

  25. travisͰσϓϩΠ࣌ͷ npmͷೋஈ֊ೝূͷ᠘

  26. ηΩϡϦςΟͷͨΊʹ npmʹ͸2FAઃఆͯ͠·͢

  27. npmͷ E-mail,token͸ travisͷ؀ڥม਺ʹ

  28. ʮOTP!!OTP!!OTP!!OTP!!ʯ

  29. travisͰOTPฉ͔Ε·ͨ͠ɻ ຊ౰ʹ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ

  30. 2FAʹ͸Level͕͋Δ

  31. npm profile enable-2fa auth-only https://tailordev.fr/blog/2018/03/15/automated-npm-releases-with-travis-ci/

  32. auth-onlyͰOTPฉ͔ΕΔ࣌ • npmʹϩάΠϯ͢Δ࣌ • 2FAΛ࡟আ͢Δ࣌

  33. ଓ͖͸ ϒϩάͰʂʂʂ

  34. ࠷ޙʹ

  35. ෱ԬͰnpmͷ ύοέʔδ։ൃ΋͘΋͘ձ ͠·͠ΐ͏ɻ

  36. ͜Εͱ͔ʂʂ

  37. https://cdg.connpass.com/event/109381/

  38. ͓ΘΓ