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)

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

Viewers also liked (18)

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

Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris O'Brien
 
Building JavaScript
Building JavaScript
Brady Clifford
 
Code driven development in drupal
Code driven development in drupal
Andriy Yun
 
Configuration Management and Transforming Legacy Applications in the Enterpri...
Configuration Management and Transforming Legacy Applications in the Enterpri...
Docker, Inc.
 
Webpack: from 0 to 2
Webpack: from 0 to 2
Alessandro Bellini
 
DevHub 3 - Composer plus Magento
DevHub 3 - Composer plus Magento
Magento Dev
 
Serverless Container with Source2Image
Serverless Container with Source2Image
QAware GmbH
 
Serverless containers … with source-to-image
Serverless containers … with source-to-image
Josef Adersberger
 
Continuous integration / continuous delivery
Continuous integration / continuous delivery
EatDog
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
Marcos Labad
 
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Evgeniy Kuzmin
 
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
European Collaboration Summit
 
Continuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
Evgeniy Kuzmin
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Mack Hardy
 
Creating Developer-Friendly Docker Containers with Chaperone
Creating Developer-Friendly Docker Containers with Chaperone
Gary Wisniewski
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes Demystified
Claudio Procida
 
Droidcon Paris 2015
Droidcon Paris 2015
Renaud Boulard
 
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...
Fwdays
 
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Lyzun Oleksandr
 
Custom Tile Generation in PCF
Custom Tile Generation in PCF
VMware Tanzu
 
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris O'Brien
 
Code driven development in drupal
Code driven development in drupal
Andriy Yun
 
Configuration Management and Transforming Legacy Applications in the Enterpri...
Configuration Management and Transforming Legacy Applications in the Enterpri...
Docker, Inc.
 
DevHub 3 - Composer plus Magento
DevHub 3 - Composer plus Magento
Magento Dev
 
Serverless Container with Source2Image
Serverless Container with Source2Image
QAware GmbH
 
Serverless containers … with source-to-image
Serverless containers … with source-to-image
Josef Adersberger
 
Continuous integration / continuous delivery
Continuous integration / continuous delivery
EatDog
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
Marcos Labad
 
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Evgeniy Kuzmin
 
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
European Collaboration Summit
 
Continuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
Evgeniy Kuzmin
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Mack Hardy
 
Creating Developer-Friendly Docker Containers with Chaperone
Creating Developer-Friendly Docker Containers with Chaperone
Gary Wisniewski
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes Demystified
Claudio Procida
 
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...
Fwdays
 
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Lyzun Oleksandr
 
Custom Tile Generation in PCF
Custom Tile Generation in PCF
VMware Tanzu
 
Ad

More from David Amend (6)

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

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