SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
Introduction to
Introduction
to
By Suroor Wijdan
Introduction to
Agenda
● What is NPM?
● Understanding package.json
● Where to find Packages?
● Installing Packages
● Writing your own Packages
● Command Line
● Publishing to NPM
● Questions & Exercises
Introduction to
What is NPM?
First Time Using NPM
Introduction to
What is NPM?
● A Node Package Manager
● No other Package Manager comes closer
● Is also used by developers who don’t use Node.js at all
● Created by Isaac Z. Schlueter
● Breeze to use
● Recently made into a company, NPM Inc. by Isaac
● Free and Open Source!
Introduction to
Understanding package.json
● It is a valid JSON object
● name and version fields are required, the combination
makes a unique identifier for the package
● Some used fields in package.json
○ description
○ keywords
○ homepage
○ bugs
○ license
○ author & contributors
○ main
○ bin
○ dependencies
○ scripts - {start, preinstall}
Introduction to
Where to find Packages?
https://npmjs.org
Introduction to
Installing Packages
● npm comes along with node.js
● to install a package run:
○ npm install <package-name>
○ npm install <tarball file>
○ npm install <tarball url>
● install a package globally
○ npm install -g <package-name>
Note: Global installation makes the package available globally irrespective of the directory you installed it from.
Introduction to
Writing your own packages
● Install Grunt , the javascript task runner
○ npm install -g grunt-cli
● Run command :
○ grunt-init node
● Answer few questions and you are ready with a nice
package.json file and main .js file for your package.
Introduction to
Writing your own packages
The generated folder structure should look something like this:
Write the code in the .js file created, you can also create many more files as
per your need.
Introduction to
Writing your own packages
Some guidelines to keep in mind when writing new
packages:
● Don’t reinvent the wheel
● Try to contribute to other packages whenever possible
● If you are writing a utility package, then multiple exports should be used
● If your package needs to maintain a state then its good to export a
constructor
● Most Important thing, KEEP IT COOL!
Introduction to
Command Line
To be able to use your package through command line, you need to specify
‘bin’ in package.json as follows:
"bin": {
"nodeart": "lib/nodeArt.js"
}
Also add this #! /usr/bin/env node at the top of “lib/nodeArt.js” file. This tells how the file should be
executed.
As above, ‘nodeart’ will be the command available to you when you install
the package on your machine.
Introduction to
Command Line
You can receive the arguments passed from command line in process.argv
array. First two values in the array are pre-defined :
[ 'node', '/opt/node-v0.10.5-linux-x64/bin/nodeArt']
The actual arguments being passed will be available at indexes greater than
1. So if you run nodeart ‘suroor wijdan’, the process.argv array will be:
[ 'node', '/opt/node-v0.10.5-linux-x64/bin/nodeArt', ‘suroor wijdan’]
Introduction to
Command Line
So its better to slice the array and store the arguments in another variable:
var argumentsPassed = process.argv.slice(2);
Introduction to
Publishing to NPM
To publish on NPM, you just need to have an account on it. To make an
account run the following command:
Once you have the account ready, just run the below command from project
root to publish your module:
And thats all, everything else will be taken care of by NPM registry.
npm adduser //will ask for username, email and password
npm publish
Introduction to
Questions?
Introduction to
/THANKS/ig
Introduction to
References
1. NPM Logo - https://npmjs.org
2. https://npmjs.org/doc/
3. Image Credit - http://nodejsreactions.tumblr.com/post/64781824365/first-time-using-npm
4. Grunt Logo - http://gruntjs.com

Mais conteúdo relacionado

Mais procurados

Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBhargav Anadkat
 
DCEU 18: Dockerfile Best Practices
DCEU 18: Dockerfile Best PracticesDCEU 18: Dockerfile Best Practices
DCEU 18: Dockerfile Best PracticesDocker, Inc.
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node jsAkshay Mathur
 
API Asynchrones en Java 8
API Asynchrones en Java 8API Asynchrones en Java 8
API Asynchrones en Java 8José Paumard
 
Useful Linux and Unix commands handbook
Useful Linux and Unix commands handbookUseful Linux and Unix commands handbook
Useful Linux and Unix commands handbookWave Digitech
 
Vim Editor And Basic Scripting (Ch-7)
Vim Editor And Basic Scripting (Ch-7)Vim Editor And Basic Scripting (Ch-7)
Vim Editor And Basic Scripting (Ch-7)MohsinHusenManasiya
 
Android & PostgreSQL
Android & PostgreSQLAndroid & PostgreSQL
Android & PostgreSQLMark Wong
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 
Prism + ReactiveProperty入門
Prism + ReactiveProperty入門Prism + ReactiveProperty入門
Prism + ReactiveProperty入門一希 大田
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js ExpressEyal Vardi
 

