Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

ITB2019 CommandBox vs Node.js - Nolan Erck

59 vues

Publié le

Code Examples: https://github.com/nolanerck/commandbox-vs-node

JavaScript is everywhere, and with that so is Node.js. Developers feel they have to have Node installed for a modern development workflow. Did you know that all the core features of Node now exist in a pure CFML workflow? Everything you’ve heard about from the JavaScript/Node world can be done with CommandBox! Package management, installing dependencies, command line tooling, flipping between run-time environments, automated build and testing processes are often mentioned as tasks made easier with Node. Modern CFML developers can have all of these same benefits without ever installing Node! It all can be done from CommandBox and this preso will show you how!

Publié dans : Technologie
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

ITB2019 CommandBox vs Node.js - Nolan Erck

  1. 1. CommandBox vs Node.jsCommandBox vs Node.js Nolan Erck South of Shasta
  2. 2. About MeAbout Me Software Consultant (southofshasta.com) Software Development, Training, Design ColdFusion, C++, Java, jQuery, PHP, .NET, HTML5, Angular, SQL, etc... Manager of SacInteractive User Group Reformed Video Game Developer (Grim Fandango, SimPark, StarWars Rogue Squadron, etc). Music Junkie
  3. 3. Slide deck and code samples are here:Slide deck and code samples are here: github.com/nolanerck commandbox-vs-node
  4. 4. For today's talkFor today's talk Screenshots and recorded videos No smoke and mirrors I'm merely avoiding hotel wi
  5. 5. Let's get started!Let's get started!
  6. 6. We've all heard these things:We've all heard these things: JavaScript has all the cool toys! CFML is old, dying and only for legacy stuff!
  7. 7. Incorrect!Incorrect! CommandBox is here to save the day! All of the Node.js fundamentals are available to CFML developers
  8. 8. What is Node.js?What is Node.js? App you install On laptop or server "JavaScript can run anywhere" In web browser (obviously) As a server side language (ala CFML) As a native CLI tool on your laptop
  9. 9. Installing Node.jsInstalling Node.js Go to Nodejs.org Click one of these: It usually "just works" Regular updates are available
  10. 10. What is CommandBox?What is CommandBox? App you install On laptop or server "CFML from the command line" As a server side language (duh) As a native CLI tool on your laptop
  11. 11. Installing CommandBoxInstalling CommandBox Go to ortussolutions.com/products/commandbox Click one of these: It usually "just works" Regular updates are available
  12. 12. The score:The score: CommandBox 1, Node 1
  13. 13. The Command Line...The Command Line...
  14. 14. Launching Node.jsLaunching Node.js Open a command prompt, type "node" This hapens:
  15. 15. Why did it say "undefined"?Why did it say "undefined"? Not a bug, working as designed You see 2 things in the results: The output of your code And the return value of your code console.log() doesn't return anything, so you get "unde ned"
  16. 16. Launching CommandBoxLaunching CommandBox Open a command prompt, type "box" This hapens:
  17. 17. The score:The score: CommandBox 2, Node 2
  18. 18. Running files via NodeRunning files via Node Type "node app.js", this happens:
  19. 19. Running files via CommandBoxRunning files via CommandBox Type "execute app.cfm", this happens:
  20. 20. The score:The score: CommandBox 3, Node 3
  21. 21. Built-in help from Node.jsBuilt-in help from Node.js Type "node --help", this happens: 0:00 / 0:14
  22. 22. Built-in help from CommandBoxBuilt-in help from CommandBox Type "box help", this happens: 0:00 / 0:19
  23. 23. Built-in help from CommandBoxBuilt-in help from CommandBox But wait, there's more! CommandBox is broken up into "namespaces" Each "namespace" contains many different commands Switch to a new namespace to see more detailed help
  24. 24. The score:The score: CommandBox 4, Node 4
  25. 25. How does Node do it?How does Node do it? Running a JavaScript application engine on your computer (or server) Code is processed thru the engine Spins up different services as needed Customizable per project via ".json" con g les
  26. 26. How does CommandBox do it?How does CommandBox do it? Running a CFML application engine on your computer (or server) Code is processed thru the engine Spins up different services as needed (modules, packages) Customizable per project via ".json" con g les
  27. 27. The score:The score: CommandBox 5, Node 5
  28. 28. Setting up a Node ProjectSetting up a Node Project Type "npm init", this happens: 0:00 / 0:33
  29. 29. Setting up a CommandBox ProjectSetting up a CommandBox Project Type "box init", this happens: 0:00 / 0:54
  30. 30. The score:The score: CommandBox 6, Node 6
  31. 31. Dependencies Witih NodeDependencies Witih Node In package.json, "dependencies" section Things your app needs to run jquery, lodash, Angular, libaries from your team, etc "npm install" Node goes out to "the registry" and grabs those assets Puts them in "node_modules" folder
  32. 32. Dependencies Witih NodeDependencies Witih Node
  33. 33. Dependencies Witih NodeDependencies Witih Node
  34. 34. Dependencies Witih CommandBoxDependencies Witih CommandBox In box.json, "dependencies" section Things your app needs to run jquery, lodash, Angular, libaries from your team, etc "box install" CommandBox goes out to "the cloud" and grabs those assets Puts them in "installPaths" folders
  35. 35. Dependencies Witih CommandBoxDependencies Witih CommandBox
  36. 36. Dependencies Witih CommandBoxDependencies Witih CommandBox 0:00 / 1:35
  37. 37. The score:The score: CommandBox 7, Node 7
  38. 38. Dev Dependencies With NodeDev Dependencies With Node In package.json, "devDependencies" section Things your app needs to build CLI Tools, Typescript transpiler, Code Analyzer, Linter, etc Angujlar CLI, TypeScript, Webpack, etc "npm install --dev [thing]" Node goes out to "the registry" and grabs those assets Puts them in "node_modules" folder
  39. 39. Dev Dependencies Witih NodeDev Dependencies Witih Node
  40. 40. Dev Dependencies Witih NodeDev Dependencies Witih Node
  41. 41. Dev Dependencies Witih CommandBoxDev Dependencies Witih CommandBox In box.json, "devDependencies" section Things your app needs to build jquery, lodash, Angular, libaries from your team, etc "box install --saveDev [thing]" CommandBox goes out to "the cloud" and grabs those assets Puts them in "installPaths" folders
  42. 42. Dev Dependencies Witih CommandBoxDev Dependencies Witih CommandBox
  43. 43. Dev Dependencies Witih CommandBoxDev Dependencies Witih CommandBox 0:00 / 1:07
  44. 44. The score:The score: CommandBox 8, Node 8
  45. 45. Node has a Registry: npmNode has a Registry: npm Magic place in "the cloud" where reusable JavaScript lives "npm install [some library]" Node talks to "the registry", downloads the lib These dependencies live in the "node_modules" folder of your project
  46. 46. How do I addHow do I add mymyproject to npm?project to npm?
  47. 47. Adding My Project to npmAdding My Project to npm Create a package.json le Follow a few basic guidlines README, semantic version, Author, etc More details: https://docs.npmjs.com
  48. 48. CommandBox has a Registry: ForgeBoxCommandBox has a Registry: ForgeBox The "npm" of the CF world Not just *Box stuff! Can install CFWheels, Mura, FW/1, etc Any general CFML project can live here
  49. 49. How do I addHow do I add mymyproject to ForgeBox?project to ForgeBox?
  50. 50. Adding My Project to npmAdding My Project to npm Create a box.json le Follow a few basic guidlines README, semantic version, Author, etc More details: https://forgebox.io
  51. 51. The score:The score: CommandBox 9, Node 9
  52. 52. Using Node and DockerUsing Node and Docker hub.docker.com/_/node
  53. 53. Using CommandBox and DockerUsing CommandBox and Docker Of cial Docker images from Ortus Solutions hub.docker.com/r/ortussolutions/commandbox/
  54. 54. The score:The score: CommandBox 10, Node 10
  55. 55. Using Node to Make GamesUsing Node to Make Games Tons of resources Many game engines support JavaScript Can get as simple or advanced as you like
  56. 56. Using CommandBox to Make GamesUsing CommandBox to Make Games
  57. 57. Using both JavaScript *and* CFML for Games!Using both JavaScript *and* CFML for Games! box snake Vintage gaming at its nest! Minh Vo's preso on React at Gov't Summit draftstudios.com Giancarlo Gomez's preso on WebSockets: "Refreshing Your UI: Modern Uses for WebSockets"
  58. 58. The score:The score: CommandBox 11, Node 11
  59. 59. Contributing to Node.jsContributing to Node.js Main engine is written in C++, not JavaScript Add-ons can be JavaScript but not the core e.g the Angular CLI, create-react-app
  60. 60. Contributing to CommandBoxContributing to CommandBox 90% of the core is CFML Remaining 10% is Java Installing CommandBox also gives you the source code!
  61. 61. Contributing to CommandBoxContributing to CommandBox
  62. 62. But my custom commands have to be ColdBox apps, right?But my custom commands have to be ColdBox apps, right?
  63. 63. Nope!Nope!
  64. 64. My First CommandBox CommandMy First CommandBox Command
  65. 65. ModuleConfig.cfcModuleConfig.cfc
  66. 66. list.cfclist.cfc
  67. 67. MovieQuotes In Action!MovieQuotes In Action! 0:00 / 0:09
  68. 68. The score:The score: CommandBox 12, Node 12
  69. 69. Okay so what's the catch?Okay so what's the catch?
  70. 70. There isn't oneThere isn't one CommandBox is... Free, open source, well supported Supports all CFML engines Lucee and Railo Adobe CF as far back as version 9
  71. 71. CommandBox Really is a Game-ChangerCommandBox Really is a Game-Changer You can do all the cool things that Node/JavaScript developers do
  72. 72. So which do I have installed for development?So which do I have installed for development? Node or CommandBox?Node or CommandBox?
  73. 73. BothBoth They serve different purposes
  74. 74. Uses for Node.jsUses for Node.js It's ubiquitous with modern front-end development Front-end tooling requires Node Angular, Vue, React, PhoneGap, Grunt, Gulp, Stylus, SASS, SCSS, LESS, WebPack, Babel, TypeScript, etc This is a "given" nowadays
  75. 75. Uses for CommandBoxUses for CommandBox This is the way to tell modern CFML developers from legacy programmers Spinning up Dev environments, testing everything, containerization, onboarding new team members Managing production web servers Building CLI tools for development AND production servers!
  76. 76. Other ResourcesOther Resources South of Shasta - onsite and remote training nodejs.org docs.npmjs.com commandbox.ortusbooks.com Ortus Solutions Brad Wood's Blog Talk to people at the conference!
  77. 77. Learning in 30 minutes a day.Learning in 30 minutes a day.
  78. 78. Questions? Comments?Questions? Comments? southofshasta.com nolan@southofshasta.com Twitter: @southofshasta Github: nolanerck Slides and code: github.com/nolanerck/commandbox-vs-node Thanks!

×