SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
Ember Addons:
Served Three Ways
Mike North
Global Ember Meetup - Ember Components Day
12/5/2015
About.me
About.me
About.me
I’m coming to somewhere near you
• Twitter: @MichaelLNorth
• LinkedIn: Mike North
• Instagram: @OfficeToday
• Github: mike-north
• WhatsApp: 8144412418
• LINE: mike_north
About.me
• Job.old = "UI Architect, Yahoo Ads & Data"
• Job.new = ["CTO Levanto Financial",

"CTO TaskLight",

"JavaScript Consultant & Trainer”]
Ember Addons
• A first-class citizen of the ember ecosystem
• Powerful & flexible abstractions at multiple levels
• Catalyst for adoption and community — WHY?
Served Three Ways
• Encapsulate components & modules
• Modify build pipeline
• Add a new command to ember-cli
Some Disclaimers
• I’m not talking about pods today
• We’re still in NPM v0.12 land
• These are tips for getting started with basic use cases,
not comprehensive instructions
Common Stuff
• Pattern for addon configuration
• Best practices
• Testing
• Add-on Dependencies
Common Stuff
• configuration/environment.js is where
parameters belong
• This is injected into a <meta> as part of the build
process
• Anything embery should access config via an
Ember.Service
CONFIGURATION
Common Stuff
• Assume no prototype modifications
• JSHint & JSCS (via ember-suave)
• Minimize dependencies, and consider compatibility
• Documentation
• Test against beta and canary!
BEST PRACTICES
Common Stuff
• Demo app is great for acceptance testing
• Continuous integration (i.e., travis-ci)
• Test against multiple framework versions w/
ember-try
• Measuring test coverage is possible (sort of!)
TESTING
• publish to npm
• add a demoURL to your package.json
• Hook up testing and continuous deploy to github pages via
travis-ci
• Protect master brach

npm publish
ember install ember-cli-github-pages
Common Stuff
PUBLISHING
A simple component
ember addon ember-twitter
addon name
{{x-twitter username="MichaelLNorth"}}
A simple component
ember-cli-htmlbars
IF your add-on involves templates,
these are compiled at BUILD TIME
devDependency —> dependency
A simple component
• App vs Addon folder
• Resolver considerations
• ember-cli-build.js is just for your demo app!
• Blueprints
• Default blueprint
Modifying the build pipeline
./index.js
• included hook lets you register plugins for filetypes
dummy/app.js => 650 B (302 B gzipped)
dummy/router.js => 311 B (193 B gzipped)
dummy/templates/application.js => 1.45 kB (556 B gzipped)
dummy/initializers/app-version.js => 433 B (227 B gzipped)
dummy/initializers/export-application-global.js => 1.01 kB (413 B gzipped)
dummy/controllers/array.js => 141 B (124 B gzipped)
dummy/controllers/object.js => 142 B (126 B gzipped)
dummy/components/app-version.js => 468 B (224 B gzipped)
dummy/tests/test-helper.js => 231 B (161 B gzipped)
ember addon ember-js-filesize
Modifying the build pipeline
Start with a broccoli plugin
Modifying the build pipeline
var Filter = require('broccoli-filter');
var fileSize = require('broccoli-file-size');
FileSizePlugin.prototype = Object.create(Filter.prototype);
FileSizePlugin.prototype.constructor = FileSizePlugin;
function FileSizePlugin() {
Filter.call(this, '', {});
}
FileSizePlugin.prototype.toTree = function(
tree, inputPath, outputPath, inputOptions
) {
return fileSize(tree, {
colors: true
});
};
Make a broccoli filter subclass
Modifying the build pipeline
module.exports = {
name: 'ember-js-filesize',
included: function(app, parentAddon) {
(parentAddon || app)
.registry
.add('js', new FileSizePlugin());
}
};
Modify the addon to use the filter for .js files
Modifying the build pipeline
Try it
ember s
Modifying the build pipeline
Try it in an app
npm link
cd ..
ember new tester
cd tester
npm link ember-js-filesize
Make sure you add the addon to the app’s package.json
a new “ember” command
ember slack --channel Product "Deployed new version"
#General: Deployed new
version
ember install ember-slack
Installation
Usage
a new “ember” command
module.exports = {
name: 'ember-slack',
includedCommands: function() {
return {
slack: {
name: 'slack',
description: 'Send a slack message',
works: 'insideProject',
anonymousOptions: [],
availableOptions: [],
run: function(commandOptions, rawArgs) { }
}
}
}
};
./index.js
a new “ember” command
OPTIONS
// Un-named options
anonymousOptions: [
'<message>'
],
// Named options
availableOptions: [{
name: 'channel',
type: String,
default: 'general'
}],
a new “ember” command
OPTIONS
a new “ember” command
run: function(commandOptions, rawArgs) {
var channel = commandOptions.channel;
var message = rawArgs[0];
console.log("----------------------n" +
"#" + channel + ":t" + message);
}
a new “ember” command
try it!
Dessert!
Representative Examples
Pre-packaged modules
ember-moment, ember-truth-helpers, ember-cpm,
ember-cli-materialize, ember-api-actions
Build pipeline mods ember-cli-sass, ember-suave
Ember commands
ember-try, ember-cli-deploy, ember-cli-github-
pages
BY TYPE
Representative Examples
OTHER IMPORTANT EXAMPLES
ember-cli-flash
customizable configuration, with default value
management
ember-perf
support for wide range of framework versions
(canary >= ember > 1.6.0)
ember-lodash shim ES6 node library for ember apps
ember-cpm complex blueprint
ember-truth-helpers elegant support for legacy and current helper API
mike-north/ember-addons-three-ways

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Ci of js and apex using jasmine, phantom js and drone io df14
Ci of js and apex using jasmine, phantom js and drone io   df14Ci of js and apex using jasmine, phantom js and drone io   df14
Ci of js and apex using jasmine, phantom js and drone io df14
 
Untangling spring week10
Untangling spring week10Untangling spring week10
Untangling spring week10
 
Zend Framwork configurations
Zend Framwork configurationsZend Framwork configurations
Zend Framwork configurations
 
Untangling spring week9
Untangling spring week9Untangling spring week9
Untangling spring week9
 
Untangling - fall2017 - week 8
Untangling - fall2017 - week 8Untangling - fall2017 - week 8
Untangling - fall2017 - week 8
 
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1
 
Capybara testing
Capybara testingCapybara testing
Capybara testing
 
Untangling spring week8
Untangling spring week8Untangling spring week8
Untangling spring week8
 
How to make your Webpack builds 10x faster
How to make your Webpack builds 10x fasterHow to make your Webpack builds 10x faster
How to make your Webpack builds 10x faster
 
BP101: A Modernized Workflow w/ Domino/XPages
BP101: A Modernized Workflow w/ Domino/XPagesBP101: A Modernized Workflow w/ Domino/XPages
BP101: A Modernized Workflow w/ Domino/XPages
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
 
Production optimization with React and Webpack
Production optimization with React and WebpackProduction optimization with React and Webpack
Production optimization with React and Webpack
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
 
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Kickstart Jpa
Kickstart JpaKickstart Jpa
Kickstart Jpa
 
Building Creative Product Extensions with Experience Manager
Building Creative Product Extensions with Experience ManagerBuilding Creative Product Extensions with Experience Manager
Building Creative Product Extensions with Experience Manager
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
 

Andere mochten auch

PRINT_Snapple Book_433
PRINT_Snapple Book_433PRINT_Snapple Book_433
PRINT_Snapple Book_433
Paige Powell
 
Project production schedule for my project
Project production schedule for my projectProject production schedule for my project
Project production schedule for my project
humaira28
 
Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
joph10
 
정품프릴리지 구입방법 카톡:DDF11 & DDF11.KR 프릴리지 녹색,프릴리지 연예인,프릴리지 제조사,프릴리지 후기,프릴리지 복제약,프릴...
정품프릴리지 구입방법 카톡:DDF11 & DDF11.KR 프릴리지 녹색,프릴리지 연예인,프릴리지 제조사,프릴리지 후기,프릴리지 복제약,프릴...정품프릴리지 구입방법 카톡:DDF11 & DDF11.KR 프릴리지 녹색,프릴리지 연예인,프릴리지 제조사,프릴리지 후기,프릴리지 복제약,프릴...
정품프릴리지 구입방법 카톡:DDF11 & DDF11.KR 프릴리지 녹색,프릴리지 연예인,프릴리지 제조사,프릴리지 후기,프릴리지 복제약,프릴...
kktes nfsaw
 
Marion cotillard trabajo
Marion cotillard trabajoMarion cotillard trabajo
Marion cotillard trabajo
frmoliere
 

Andere mochten auch (18)

Sopita
SopitaSopita
Sopita
 
C0 3 ricardo_health social
C0 3 ricardo_health socialC0 3 ricardo_health social
C0 3 ricardo_health social
 
October 2015 Leases
October 2015 LeasesOctober 2015 Leases
October 2015 Leases
 
PRINT_Snapple Book_433
PRINT_Snapple Book_433PRINT_Snapple Book_433
PRINT_Snapple Book_433
 
Alumndatos
Alumndatos Alumndatos
Alumndatos
 
Project production schedule for my project
Project production schedule for my projectProject production schedule for my project
Project production schedule for my project
 
Two tier enterprise resource planning
Two tier enterprise resource planningTwo tier enterprise resource planning
Two tier enterprise resource planning
 
Presentación anuncio carlos
Presentación anuncio carlosPresentación anuncio carlos
Presentación anuncio carlos
 
puspendra3
puspendra3puspendra3
puspendra3
 
Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
 
정품프릴리지 구입방법 카톡:DDF11 & DDF11.KR 프릴리지 녹색,프릴리지 연예인,프릴리지 제조사,프릴리지 후기,프릴리지 복제약,프릴...
정품프릴리지 구입방법 카톡:DDF11 & DDF11.KR 프릴리지 녹색,프릴리지 연예인,프릴리지 제조사,프릴리지 후기,프릴리지 복제약,프릴...정품프릴리지 구입방법 카톡:DDF11 & DDF11.KR 프릴리지 녹색,프릴리지 연예인,프릴리지 제조사,프릴리지 후기,프릴리지 복제약,프릴...
정품프릴리지 구입방법 카톡:DDF11 & DDF11.KR 프릴리지 녹색,프릴리지 연예인,프릴리지 제조사,프릴리지 후기,프릴리지 복제약,프릴...
 
Jan_Feb 2010
Jan_Feb 2010Jan_Feb 2010
Jan_Feb 2010
 
Social Media id Praktijk - IBM Case
Social Media id Praktijk - IBM CaseSocial Media id Praktijk - IBM Case
Social Media id Praktijk - IBM Case
 
Tesis presentacion
Tesis presentacionTesis presentacion
Tesis presentacion
 
Web Components 2016 & Polymer v2
Web Components 2016 & Polymer v2Web Components 2016 & Polymer v2
Web Components 2016 & Polymer v2
 
4 rpp-fisika-sma
4 rpp-fisika-sma4 rpp-fisika-sma
4 rpp-fisika-sma
 
Marion cotillard trabajo
Marion cotillard trabajoMarion cotillard trabajo
Marion cotillard trabajo
 
Vinayak Kshirsagar Resume
Vinayak Kshirsagar ResumeVinayak Kshirsagar Resume
Vinayak Kshirsagar Resume
 

Ähnlich wie Ember addons, served three ways

Ähnlich wie Ember addons, served three ways (20)

Cypress report
Cypress reportCypress report
Cypress report
 
Job DSL Plugin for Jenkins
Job DSL Plugin for JenkinsJob DSL Plugin for Jenkins
Job DSL Plugin for Jenkins
 
How to set up an ASP.NET 5 Continuous Delivery Pipeline using IBM Bluemix Dev...
How to set up an ASP.NET 5 Continuous Delivery Pipeline using IBM Bluemix Dev...How to set up an ASP.NET 5 Continuous Delivery Pipeline using IBM Bluemix Dev...
How to set up an ASP.NET 5 Continuous Delivery Pipeline using IBM Bluemix Dev...
 
Alfresco Development Framework Basic
Alfresco Development Framework BasicAlfresco Development Framework Basic
Alfresco Development Framework Basic
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework Webpart
 
Priming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the CloudPriming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the Cloud
 
Ansible top 10 - 2018
Ansible top 10 -  2018Ansible top 10 -  2018
Ansible top 10 - 2018
 
Simplified DevOps Bliss -with OpenAI API
Simplified DevOps Bliss -with OpenAI APISimplified DevOps Bliss -with OpenAI API
Simplified DevOps Bliss -with OpenAI API
 
Ember - introduction
Ember - introductionEmber - introduction
Ember - introduction
 
Azure DevOps for JavaScript Developers
Azure DevOps for JavaScript DevelopersAzure DevOps for JavaScript Developers
Azure DevOps for JavaScript Developers
 
Devops
DevopsDevops
Devops
 
Trusting the Unknown
Trusting the UnknownTrusting the Unknown
Trusting the Unknown
 
Trusting the Unknown
Trusting the UnknownTrusting the Unknown
Trusting the Unknown
 
Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web Applications
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
 
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsTYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
 
FullStack London - Cloud Native Node.js
FullStack London - Cloud Native Node.jsFullStack London - Cloud Native Node.js
FullStack London - Cloud Native Node.js
 
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
 

Mehr von Mike North

Enemy of the state
Enemy of the stateEnemy of the state
Enemy of the state
Mike North
 

Mehr von Mike North (18)

Web Security: A Primer for Developers
Web Security: A Primer for DevelopersWeb Security: A Primer for Developers
Web Security: A Primer for Developers
 
A Debugging Adventure: Journey through Ember.js Glue
A Debugging Adventure: Journey through Ember.js GlueA Debugging Adventure: Journey through Ember.js Glue
A Debugging Adventure: Journey through Ember.js Glue
 
Anatomy of a Progressive Web App
Anatomy of a Progressive Web AppAnatomy of a Progressive Web App
Anatomy of a Progressive Web App
 
Web and Native: Bridging the Gap
Web and Native: Bridging the GapWeb and Native: Bridging the Gap
Web and Native: Bridging the Gap
 
The Road to Native Web Components
The Road to Native Web ComponentsThe Road to Native Web Components
The Road to Native Web Components
 
Enemy of the state
Enemy of the stateEnemy of the state
Enemy of the state
 
Phoenix for Rubyists - Rubyconf Brazil 2016
Phoenix for Rubyists - Rubyconf Brazil 2016Phoenix for Rubyists - Rubyconf Brazil 2016
Phoenix for Rubyists - Rubyconf Brazil 2016
 
Phoenix for Rubyists
Phoenix for RubyistsPhoenix for Rubyists
Phoenix for Rubyists
 
Write Once, Run Everywhere - Ember.js Munich
Write Once, Run Everywhere - Ember.js MunichWrite Once, Run Everywhere - Ember.js Munich
Write Once, Run Everywhere - Ember.js Munich
 
Delightful UX for Distributed Systems
Delightful UX for Distributed SystemsDelightful UX for Distributed Systems
Delightful UX for Distributed Systems
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsModern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.js
 
CI/CD and Asset Serving for Single Page Apps
CI/CD and Asset Serving for Single Page AppsCI/CD and Asset Serving for Single Page Apps
CI/CD and Asset Serving for Single Page Apps
 
User percieved performance
User percieved performanceUser percieved performance
User percieved performance
 
User-percieved performance
User-percieved performanceUser-percieved performance
User-percieved performance
 
Write Once, Run Everywhere
Write Once, Run EverywhereWrite Once, Run Everywhere
Write Once, Run Everywhere
 
Compose all the things (Wicked Good Ember 2015)
Compose all the things (Wicked Good Ember 2015)Compose all the things (Wicked Good Ember 2015)
Compose all the things (Wicked Good Ember 2015)
 
Async JavaScript in ES7
Async JavaScript in ES7Async JavaScript in ES7
Async JavaScript in ES7
 
Test like a pro with Ember.js
Test like a pro with Ember.jsTest like a pro with Ember.js
Test like a pro with Ember.js
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Ember addons, served three ways

  • 1. Ember Addons: Served Three Ways Mike North Global Ember Meetup - Ember Components Day 12/5/2015
  • 4. About.me I’m coming to somewhere near you • Twitter: @MichaelLNorth • LinkedIn: Mike North • Instagram: @OfficeToday • Github: mike-north • WhatsApp: 8144412418 • LINE: mike_north
  • 5. About.me • Job.old = "UI Architect, Yahoo Ads & Data" • Job.new = ["CTO Levanto Financial",
 "CTO TaskLight",
 "JavaScript Consultant & Trainer”]
  • 6. Ember Addons • A first-class citizen of the ember ecosystem • Powerful & flexible abstractions at multiple levels • Catalyst for adoption and community — WHY?
  • 7. Served Three Ways • Encapsulate components & modules • Modify build pipeline • Add a new command to ember-cli
  • 8. Some Disclaimers • I’m not talking about pods today • We’re still in NPM v0.12 land • These are tips for getting started with basic use cases, not comprehensive instructions
  • 9. Common Stuff • Pattern for addon configuration • Best practices • Testing • Add-on Dependencies
  • 10. Common Stuff • configuration/environment.js is where parameters belong • This is injected into a <meta> as part of the build process • Anything embery should access config via an Ember.Service CONFIGURATION
  • 11. Common Stuff • Assume no prototype modifications • JSHint & JSCS (via ember-suave) • Minimize dependencies, and consider compatibility • Documentation • Test against beta and canary! BEST PRACTICES
  • 12. Common Stuff • Demo app is great for acceptance testing • Continuous integration (i.e., travis-ci) • Test against multiple framework versions w/ ember-try • Measuring test coverage is possible (sort of!) TESTING
  • 13. • publish to npm • add a demoURL to your package.json • Hook up testing and continuous deploy to github pages via travis-ci • Protect master brach
 npm publish ember install ember-cli-github-pages Common Stuff PUBLISHING
  • 14. A simple component ember addon ember-twitter addon name {{x-twitter username="MichaelLNorth"}}
  • 15. A simple component ember-cli-htmlbars IF your add-on involves templates, these are compiled at BUILD TIME devDependency —> dependency
  • 16. A simple component • App vs Addon folder • Resolver considerations • ember-cli-build.js is just for your demo app! • Blueprints • Default blueprint
  • 17. Modifying the build pipeline ./index.js • included hook lets you register plugins for filetypes dummy/app.js => 650 B (302 B gzipped) dummy/router.js => 311 B (193 B gzipped) dummy/templates/application.js => 1.45 kB (556 B gzipped) dummy/initializers/app-version.js => 433 B (227 B gzipped) dummy/initializers/export-application-global.js => 1.01 kB (413 B gzipped) dummy/controllers/array.js => 141 B (124 B gzipped) dummy/controllers/object.js => 142 B (126 B gzipped) dummy/components/app-version.js => 468 B (224 B gzipped) dummy/tests/test-helper.js => 231 B (161 B gzipped) ember addon ember-js-filesize
  • 18. Modifying the build pipeline Start with a broccoli plugin
  • 19. Modifying the build pipeline var Filter = require('broccoli-filter'); var fileSize = require('broccoli-file-size'); FileSizePlugin.prototype = Object.create(Filter.prototype); FileSizePlugin.prototype.constructor = FileSizePlugin; function FileSizePlugin() { Filter.call(this, '', {}); } FileSizePlugin.prototype.toTree = function( tree, inputPath, outputPath, inputOptions ) { return fileSize(tree, { colors: true }); }; Make a broccoli filter subclass
  • 20. Modifying the build pipeline module.exports = { name: 'ember-js-filesize', included: function(app, parentAddon) { (parentAddon || app) .registry .add('js', new FileSizePlugin()); } }; Modify the addon to use the filter for .js files
  • 21. Modifying the build pipeline Try it ember s
  • 22. Modifying the build pipeline Try it in an app npm link cd .. ember new tester cd tester npm link ember-js-filesize Make sure you add the addon to the app’s package.json
  • 23. a new “ember” command ember slack --channel Product "Deployed new version" #General: Deployed new version ember install ember-slack Installation Usage
  • 24. a new “ember” command module.exports = { name: 'ember-slack', includedCommands: function() { return { slack: { name: 'slack', description: 'Send a slack message', works: 'insideProject', anonymousOptions: [], availableOptions: [], run: function(commandOptions, rawArgs) { } } } } }; ./index.js
  • 25. a new “ember” command OPTIONS // Un-named options anonymousOptions: [ '<message>' ], // Named options availableOptions: [{ name: 'channel', type: String, default: 'general' }],
  • 26. a new “ember” command OPTIONS
  • 27. a new “ember” command run: function(commandOptions, rawArgs) { var channel = commandOptions.channel; var message = rawArgs[0]; console.log("----------------------n" + "#" + channel + ":t" + message); }
  • 28. a new “ember” command try it!
  • 30. Representative Examples Pre-packaged modules ember-moment, ember-truth-helpers, ember-cpm, ember-cli-materialize, ember-api-actions Build pipeline mods ember-cli-sass, ember-suave Ember commands ember-try, ember-cli-deploy, ember-cli-github- pages BY TYPE
  • 31. Representative Examples OTHER IMPORTANT EXAMPLES ember-cli-flash customizable configuration, with default value management ember-perf support for wide range of framework versions (canary >= ember > 1.6.0) ember-lodash shim ES6 node library for ember apps ember-cpm complex blueprint ember-truth-helpers elegant support for legacy and current helper API