makenai / robotnik

Drag and drop robotics educational library starring Johnny Five and Blockly (crowd goes wild)
52 stars 13 forks source link

Angular #25

Closed BrianGenisio closed 9 years ago

BrianGenisio commented 9 years ago

A POC for Robotnik using Angular for the organization.

Using tactics that will migrate well over to Angular 2.0 when it comes out. This means avoiding $scope wherever possible (not always possible), using directives instead of controllers/view, and using ES6 modules

I will probably do some cleanup of the CSS and some other things, but I think this is a good start. Need to integrate the CodeMirror stuff that @lynnaloo is doing still.

lynnaloo commented 9 years ago

@BrianGenisio I just pushed up a branch to my repo starting to use the the CodeMirror npm module, but I'm wondering if it might be cleaner to just use this: https://github.com/angular-ui/ui-codemirror since your refactoring for Angular.

BrianGenisio commented 9 years ago

@lynnaloo It might be. We use that directive in my day-job product and it wraps it nicely. I can also wrap it minimally like I did in editor.js. I figured I'd start by merging your editor changes into my editor.js component, and then consider whether the ui-codemirror wrapper is valuable.

lynnaloo commented 9 years ago

My CodeMirror changes so far are on this branch: https://github.com/lynnaloo/robotnik/tree/codemirror. It's not that many changes to swap out Ace, but it's not quite working right yet so I'll probably PR later tonight or tomorrow.

BrianGenisio commented 9 years ago

Hmmm... if you are still working on it, perhaps you shouldn't put too much effort into it. Assuming the Angular branch goes as planned, the changes you are making for CodeMirror will probably have to be modified to fit into the NG paradigm anyways.

I think the thing I am more interested in is how are we bringing in the NPM dependencies?

For example, in the Angular branch, I bring them in app.js

import angular from 'angular';
import angularBootstrap from 'angular-bootstrap';

Perhaps that is not the best way to bring in Angular, CodeMirror, etc? Perhaps it is better to bundle the JS as a single vendor.js file which app.js is not directly dependent upon? Just a consideration. How are you going about it?

BrianGenisio commented 9 years ago

NM. I just looked at your branch. I see you are using the "import from app" approach.

I am new to Browserify. If I include my dependencies that way, is Browserify smart enough to not include Angular twice? (Or three times, if I include UI-Codemirror)? Or does it take the Node/NPM approach of bringing in all the dependencies in the tree, and will bring in multiple versions of the same thing?

(sorry for being ignorant. I'm learning :smile: )

BrianGenisio commented 9 years ago

I'm not going to tackle CodeMirror in this branch/PR. That will come later based on the work @lynnaloo is doing.

Resseguie commented 9 years ago

LGTM

lynnaloo commented 9 years ago

This has been a great opportunity for me to finally look at the es6 module system :)