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

Lerna による明示的疎結合アーキテクチャ

Lerna による明示的疎結合アーキテクチャ

Gotanda.js #9 in adish で発表した資料
https://gotandajs.connpass.com/event/66262/

842aaadff6e13fbf372c9b17b49b031c?s=128

Pine Mizune

October 06, 2017
Tweet

Transcript

  1. 1JOF.J[VOF 0DU (PUBOEBKT JOBEJTI -FSOB ʹΑΔ ໌ࣔతૄ݁߹ΞʔΩςΫνϟ

  2. ࣗݾ঺հ v (JU)VC !QJOF v 5XJUUFS!QJOF v ޷͖ͳݴޠ +BWB4DSJQU v

    /FYUCFBU $P -UE JO ޒ൓ా v ֆจࣈδΣωϨʔλʔ "VUIPS
  3. ໨࣍ -FSOB ͷ֓ཁͱɺΞʔΩςΫνϟྫΛ࿩͠·͢ v -FSOB ͱ͸ v -FSOB ͷಈ࡞ݪཧ v

    -FSOB ʹΑΔ໌ࣔతૄ݁߹ΞʔΩςΫνϟ v ΞʔΩςΫνϟྫͷ঺հ
  4. -FSOB ͱ͸ -FSOB ͸ #BCFMͷ࡞ऀʹΑΔ NPOPSFQP ࢧԉπʔϧͰ͢ ෳ਺ύοέʔδΛ୯ҰϨϙδτϦͰ؅ཧ ྫ#BCFMͷϨϙδτϦߏ଄ QBDLBHFT

    MFSOBKTPO QBDLBHFKTPO CBCFMDMJ CBCFMDPSF TSD UFTU QBDLBHFKTPO CBCFM ܭ ݸͷύοέʔδ ݱࡏ
  5. -FSOB ͷಈ࡞ݪཧ -FSOB ͸γϯϘϦοΫͰϓϩδΣΫτ಺ґଘΛղܾ͠·͢ QLH QLH QLH OPEF@NPEVMFT !QSPK QBDLBHFT

    QLH NPOSFQP ಺͸γϯϘϦοΫϦϯΫ ֎෦ύοέʔδ͸௚઀Πϯετʔϧ QLH FYUQLH
  6. -FSOB ίϚϯυྫ $ lerna bootstrap ґଘղܾ࣮ߦ $ lerna run test

    શύοέʔδͷίϚϯυ࣮ߦ $ lerna run --scope @proj/pkg1 build ಛఆύοέʔδͷίϚϯυ࣮ߦ
  7. େن໛ϥΠϒϥϦͷͨΊʹ࡞ΒΕͨ -FSOB Ͱ͕͢ ࠓ೔͸ϓϩμΫτ΁ͷద༻͢Δ࿩Λ͠·͢ɻ

  8. -FSOB ʹΑΔ໌ࣔతૄ݁߹ΞʔΩςΫνϟ ϥΠϒϥϦͰ͸ͳ͘ϓϩμΫτͷૄ݁߹Խʹ࢖͏ v ϨΠϠͰ෼͚Δ Ø !QSPKDPOUSPMMFST !QSPKNPEFMT  Ø

    !QSPKEJTQBUDIFS !QSPKTUPSF  v σʔλछผ͝ͱʹ෼͚Δ Ø !QSPKVTFST !QSPKJUFNT 
  9. -FSOB ʹΑΔ໌ࣔతૄ݁߹ΞʔΩςΫνϟ -FSOB ʹΑΔΞʔΩςΫνϟͷϝϦοτɾσϝϦοτ v ϝϦοτ Ø ϨΠϠؒͷґଘ͕໌ࣔతʹͳΔ Ø ϨΠϠ͝ͱʹґଘ͕࣋ͯΔ

    Ø ϨΠϠ͝ͱʹςετ͕ॻ͚Δ ςετϑϨʔϜϫʔΫͷࠞࡏ΋༰қ v σϝϦοτ Ø ύοέʔδ਺ͷංେԽɺݟ௨͠ͷѱԽ Ø ಉҰϥΠϒϥϦͷෳ਺όʔδϣϯ΁ͷґଘͷൃੜ ڞ௨ґଘΛϧʔτύοέʔδͰ࣋ͭ͜ͱͰ͋Δఔ౓ղܾՄ
  10. &YQSFTT΁ͷద༻ྫ $POUSPMMFS 3FQPTJUPSZ .PEFMʹ෼͚Δྫ QBDLBHFT MFSOBKTPO BQQ DPOGJH HPUBOEBKTBQJ NPEFMT

    FOW SFQPT QBDLBHFKTPO $POUSPMMFS 3FQPTJUPSZ .PEFM ιʔείʔυIUUQTHJUIVCDPNQJOFHPUBOEBKTBQJTBNQMF
  11. &YQSFTT΁ͷద༻ྫ ύοέʔδؒͷґଘؔ܎ !HPUBOEBKTBQQ !HPUBOEBKTDPOGJH !HPUBOEBKTFOW !HPUBOEBKTSFQT !HPUBOEBKTNPEFMT ϢʔςΟϦςΟܥ͸ݸʑʹಠཱ ιʔείʔυIUUQTHJUIVCDPNQJOFHPUBOEBKTBQJTBNQMF

  12. &YQSFTT΁ͷద༻ྫ ιʔείʔυIUUQTHJUIVCDPNQJOFHPUBOEBKTBQJTBNQMF const { EventRepository, EventPlaceRepository, PlaceRepository, } = require('@gotandajs/repos')

    const { EventResult } = require('@gotandajs/models') $POUSPMMFS
  13. ·ͱΊ -FSOB ͸ NPOPSFQP ࢧԉπʔϧͰ͢ v -FSOB ͸ #BCFM౳ͷେن໛ϥΠϒϥϦͰར༻ v

    -FSOB ΛϓϩμΫτʹదԠ͢Δ͜ͱ΋Մೳ v ૄ݁߹ɺ͔ͭ໌ࣔతʹϓϩμΫτΛߏ੒Մೳ v ΞʔΩςΫνϟΛߟ͑Δͱ͖ͷύʔπͱͯ͠