SlideShare une entreprise Scribd logo
1  sur  69
The Package Manager for Node
Disclaimer

• I'm going to talk about how npm works.
• It works the way I want it to work.
• There are a lot of trade-offs and paths.
• We can be different and still be friends.
wtf is a npm?

• If you're here, you've probably used it
• v1.0 just landed
• curl http://npmjs.org/install.sh | sh
Vision

         To increase speed:

Either push harder, or reduce friction.

      If everyone is doing one,
            do the other.
Vision

• 2009: Lots of folks pushing hard on node.
• Wanted a way to easily install the
  things people were making.
• Starting with a clean slate. Get it right.
  No dependency hell allowed!
Sources of Friction

• Conflicting dependencies
• Inconsistent surfaces
• Excessive metadata
• Publication cabal
Sources of Friction

• Conflicting dependencies
• Inconsistent surfaces
• Excessive metadata
• Publication cabal
Conflicting
        dependencies
• Try to install foo 1.0.0
• foo 1.0.0 → bar >= 1.0.0
• bar 1.2.3 → baz > 2.0.0.
• baz 2.1.2 → foo >2.0.0
• CONFLICT.
Conflicting
dependencies
Sources of Friction

• Conflicting dependencies
• Inconsistent surfaces
• Excessive metadata
• Publication cabal
Inconsistent surfaces
• Before:
 • clone this git repo, then run "make", then
    copy this file into your .node_libraries
    folder, and make sure you name it
    "whatever.js", and that you have some
    version of "blab" already installed there, I
    think the latest version on github works.
Inconsistent surfaces

• After:
 • npm install whatever
 • require("whatever")
Inconsistent surfaces


      THIS IS EASIER.
Sources of Friction

• Conflicting dependencies
• Inconsistent surfaces
• Excessive metadata
• Publication cabal
Excessive metadata

• In npm, it's just a package.json
• Only two required fields:
 • name
 • version
• Lots of optional stuff:
  See `npm help json`
Sources of Friction

• Conflicting dependencies
• Inconsistent surfaces
• Excessive metadata
• Publication cabal
Publication cabal

• aka "permission to publish"
• Sensible in the Debian world
• Not so much in Node
• Anarchic Dictatorship
convention vs
        configuration
• Popular mantra:
  Convention over Configuration
• Convention is like kids:
  It has to grow up at its own speed.
• Having it before you're ready is unwise.
convention vs
configuration
convention vs
        configuration
• Perl: 24 years old
convention vs
        configuration
• Perl: 24 years old
• Python: 20 years old
convention vs
        configuration
• Perl: 24 years old
• Python: 20 years old
• Ruby: 16 years old
convention vs
        configuration
• Perl: 24 years old
• Python: 20 years old
• Ruby: 16 years old
• Node: 2 years old
convention vs
         configuration
• Standing on the shoulders of giants, yes.
• Impressive and important, absolutely.
• Meteorically hacker-news spamming.
• But the community is still finding its voice.
convention vs
         configuration
• Be a pain-killer, not a vitamin, not surgery
• "Here's a package.json file" vs
  "Please structure your program like this."
• Patterns that make sense for Python/Ruby
  don't always make sense for Node.
convention vs
         configuration
• Better model:
  Configuration in search of convention
• Enable as much as possible,
  then bless popular patterns as they arise.
• This is a process. It is organic.
Today...

• almost 1900 projects from
  775 active package authors
