SlideShare una empresa de Scribd logo
1 de 35
Descargar para leer sin conexión
JavaScript Build tools, npm, bower, git
and grunt
Marc Torrent & Raúl Delgado
NPM
“The trouble with programmers is that you can never
tell what a programmer is doing until it’s too late.”
—Seymour Cray
What is a package manager?
Is a collection of software tools that automates the process of installing, upgrading,
configuring, and removing software packages
Why use a package manager?
It is clean, tidy and forced everyone to have the same packages with the same versions
What managers are for JS?
Package managers for Javascript
Node Package Manager (NPM)
Back-end or Front-end ?
Both, but mainly in back-end.
How do I use it?
Command lines
How many packages have?
Some packages
Important command lines:
Node Package Manager (NPM)
$ npm init
$ npm search <package name | key word>
$ npm install <package name> | --save
$ npm uninstall <package name>
( --save option instructs NPM to include the package inside of the dependencies section of your
package.json )
Node Package Manager (NPM)
- Project’s name
- Author
- Version
- Dependencies
- Scripts
- Git repository
- Node engine
NPM Package.json
- Project’s name
- Author
- Version
- Dependencies
- Scripts
- Git repository
- Node engine
NPM Package.json
NPM info..
https://docs.npmjs.com/
https://docs.npmjs.com/getting-started/what-is-npm
https://quickleft.com/blog/creating-and-publishing-a-node-js-module/
http://howtonode.org/introduction-to-npm
http://www.sitepoint.com/beginners-guide-node-package-manager/
https://dreyacosta.com/webserver-con-node-y-express/
http://www.nodehispano.com/2012/04/una-introduccion-a-npm-nodejs/
https://www.google.es/
Bower
“The reason why God could create the universe in six days do not
have to worry about it compatible with the previous version.”
—Anonymous
BOWER
Front-end package manager
How to install bower?
# npm install -g bower
Bower commands
$ bower init
$ bower search <package>
$ bower install <package>
$ bower uninstall <package>
Bower: bower.json
- name
- version
- packages
- version packages
.bowerrc :
This file is used, among other things, to
modify the directory where to install
components Bower.
Bower info…
http://bower.io/
https://www.codementor.io/bower/tutorial/beginner-tutorial-getting-started-bower-
package-manager
http://code.tutsplus.com/tutorials/how-to-setup-bower-in-your-next-project--cms-
20526
https://www.quora.com/Why-use-Bower-when-there-is-npm
http://blog.teamtreehouse.com/getting-started-bower
https://www.google.es/
Git
—Anonymous
“It’s not a bug – it’s an undocumented feature.”
VCS
What is Git ?
Version Control System
Why is it necessary to use a VCS ?
- Storage elements of the project
- Ability to make changes to stored items
- Historical record of the actions taken
What if you do not use?
Storage architectures
Centralized VCS (CVCS) Distributed VCS (DCVS)
Git
Why git?
Git almost all operations are local:
-To browse history
-See changes in another version
-Branches
Data integrity (checksum)
-Way control redundancy to protect data integrity impossible to change a
file git project without knowing. You can not upload files corrupted.
Git actions are always modifiable
- After making a commit it is very difficult to lose data
Git commands
SourceTree
Work styles
-Everybody works in
master-branch
-Branch for epic-task
-Commits for task
-Create branch for
stable version
-One user one
branch
-One task one
branch
-Create commit into
main branch por
stable version
-Master-branch
Developer-branch
User-branch
Task-branch
Git info…
http://git-scm.com/
http://git-scm.com/book/en/v2
https://git-scm.com/book/es/v1/Git-en-entornos-distribuidos-Gestionando-un-
proyecto
http://rogerdudler.github.io/git-guide/index.es.html
http://www.ndpsoftware.com/git-cheatsheet.html#loc=remote_repo;
http://blogs.atlassian.com/2012/03/git-vs-mercurial-why-git/
https://www.wikivs.com/wiki/Git_vs_Mercurial?
https://importantshock.wordpress.com/2008/08/07/git-vs-mercurial/
https://www.google.es/
Grunt.js is a Javascript task runner. At its bare core it does file
manipulation (mkdir, reads, write, copy), print messages and
helper methods to organize and configure multiple tasks. It
takes care of differences among Operating Systems for you.
However, the real power comes in with the number of
available plugins ready to use.
Installing GruntJS
npm install grunt --save-dev
npm install -g grunt-cli
➢ Add a Gruntfile to the project
➢ Edit the configuration file for the tasks you want to run
➢ Write your own tasks
➢ Use plugins for common tasks
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
myTask: { a custom configuration object },
karma: {
unit: {
configFile: 'test/karma.conf.js'
}
}
};
// Load our own tasks
grunt.loadTasks('./tools/grunt-tasks');
// Load 3rd party tasks
grunt.loadNpmTasks('grunt-karma');
// Register our custom named task
grunt.registerTask('validate', ['karma:unit', ‘myTask]);
};
> npm install grunt-karma
grunt-contrib-sass --
save-dev
> grunt karma
……
> grunt validate
Grunt Tasks I
Basic Tasks
grunt.registerTask(taskName, [description,] taskFunction)
grunt.registerTask(‘myTask’, ‘This task is for example purposes’,
function(arg1, arg2) {
grunt.log.writeln(this.name + ‘, ‘ + arg1 + ‘ ‘ + arg2);
});
> grunt myTask:foo:12345
myTask, foo, 12345
Grunt Tasks II
Multi Tasks
grunt.registerMultiTask(taskName, [description,] taskFunction)
grunt.registerMultiTask(‘myTask’, ‘This task is for example
purposes’, function() {
grunt.log.writeln(this.target + ‘: ‘ +
this.data.description);
});
…
myTask: {
target1: {
description: ‘Target 1 description’,
list: [‘item1’, ‘item2’, ‘item3’]
},
target2: {
description: ‘Target 2 description’,
list: [‘item4’, ‘item5’, ‘item6’]
}
}
...
> grunt myTask:target1
target1: Target 1 description
> grunt myTask:target2
target2: Target 2 description
> grunt myTask
target1: Target 1 description
target2: Target 2 description
Grunt Tasks III
Alias Tasks
grunt.registerTask(taskName, [description, ] taskList)
grunt.registerTask(‘validate’,[‘karma:unit’, ‘myTask:target1’]);
> grunt validate
Karma running …
...
target1: Target 1 description
Grunt Tasks IV
Asynchronous Tasks
grunt.registerTask(‘myTask’,function(){
var done = this.async();
grunt.log.writeln(‘Processing task…’);
setTimeout(function(){
grunt.log.writeln(‘Task done’);
done();
}, 1000);
});
Fork Process
grunt.registerTask(‘myTask’,function(){
var done = this.async(),
options = {
cmd: ‘command_to_execute’,
args: [‘arg1’, ‘arg2’],
options: {}
};
grunt.util.spawn(options, done);
});
Build process with GruntJS
Build Process
➢grunt-contrib-jshint: syntax and coding style
checking
➢grunt-contrib-sass: compile sass to css
➢grunt-karma: pass client side testing
➢compile-templates: from templates to html
➢requirejs: build requirejs optimized bundle
➢clean: clean unused assets and create final
directory with production HTML and JS
Let’s see it in action!
Workshop 3: JavaScript build tools

