SlideShare a Scribd company logo
Practical Multi-Module
Gulp-Setup
with Angular.JS & TypeScript at
DAB Bank
1. Build Setup
2. Dependency Management
To Be Solved ...
Pursuit of stable
quality & efficience
- 3 teams
- 25 developers
- single portal project
Node.js NPM:
Build tools for the web
- Efficient development
- Minification
- Optimization
- Modularization
- Analysis
First Build Setup Approach
- grunt.js
- organized by feature
- functionality by file
- missing cross project/
module management
https://www.dab-bank.de/Konto-Kredit/DAB-Finanzmanager-
Demo/
https://www.dab-bank.de/Special/Videos/Video-Finanzmanager.
First approach: Build Setup
Copy-Paste
@Dev:
long manual list
@Prod:
Differs from @Dev
Scaffolding / Templating
Problems with existing template projects
- opinionated
→ create your own
- copy&paste template
→ breaks on updates
→ require merging
- missing cross module
DAB Enterprise Build Setup
customization by composition
- predefine
- override
- extend
- integrate
npm: common-setup-module
gulpfile.js + BuildConfig.js
+ tslint.json, tsd.rc, protractor.conf.js, karma.conf.js
common-setup-module gulpfile
module.exports = function ( gulp, CONFIG) {
gulp.task("default", ["dev"]);
gulp.task("prod:once", ["prod"]);
gulp.task("prod", ["prod:tscompile", "templates"]);
gulp.task("dev", ["dev:once", "webserver", "watch"]);
…
gulp.task("js-app", function () {
gulp.src(CONFIG.SRC.TS.FILES())
.pipe(partials.errorPipe())
.pipe(plugins.concat( CONFIG.DIST.JS.FILES.APP()))
.pipe(gulp.dest( CONFIG.DIST.JS.FOLDER()));
});
Appplication module
myappfolder
node_modules
- package.json
- gulpfile.js
- bower.json
Composition: Gulpfile.json
var gulp = require("gulp");
var CONFIG= require('./node_modules/common-setup-module/BuildConfig');
var gulpInit = require("./node_modules/common-setup-module/gulpfile");
CONFIG.SRC.JS.FILES = “customSRC/**.js” ;
var gulpInstanceToOverride = gulpInit(gulp, CONFIG);
gulpInstanceToOverride.task("js-app", function(){
console.log("was overridden");
});
gulpInstanceToOverride.task(“someNewTask”, function(){ ...}
1. Build Setup
2. Dependency Management
To be Solved ...
JavaScript IDE Support
JsHint Refactoring
→ by single file
Autocompletion
Dependency
Management
???
→ cross file
???
→ cross module1. 2.
Cross File Dependency Management
- AMD
- Common.Js
- ES6 Harmony
- angular.modules
- Web Components
- TypeScript
- Bower
- None
...
Angular.module Best Practices
/app
/applicationContext.js
/modules
/submodule
/submodule-service.js
/submodule-directive.js
/submodule-controller.js Miško Hevery
Inspired By
1.
2.
Module Creation & Referencing
Module Retrieval & Chargement
Single Point of Dependency Wiring
/app
applicationContext.js
angular.module(‘de.dab.pfm.app’, [‘de.dab.pfm.dashboard’]);
angular.module(‘de.dab.pfm.dashboard’, [‘de.dab.pfm.dashboard.header’]);
angular.module(‘de.dab.pfm.dashboard.header’, [‘de.dab.pfm.dashboard.
intro’,‘de.dab.shared.pieChart‘]);
angular.module(‘de.dab.pfm.dashboard.intro’, [‘...’]);
angular.module(‘de.dab.shared.pieChart’, [‘...’]);
Registration
Usage of Module In File
pieChart
pie-chart-directive.js
angular.module(‘de.dab.shared.pieChart’)
.directive(‘de.dab.shared.pieChartService’, ...);
pie-chart-service.js
angular.module(‘de.dab.shared.pieChart’)
.service(‘de.dab.shared.pieChartService’, ...)
pie-chart-model.js
pie-chart.tpl.html
Getter
Why separate angular.
module
Registration & Usage ?
Handling cross file dependencies over to angular
→ order does not matter
Angular.module Graph
https://github.com/lucalanca/grunt-angular-architecture-
http://kyu-project.co/kyu.html
Lab: Results
TypeScript: outer modules
= Common.js/AMD
import angular = require(“./thirdparty/angular.d.ts”);
Lab: TS: outer modules (Common.js/AMD)
→ no difference to angular.module
→ aync needed in AMD ?
→ define file dependencies:
anyway app.min.js file deployed
Evidence, same graph with: https:
//github.com/auchenberg/dependo
Dependency Management
???
→ cross file
???
→ cross module1. 2.
Cross File Dependency Solution
1. Concat
→ cross file dependencies managed by angular.module
2. TypeScript innerModules
module de.dab.myproject{
import MyType = de.dab.IMyType;
}
IMytype.d.ts
declare module de.dab {
interface IMyType {
id: string;
accounts : IAccount[];
}
Final Solution to
Dependency Management
1. BuildConfig.js
→ store bower.json “dab-*”deps
devDependencies/dependencies
2. gulpfile.js
→ use list of deps in tasks
Bower
???
JavaScript Multi Projects
bower.json deps:
dab-subproject-component
dab-common-widget-component
dab-bootstrap-component
current module
gulpfile.js
concat/TypeScript:
common.js, app.js,
templates.js, libs.js
webserver:
target/main.css
bower dependency
bower devDependency
1. Register local module
bower link
2. Use on local machine
bower link mymodule
*.d.ts
*.ts
Multi modularized project setup with gulp, typescript and angular.js
Trash
Advanced
TypeScript & Angular
1. Gulp Multi-Project Build-Setup
2. Code Conventions & Best Practices
Gulp Multi-Project Build-Setup
1. Why another bootstrap?
2. scaffolding vs. composition
3. multi-project development
4. TypeScript strategy
a. tsd
b. devDependency, dependency strategy
i. no </// references
ii. separate in .d.ts => performance
c. Java → .d.ts generator
d. TsLint
Why another bootstrap?
1. Fit to techstack
2. Large scale project
3. Multi-project strategy
4. Being up to date
Scaffolding vs Composition
Problems with scaffolding (Yeoman)
- copy+paste of templates
- opinionated technologies
- missing common glue
- hard to find matching techstack
- breaks on updates
- merge operations
→ convention > customization
Composition / Inheritance
- glue strategy for projects
- technology agnostic
- update project without merging
- reuse != copy
→ customization is the default
By Example
1. leading gulpfile
2. customization:
override, extend or integrate
3.
Complexity
RequireJS
- file dependencies
- Issues with testing
- 350 Requests are slow
- at runtime & async
- Angular.modules vs. modularization
→ will be one file at prod, anyway
→ which files to deliver in which package?
→ versioning
Simplicity
1. Modularize by module
2. Adapt complexity later: http://www.2ality.com/2014/09/es6-
modules-final.html
3. Bower: not supporting multi versioning
4. be similar to production, only dev & prod mode
angular overmind
Multi Project Development
Problems:
1. Multi project strategy
2.
3. realtime sync
Multi Project Development
1. bower link
2. npm link
3. git versioning vs. searchable/-repository
4. devDependency, dependency strategy
Code Conventions & Best Practices
1. constant namespaces
2. direct export
3. controller
a. mycontroller = this.scope;
4. directives
a. lambda
5. services
Multi modularized project setup with gulp, typescript and angular.js
Compiling & TypeScript
Why TypeScript?
- Compilation Imposed by Google
- Sweet Home Java/.Net-Developer
- Refactoring Made Easy
- Models Management
- Future-Proof Syntax, Angular
2.0, …
- Choice of TypeScriptifying
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js

More Related Content

What's hot (20)

PDF
Beyond AngularJS: Best practices and more
Ari Lerner
 
PDF
Zukunftssichere Anwendungen mit AngularJS 1.x entwickeln (GDG DevFest Karlsru...
Christian Janz
 
PDF
Angular based enterprise level frontend architecture
Himanshu Tamrakar
 
PPTX
Angular Lazy Loading and Resolve (Route Resolver)
Squash Apps Pvt Ltd
 
PDF
Angular js
Knoldus Inc.
 
PPTX
Introduction to Angular js 2.0
Nagaraju Sangam
 
PDF
General Assembly Workshop: Advanced JavaScript
Spike Brehm
 
PDF
android design pattern
Lucas Xu
 
PPTX
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
MarkupBox
 
PDF
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
Katy Slemon
 
PDF
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
PDF
Top 7 Angular Best Practices to Organize Your Angular App
Katy Slemon
 
PDF
Tutorial: Develop Mobile Applications with AngularJS
Philipp Burgmer
 
PDF
Angular from Scratch
Christian Lilley
 
PDF
Testdrive AngularJS with Spring 4
Oliver Wahlen
 
PDF
Angular 2 overview
Jesse Warden
 
PDF
Angular Dependency Injection
Nir Kaufman
 
PDF
In Pursuit of the Holy Grail: Building Isomorphic JavaScript Apps
Spike Brehm
 
PPT
Angular Seminar-js
Mindfire Solutions
 
PDF
Up & running with ECMAScript6
Nir Kaufman
 
Beyond AngularJS: Best practices and more
Ari Lerner
 
Zukunftssichere Anwendungen mit AngularJS 1.x entwickeln (GDG DevFest Karlsru...
Christian Janz
 
Angular based enterprise level frontend architecture
Himanshu Tamrakar
 
Angular Lazy Loading and Resolve (Route Resolver)
Squash Apps Pvt Ltd
 
Angular js
Knoldus Inc.
 
Introduction to Angular js 2.0
Nagaraju Sangam
 
General Assembly Workshop: Advanced JavaScript
Spike Brehm
 
android design pattern
Lucas Xu
 
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
MarkupBox
 
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
Katy Slemon
 
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
Top 7 Angular Best Practices to Organize Your Angular App
Katy Slemon
 
Tutorial: Develop Mobile Applications with AngularJS
Philipp Burgmer
 
Angular from Scratch
Christian Lilley
 
Testdrive AngularJS with Spring 4
Oliver Wahlen
 
Angular 2 overview
Jesse Warden
 
Angular Dependency Injection
Nir Kaufman
 
In Pursuit of the Holy Grail: Building Isomorphic JavaScript Apps
Spike Brehm
 
Angular Seminar-js
Mindfire Solutions
 
Up & running with ECMAScript6
Nir Kaufman
 

Viewers also liked (18)

PDF
Angularjs practical project experiences with javascript development in a bank
David Amend
 
PPTX
In Memory Data Grids, Demystified!
Uri Cohen
 
PPTX
Advanced AngularJS Tips and Tricks
Jeremy Likness
 
PDF
Grunt.js and Yeoman, Continous Integration
David Amend
 
PDF
Data Grids vs Databases
Galder Zamarreño
 
PDF
Javascript & Angular .js for the enterprise, lessons learned, typescript scal...
David Amend
 
PDF
Gwt presentation
철민 배
 
PDF
Reasons to migrate to modern web development with JavaScript
David Amend
 
PDF
Hortonworks.Cluster Config Guide
Douglas Bernardini
 
PDF
Gwt widget frameworks_presentation
David Amend
 
PDF
Geecon 2014 - Five Ways to Not Suck at Being a Java Freelancer
Roberto Cortez
 
PDF
Data Grids and Data Caching
Galder Zamarreño
 
PDF
Maven - Taming the Beast
Roberto Cortez
 
PDF
Migration tales from java ee 5 to 7
Roberto Cortez
 
PDF
KYSUC - Keep Your Schema Under Control
Coimbra JUG
 
PDF
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Alvaro Sanchez-Mariscal
 
PDF
Just enough app server
Antonio Goncalves
 
PDF
How to Become a Thought Leader in Your Niche
Leslie Samuel
 
Angularjs practical project experiences with javascript development in a bank
David Amend
 
In Memory Data Grids, Demystified!
Uri Cohen
 
Advanced AngularJS Tips and Tricks
Jeremy Likness
 
Grunt.js and Yeoman, Continous Integration
David Amend
 
Data Grids vs Databases
Galder Zamarreño
 
Javascript & Angular .js for the enterprise, lessons learned, typescript scal...
David Amend
 
Gwt presentation
철민 배
 
Reasons to migrate to modern web development with JavaScript
David Amend
 
Hortonworks.Cluster Config Guide
Douglas Bernardini
 
Gwt widget frameworks_presentation
David Amend
 
Geecon 2014 - Five Ways to Not Suck at Being a Java Freelancer
Roberto Cortez
 
Data Grids and Data Caching
Galder Zamarreño
 
Maven - Taming the Beast
Roberto Cortez
 
Migration tales from java ee 5 to 7
Roberto Cortez
 
KYSUC - Keep Your Schema Under Control
Coimbra JUG
 
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Alvaro Sanchez-Mariscal
 
Just enough app server
Antonio Goncalves
 
How to Become a Thought Leader in Your Niche
Leslie Samuel
 
Ad

Similar to Multi modularized project setup with gulp, typescript and angular.js (20)

PPTX
How Does Angular Work?
Albiorix Technology
 
PDF
Angular, the New Angular JS
Kenzan
 
PPTX
AngularJS with TypeScript and Windows Azure Mobile Services
Rainer Stropek
 
PPTX
Angular interview questions
Goa App
 
PPTX
Angular kickstart slideshare
SaleemMalik52
 
PDF
ES6 Everywhere – Adam Klein
500Tech
 
PDF
Es6 everywhere
Adam Klein
 
PPTX
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
tilejak773
 
PDF
Angular Notes.pdf
sagarpal60
 
PPTX
Angular IO
Jennifer Estrada
 
PDF
The Angular road from 1.x to 2.0
Vassilis Pitsounis
 
PPT
Angular Introduction By Surekha Gadkari
Surekha Gadkari
 
PDF
Introduction To Angular 4 - J2I
Nader Debbabi
 
PDF
Angular JS2 Training Session #1
Paras Mendiratta
 
PPTX
Angular JS in 2017
Ayush Sharma
 
PPTX
Angular 2.0
Mallikarjuna G D
 
PPTX
Angular Framework ppt for beginners and advanced
Preetha Ganapathi
 
PPTX
Angular2
Oswald Campesato
 
PPTX
Foster - Getting started with Angular
MukundSonaiya1
 
PDF
Building Blocks of Angular 2 and ASP.NET Core
Levi Fuller
 
How Does Angular Work?
Albiorix Technology
 
Angular, the New Angular JS
Kenzan
 
AngularJS with TypeScript and Windows Azure Mobile Services
Rainer Stropek
 
Angular interview questions
Goa App
 
Angular kickstart slideshare
SaleemMalik52
 
ES6 Everywhere – Adam Klein
500Tech
 
Es6 everywhere
Adam Klein
 
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
tilejak773
 
Angular Notes.pdf
sagarpal60
 
Angular IO
Jennifer Estrada
 
The Angular road from 1.x to 2.0
Vassilis Pitsounis
 
Angular Introduction By Surekha Gadkari
Surekha Gadkari
 
Introduction To Angular 4 - J2I
Nader Debbabi
 
Angular JS2 Training Session #1
Paras Mendiratta
 
Angular JS in 2017
Ayush Sharma
 
Angular 2.0
Mallikarjuna G D
 
Angular Framework ppt for beginners and advanced
Preetha Ganapathi
 
Foster - Getting started with Angular
MukundSonaiya1
 
Building Blocks of Angular 2 and ASP.NET Core
Levi Fuller
 
Ad

More from David Amend (6)

PDF
Componentization css angular
David Amend
 
PDF
Thin Server Architecture SPA, 5 years old presentation
David Amend
 
PDF
Grunt Advanced Vol 2, Plugins Text I/O with fun
David Amend
 
PDF
Client Vs. Server Rendering
David Amend
 
PDF
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
David Amend
 
PDF
Grunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
David Amend
 
Componentization css angular
David Amend
 
Thin Server Architecture SPA, 5 years old presentation
David Amend
 
Grunt Advanced Vol 2, Plugins Text I/O with fun
David Amend
 
Client Vs. Server Rendering
David Amend
 
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
David Amend
 
Grunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
David Amend
 

Multi modularized project setup with gulp, typescript and angular.js