SlideShare a Scribd company logo
WORKFLOW AUTOMATION FOR WEB
APPLICATIONS
MAYANK PATEL
APPLICATION ARCHITECT - OILDEX, A SERVICE OF
TRANSZAP
 / Linked In @maxy_ermayank
WHY WORKFLOW AUTOMATION?
Boilerplate
Dependency management
Framework
Abstrations
Build
Automation test
Docs
Continuous integration
Deployment
Performance optimization
Workflow
Deployment
WORK FLOW
SETUP
Download
dependecies
Download
frameworks
Download
libraries
Scaffolding
DEVELOP
Non minified
Linting (HTML, JS)
Seperated files
Generate responsive
images
Optimize images
Compilation
(CoffeScript, SASS,
LESS..)
Test configuration
Unit testing & e2e
testing
Generate test report
Watchers
Live reload
BUILD
Annotate (JS)
Generate copyright and
license information
Sourcemap (JS, CSS)
Concatenation (JS, CSS)
Minification (HTML, JS, CSS)
Uglification (HTML, JS, CSS)
Compress (JS, CSS)
Live configuration
Compiled
Renamed
Cache templates (HTML)
Inject resources in Template
Optimize performance
Deployment setup
DEPENDENCY MANAGEMENT TOOLS
Downloads dependencies using Git, HTTPS, ZIP, npm
npm
Bower
NPM
Package manager for the web
Comes with node.js
Default for node.js modules
INSTALL NODE.JS
Filename: package.json
Download and follow installation guidenode.js
NPM EXAMPLES
Find available package .Here
> npm install
<package>
-g installs package globally
> npm install -g
<package>
use --save to save dependecy in package.json & -dev to lock package v
> npm install
<package> --save-dev
```
> npm init
```
SAMPLE PACKAGE.JSON
{
"name": "project-name",
"version": "1.0.0",
"description": "Description goes here",
"main": "index.html",
"scripts": {
"test": "gulp e2e"
},
"repository": {
"type": "git",
"url": "https://example.com/project-name"
},
"author": "Mayank Patel
<maxy.ermayank@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://example.com/project-name/issues"
DEMO TIME
BOWER
Package manager for the web
Designed solely for web and it is optimized with that in mind.
INSTALL
Filename: bower.json
Install Globally
> npm install -g bower
Install in your project
> npm install bower
EXAMPLES
Packages available Here
bower install
<package>
bower install git://github.com/user/package.git
bower install http://example.com/script.js
SAMPLE BOWER.JSON
{
"name": "project-name",
"version": "1.0.0",
"author": "Mayank Patel
<maxy.ermayank@gmail.com>",
"homepage": "https://example.com/project-name",
"description": "Description goes here",
"main": "index.html",
"license": "apache 2",
"dependencies": {
"angular": "1.3.15",
"json3": "~3.2.4",
"es5-shim": "~2.0.8",
"angular-resource": "1.3.15",
"d3": "3.3.x"
},
"devDependencies": {
DEMO TIME
SCAFFOLDING TOOL / GENERATOR
YEMON (YO)
Scaffolds out boilerplate
Abstraction
Performance optimization
Testing and Build process
Custom generators are available
Install YO globally
> npm install -g yo
EXAMPLES
> yo
[?] What would you like to do?
›❯ Install a generator
Run the Angular generator (0.4.0)
Run the Backbone generator (0.1.9)
Run the Blog generator (0.0.0)
Run the jQuery generator (0.1.4)
Run the Gruntfile generator (0.0.6)
(Move up and down to reveal more choices)
yo jquery-boilerplate
Boom. You just created a jQuery plugin.
CUSTOM GENERATOR
Find available generators <a
href=" " target="_blank"http://yeoman.io/generators/
style="color: #fff;">Here</a>.</p>
> npm install generator-bootstrap -g
> yo bootstrap
> npm install generator-webapp -g
> yo webapp
GENERATE ENTERPRISE APP USING
ANGULAR
> npm install generator-angular -g
> yo angular
> yo angular:view user
> yo angular:controller user
> yo angular:directive mydirective
DEMO TIME
BUILD TOOL
GULP STRENGTH
Mature: ~ Aug 2013, relatively mature
Community Support: New kid in town, Picking up popularity
Code over configuration
Easy to read & use
Tons of plugins available
Provides node streams - no need for tmp files/folders
Plugins do ONE thing
Provides plugin to run Grunt tasks
Only has 5 functions to learn!
Runs with maximum concurrency by default
GULP WEEKNESSES
Can be daunting to learn streams
Sometimes setting up src/dest can be tricky (use base)
Streams are not a great abstraction for complex builds. They don't compose well.
INSTALL GULP
Filename: gulpfile.js
Install Gulp in your project
> npm install gulp --save
Install Gulp Globaly
> npm install -g gulp
THE GULP API
gulp.task(name[, deps], fn)
gulp.src(globs)
gulp.dest(path)
gulp.watch(glob[, opts], tasks)
gulp.run(tasks...)
GULP.TASK(NAME[, DEPS], FN)
gulp.task('somename', function() {
// Do stuff
});
gulp.task('build', ['somename', 'test'];
> gulp build
GULP.SRC(GLOBS)
gulp.src('client/templates/*.jade')
.pipe(jade())
gulp.src(['src/**/*.js', 'test/spec/**/*.js'])
.pipe(jshint())
GULP.DEST(PATH)
gulp.src('./client/templates/*.jade')
.pipe(jade())
.pipe(gulp.dest('./build/templates'))
.pipe(minify())
.pipe(gulp.dest('./build/minified_templates'));
GULP.WATCH(GLOB[, OPTS], TASKS)
gulp.watch('app/**/*.js', ['test','reload']);
GULP.RUN(TASKS...)
gulp.task('hello-world', function () {
run('echo Hello World').exec() // prints "[echo] Hello Worldn".
.pipe(gulp.dest('build')) // Writes "Hello Worldn" to output/echo.
})
STREAMS
gulp.task('scripts', function () {
return gulp.src('src/app/**/*.js') // <-- read from filesystem
// In memory transform
.pipe(jshint('.jshintrc')) // <-- lint the code
.pipe(concat('app.min.js')) // <-- concatenate to one file
.pipe(uglify()) // <-- minify the file
.pipe(rev()) // <-- add revision to filename
.pipe(gulp.dest('dist/app')); // <-- write to filesystem
});
SAMPLE GULPFILE.JS
'use strict';
var gulp = require('gulp'),
gutil = require('gulp-util'),
del = require('del'),
jshint = require('gulp-jshint'),
ngAnnotate = require('gulp-ng-annotate'),
concat = require('gulp-concat'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require('gulp-uglify'),
concatCss = require('gulp-concat-css'),
minifyCSS = require('gulp-minify-css'),
imagemin = require('gulp-imagemin'),
minifyHtml = require('gulp-minify-html'),
templateCache = require('gulp-angular-templatecache'),
inject = require('gulp-inject'),
arialinter = require('gulp-arialinter'),
DEMO TIME
GRUNT STRENGTH
Mature: Mar 2012, very mature
Community Support: Most Popular
Configuration over code
Based on files
Tons of plugins available
Flexibility
Scaffolding is available through generators
Provides plugin to run Gulp tasks
GRUNT WEEKNESSES
Plugins do multiple things
Headache of temp files/folders
Not one solid control flow
Configuration can get lengthy - 500+ lines / Hard to read
Very lengthy & vast API
Can get pretty slow when tasks increase
INSTALL GRUNT
Filename: gruntfile.js
Install Grunt in your project
> npm install grunt --save
Install Grunt-cli / Global install of Grunt command line
> npm install -g grunt-cli
STRUCTURE
module.exports = function(grunt) {
grunt.initConfig({
// Configuration des tâches
});
// Enregistrement d'une tâche
grunt.registerTask(taskName, [description, ] taskFunction)
// Chargement d'un plugin
grunt.loadNpmTasks('package');
};
DEMO TIME
BRUNCH
Mature: Jan 2011, very mature
Community Support: fairly new, plenty of plugins & skeletons
Easy to set up - use skeleton
Introduces conventions for you
Simple CLI - only a few commands
Commands for dev/staging/production releases
BRUNCH WEEKNESSES
Not using conventions causes headaches
Not easy to set up with existing projects
Skeleton set ups not maintained as fast as plugins
Not as supported as Grunt/Gulp
INSTALL BRUNCH
Filename: brunch-config.js
> npm install -g brunch
DEMO TIME
//Create new skeleton of angular app
brunch new https://github.com/scotch/angular-brunch-seed myapp
//Install bower packages (css/js/etc)
bower install
//tell Brunch to watch your project and incrementally rebuild it when source
brunch watch --server
//builds a project for distribution. By default it enables minification
brunch build --production
BROCCOLI
Mature: Feb 2014, still in beta
Community Support: in Beta
Trees allow dev to think of assets
Provides caching for map files
Makes some conventions for you - assets
Watching files handled by serve, only rebuilds whats needed
Supported by trees that mirror filesystem
Lets you have a transactional-style build pipeline
Trees later in process can have more files than those previously
Can do operations on multiple generated trees
Can merge trees (output for ES5 from TypeScript & ES6 sources for example)
Incremental builds by default
Cacheing is built-in rather than manual
BROCCOLI WEEKNESSES
No parallelism
Mainstream usage only in ember-cli (and even then only used as a lib, not as a tool
itself)
Many rough edges - not forgiving for things off common path
Some implementation flaws (though fixable)
Some design decisions won’t scale from company to company, though it maps better
to blaze (bazel) than does gulp
INSTALL BROCCOLI
Filename: brocfile.js
Install Broccoli globaly
> npm install --g broccoli-cli
Install Broccoli in your project
> npm install --save-dev broccoli
SAMPLE BROCFILE.JS
var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp({
name: require('./package.json').name,
minifyCSS: {
enabled: true,
options: {}
},
getEnvJSON: require('./config/environment')
});
// Use this to add additional libraries to the generated output files.
app.import('vendor/ember-data/ember-data.js');
DEMO TIME
TEST COVERAGE
TEST FRAMEWORKS
Jasmine
Karma
Istanbul
Protractor
JASMINE
Started in 2010
Huge community - Most popular
Behavior-driven development framework for testing JavaScript code
Doesn't require DOM, can be used serverside or in the browser
Obvious syntax
Easy to write tests
Async Support
Continuous Integration
INSTALL JASMINE
Install jasmine globaly
> npm install -g jasmine
Install jasmine plugin for Grunt/Gulp
> npm i grunt-jasmine-runner --save-dev
> npm install gulp-jasmine --save-dev
BASICS
describe("Test suite", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
});
});
JASMINE USAGE WITH GULP
var gulp = require('gulp');
var jasmine = require('gulp-jasmine');
gulp.task('default', function () {
return gulp.src('spec/test.js')
.pipe(jasmine());
});
> gulp
AVAILABLE MATCHERS
toBe()
toEqual()
toMatch()
toBeDefined()
toBeUndefined()
toBeNull()
toBeTruthy()
toBeFalsy()
toContain()
toBeLessThan()
toBeGreaterThan()
toBeCloseTo()
toThrow()
Above matchers can be chained with the Not() function. e.g.
not.toBe()
KARMA
Executes tests and source in a browser
Lots of plugins available
Can drive multiple browsers at once
Built in JUnit reporter
INSTALL KARMA
Install Karma command line tool globaly
> npm install -g karma-cli
Install Karma in project
> npm install karma --save-dev
> karma init
KARMA CONFIGURATION
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine','browserify'],
files: ['test/spec/**/*Spec.coffee'],
preprocessors: {
'test/spec/**/*.coffee': ['coffee', 'browserify']
},
port: 9876,
browsers: ['Chrome', 'Firefox', 'PhantomJS']
ISTANBUL
Instrument your source code
Run your test suite against your instrumented source code
Store your coverage results
Allows you to generate coverage report
HTML and LCOV reporting
INSTALL
> npm install istanbul
> npm install grunt-istanbul --save-dev
> npm install gulp-istanbul --save-dev
PROTRACTOR
AngularJS E2E Testing Framework
Built on Selenium's WebDriver API
Built on top of Jasmine framework
Extension for all browsers
Every action is asynchronous.
Rapid development.
Allows to test your app the way end user will use it.
INSTALL PROTRACTOR
Install protractor globally
> npm install protractor -g
Install protractor in your project using Grunt
> npm i grunt-protractor-runner --save-dev
Install protractor in your project using Gulp
> npm install gulp-protractor --save-dev
Scaffolding is available through YO as well
> npm install -g generator-protractor
> yo protractor
Update WebDriver
> webdriver-manager update
SAMPLE CONFIGURATION FILE
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
multiCapabilities: [{
browserName: 'firefox'
}, {
browserName: 'chrome'
}]
}
SAMPLE SPEC.JS
describe('angularjs homepage', function() {
var firstNumber = element(by.model('first'));
var secondNumber = element(by.model('second'));
var goButton = element(by.id('gobutton'));
var latestResult = element(by.binding('latest'));
var history = element.all(by.repeater('result in memory'));
function add(a, b) {
firstNumber.sendKeys(a);
secondNumber.sendKeys(b);
goButton.click();
}
beforeEach(function() {
browser.get('http://juliemr.github.io/protractor-demo/');
});
EXECUTE E2E TEST
> webdriver-manager start
> protractor
<path to conf file>
PROTRACTOR API
SELECTORS
by class name
by css
by id
by linkText
by partialLinktext
by name
by xpath
by binding
by input
by repeater
by model
METHODS
clear()
click()
getAttribute(name)
getCSSValue(propertyName)
getLocation()
getSize()
getTagName()
getText()
isDisplayed()
isEnabled()
isSelected()
sendKeys(keysToSend)
DEMO TIME
CHOOSING WORKFLOW AUTOMATION TOOL
No tool is wrong, just different approaches
Each tool has strengths and weaknesses.
Your job will be to identify which tool may be best suited for your needs.
DEVELOPER TOOLS
Synchronized cross-device testing
Simulators & Emulators
Automated testing in the cloud for CI
Chrom Dev Tools
Remote Preview
Adobe Edge Inspect
Ghost Lab
Live Reload
Network Link conditioner
Slowy app
Fiddler
Opendevicelab.com
Sauce Labs
BrowserStack
Browserling
ARIA (Accessible Rich Internet Applications specification)
LET'S MAKE SMART APPLICATIONS
W3C Standard WAVE (Web Accessibility Evaluation Tool)
Plugin
DEMO TIME
RESOURCES
nodeJS
npm
Bower
Yemon (YO)
Gulp
Grunt
Brunch
Broccoli
List of JavaScript Build Tools
Jasmine
Karma
Istanbul
Protractor
THANK YOU!!!
Ad

Recommended

Java 9 and Beyond
Java 9 and Beyond
Mayank Patel
 
Discuss about java 9 with latest features
Discuss about java 9 with latest features
NexSoftsys
 
Java 9 and the impact on Maven Projects (Devoxx 2016)
Java 9 and the impact on Maven Projects (Devoxx 2016)
Robert Scholte
 
Preparing your code for Java 9
Preparing your code for Java 9
Deepu Xavier
 
Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)
Robert Scholte
 
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Robert Scholte
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolbox
Antoine Sabot-Durand
 
GlassFish Embedded API
GlassFish Embedded API
Eduardo Pelegri-Llopart
 
Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)
Robert Scholte
 
Mete Atamel
Mete Atamel
CodeFest
 
CollabSphere 2020 - NSF ODP Tooling
CollabSphere 2020 - NSF ODP Tooling
Jesse Gallagher
 
Short Lived Tasks in Cloud Foundry #cfdtokyo
Short Lived Tasks in Cloud Foundry #cfdtokyo
Toshiaki Maki
 
Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9
Anna Shymchenko
 
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Julian Robichaux
 
Java 9 preview
Java 9 preview
Ivan Krylov
 
為 Node.js 專案打造專屬管家進行開發流程整合及健康檢測
為 Node.js 專案打造專屬管家進行開發流程整合及健康檢測
謝 宗穎
 
Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)
William Yeh
 