Más contenido relacionado

La actualidad más candente

Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 

La actualidad más candente (20)

Workshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCWorkshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVC
 
Workshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & ReduxWorkshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & Redux
 
Workshop 24: React Native Introduction
Workshop 24: React Native IntroductionWorkshop 24: React Native Introduction
Workshop 24: React Native Introduction
 
Workshop Intro: FrontEnd General Overview
Workshop Intro: FrontEnd General OverviewWorkshop Intro: FrontEnd General Overview
Workshop Intro: FrontEnd General Overview
 
AngularJS with RequireJS
AngularJS with RequireJSAngularJS with RequireJS
AngularJS with RequireJS
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
How to build to do app using vue composition api and vuex 4 with typescript
How to build to do app using vue composition api and vuex 4 with typescriptHow to build to do app using vue composition api and vuex 4 with typescript
How to build to do app using vue composition api and vuex 4 with typescript
 
Dependency Injection @ AngularJS
Dependency Injection @ AngularJSDependency Injection @ AngularJS
Dependency Injection @ AngularJS
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
Workshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareWorkshop 22: React-Redux Middleware
Workshop 22: React-Redux Middleware
 
React
React React
React
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native Side
 
Using React, Redux and Saga with Lottoland APIs
Using React, Redux and Saga with Lottoland APIsUsing React, Redux and Saga with Lottoland APIs
Using React, Redux and Saga with Lottoland APIs
 
How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design Patterns
 
7 Redux challenges
7 Redux challenges7 Redux challenges
7 Redux challenges
 