Mais procurados (20)

Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
React Hooks
React HooksReact Hooks
React Hooks
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
DCEU 18: Dockerfile Best Practices
DCEU 18: Dockerfile Best PracticesDCEU 18: Dockerfile Best Practices
DCEU 18: Dockerfile Best Practices
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
API Asynchrones en Java 8
API Asynchrones en Java 8API Asynchrones en Java 8
API Asynchrones en Java 8
 
Angular 2 observables
Angular 2 observablesAngular 2 observables
Angular 2 observables
 
Useful Linux and Unix commands handbook
Useful Linux and Unix commands handbookUseful Linux and Unix commands handbook
Useful Linux and Unix commands handbook
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
Vue.js
Vue.jsVue.js
Vue.js
 
Vim Editor And Basic Scripting (Ch-7)
Vim Editor And Basic Scripting (Ch-7)Vim Editor And Basic Scripting (Ch-7)
Vim Editor And Basic Scripting (Ch-7)
 
Android & PostgreSQL
Android & PostgreSQLAndroid & PostgreSQL
Android & PostgreSQL
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Prism + ReactiveProperty入門
Prism + ReactiveProperty入門Prism + ReactiveProperty入門
Prism + ReactiveProperty入門
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
NPM
NPMNPM
NPM
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
 

Destaque

Package.json ( NodeJS )
Package.json ( NodeJS )Package.json ( NodeJS )
Package.json ( NodeJS )Vivek Garg
 
npm: Modularizing your JavaScript development
npm: Modularizing your JavaScript developmentnpm: Modularizing your JavaScript development
npm: Modularizing your JavaScript developmentRuy Adorno
 
Working with npm packages
Working with npm packagesWorking with npm packages
Working with npm packagesTomasz Bak
 
Angular 2 Seminar_(December 7/12/2015)
Angular 2 Seminar_(December 7/12/2015)Angular 2 Seminar_(December 7/12/2015)
Angular 2 Seminar_(December 7/12/2015)Haim Michael
 
El proceso de tercerizacion económica (memes)
El proceso de tercerizacion económica (memes)El proceso de tercerizacion económica (memes)
El proceso de tercerizacion económica (memes)Victor Morales
 
Cómo recuperar datos perdidos después de android actualización
Cómo recuperar datos perdidos después de android actualizaciónCómo recuperar datos perdidos después de android actualización
Cómo recuperar datos perdidos después de android actualizaciónJihosoft
 
Parcial de segundo corte
Parcial de segundo corteParcial de segundo corte
Parcial de segundo corteyomariver
 
Twitter im Redaktionsalltag
Twitter im RedaktionsalltagTwitter im Redaktionsalltag
Twitter im RedaktionsalltagTimo Stoppacher
 
Enterprise Node - Securing Your Environment
Enterprise Node - Securing Your EnvironmentEnterprise Node - Securing Your Environment
Enterprise Node - Securing Your EnvironmentKurtis Kemple
 
Node Architecture and Getting Started with Express
Node Architecture and Getting Started with ExpressNode Architecture and Getting Started with Express
Node Architecture and Getting Started with Expressjguerrero999
 
congratulatory letter from GBCI.com
congratulatory letter from GBCI.comcongratulatory letter from GBCI.com
congratulatory letter from GBCI.commax sh.
 
Getting started with Angular CLI
Getting started with Angular CLIGetting started with Angular CLI
Getting started with Angular CLISasha Vinčić
 

Destaque (20)

NPM THE GUIDE
NPM THE GUIDENPM THE GUIDE
NPM THE GUIDE
 
Package.json ( NodeJS )
Package.json ( NodeJS )Package.json ( NodeJS )
Package.json ( NodeJS )
 
npm: Modularizing your JavaScript development
npm: Modularizing your JavaScript developmentnpm: Modularizing your JavaScript development
npm: Modularizing your JavaScript development
 
Working with npm packages
Working with npm packagesWorking with npm packages
Working with npm packages
 
Angular 2 Seminar_(December 7/12/2015)
Angular 2 Seminar_(December 7/12/2015)Angular 2 Seminar_(December 7/12/2015)
Angular 2 Seminar_(December 7/12/2015)
 
Npm
NpmNpm
Npm
 
Nodeconf npm 2011
Nodeconf npm 2011Nodeconf npm 2011
Nodeconf npm 2011
 
El proceso de tercerizacion económica (memes)
El proceso de tercerizacion económica (memes)El proceso de tercerizacion económica (memes)
El proceso de tercerizacion económica (memes)
 
Grelha 06-elementos finitos de placas
Grelha 06-elementos finitos de placasGrelha 06-elementos finitos de placas
Grelha 06-elementos finitos de placas
 
Memoria2011 nexusenergia esp
Memoria2011 nexusenergia espMemoria2011 nexusenergia esp
Memoria2011 nexusenergia esp
 