Welcome to Jenkins
Welcome to Jenkins
Somkiat Puisungnoen
 
OpenNTF Webinar May 2021 - Jesse
OpenNTF Webinar May 2021 - Jesse
Jesse Gallagher
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
Jesse Gallagher
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your Development
Sven Peters
 
Sleep Peacefully as Maven Tycho Builds your Product
Sleep Peacefully as Maven Tycho Builds your Product
Subramanyam C
 
Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9
Pavel Bucek
 
Java 9 Modularity and Project Jigsaw
Java 9 Modularity and Project Jigsaw
Comsysto Reply GmbH
 
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
謝 宗穎
 
Managed Beans: When, Why and How
Managed Beans: When, Why and How
Russell Maher
 
Dropwizard
Dropwizard
Abdulhadi ÇELENLİOĞLU
 
DNUG Webcast: IBM Notes V10 Performance Boost
DNUG Webcast: IBM Notes V10 Performance Boost
Christoph Adler
 
Frontend Workflow
Frontend Workflow
DelphiCon
 
Modernizing Your WordPress Workflow with Grunt & Bower
Modernizing Your WordPress Workflow with Grunt & Bower
Alan Crissey
 

More Related Content

What's hot (20)

Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)
Robert Scholte
 
Mete Atamel
Mete Atamel
CodeFest
 
