Skip to content

Commit

Permalink
Port to ES6
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed Sep 23, 2018
1 parent f52d0c4 commit 2d69b45
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 143 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,3 @@
{
"extends": "airbnb-base"
}
113 changes: 0 additions & 113 deletions Gruntfile.coffee

This file was deleted.

49 changes: 49 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,49 @@
module.exports = function tasks() {
// Project configuration
const pkg = this.file.readJSON('package.json');
const repo = pkg.repository.url.replace('git://', `https://${process.env.GH_TOKEN}@`);
this.initConfig({
pkg: this.file.readJSON('package.json'),
// Browser build of NoFlo
noflo_browser: {
build: {
options: {
debug: true,
exposed_modules: {
noflo: 'noflo',
'noflo-runtime-postmessage': 'noflo-runtime-postmessage',
},
},
files: {
'browser/<%=pkg.name%>.js': ['package.json'],
},
},
},
// Deployment to GitHub Pages
'gh-pages': {
options: {
base: 'browser',
clone: 'gh-pages',
message: `Release ${pkg.name} ${process.env.TRAVIS_TAG}`,
repo,
user: {
name: 'NoFlo bot',
email: 'bot@noflo.org',
},
silent: true,
},
src: '**/*',
},
});
// Grunt plugins used for building
this.loadNpmTasks('grunt-noflo-browser');
// Grunt plugins used for deploying
this.loadNpmTasks('grunt-gh-pages');
// Our local tasks
this.registerTask('build', 'Build NoFlo for the chosen target platform', (target = 'all') => {
if (target === 'all' || target === 'browser') {
this.task.run('noflo_browser');
}
});
this.registerTask('default', ['build']);
};
30 changes: 0 additions & 30 deletions components/DoSomething.coffee

This file was deleted.

33 changes: 33 additions & 0 deletions components/DoSomething.js
@@ -0,0 +1,33 @@
const noflo = require('noflo');

exports.getComponent = () => {
const c = new noflo.Component();
// Define a meaningful icon for component from http://fontawesome.io/icons/
c.icon = 'cog';
// Provide a description on component usage
c.description = 'do X';
// Add input ports
c.inPorts.add('in', {
datatype: 'string',
});
// Add output ports
c.outPorts.add('out', {
datatype: 'string',
});
// What to do when port receives a packet
c.process((input, output) => {
// Check that input has received data packet
if (!input.hasData('in')) {
return;
}
// Read the contents of the data packet
const data = input.getData('in');
// Send the contents to output port
output.send({
out: data,
});
// Finish processing
output.done();
});
return c;
};
26 changes: 26 additions & 0 deletions spec/DoSomething.yaml
@@ -0,0 +1,26 @@
topic: "DoSomething"
cases:
-
name: 'sending a boolean'
assertion: 'should repeat the same'
inputs:
in: true
expect:
out:
equals: true
-
name: 'sending a number'
assertion: 'should repeat the same'
inputs:
in: 1000
expect:
out:
equals: 1000
-
name: 'sending a string'
assertion: 'should repeat the same'
inputs:
in: "my string"
expect:
out:
equals: "my string"

0 comments on commit 2d69b45

Please sign in to comment.