Skip to content

Commit

Permalink
noflo via browserify and polymer and react update
Browse files Browse the repository at this point in the history
  • Loading branch information
forresto committed Aug 4, 2014
1 parent adcfa17 commit feb7af9
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 13 deletions.
16 changes: 15 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
command: 'node ./scripts/build-font-awesome-javascript.js '
}
},
browserify: {
libs: {
files: {
'build/noflo.js': ['index.js'],
},
options: {
transform: ['coffeeify']
},
browserifyOptions: {
require: 'noflo'
}
}
},
jshint: {
options: jshintOptions,
all: {
Expand Down Expand Up @@ -104,10 +117,11 @@
this.loadNpmTasks('grunt-contrib-jshint');
this.loadNpmTasks('grunt-lint-inline');
this.loadNpmTasks('grunt-contrib-connect');
this.loadNpmTasks('grunt-browserify');

this.registerTask('dev', ['test', 'connect:server', 'watch']);
this.registerTask('test', ['jshint:all', 'inlinelint:all']);
this.registerTask('build', ['exec:build_stylus', 'exec:build_fa']);
this.registerTask('build', ['exec:build_stylus', 'exec:build_fa', 'browserify:libs']);
this.registerTask('default', ['test']);
};

Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
],
"description": "HTML custom elements for dataflow graph editing",
"dependencies": {
"polymer": "Polymer/polymer#0.2.4",
"polymer": "Polymer/polymer#0.3.4",
"hammerjs": "~1.1.2",
"font-awesome": "~4.1.0",
"react": "~0.10.0",
"klay-js": "~0.0.8"
"react": "~0.11.1",
"klay-js": "~0.1.0"
},
"license": "MIT",
"ignore": [
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "polymer components for flow-based programming graph editing",
"main": "the-graph-editor/index.html",
"dependencies": {
"noflo": "^0.5.7"
},
"devDependencies": {
"stylus": "~0.42.3",
Expand All @@ -12,7 +13,9 @@
"grunt-contrib-jshint": "~0.6.3",
"grunt-lint-inline": "~0.3.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-connect": "~0.5.0"
"grunt-contrib-connect": "~0.5.0",
"grunt-browserify": "^2.1.4",
"coffeeify": "^0.7.0"
},
"scripts": {
"test": "grunt test"
Expand Down
8 changes: 5 additions & 3 deletions the-graph-editor/demo-simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
<title>Graph Editor Demo</title>
<meta charset="utf-8">

<!-- Libraries -->
<!-- Bower Libraries -->
<script src="../bower_components/platform/platform.js"></script>
<script src="../bower_components/react/react.js"></script>
<script src="../bower_components/noflo/browser/noflo.js"></script>
<script src="../bower_components/klay-js/klay.js"></script>
<script src="../bower_components/hammerjs/hammer.js"></script>
<script src="../bower_components/hammerjs/hammer.min.js"></script>

<!-- Browserify Libraries -->
<script src="../build/noflo.js"></script>

<!-- Custom elements -->
<link rel="import" href="../bower_components/polymer/polymer.html">
Expand Down
8 changes: 5 additions & 3 deletions the-graph-editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
<title>Graph Editor</title>
<meta charset="utf-8">

<!-- Libraries -->
<!-- Bower Libraries -->
<script src="../bower_components/platform/platform.js"></script>
<script src="../bower_components/react/react.js"></script>
<script src="../bower_components/noflo/browser/noflo.js"></script>
<script src="../bower_components/klay-js/klay.js"></script>
<script src="../bower_components/hammerjs/hammer.js"></script>
<script src="../bower_components/hammerjs/hammer.min.js"></script>

<!-- Browserify Libraries -->
<script src="../build/noflo.js"></script>

<!-- Custom elements -->
<link rel="import" href="../bower_components/polymer/polymer.html">
Expand Down
15 changes: 14 additions & 1 deletion the-graph-editor/the-graph-editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,20 @@
this.nofloGraph = this.graph;
return;
}
require('noflo').graph.loadJSON(this.graph, function(nofloGraph){

var noflo;
if ('noflo' in window) {
noflo = window.noflo;
}
if (!noflo && 'require' in window) {
noflo = require('noflo');
}
if (!noflo) {
console.warn('Missing noflo dependency! Should be built with Component.io or Browserify to require it.');
return;
}

noflo.graph.loadJSON(this.graph, function(nofloGraph){
this.buildInitialLibrary(nofloGraph);
this.nofloGraph = nofloGraph;
}.bind(this));
Expand Down
2 changes: 1 addition & 1 deletion the-graph/the-graph-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
nextProps.ports !== this.props.ports ||
nextProps.selected !== this.props.selected ||
nextProps.highlightPort !== this.props.highlightPort ||
nextProps.ports.dirty
nextProps.ports.dirty === true
);
},
componentDidUpdate: function (prevProps, prevState) {
Expand Down

0 comments on commit feb7af9

Please sign in to comment.