CollabSphere 2020 - NSF ODP Tooling
CollabSphere 2020 - NSF ODP Tooling
Jesse Gallagher
 
Short Lived Tasks in Cloud Foundry #cfdtokyo
Short Lived Tasks in Cloud Foundry #cfdtokyo
Toshiaki Maki
 
Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9
Anna Shymchenko
 
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Julian Robichaux
 
Java 9 preview
Java 9 preview
Ivan Krylov
 
為 Node.js 專案打造專屬管家進行開發流程整合及健康檢測
為 Node.js 專案打造專屬管家進行開發流程整合及健康檢測
謝 宗穎
 
Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)
William Yeh
 
Welcome to Jenkins
Welcome to Jenkins
Somkiat Puisungnoen
 
OpenNTF Webinar May 2021 - Jesse
OpenNTF Webinar May 2021 - Jesse
Jesse Gallagher
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
Jesse Gallagher
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your Development
Sven Peters
 
Sleep Peacefully as Maven Tycho Builds your Product
Sleep Peacefully as Maven Tycho Builds your Product
Subramanyam C
 
Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9
Pavel Bucek
 
Java 9 Modularity and Project Jigsaw
Java 9 Modularity and Project Jigsaw
Comsysto Reply GmbH
 
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
謝 宗穎
 
Managed Beans: When, Why and How
Managed Beans: When, Why and How
Russell Maher
 
