SlideShare a Scribd company logo
www.luxoft.com
Modules and
Artifacts in NPM
- When do we need to create npm module?
- How to create npm module?
- How to easy import modules into the project?
- How to publish npm artifact?
- Where we should store npm modules?
- public and private npm registry
- How to maintain modules without PAIN
Modules and artifacts in NPM
NPM modules. Why
- Isolating components that are duplicated in multiple projects
- Flexibility in development
- Using the advantages of versioning
- Convenience during release
- Common standards for working with components
Fast solution
npm install --save username/repo#branch-name
.npmrc file with registry path
NO!
NPM CLI
- npm publish (publish your package):
- configure package.json
- describe README.MD
- set default credentials
- tap npm publish
- enjoy public registry
- npm pack (own artifact):
- setup your package.json
- tap npm pack
- get file <name>-<version>.tgz
- OK. WHAT'S NEXT?
Anton Cherednikov "Modules and Artifacts in NPM"
Registry
default (https://registry.npmjs.org)
- public (may do anything with any dependencies)
- private:
- MyGet (https://www.myget.org) —which costs US$
9/month for starter plan and you only would have 2
contributors and 1GB storage
- NPM Org (https://www.npmjs.com)—which costs US$ 7 per
user per month. (Organize packages and teams into
permissions groups)
- *Custom solution
left-pad - as an example of unexpected behavior of public registry
(https://www.npmjs.com/policies/terms)
Anton Cherednikov "Modules and Artifacts in NPM"
Artifactory
- Artifactory provides full support for managing npm packages and
ensures optimal and reliable access to npmjs.org.
- The ability to access multiple npm registries from a single URL by
aggregating them under a Virtual Repository. This overcomes the
limitation of the npm client which can only access a single registry at
a time.
- Support for flexible npm repository layouts that allow you to
organize your npm packages and assign access privileges
according to projects or development teams.
* duplication of dependencies using the virtual repository Artifactory -
will protect dependencies from deletion / renaming case
Anton Cherednikov "Modules and Artifacts in NPM"
Recommendations
- Choose the right solution for each individual situation (git
dependency, public/private registry, registry provider...)
- Try to avoid public registry
- Follow the rules of semantic versioning
- Don't fuck up with package.json dependencies specification ^, ~
- Collect old artifacts
- Build process of deployment your npm modules with a team
(example: prefix for development, republish package terms)
- CI / CD
Semantic Versioning
semver.org
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards-
compatible manner, and
- PATCH version when you make backwards-compatible bug
fixes.
Basic CI/CD flow
example
- unit tests - run on each commit. Quality control.
- manual publish - publish npm module to artifactory. Manual
action. Appends a prefix to the artifact name
- manual unpublish - remove npm module from artifactory
- autopublish - triggered only when changes were merged in
master. Publish npm module to artifactory without any prefixes
Anton Cherednikov "Modules and Artifacts in NPM"

More Related Content

What's hot (20)

PDF
OpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
Alkacon Software GmbH & Co. KG
 
PDF
openSUSE Conference 2017 - YaST News
lslezak
 
PPTX
Domain's Robot Army
domaingroup
 
PDF
Composer
Naseer Ahmad
 
PPTX
Hang fire
Reshmy P.P
 
PDF
Screaming Fast Wpmu
djcp
 
PDF
Vagrantfordevops
Deepanshu Gajbhiye
 
ODP
Wt vs phalcon
Amitoj Singh
 
PDF
Writing your own browser reload functionality
Anže Žnidaršič
 
PDF
Introducción a Nginx y PHP FPM
Yannick Warnier
 
ODP
Laka Blogging engine
Amitoj Singh
 
PPT
easyM2R
Carsten Klee
 
PDF
WordPress Performance & Scalability
Joseph Scott
 
PDF
Frontend Build Tools - CC FE & UX
JWORKS powered by Ordina
 
PPTX
Vertx in production
Mariam Hakobyan
 
PPTX
Production ready Vert.x
Sascha Möllering
 
PDF
How Can OpenNebula Fit Your Needs: A European Project Feedback
NETWAYS
 
PDF
How can OpenNebula fit your needs - OpenNebulaConf 2013
Maxence Dunnewind
 
PDF
Александр Махомет "Feature Flags. Уменьшаем риски при выпуске изменений"
Fwdays
 
PDF
libcurl, seven SSL libraries and one SSH library
Daniel Stenberg
 
OpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
Alkacon Software GmbH & Co. KG
 
openSUSE Conference 2017 - YaST News
lslezak
 
Domain's Robot Army
domaingroup
 
Composer
Naseer Ahmad
 
Hang fire
Reshmy P.P
 
Screaming Fast Wpmu
djcp
 
Vagrantfordevops
Deepanshu Gajbhiye
 
Wt vs phalcon
Amitoj Singh
 
Writing your own browser reload functionality
Anže Žnidaršič
 
Introducción a Nginx y PHP FPM
Yannick Warnier
 
Laka Blogging engine
Amitoj Singh
 
easyM2R
Carsten Klee
 
WordPress Performance & Scalability
Joseph Scott
 
Frontend Build Tools - CC FE & UX
JWORKS powered by Ordina
 
Vertx in production
Mariam Hakobyan
 
Production ready Vert.x
Sascha Möllering
 
How Can OpenNebula Fit Your Needs: A European Project Feedback
NETWAYS
 
How can OpenNebula fit your needs - OpenNebulaConf 2013
Maxence Dunnewind
 
Александр Махомет "Feature Flags. Уменьшаем риски при выпуске изменений"
Fwdays
 
libcurl, seven SSL libraries and one SSH library
Daniel Stenberg
 

Similar to Anton Cherednikov "Modules and Artifacts in NPM" (20)

PDF
open source product management (feat. npm)
Forrest Norvell
 
PPTX
Modular development in Node.js
Mehdi Valikhani
 
PDF
Cover Your Apps While Still Using npm
Tierney Cyren
 
PDF
npm + browserify
maxgfeller
 
PPTX
GDG Morgantown, WV: Write code you can depend on!
Logan Spears
 
KEY
Nodeconf npm 2011
Florent Jaby ヅ
 
PDF
O365Con19 - Sharing Code Efficiently in your Organisation - Elio Struyf
NCCOMMS
 
PDF
Bringing Open-Source Practices to Your Day Job
Ben Coe
 
PPTX
NPM (Node Package Manager) A powerful package manager for JavaScript and Node.js
Amit Shinde
 
PDF
NPM THE GUIDE
Kameron Tanseli
 
PPTX
Overview of Node JS
Jacob Nelson
 
PDF
Repository Management with JFrog Artifactory
Stephen Chin
 
PDF
Introduction to NPM and building CLI Tools with Node.js
Suroor Wijdan
 
PDF
Distributing UI Libraries: in a post Web-Component world
Rachael L Moore
 
PDF
Introducing Electron
Baylee Schmeisser
 
PPTX
Building Open-Source React Components
Zack Argyle
 
PPTX
Building Open-source React Components
Zack Argyle
 
PDF
An Introduction of Node Package Manager (NPM)
iFour Technolab Pvt. Ltd.
 
open source product management (feat. npm)
Forrest Norvell
 
Modular development in Node.js
Mehdi Valikhani
 
Cover Your Apps While Still Using npm
Tierney Cyren
 
npm + browserify
maxgfeller
 
GDG Morgantown, WV: Write code you can depend on!
Logan Spears
 
Nodeconf npm 2011
Florent Jaby ヅ
 
O365Con19 - Sharing Code Efficiently in your Organisation - Elio Struyf
NCCOMMS
 
Bringing Open-Source Practices to Your Day Job
Ben Coe
 
NPM (Node Package Manager) A powerful package manager for JavaScript and Node.js
Amit Shinde
 
NPM THE GUIDE
Kameron Tanseli
 
Overview of Node JS
Jacob Nelson
 
Repository Management with JFrog Artifactory
Stephen Chin
 
Introduction to NPM and building CLI Tools with Node.js
Suroor Wijdan
 
Distributing UI Libraries: in a post Web-Component world
Rachael L Moore
 
Introducing Electron
Baylee Schmeisser
 
Building Open-Source React Components
Zack Argyle
 
Building Open-source React Components
Zack Argyle
 
An Introduction of Node Package Manager (NPM)
iFour Technolab Pvt. Ltd.
 
Ad

More from LogeekNightUkraine (20)

PPTX
Face recognition with c++
LogeekNightUkraine
 
PPTX
C++20 features
LogeekNightUkraine
 
PPTX
Autonomous driving on your developer pc. technologies, approaches, future
LogeekNightUkraine
 
PDF
Orkhan Gasimov "High Performance System Design"
LogeekNightUkraine
 
PPTX
Vitalii Korzh "Managed Workflows or How to Master Data"
LogeekNightUkraine
 
PDF
Yevhen Tatarynov "From POC to High-Performance .NET applications"
LogeekNightUkraine
 
PDF
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
LogeekNightUkraine
 
PDF
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
LogeekNightUkraine
 
PDF
Pavlo Zhdanov "Mastering solid and base principles for software design"
LogeekNightUkraine
 
PDF
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
LogeekNightUkraine
 
PDF
Iurii Antykhovych "Java and performance tools and toys"
LogeekNightUkraine
 
PDF
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
LogeekNightUkraine
 
PPTX
Aleksandr Kutsan "Managing Dependencies in C++"
LogeekNightUkraine
 
PDF
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
LogeekNightUkraine
 
PDF
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
LogeekNightUkraine
 
PPTX
Michal Kordas "Docker: Good, Bad or Both"
LogeekNightUkraine
 
PPTX
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
LogeekNightUkraine
 
PPTX
Shestakov Illia "The Sandbox Theory"
LogeekNightUkraine
 
PPTX
Dmytro Kochergin “Autotest with CYPRESS”
LogeekNightUkraine
 
PPTX
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
LogeekNightUkraine
 
Face recognition with c++
LogeekNightUkraine
 
C++20 features
LogeekNightUkraine
 
Autonomous driving on your developer pc. technologies, approaches, future
LogeekNightUkraine
 
Orkhan Gasimov "High Performance System Design"
LogeekNightUkraine
 
Vitalii Korzh "Managed Workflows or How to Master Data"
LogeekNightUkraine
 
Yevhen Tatarynov "From POC to High-Performance .NET applications"
LogeekNightUkraine
 
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
LogeekNightUkraine
 
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
LogeekNightUkraine
 
Pavlo Zhdanov "Mastering solid and base principles for software design"
LogeekNightUkraine
 
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
LogeekNightUkraine
 
Iurii Antykhovych "Java and performance tools and toys"
LogeekNightUkraine
 
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
LogeekNightUkraine
 
Aleksandr Kutsan "Managing Dependencies in C++"
LogeekNightUkraine
 
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
LogeekNightUkraine
 
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
LogeekNightUkraine
 
Michal Kordas "Docker: Good, Bad or Both"
LogeekNightUkraine
 
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
LogeekNightUkraine
 
Shestakov Illia "The Sandbox Theory"
LogeekNightUkraine
 
Dmytro Kochergin “Autotest with CYPRESS”
LogeekNightUkraine
 
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
LogeekNightUkraine
 
Ad

Recently uploaded (20)

PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
July Patch Tuesday
Ivanti
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
July Patch Tuesday
Ivanti
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 

Anton Cherednikov "Modules and Artifacts in NPM"

  • 2. - When do we need to create npm module? - How to create npm module? - How to easy import modules into the project? - How to publish npm artifact? - Where we should store npm modules? - public and private npm registry - How to maintain modules without PAIN Modules and artifacts in NPM
  • 3. NPM modules. Why - Isolating components that are duplicated in multiple projects - Flexibility in development - Using the advantages of versioning - Convenience during release - Common standards for working with components
  • 4. Fast solution npm install --save username/repo#branch-name .npmrc file with registry path
  • 5. NO!
  • 6. NPM CLI - npm publish (publish your package): - configure package.json - describe README.MD - set default credentials - tap npm publish - enjoy public registry - npm pack (own artifact): - setup your package.json - tap npm pack - get file <name>-<version>.tgz - OK. WHAT'S NEXT?
  • 8. Registry default (https://registry.npmjs.org) - public (may do anything with any dependencies) - private: - MyGet (https://www.myget.org) —which costs US$ 9/month for starter plan and you only would have 2 contributors and 1GB storage - NPM Org (https://www.npmjs.com)—which costs US$ 7 per user per month. (Organize packages and teams into permissions groups) - *Custom solution left-pad - as an example of unexpected behavior of public registry (https://www.npmjs.com/policies/terms)
  • 10. Artifactory - Artifactory provides full support for managing npm packages and ensures optimal and reliable access to npmjs.org. - The ability to access multiple npm registries from a single URL by aggregating them under a Virtual Repository. This overcomes the limitation of the npm client which can only access a single registry at a time. - Support for flexible npm repository layouts that allow you to organize your npm packages and assign access privileges according to projects or development teams. * duplication of dependencies using the virtual repository Artifactory - will protect dependencies from deletion / renaming case
  • 12. Recommendations - Choose the right solution for each individual situation (git dependency, public/private registry, registry provider...) - Try to avoid public registry - Follow the rules of semantic versioning - Don't fuck up with package.json dependencies specification ^, ~ - Collect old artifacts - Build process of deployment your npm modules with a team (example: prefix for development, republish package terms) - CI / CD
  • 13. Semantic Versioning semver.org - MAJOR version when you make incompatible API changes, - MINOR version when you add functionality in a backwards- compatible manner, and - PATCH version when you make backwards-compatible bug fixes.
  • 14. Basic CI/CD flow example - unit tests - run on each commit. Quality control. - manual publish - publish npm module to artifactory. Manual action. Appends a prefix to the artifact name - manual unpublish - remove npm module from artifactory - autopublish - triggered only when changes were merged in master. Publish npm module to artifactory without any prefixes