Cómo recuperar datos perdidos después de android actualización
Cómo recuperar datos perdidos después de android actualizaciónCómo recuperar datos perdidos después de android actualización
Cómo recuperar datos perdidos después de android actualización
 
Parcial de segundo corte
Parcial de segundo corteParcial de segundo corte
Parcial de segundo corte
 
Conclusiones y recomendaciones
Conclusiones y recomendacionesConclusiones y recomendaciones
Conclusiones y recomendaciones
 
Angular 2 - An Introduction
Angular 2 - An IntroductionAngular 2 - An Introduction
Angular 2 - An Introduction
 
Twitter im Redaktionsalltag
Twitter im RedaktionsalltagTwitter im Redaktionsalltag
Twitter im Redaktionsalltag
 
Enterprise Node - Securing Your Environment
Enterprise Node - Securing Your EnvironmentEnterprise Node - Securing Your Environment
Enterprise Node - Securing Your Environment
 
Mercedes Sánchez - TripAdvisor #eHotelExperts
Mercedes Sánchez - TripAdvisor #eHotelExpertsMercedes Sánchez - TripAdvisor #eHotelExperts
Mercedes Sánchez - TripAdvisor #eHotelExperts
 
Node Architecture and Getting Started with Express
Node Architecture and Getting Started with ExpressNode Architecture and Getting Started with Express
Node Architecture and Getting Started with Express
 
congratulatory letter from GBCI.com
congratulatory letter from GBCI.comcongratulatory letter from GBCI.com
congratulatory letter from GBCI.com
 
Getting started with Angular CLI
Getting started with Angular CLIGetting started with Angular CLI
Getting started with Angular CLI
 

Semelhante a NPM Intro: Learn Package Management in Node.js

Overview of Node JS
Overview of Node JSOverview of Node JS
Overview of Node JSJacob Nelson
 
Wrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetWrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetPuppet
 
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
 
Introduction to package manager
Introduction to package managerIntroduction to package manager
Introduction to package manageryashobantabai
 
Deploying NPM packages with the Nix package manager
Deploying NPM packages with the Nix package managerDeploying NPM packages with the Nix package manager
Deploying NPM packages with the Nix package managerSander van der Burg
 
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)Puppet
 
Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015ice799
 
Getting Started with Node.js
Getting Started with Node.jsGetting Started with Node.js
Getting Started with Node.jsJustin Reock
 
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)Aaron Meurer
 
Automating Mendix application deployments with Nix
Automating Mendix application deployments with NixAutomating Mendix application deployments with Nix
Automating Mendix application deployments with NixSander van der Burg
 
Strategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and imagesStrategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and imagesMender.io
 
Making your app soar without a container manifest
Making your app soar without a container manifestMaking your app soar without a container manifest
Making your app soar without a container manifestLibbySchulze
 
Steps to Install NPM and Node.js on Windows and MAC
Steps to Install NPM and Node.js on Windows and MACSteps to Install NPM and Node.js on Windows and MAC
Steps to Install NPM and Node.js on Windows and MACInexture Solutions
 
Node Package Manager Tutorial | NPM Tutorial for Beginners | Express JS Tutor...
Node Package Manager Tutorial | NPM Tutorial for Beginners | Express JS Tutor...Node Package Manager Tutorial | NPM Tutorial for Beginners | Express JS Tutor...
Node Package Manager Tutorial | NPM Tutorial for Beginners | Express JS Tutor...Simplilearn
 
Installing Software, Part 3: Command Line
Installing Software, Part 3: Command LineInstalling Software, Part 3: Command Line
Installing Software, Part 3: Command LineKevin OBrien
 
Create ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageCreate ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageAndrii Lundiak
 

Semelhante a NPM Intro: Learn Package Management in Node.js (20)

Overview of Node JS
Overview of Node JSOverview of Node JS
Overview of Node JS
 
Wrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetWrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from Puppet
 
Node.js
Node.jsNode.js
Node.js
 
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
 
Introduction to package manager
Introduction to package managerIntroduction to package manager
Introduction to package manager
 
Debian packaging
Debian packagingDebian packaging
Debian packaging
 
Deploying NPM packages with the Nix package manager
Deploying NPM packages with the Nix package managerDeploying NPM packages with the Nix package manager
Deploying NPM packages with the Nix package manager
 
nuxt-en.pdf
nuxt-en.pdfnuxt-en.pdf
nuxt-en.pdf
 
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
Puppet Camp LA 2015: Package Managers and Puppet (Beginner)
 
Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015
 
Getting Started with Node.js
Getting Started with Node.jsGetting Started with Node.js
Getting Started with Node.js
 
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
 
Automating Mendix application deployments with Nix
Automating Mendix application deployments with NixAutomating Mendix application deployments with Nix
Automating Mendix application deployments with Nix
 
Strategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and imagesStrategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and images
 
Making your app soar without a container manifest
Making your app soar without a container manifestMaking your app soar without a container manifest
Making your app soar without a container manifest
 
Steps to Install NPM and Node.js on Windows and MAC
Steps to Install NPM and Node.js on Windows and MACSteps to Install NPM and Node.js on Windows and MAC
Steps to Install NPM and Node.js on Windows and MAC
 
Node Package Manager Tutorial | NPM Tutorial for Beginners | Express JS Tutor...
Node Package Manager Tutorial | NPM Tutorial for Beginners | Express JS Tutor...Node Package Manager Tutorial | NPM Tutorial for Beginners | Express JS Tutor...
Node Package Manager Tutorial | NPM Tutorial for Beginners | Express JS Tutor...
 
Installing Software, Part 3: Command Line
Installing Software, Part 3: Command LineInstalling Software, Part 3: Command Line
Installing Software, Part 3: Command Line
 
Ferrara Linux Day 2011
Ferrara Linux Day 2011Ferrara Linux Day 2011
Ferrara Linux Day 2011
 
Create ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageCreate ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm package
 

Último

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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
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
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
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
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Último (20)

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!
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
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
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
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
 
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
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

NPM Intro: Learn Package Management in Node.js

  • 2. Introduction to Agenda ● What is NPM? ● Understanding package.json ● Where to find Packages? ● Installing Packages ● Writing your own Packages ● Command Line ● Publishing to NPM ● Questions & Exercises
  • 3. Introduction to What is NPM? First Time Using NPM
  • 4. Introduction to What is NPM? ● A Node Package Manager ● No other Package Manager comes closer ● Is also used by developers who don’t use Node.js at all ● Created by Isaac Z. Schlueter ● Breeze to use ● Recently made into a company, NPM Inc. by Isaac ● Free and Open Source!
  • 5. Introduction to Understanding package.json ● It is a valid JSON object ● name and version fields are required, the combination makes a unique identifier for the package ● Some used fields in package.json ○ description ○ keywords ○ homepage ○ bugs ○ license ○ author & contributors ○ main ○ bin ○ dependencies ○ scripts - {start, preinstall}
  • 6. Introduction to Where to find Packages? https://npmjs.org
  • 7. Introduction to Installing Packages ● npm comes along with node.js ● to install a package run: ○ npm install <package-name> ○ npm install <tarball file> ○ npm install <tarball url> ● install a package globally ○ npm install -g <package-name> Note: Global installation makes the package available globally irrespective of the directory you installed it from.
  • 8. Introduction to Writing your own packages ● Install Grunt , the javascript task runner ○ npm install -g grunt-cli ● Run command : ○ grunt-init node ● Answer few questions and you are ready with a nice package.json file and main .js file for your package.
  • 9. Introduction to Writing your own packages The generated folder structure should look something like this: Write the code in the .js file created, you can also create many more files as per your need.
  • 10. Introduction to Writing your own packages Some guidelines to keep in mind when writing new packages: ● Don’t reinvent the wheel ● Try to contribute to other packages whenever possible ● If you are writing a utility package, then multiple exports should be used ● If your package needs to maintain a state then its good to export a constructor ● Most Important thing, KEEP IT COOL!
  • 11. Introduction to Command Line To be able to use your package through command line, you need to specify ‘bin’ in package.json as follows: "bin": { "nodeart": "lib/nodeArt.js" } Also add this #! /usr/bin/env node at the top of “lib/nodeArt.js” file. This tells how the file should be executed. As above, ‘nodeart’ will be the command available to you when you install the package on your machine.
  • 12. Introduction to Command Line You can receive the arguments passed from command line in process.argv array. First two values in the array are pre-defined : [ 'node', '/opt/node-v0.10.5-linux-x64/bin/nodeArt'] The actual arguments being passed will be available at indexes greater than 1. So if you run nodeart ‘suroor wijdan’, the process.argv array will be: [ 'node', '/opt/node-v0.10.5-linux-x64/bin/nodeArt', ‘suroor wijdan’]
  • 13. Introduction to Command Line So its better to slice the array and store the arguments in another variable: var argumentsPassed = process.argv.slice(2);
  • 14. Introduction to Publishing to NPM To publish on NPM, you just need to have an account on it. To make an account run the following command: Once you have the account ready, just run the below command from project root to publish your module: And thats all, everything else will be taken care of by NPM registry. npm adduser //will ask for username, email and password npm publish
  • 17. Introduction to References 1. NPM Logo - https://npmjs.org 2. https://npmjs.org/doc/ 3. Image Credit - http://nodejsreactions.tumblr.com/post/64781824365/first-time-using-npm 4. Grunt Logo - http://gruntjs.com