Dropwizard
Dropwizard
Abdulhadi ÇELENLİOĞLU
 
DNUG Webcast: IBM Notes V10 Performance Boost
DNUG Webcast: IBM Notes V10 Performance Boost
Christoph Adler
 
Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)
Robert Scholte
 
Mete Atamel
Mete Atamel
CodeFest
 
CollabSphere 2020 - NSF ODP Tooling
CollabSphere 2020 - NSF ODP Tooling
Jesse Gallagher
 
Short Lived Tasks in Cloud Foundry #cfdtokyo
Short Lived Tasks in Cloud Foundry #cfdtokyo
Toshiaki Maki
 
Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9
Anna Shymchenko
 
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Julian Robichaux
 
為 Node.js 專案打造專屬管家進行開發流程整合及健康檢測
為 Node.js 專案打造專屬管家進行開發流程整合及健康檢測
謝 宗穎
 
Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)
William Yeh
 
OpenNTF Webinar May 2021 - Jesse
OpenNTF Webinar May 2021 - Jesse
Jesse Gallagher
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
Jesse Gallagher
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your Development
Sven Peters
 
Sleep Peacefully as Maven Tycho Builds your Product
Sleep Peacefully as Maven Tycho Builds your Product
Subramanyam C
 
Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9
Pavel Bucek
 