• Too many to list in a lunch
  (even if you're Marak)
• ~300 new packages per month
  ~2000 updates per month
Today...


    At the next NodeConf,
I will show you that last slide.
    You will say, "So few?"
Today...


npm is valuable because of
  what you do with it.
how it works
   The $0.50 tour
The Registry

• A Couchapp:
 • http://isaacs.ic.ht/registry
 • https://github.com/isaacs/npmjs.org
• JSON: http://registry.npmjs.org/
• HTML: http://search.npmjs.org/
The Registry

• Tarballs are attachments to package docs
• "npm adduser" to auth
• "npm owner" to manage ownership
• CouchDB rocks for this.
Behind the Firewall
• Several companies running their own
  internal registries.
• "private":true
• "publishConfig" :
      {"registry":"http://internal"}
• Replicate from the public reg (if you want)
anarchic dictatorship

• If you publish it, it's yours.
• Land-grab for names.
• Authors admin their own stuff,
  simple permission scheme
anarchic dictatorship

• Packages get abandoned
• Authors go awol
• Programs can be malicious or misleading
• Having a server admin is important
  <i@izs.me> (don't be creepy)
The cache


• In ~/.npm, registry items are cached.
• ETags FTW!
new in 1.0

• *vastly* simplified folder structure
• Smarter .gitignore/.npmignore handling
  (ie, it works how you think now)
• global vs local installation
new in 1.0

• *vastly* simplified folder structure
• Smarter .gitignore/.npmignore handling
  (ie, it works how you think now)
• global vs local installation
global vs local


• Any command: add `-g` to do it globally.
• Local by default ("always bundle")
global vs local


• Global goes in /usr/local
• Local goes in $PWD/node_modules
global vs local


• Global for putting bin files in the PATH
• Local for require()
global vs local


• Global root is not in node's require path.
• Local root is.
global vs local


 Yes, this is on purpose.
global vs local


       Try it!
    You'll like it!
node_modules

• Packages are installed into node_modules
• Dependencies are nested.
• Cycles handled smartly
Scripts

• Hash of {<event>:<command>}
• npm runs scripts as "nobody" if you're root
• prefoo, foo, postfoo
• The env has all KINDS of data.
Scripts
           (The Important Ones)


• install: When your package is installed.
• start: How to start your server.
• test: Run by the `npm test` command.
• prepublish: Before publishing
Scripts

• Definitely include a "test" script.
• npat! You will super <3 this!
• (Also, tests make you look like a grown up.)
commands


• Files in npm's source as lib/<cmd>.js
• Hang on the npm object at
  npm.commands.<cmd>
commands

• Pretty big CLI app in Node.js
• npm completion
• npm install -h
• abbrev support
install

• If you only know a single npm command,
  this is the one to know.
• With no args:
  Install deps locally, run build scripts
link

• "I want to make changes to node-foo lib,
  and have all my projects always see the
  latest code."
• "I want to make changes to node-foo cli
  app, and always have `foo` run the latest
  code."
link


• See changes without re-installing.
• Read more: `npm help link`
ls
• Displays installed packages
• ls -g -- List global packages
• ls -p -- List in parseable format
• ls -l -- List in "long" format (more data)
• Combine 'em: ls<rimshot>
  still MIT licensed, though
                             -gpl
npm reusable team

• Pieces spun off as standalone projects:
 • nopt - the option parser
 • semver - the version thingie
 • abbrev - like ruby's Abbrev
• More coming soon!
The Future
the part where I make promises
   and get myself into trouble
bindist

• On publish, pre-compile binary addons.
• Required for eventual Windows support
• Experimental, but working surprisingly well.
• (probably hideously broken somehow)
npat

• npm Package Testers
• Inspired by Perl's CPANTs, the best damn
  distributed CI testing system yet devised.
• Ours will be even better, because CPANTs
  wasn't built in a world where CPANTs had
  already been built. :)
npat

• To get on the bandwagon:
  npm set npat true
• installs devDependencies and runs tests
• Fail fast! Fail hard!
  (Then install with --no-npat )
npat

• Results will be uploaded to a database
• "Which platforms should I care about?"
• "Which packages work on my platform?"
• Npat will tell you.
Build Farms

               npat reports +
            binary distributions +
   servers in multiple operating systems =
Ultimate Package Test Integration Mega Engine
Build Farms

               npat reports +
            binary distributions +
   servers in multiple operating systems =
Ultimate Package Test Integration Mega Engine
Build Farms

               npat reports +
            binary distributions +
    vm's in multiple operating systems =
Ultimate Package Test Integration Mega Engine
Build Farms

               npat reports +
            binary distributions +
    vm's in multiple operating systems =
Ultimate Package Test Integration Mega Engine
Build Farms

               npat reports +
            binary distributions +
    vm's in multiple operating systems =
Ultimate Package Test Integration Mega Engine
Build Farms


      UPTIME!




 (It's a working title.)
Build Farms

• Build everything as it's published
• Publish bindists back to the registry
• Run tests and upload results
• Seriously, it's gonna rock
How you can help

• Keep building awesome stuff with Node
• Open-source your reusable libraries
• Publish to the npm registry
• Help out with some of that future stuff
• Provide feedback, find bugs, help n00bs
http://j.mp/nodeconf-npm                  Questions?




                           ...loves you




                                 npm loves you

Contenu connexe

Tendances

PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentIrfan Maulana
 
Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of dockerPHP Indonesia
 
Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?Weng Wei
 
Integrating Node.js with PHP
Integrating Node.js with PHPIntegrating Node.js with PHP
Integrating Node.js with PHPLee Boynton
 
MEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona WorkshopMEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona WorkshopValeri Karpov
 
3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don'tF5 Buddy
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devopsRob Kinyon
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails PresentationChanHan Hy
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs Irfan Maulana
 
Bringing Interactivity to Your Drupal Site with Node.js Integration
Bringing Interactivity to Your Drupal Site with Node.js IntegrationBringing Interactivity to Your Drupal Site with Node.js Integration
Bringing Interactivity to Your Drupal Site with Node.js IntegrationAcquia
 
ClubAJAX Basics - Server Communication
ClubAJAX Basics - Server CommunicationClubAJAX Basics - Server Communication
ClubAJAX Basics - Server CommunicationMike Wilcox
 
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAdler Hsieh
 
Day 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureDay 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureBarry Jones
 
Getting Started With WP REST API
Getting Started With WP REST APIGetting Started With WP REST API
Getting Started With WP REST APIKishor Kumar
 
Future-proof Development for Classic SharePoint
Future-proof Development for Classic SharePointFuture-proof Development for Classic SharePoint
Future-proof Development for Classic SharePointBob German
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 

Tendances (20)

PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
Day 8 - jRuby
Day 8 - jRubyDay 8 - jRuby
Day 8 - jRuby
 
Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of docker
 
Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?
 
Integrating Node.js with PHP
Integrating Node.js with PHPIntegrating Node.js with PHP
Integrating Node.js with PHP
 
MEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona WorkshopMEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona Workshop
 
3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devops
 
Node js first look - 2016
Node js first look - 2016Node js first look - 2016
Node js first look - 2016
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs
 
Bringing Interactivity to Your Drupal Site with Node.js Integration
Bringing Interactivity to Your Drupal Site with Node.js IntegrationBringing Interactivity to Your Drupal Site with Node.js Integration
Bringing Interactivity to Your Drupal Site with Node.js Integration
 
ClubAJAX Basics - Server Communication
ClubAJAX Basics - Server CommunicationClubAJAX Basics - Server Communication
ClubAJAX Basics - Server Communication
 
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
 
Node.js
Node.jsNode.js
Node.js
 
Day 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureDay 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application Architecture
 
Node js
Node jsNode js
Node js
 
Getting Started With WP REST API
Getting Started With WP REST APIGetting Started With WP REST API
Getting Started With WP REST API
 
Future-proof Development for Classic SharePoint
Future-proof Development for Classic SharePointFuture-proof Development for Classic SharePoint
Future-proof Development for Classic SharePoint
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 

En vedette

npm: Modularizing your JavaScript development
npm: Modularizing your JavaScript developmentnpm: Modularizing your JavaScript development
npm: Modularizing your JavaScript developmentRuy Adorno
 
Использовании TypeScript для Node.js
Использовании TypeScript для Node.jsИспользовании TypeScript для Node.js
Использовании TypeScript для Node.jsFullStackJS
 
Yarn – der neue Package Manager von Facebook
Yarn – der neue Package Manager von FacebookYarn – der neue Package Manager von Facebook
Yarn – der neue Package Manager von FacebookPOINT. Consulting GmbH
 
How to Write Node.js Module
How to Write Node.js ModuleHow to Write Node.js Module
How to Write Node.js ModuleFred Chien
 
Introduction to NPM and building CLI Tools with Node.js
Introduction to NPM and building CLI Tools with Node.jsIntroduction to NPM and building CLI Tools with Node.js
Introduction to NPM and building CLI Tools with Node.jsSuroor Wijdan
 
Harnessing the power of YARN with Apache Twill
Harnessing the power of YARN with Apache TwillHarnessing the power of YARN with Apache Twill
Harnessing the power of YARN with Apache TwillTerence Yim
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Ryan Weaver
 

En vedette (10)

npm: Modularizing your JavaScript development
npm: Modularizing your JavaScript developmentnpm: Modularizing your JavaScript development
npm: Modularizing your JavaScript development
 
Использовании TypeScript для Node.js
Использовании TypeScript для Node.jsИспользовании TypeScript для Node.js
Использовании TypeScript для Node.js
 
Yarn
YarnYarn
Yarn
 
Npm: beyond 'npm i'
Npm: beyond 'npm i'Npm: beyond 'npm i'
Npm: beyond 'npm i'
 
Yarn – der neue Package Manager von Facebook
Yarn – der neue Package Manager von FacebookYarn – der neue Package Manager von Facebook
Yarn – der neue Package Manager von Facebook
 
Npm scripts
Npm scriptsNpm scripts
Npm scripts
 
How to Write Node.js Module
How to Write Node.js ModuleHow to Write Node.js Module
How to Write Node.js Module
 
Introduction to NPM and building CLI Tools with Node.js
Introduction to NPM and building CLI Tools with Node.jsIntroduction to NPM and building CLI Tools with Node.js
Introduction to NPM and building CLI Tools with Node.js
 
Harnessing the power of YARN with Apache Twill
Harnessing the power of YARN with Apache TwillHarnessing the power of YARN with Apache Twill
Harnessing the power of YARN with Apache Twill
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
 

Similaire à Nodeconf npm 2011

Building Open-source React Components
Building Open-source React ComponentsBuilding Open-source React Components
Building Open-source React ComponentsZack Argyle
 
Building Open-Source React Components
Building Open-Source React ComponentsBuilding Open-Source React Components
Building Open-Source React ComponentsZack Argyle
 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010Kang-min Liu
 
Ninja, Choose Your Weapon!
Ninja, Choose Your Weapon!Ninja, Choose Your Weapon!
Ninja, Choose Your Weapon!Anton Weiss
 
Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011Tim Bunce
 
Packaging is the Worst Way to Distribute Software, Except for Everything Else
Packaging is the Worst Way to Distribute Software, Except for Everything ElsePackaging is the Worst Way to Distribute Software, Except for Everything Else
Packaging is the Worst Way to Distribute Software, Except for Everything Elsemckern
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerJürgen Gutsch
 
21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANci21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANciMike Friedman
 
Dcjq node.js presentation
Dcjq node.js presentationDcjq node.js presentation
Dcjq node.js presentationasync_io
 
Deploying your SaaS stack OnPrem
Deploying your SaaS stack OnPremDeploying your SaaS stack OnPrem
Deploying your SaaS stack OnPremKris Buytaert
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_monTomas Doran
 
Package Management and Chef - ChefConf 2015
Package Management and Chef - ChefConf 2015Package Management and Chef - ChefConf 2015
Package Management and Chef - ChefConf 2015Chef
 
Chef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & ChefChef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & Chefice799
 
CNPM: Private NPM for Company / 企業級私有NPM
CNPM: Private NPM for Company / 企業級私有NPMCNPM: Private NPM for Company / 企業級私有NPM
CNPM: Private NPM for Company / 企業級私有NPMFeng Yuan
 
Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)p3castro
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & howdotCloud
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAlberto Molina Coballes
 

Similaire à Nodeconf npm 2011 (20)

Building Open-source React Components
Building Open-source React ComponentsBuilding Open-source React Components
Building Open-source React Components
 
Building Open-Source React Components
Building Open-Source React ComponentsBuilding Open-Source React Components
Building Open-Source React Components
 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010
 
Ninja, Choose Your Weapon!
Ninja, Choose Your Weapon!Ninja, Choose Your Weapon!
Ninja, Choose Your Weapon!
 
CentOS at Facebook
CentOS at FacebookCentOS at Facebook
CentOS at Facebook
 
Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011
 
Packaging is the Worst Way to Distribute Software, Except for Everything Else
Packaging is the Worst Way to Distribute Software, Except for Everything ElsePackaging is the Worst Way to Distribute Software, Except for Everything Else
Packaging is the Worst Way to Distribute Software, Except for Everything Else
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & docker
 
Migrating big data
Migrating big dataMigrating big data
Migrating big data
 
21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANci21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANci
 
Dcjq node.js presentation
Dcjq node.js presentationDcjq node.js presentation
Dcjq node.js presentation
 
Deploying your SaaS stack OnPrem
Deploying your SaaS stack OnPremDeploying your SaaS stack OnPrem
Deploying your SaaS stack OnPrem
 
Python+gradle
Python+gradlePython+gradle
Python+gradle
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
 
Package Management and Chef - ChefConf 2015
Package Management and Chef - ChefConf 2015Package Management and Chef - ChefConf 2015
Package Management and Chef - ChefConf 2015
 
Chef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & ChefChef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & Chef
 
CNPM: Private NPM for Company / 企業級私有NPM
CNPM: Private NPM for Company / 企業級私有NPMCNPM: Private NPM for Company / 企業級私有NPM
CNPM: Private NPM for Company / 企業級私有NPM
 
Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
 

Dernier

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Dernier (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

Nodeconf npm 2011

  • 2. Disclaimer • I'm going to talk about how npm works. • It works the way I want it to work. • There are a lot of trade-offs and paths. • We can be different and still be friends.
  • 3. wtf is a npm? • If you're here, you've probably used it • v1.0 just landed • curl http://npmjs.org/install.sh | sh
  • 4. Vision To increase speed: Either push harder, or reduce friction. If everyone is doing one, do the other.
  • 5. Vision • 2009: Lots of folks pushing hard on node. • Wanted a way to easily install the things people were making. • Starting with a clean slate. Get it right. No dependency hell allowed!
  • 6. Sources of Friction • Conflicting dependencies • Inconsistent surfaces • Excessive metadata • Publication cabal
  • 7. Sources of Friction • Conflicting dependencies • Inconsistent surfaces • Excessive metadata • Publication cabal
  • 8. Conflicting dependencies • Try to install foo 1.0.0 • foo 1.0.0 → bar >= 1.0.0 • bar 1.2.3 → baz > 2.0.0. • baz 2.1.2 → foo >2.0.0 • CONFLICT.
  • 10. Sources of Friction • Conflicting dependencies • Inconsistent surfaces • Excessive metadata • Publication cabal
  • 11. Inconsistent surfaces • Before: • clone this git repo, then run "make", then copy this file into your .node_libraries folder, and make sure you name it "whatever.js", and that you have some version of "blab" already installed there, I think the latest version on github works.
  • 12. Inconsistent surfaces • After: • npm install whatever • require("whatever")
  • 13. Inconsistent surfaces THIS IS EASIER.
  • 14. Sources of Friction • Conflicting dependencies • Inconsistent surfaces • Excessive metadata • Publication cabal
  • 15. Excessive metadata • In npm, it's just a package.json • Only two required fields: • name • version • Lots of optional stuff: See `npm help json`
  • 16. Sources of Friction • Conflicting dependencies • Inconsistent surfaces • Excessive metadata • Publication cabal
  • 17. Publication cabal • aka "permission to publish" • Sensible in the Debian world • Not so much in Node • Anarchic Dictatorship
  • 18. convention vs configuration • Popular mantra: Convention over Configuration • Convention is like kids: It has to grow up at its own speed. • Having it before you're ready is unwise.
  • 20. convention vs configuration • Perl: 24 years old
  • 21. convention vs configuration • Perl: 24 years old • Python: 20 years old
  • 22. convention vs configuration • Perl: 24 years old • Python: 20 years old • Ruby: 16 years old
  • 23. convention vs configuration • Perl: 24 years old • Python: 20 years old • Ruby: 16 years old • Node: 2 years old
  • 24. convention vs configuration • Standing on the shoulders of giants, yes. • Impressive and important, absolutely. • Meteorically hacker-news spamming. • But the community is still finding its voice.
  • 25. convention vs configuration • Be a pain-killer, not a vitamin, not surgery • "Here's a package.json file" vs "Please structure your program like this." • Patterns that make sense for Python/Ruby don't always make sense for Node.
  • 26. convention vs configuration • Better model: Configuration in search of convention • Enable as much as possible, then bless popular patterns as they arise. • This is a process. It is organic.
  • 27. Today... • almost 1900 projects from 775 active package authors • Too many to list in a lunch (even if you're Marak) • ~300 new packages per month ~2000 updates per month
  • 28. Today... At the next NodeConf, I will show you that last slide. You will say, "So few?"
  • 29. Today... npm is valuable because of what you do with it.
  • 30. how it works The $0.50 tour
  • 31. The Registry • A Couchapp: • http://isaacs.ic.ht/registry • https://github.com/isaacs/npmjs.org • JSON: http://registry.npmjs.org/ • HTML: http://search.npmjs.org/
  • 32. The Registry • Tarballs are attachments to package docs • "npm adduser" to auth • "npm owner" to manage ownership • CouchDB rocks for this.
  • 33. Behind the Firewall • Several companies running their own internal registries. • "private":true • "publishConfig" : {"registry":"http://internal"} • Replicate from the public reg (if you want)
  • 34. anarchic dictatorship • If you publish it, it's yours. • Land-grab for names. • Authors admin their own stuff, simple permission scheme
  • 35. anarchic dictatorship • Packages get abandoned • Authors go awol • Programs can be malicious or misleading • Having a server admin is important <i@izs.me> (don't be creepy)
  • 36. The cache • In ~/.npm, registry items are cached. • ETags FTW!
  • 37. new in 1.0 • *vastly* simplified folder structure • Smarter .gitignore/.npmignore handling (ie, it works how you think now) • global vs local installation
  • 38. new in 1.0 • *vastly* simplified folder structure • Smarter .gitignore/.npmignore handling (ie, it works how you think now) • global vs local installation
  • 39. global vs local • Any command: add `-g` to do it globally. • Local by default ("always bundle")
  • 40. global vs local • Global goes in /usr/local • Local goes in $PWD/node_modules
  • 41. global vs local • Global for putting bin files in the PATH • Local for require()
  • 42. global vs local • Global root is not in node's require path. • Local root is.
  • 43. global vs local Yes, this is on purpose.
  • 44. global vs local Try it! You'll like it!
  • 45. node_modules • Packages are installed into node_modules • Dependencies are nested. • Cycles handled smartly
  • 46. Scripts • Hash of {<event>:<command>} • npm runs scripts as "nobody" if you're root • prefoo, foo, postfoo • The env has all KINDS of data.
  • 47. Scripts (The Important Ones) • install: When your package is installed. • start: How to start your server. • test: Run by the `npm test` command. • prepublish: Before publishing
  • 48. Scripts • Definitely include a "test" script. • npat! You will super <3 this! • (Also, tests make you look like a grown up.)
  • 49. commands • Files in npm's source as lib/<cmd>.js • Hang on the npm object at npm.commands.<cmd>
  • 50. commands • Pretty big CLI app in Node.js • npm completion • npm install -h • abbrev support
  • 51. install • If you only know a single npm command, this is the one to know. • With no args: Install deps locally, run build scripts
  • 52. link • "I want to make changes to node-foo lib, and have all my projects always see the latest code." • "I want to make changes to node-foo cli app, and always have `foo` run the latest code."
  • 53. link • See changes without re-installing. • Read more: `npm help link`
  • 54. ls • Displays installed packages • ls -g -- List global packages • ls -p -- List in parseable format • ls -l -- List in "long" format (more data) • Combine 'em: ls<rimshot> still MIT licensed, though -gpl
  • 55. npm reusable team • Pieces spun off as standalone projects: • nopt - the option parser • semver - the version thingie • abbrev - like ruby's Abbrev • More coming soon!
  • 56. The Future the part where I make promises and get myself into trouble
  • 57. bindist • On publish, pre-compile binary addons. • Required for eventual Windows support • Experimental, but working surprisingly well. • (probably hideously broken somehow)
  • 58. npat • npm Package Testers • Inspired by Perl's CPANTs, the best damn distributed CI testing system yet devised. • Ours will be even better, because CPANTs wasn't built in a world where CPANTs had already been built. :)
  • 59. npat • To get on the bandwagon: npm set npat true • installs devDependencies and runs tests • Fail fast! Fail hard! (Then install with --no-npat )
  • 60. npat • Results will be uploaded to a database • "Which platforms should I care about?" • "Which packages work on my platform?" • Npat will tell you.
  • 61. Build Farms npat reports + binary distributions + servers in multiple operating systems = Ultimate Package Test Integration Mega Engine
  • 62. Build Farms npat reports + binary distributions + servers in multiple operating systems = Ultimate Package Test Integration Mega Engine
  • 63. Build Farms npat reports + binary distributions + vm's in multiple operating systems = Ultimate Package Test Integration Mega Engine
  • 64. Build Farms npat reports + binary distributions + vm's in multiple operating systems = Ultimate Package Test Integration Mega Engine
  • 65. Build Farms npat reports + binary distributions + vm's in multiple operating systems = Ultimate Package Test Integration Mega Engine
  • 66. Build Farms UPTIME! (It's a working title.)
  • 67. Build Farms • Build everything as it's published • Publish bindists back to the registry • Run tests and upload results • Seriously, it's gonna rock
  • 68. How you can help • Keep building awesome stuff with Node • Open-source your reusable libraries • Publish to the npm registry • Help out with some of that future stuff • Provide feedback, find bugs, help n00bs
  • 69. http://j.mp/nodeconf-npm Questions? ...loves you npm loves you

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. So, where are we now?\n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n