Workshop 25: React Native - Components
Workshop 25: React Native - ComponentsWorkshop 25: React Native - Components
Workshop 25: React Native - Components
 
Angular 1 + es6
Angular 1 + es6Angular 1 + es6
Angular 1 + es6
 
Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.
 

Similar a Workshop 3: JavaScript build tools

Similar a Workshop 3: JavaScript build tools (20)

Improving build solutions dependency management with webpack
Improving build solutions  dependency management with webpackImproving build solutions  dependency management with webpack
Improving build solutions dependency management with webpack
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Front end development gurant
Front end development gurantFront end development gurant
Front end development gurant
 
Front-end tools
Front-end toolsFront-end tools
Front-end tools
 
Getting Started With CFEngine - Updated Version
Getting Started With CFEngine - Updated VersionGetting Started With CFEngine - Updated Version
Getting Started With CFEngine - Updated Version
 
Modern Development Tools
Modern Development ToolsModern Development Tools
Modern Development Tools
 
Get Grulping with JavaScript Task Runners (Matt Gifford)
Get Grulping with JavaScript Task Runners (Matt Gifford)Get Grulping with JavaScript Task Runners (Matt Gifford)
Get Grulping with JavaScript Task Runners (Matt Gifford)
 
Improving WordPress Theme Development Workflow - Naveen Kharwar.
Improving WordPress Theme Development Workflow - Naveen Kharwar.Improving WordPress Theme Development Workflow - Naveen Kharwar.
Improving WordPress Theme Development Workflow - Naveen Kharwar.
 
GruntJS + Wordpress
GruntJS + WordpressGruntJS + Wordpress
GruntJS + Wordpress
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 Development
 
Buildr - build like you code
Buildr -  build like you codeBuildr -  build like you code
Buildr - build like you code
 
Grunt training deck
Grunt training deckGrunt training deck
Grunt training deck
 
Automating Front-End Workflow
Automating Front-End WorkflowAutomating Front-End Workflow
Automating Front-End Workflow
 
Towards Continuous Deployment with Django
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with Django
 
Maven
MavenMaven
Maven
 
Capistrano与jenkins(hudson)在java web项目中的实践
Capistrano与jenkins(hudson)在java web项目中的实践Capistrano与jenkins(hudson)在java web项目中的实践
Capistrano与jenkins(hudson)在java web项目中的实践
 
Magento & Cloud - Korostelov Avexey
Magento & Cloud - Korostelov AvexeyMagento & Cloud - Korostelov Avexey
Magento & Cloud - Korostelov Avexey
 

Más de Visual Engineering

Más de Visual Engineering (15)

Workshop iOS 4: Closures, generics & operators
Workshop iOS 4: Closures, generics & operatorsWorkshop iOS 4: Closures, generics & operators
Workshop iOS 4: Closures, generics & operators
 
Workshop iOS 3: Testing, protocolos y extensiones
Workshop iOS 3: Testing, protocolos y extensionesWorkshop iOS 3: Testing, protocolos y extensiones
Workshop iOS 3: Testing, protocolos y extensiones
 
Workshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - StructuresWorkshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - Structures
 
Workhop iOS 1: Fundamentos de Swift
Workhop iOS 1: Fundamentos de SwiftWorkhop iOS 1: Fundamentos de Swift
Workhop iOS 1: Fundamentos de Swift
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
 
Workshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux AdvancedWorkshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux Advanced
 
Workshop 21: React Router
Workshop 21: React RouterWorkshop 21: React Router
Workshop 21: React Router
 
Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effects
 
Workshop 15: Ionic framework
Workshop 15: Ionic frameworkWorkshop 15: Ionic framework
Workshop 15: Ionic framework
 
Workshop 8: Templating: Handlebars, DustJS
Workshop 8: Templating: Handlebars, DustJSWorkshop 8: Templating: Handlebars, DustJS
Workshop 8: Templating: Handlebars, DustJS
 
Workshop 11: Trendy web designs & prototyping
Workshop 11: Trendy web designs & prototypingWorkshop 11: Trendy web designs & prototyping
Workshop 11: Trendy web designs & prototyping
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
 
Workshop 7: Single Page Applications
Workshop 7: Single Page ApplicationsWorkshop 7: Single Page Applications
Workshop 7: Single Page Applications
 
Workshop 6: Designer tools
Workshop 6: Designer toolsWorkshop 6: Designer tools
Workshop 6: Designer tools
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Último (20)

How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 

Workshop 3: JavaScript build tools