Java 9 Modularity and Project Jigsaw
Java 9 Modularity and Project Jigsaw
Comsysto Reply GmbH
 
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
謝 宗穎
 
Managed Beans: When, Why and How
Managed Beans: When, Why and How
Russell Maher
 
DNUG Webcast: IBM Notes V10 Performance Boost
DNUG Webcast: IBM Notes V10 Performance Boost
Christoph Adler
 

Similar to Workflow automation for Front-end web applications (20)

Frontend Workflow
Frontend Workflow
DelphiCon
 
Modernizing Your WordPress Workflow with Grunt & Bower
Modernizing Your WordPress Workflow with Grunt & Bower
Alan Crissey
 
Play Framework on Google App Engine
Play Framework on Google App Engine
Fred Lin
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Ondřej Machulda
 
Building JBoss AS 7 for Fedora
Building JBoss AS 7 for Fedora
wolfc71
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
David Amend
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
Vivek Krishnakumar
 
Angular workflow with gulp.js
Angular workflow with gulp.js
Cihad Horuzoğlu
 
Drupal Frontend Performance and Scalability
Drupal Frontend Performance and Scalability
Ashok Modi
 
Quest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFRED
Andi Smith
 
Spring boot 3g
Spring boot 3g
vasya10
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the like
Damien Seguin
 
NodeJS
NodeJS
LinkMe Srl
 
DrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performance
Ashok Modi
 
Joomla Day Austin Part 4
Joomla Day Austin Part 4
Kyle Ledbetter
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltStack
 
Advanced Topics in Continuous Deployment
Advanced Topics in Continuous Deployment
Mike Brittain
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
Andres Almiray
 
Apache Traffic Server
Apache Traffic Server
supertom
 
Single Page JavaScript WebApps... A Gradle Story
Single Page JavaScript WebApps... A Gradle Story
Kon Soulianidis
 
Frontend Workflow
Frontend Workflow
DelphiCon
 
Modernizing Your WordPress Workflow with Grunt & Bower
Modernizing Your WordPress Workflow with Grunt & Bower
Alan Crissey
 
Play Framework on Google App Engine
Play Framework on Google App Engine
Fred Lin
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Ondřej Machulda
 
Building JBoss AS 7 for Fedora
Building JBoss AS 7 for Fedora
wolfc71
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
David Amend
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
Vivek Krishnakumar
 
Angular workflow with gulp.js
Angular workflow with gulp.js
Cihad Horuzoğlu
 
Drupal Frontend Performance and Scalability
Drupal Frontend Performance and Scalability
Ashok Modi
 
Quest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFRED
Andi Smith
 
Spring boot 3g
Spring boot 3g
vasya10
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the like
Damien Seguin
 
DrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performance
Ashok Modi
 
Joomla Day Austin Part 4
Joomla Day Austin Part 4
Kyle Ledbetter
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltStack
 
Advanced Topics in Continuous Deployment
Advanced Topics in Continuous Deployment
Mike Brittain
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
Andres Almiray
 
Apache Traffic Server
Apache Traffic Server
supertom
 
Single Page JavaScript WebApps... A Gradle Story
Single Page JavaScript WebApps... A Gradle Story
Kon Soulianidis
 
Ad

More from Mayank Patel (8)

Credential store using HashiCorp Vault
Credential store using HashiCorp Vault
Mayank Patel
 
CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2
Mayank Patel
 
Amazon Web Services EC2 Container Service (ECS)
Amazon Web Services EC2 Container Service (ECS)
Mayank Patel
 
Json web token
Json web token
Mayank Patel
 
Docker
Docker
Mayank Patel
 
