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

npm3 ❓

npm3 ❓

Daijiro Wachi

August 31, 2015
Tweet

More Decks by Daijiro Wachi

Other Decks in Programming

Transcript

  1. Table of contents • Why npm@3? • notes • breaking

    changes • new features • v3.1 - v3.3: Minor updates
  2. Why npm@3? • converting the CLI to an API •

    dependency tree realization • improved support for Windows paths • better error messages & reporting • front-end tooling support • nerf peerDependencies • better CLI search
  3. converting the CLI to an API • ػೳతཁ๬͕ࡍݶͳ͘ಧ͕͘ɺnpm͸طʹߴػೳ • APIͱͯ͠ఏڙͰ͖Ε͹ɺࣗ༝ʹΧελϚΠζՄೳ

    • ͓·͚ʹɺnpmͷίʔυͷςετ͕͠΍͘͢ͳΔ • npm cache & npm-registry-clientͷ࠶ઃܭ • cache.jsͷίʔυ෼཭ɺnpmඇґଘɺmulti-registryαϙʔτ • ΦϑϥΠϯϞʔυͷ࣮૷Λ༰қʹ͢Δ
  4. dependency tree realization • ਖ਼֬ͳΠϯετʔϧͷॱংΛอূ͢Δ
 1. ΠϯετʔϧࡁΈͷpackageΛ֬ೝ
 2. ϩʔΧϧͷnode_modulesͷޮ཰తͳ࠷ऴΠϝʔδߏங
 3.

    ࣮ࡍʹ࣮ߦ͠ͳ͖Ό͍͚ͳ͍ΞΫγϣϯͷϦετߏங
 4. ΠϯετʔϧΛ࣮ߦ • npm i -g npm͕ࣦഊͨ͠ࡍʹࣗ਎͕ফ͑ΔࣄނΛ๷͙ • ؆୯ͦ͏ʹݟ͑ͯɺ࣮ࡍͷϓϩηε͸ඇৗʹෳࡶ
 See also: https://docs.npmjs.com/cli/install#algorithm
  5. improved support for Windows paths • front-endπʔϧͷීٴʹΑΓɺWindowsͰnpm͕α ϙʔτ͖͠Ε͍ͯͳ͍γʔϯ͕සൃ࢝͠Ίͨ • plugin-basedͳπʔϧͷଟ͘͸ɺඇৗʹ௕͍ϑΝΠϧ

    ύεΛཁٻ͢ΔΑ͏ʹͳ͖ͬͯͨ • Windows Ͱ͸ɺ୯Ұύε͸࠷େ 260 จࣈ·Ͱ • npm dedupeͰnode_modulesͷFlatԽΛਪਐ͖ͯͨ͠ ͕ɺ͜ͷ໰୊ͷղܾͷͨΊʹେ୾ʹมߋ͕ඞཁ
  6. better error messages & reporting • ࠷ॳͷࠒͷϢʔβʔͰ͋ΔServer side Node.js Developer͸ɺෳࡶͳUnix

    Error messageΛใࠂ • front-end toolΛ୲͏Α͏ʹͳ͖ͬͯͨͷͰɺ΋ͬͱ ෼͔Γ΍͍͢ΤϥʔΛදࣔͰ͖ΔΑ͏ʹվળ • 1000 issues͕OPENঢ়ଶʹ͋ΓɺreportίϚϯυͷ Α͏ͳܗͰΤϥʔใࠂͷ؆қԽɺ࠷దԽɺޮ཰޲্
  7. front-end tooling support • npmͷར༻ྫͰɺ࠷΋଎͘੒௕͍ͯ͠Δ෼໺ͷ͏ͪͷҰͭ • ଟछଟ༷ͳϢʔεέʔεΛαϙʔτ͢ΔγϯϓϧͳαϒηοτΛ ௐࠪ͢Δ • Ember/Angular/BrowserifyͳͲͷ։ൃνʔϜͱٞ࿦

    • ۩ମతʹෳࡶͳ໰୊͕ൃੜ͍ͯ͠ΔΘ͚Ͱ͸ͳͦ͞͏ͰɺԿ͔໰ ୊͕͋Ε͹ղܾ͢Δͱ͍͏ํ਑ • ecosystemͱ͍͏ɺpluginͷݕࡧΛ༰қʹ͢Δregistryଆͷ৽ػೳ ͳͲ͕༧ఆ͞Ε͍ͯΔ
  8. notes • npm install -g npm
 npm@3͕betaͳ͏ͪ͸ɺnpm@2ͷ࠷৽͕ೖΔ • npm install

    -g npm@3
 npm@3ͷ࠷৽͕ೖΔ • ҆ఆੑͱޙํޓ׵ͷͳ͍มߋΛίϛϡχςΟʹೝΊ ͯ΋Β͏·Ͱ͸ϕʔλͷ··
  9. • Flat, flat, flat! • The multi-stage installer • Install:

    it works different! • Shrinkwraps: they are a-changin'! • The Age of Progress (Bars)! new features
  10. The multi-stage installer • dependency tree realization • read =>

    eval => apply => display • Detail: https://github.com/npm/npm/issues/ 5919#issuecomment-51858095
  11. Install: it works different! • npm ls, npm outdatedʹӨڹ •

    node_modules͕flatʹͳͬͨҰํͰɺtree͸ਖ਼֬ʹ ਌ࢠؔ܎Λදࣔ͢Δ
  12. • npm ping • npm install —no-progress • npm team

    • npm access • npm install —only=dev v3.1 - v3.3: Minor updates These features are from v2.13.0 and v2.14.0
  13. npm team SYNOPSIS npm team create <scope:team> npm team destroy

    <scope:team> npm team add <scope:team> <user> npm team rm <scope:team> <user> npm team ls <scope>|<scope:team> npm team edit <scope:team>
  14. • http://blog.npmjs.org/post/122450408965/npm-weekly-20-npm-3-is-here-ish • http://blog.npmjs.org/post/91303926460/npm-cli-roadmap-a-periodic-update • http://blog.npmjs.org/post/94662089625/the-future-of-the-npm-website-lets-map-this • http://blog.npmjs.org/post/110290693555/npm-weekly-4 • http://blog.npmjs.org/post/111968476155/npm-weekly-6

    • https://github.com/npm/npm/blob/master/CHANGELOG.md • https://github.com/npm/npm/issues/5919#issuecomment-51858095 • https://github.com/npm/npm/issues/5080 • https://twitter.com/othiym23 • http://www.infoq.com/news/2015/06/npm • https://github.com/npm/npm/releases/tag/v2.13.0 • https://github.com/npm/npm/releases/tag/v2.14.0 • http://windows.microsoft.com/ja-jp/windows/file-names-extensions-faq#1TC=windows-7 • https://github.com/npm/npm/search?q=enoent&ref=cmdform&type=Issues Reference links