Git
Git
Mayank Patel
 
Quality culture
Quality culture
Mayank Patel
 
Scala days 2016 overview
Scala days 2016 overview
Mayank Patel
 
Credential store using HashiCorp Vault
Credential store using HashiCorp Vault
Mayank Patel
 
CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2
Mayank Patel
 
Amazon Web Services EC2 Container Service (ECS)
Amazon Web Services EC2 Container Service (ECS)
Mayank Patel
 
Scala days 2016 overview
Scala days 2016 overview
Mayank Patel
 
Ad

Recently uploaded (20)

Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 

Workflow automation for Front-end web applications

  • 1. WORKFLOW AUTOMATION FOR WEB APPLICATIONS
  • 2. MAYANK PATEL APPLICATION ARCHITECT - OILDEX, A SERVICE OF TRANSZAP  / Linked In @maxy_ermayank
  • 3. WHY WORKFLOW AUTOMATION? Boilerplate Dependency management Framework Abstrations Build Automation test Docs Continuous integration Deployment Performance optimization Workflow Deployment
  • 4. WORK FLOW SETUP Download dependecies Download frameworks Download libraries Scaffolding DEVELOP Non minified Linting (HTML, JS) Seperated files Generate responsive images Optimize images Compilation (CoffeScript, SASS, LESS..) Test configuration Unit testing & e2e testing Generate test report Watchers Live reload BUILD Annotate (JS) Generate copyright and license information Sourcemap (JS, CSS) Concatenation (JS, CSS) Minification (HTML, JS, CSS) Uglification (HTML, JS, CSS) Compress (JS, CSS) Live configuration Compiled Renamed Cache templates (HTML) Inject resources in Template Optimize performance Deployment setup
  • 5. DEPENDENCY MANAGEMENT TOOLS Downloads dependencies using Git, HTTPS, ZIP, npm npm Bower
  • 6. NPM Package manager for the web Comes with node.js Default for node.js modules
  • 7. INSTALL NODE.JS Filename: package.json Download and follow installation guidenode.js
  • 8. NPM EXAMPLES Find available package .Here > npm install <package> -g installs package globally > npm install -g <package> use --save to save dependecy in package.json & -dev to lock package v > npm install <package> --save-dev ``` > npm init ```
  • 9. SAMPLE PACKAGE.JSON { "name": "project-name", "version": "1.0.0", "description": "Description goes here", "main": "index.html", "scripts": { "test": "gulp e2e" }, "repository": { "type": "git", "url": "https://example.com/project-name" }, "author": "Mayank Patel <[email protected]>", "license": "MIT", "bugs": { "url": "https://example.com/project-name/issues"
  • 11. BOWER Package manager for the web Designed solely for web and it is optimized with that in mind.
  • 12. INSTALL Filename: bower.json Install Globally > npm install -g bower Install in your project > npm install bower
  • 13. EXAMPLES Packages available Here bower install <package> bower install git://github.com/user/package.git bower install http://example.com/script.js
  • 14. SAMPLE BOWER.JSON { "name": "project-name", "version": "1.0.0", "author": "Mayank Patel <[email protected]>", "homepage": "https://example.com/project-name", "description": "Description goes here", "main": "index.html", "license": "apache 2", "dependencies": { "angular": "1.3.15", "json3": "~3.2.4", "es5-shim": "~2.0.8", "angular-resource": "1.3.15", "d3": "3.3.x" }, "devDependencies": {
  • 16. SCAFFOLDING TOOL / GENERATOR YEMON (YO) Scaffolds out boilerplate Abstraction Performance optimization Testing and Build process Custom generators are available Install YO globally > npm install -g yo
  • 17. EXAMPLES > yo [?] What would you like to do? ›❯ Install a generator Run the Angular generator (0.4.0) Run the Backbone generator (0.1.9) Run the Blog generator (0.0.0) Run the jQuery generator (0.1.4) Run the Gruntfile generator (0.0.6) (Move up and down to reveal more choices) yo jquery-boilerplate Boom. You just created a jQuery plugin.
  • 18. CUSTOM GENERATOR Find available generators <a href=" " target="_blank"http://yeoman.io/generators/ style="color: #fff;">Here</a>.</p> > npm install generator-bootstrap -g > yo bootstrap > npm install generator-webapp -g > yo webapp
  • 19. GENERATE ENTERPRISE APP USING ANGULAR > npm install generator-angular -g > yo angular > yo angular:view user > yo angular:controller user > yo angular:directive mydirective
  • 22. GULP STRENGTH Mature: ~ Aug 2013, relatively mature Community Support: New kid in town, Picking up popularity Code over configuration Easy to read & use Tons of plugins available Provides node streams - no need for tmp files/folders Plugins do ONE thing Provides plugin to run Grunt tasks Only has 5 functions to learn! Runs with maximum concurrency by default
  • 23. GULP WEEKNESSES Can be daunting to learn streams Sometimes setting up src/dest can be tricky (use base) Streams are not a great abstraction for complex builds. They don't compose well.
  • 24. INSTALL GULP Filename: gulpfile.js Install Gulp in your project > npm install gulp --save Install Gulp Globaly > npm install -g gulp
  • 25. THE GULP API gulp.task(name[, deps], fn) gulp.src(globs) gulp.dest(path) gulp.watch(glob[, opts], tasks) gulp.run(tasks...)
  • 26. GULP.TASK(NAME[, DEPS], FN) gulp.task('somename', function() { // Do stuff }); gulp.task('build', ['somename', 'test']; > gulp build
  • 30. GULP.RUN(TASKS...) gulp.task('hello-world', function () { run('echo Hello World').exec() // prints "[echo] Hello Worldn". .pipe(gulp.dest('build')) // Writes "Hello Worldn" to output/echo. })
  • 31. STREAMS gulp.task('scripts', function () { return gulp.src('src/app/**/*.js') // <-- read from filesystem // In memory transform .pipe(jshint('.jshintrc')) // <-- lint the code .pipe(concat('app.min.js')) // <-- concatenate to one file .pipe(uglify()) // <-- minify the file .pipe(rev()) // <-- add revision to filename .pipe(gulp.dest('dist/app')); // <-- write to filesystem });
  • 32. SAMPLE GULPFILE.JS 'use strict'; var gulp = require('gulp'), gutil = require('gulp-util'), del = require('del'), jshint = require('gulp-jshint'), ngAnnotate = require('gulp-ng-annotate'), concat = require('gulp-concat'), sourcemaps = require('gulp-sourcemaps'), uglify = require('gulp-uglify'), concatCss = require('gulp-concat-css'), minifyCSS = require('gulp-minify-css'), imagemin = require('gulp-imagemin'), minifyHtml = require('gulp-minify-html'), templateCache = require('gulp-angular-templatecache'), inject = require('gulp-inject'), arialinter = require('gulp-arialinter'),
  • 34. GRUNT STRENGTH Mature: Mar 2012, very mature Community Support: Most Popular Configuration over code Based on files Tons of plugins available Flexibility Scaffolding is available through generators Provides plugin to run Gulp tasks
  • 35. GRUNT WEEKNESSES Plugins do multiple things Headache of temp files/folders Not one solid control flow Configuration can get lengthy - 500+ lines / Hard to read Very lengthy & vast API Can get pretty slow when tasks increase
  • 36. INSTALL GRUNT Filename: gruntfile.js Install Grunt in your project > npm install grunt --save Install Grunt-cli / Global install of Grunt command line > npm install -g grunt-cli
  • 37. STRUCTURE module.exports = function(grunt) { grunt.initConfig({ // Configuration des tâches }); // Enregistrement d'une tâche grunt.registerTask(taskName, [description, ] taskFunction) // Chargement d'un plugin grunt.loadNpmTasks('package'); };
  • 39. BRUNCH Mature: Jan 2011, very mature Community Support: fairly new, plenty of plugins & skeletons Easy to set up - use skeleton Introduces conventions for you Simple CLI - only a few commands Commands for dev/staging/production releases
  • 40. BRUNCH WEEKNESSES Not using conventions causes headaches Not easy to set up with existing projects Skeleton set ups not maintained as fast as plugins Not as supported as Grunt/Gulp
  • 42. DEMO TIME //Create new skeleton of angular app brunch new https://github.com/scotch/angular-brunch-seed myapp //Install bower packages (css/js/etc) bower install //tell Brunch to watch your project and incrementally rebuild it when source brunch watch --server //builds a project for distribution. By default it enables minification brunch build --production
  • 43. BROCCOLI Mature: Feb 2014, still in beta Community Support: in Beta Trees allow dev to think of assets Provides caching for map files Makes some conventions for you - assets Watching files handled by serve, only rebuilds whats needed Supported by trees that mirror filesystem Lets you have a transactional-style build pipeline Trees later in process can have more files than those previously Can do operations on multiple generated trees Can merge trees (output for ES5 from TypeScript & ES6 sources for example) Incremental builds by default Cacheing is built-in rather than manual
  • 44. BROCCOLI WEEKNESSES No parallelism Mainstream usage only in ember-cli (and even then only used as a lib, not as a tool itself) Many rough edges - not forgiving for things off common path Some implementation flaws (though fixable) Some design decisions won’t scale from company to company, though it maps better to blaze (bazel) than does gulp
  • 45. INSTALL BROCCOLI Filename: brocfile.js Install Broccoli globaly > npm install --g broccoli-cli Install Broccoli in your project > npm install --save-dev broccoli
  • 46. SAMPLE BROCFILE.JS var pickFiles = require('broccoli-static-compiler'); var mergeTrees = require('broccoli-merge-trees'); var EmberApp = require('ember-cli/lib/broccoli/ember-app'); var app = new EmberApp({ name: require('./package.json').name, minifyCSS: { enabled: true, options: {} }, getEnvJSON: require('./config/environment') }); // Use this to add additional libraries to the generated output files. app.import('vendor/ember-data/ember-data.js');
  • 50. JASMINE Started in 2010 Huge community - Most popular Behavior-driven development framework for testing JavaScript code Doesn't require DOM, can be used serverside or in the browser Obvious syntax Easy to write tests Async Support Continuous Integration
  • 51. INSTALL JASMINE Install jasmine globaly > npm install -g jasmine Install jasmine plugin for Grunt/Gulp > npm i grunt-jasmine-runner --save-dev > npm install gulp-jasmine --save-dev
  • 52. BASICS describe("Test suite", function() { it("contains spec with an expectation", function() { expect(true).toBe(true); }); });
  • 53. JASMINE USAGE WITH GULP var gulp = require('gulp'); var jasmine = require('gulp-jasmine'); gulp.task('default', function () { return gulp.src('spec/test.js') .pipe(jasmine()); }); > gulp
  • 55. KARMA Executes tests and source in a browser Lots of plugins available Can drive multiple browsers at once Built in JUnit reporter
  • 56. INSTALL KARMA Install Karma command line tool globaly > npm install -g karma-cli Install Karma in project > npm install karma --save-dev > karma init
  • 57. KARMA CONFIGURATION module.exports = function(config) { config.set({ basePath: '', frameworks: ['jasmine','browserify'], files: ['test/spec/**/*Spec.coffee'], preprocessors: { 'test/spec/**/*.coffee': ['coffee', 'browserify'] }, port: 9876, browsers: ['Chrome', 'Firefox', 'PhantomJS']
  • 58. ISTANBUL Instrument your source code Run your test suite against your instrumented source code Store your coverage results Allows you to generate coverage report HTML and LCOV reporting
  • 59. INSTALL > npm install istanbul > npm install grunt-istanbul --save-dev > npm install gulp-istanbul --save-dev
  • 60. PROTRACTOR AngularJS E2E Testing Framework Built on Selenium's WebDriver API Built on top of Jasmine framework Extension for all browsers Every action is asynchronous. Rapid development. Allows to test your app the way end user will use it.
  • 61. INSTALL PROTRACTOR Install protractor globally > npm install protractor -g Install protractor in your project using Grunt > npm i grunt-protractor-runner --save-dev Install protractor in your project using Gulp > npm install gulp-protractor --save-dev Scaffolding is available through YO as well > npm install -g generator-protractor > yo protractor Update WebDriver > webdriver-manager update
  • 62. SAMPLE CONFIGURATION FILE exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['spec.js'], multiCapabilities: [{ browserName: 'firefox' }, { browserName: 'chrome' }] }
  • 63. SAMPLE SPEC.JS describe('angularjs homepage', function() { var firstNumber = element(by.model('first')); var secondNumber = element(by.model('second')); var goButton = element(by.id('gobutton')); var latestResult = element(by.binding('latest')); var history = element.all(by.repeater('result in memory')); function add(a, b) { firstNumber.sendKeys(a); secondNumber.sendKeys(b); goButton.click(); } beforeEach(function() { browser.get('http://juliemr.github.io/protractor-demo/'); }); EXECUTE E2E TEST > webdriver-manager start > protractor <path to conf file>
  • 64. PROTRACTOR API SELECTORS by class name by css by id by linkText by partialLinktext by name by xpath by binding by input by repeater by model METHODS clear() click() getAttribute(name) getCSSValue(propertyName) getLocation() getSize() getTagName() getText() isDisplayed() isEnabled() isSelected() sendKeys(keysToSend)
  • 66. CHOOSING WORKFLOW AUTOMATION TOOL No tool is wrong, just different approaches Each tool has strengths and weaknesses. Your job will be to identify which tool may be best suited for your needs.
  • 67. DEVELOPER TOOLS Synchronized cross-device testing Simulators & Emulators Automated testing in the cloud for CI Chrom Dev Tools Remote Preview Adobe Edge Inspect Ghost Lab Live Reload Network Link conditioner Slowy app Fiddler Opendevicelab.com Sauce Labs BrowserStack Browserling
  • 68. ARIA (Accessible Rich Internet Applications specification) LET'S MAKE SMART APPLICATIONS W3C Standard WAVE (Web Accessibility Evaluation Tool) Plugin DEMO TIME
  • 69. RESOURCES nodeJS npm Bower Yemon (YO) Gulp Grunt Brunch Broccoli List of JavaScript Build Tools Jasmine Karma Istanbul Protractor