-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
97 changed files
with
15,746 additions
and
14,793 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
module.exports = function() { | ||
// Project configuration | ||
this.initConfig({ | ||
pkg: this.file.readJSON('package.json'), | ||
|
||
// Copy plain JS files | ||
babel: { | ||
options: { | ||
presets: ['env'] | ||
}, | ||
dist: { | ||
files: [{ | ||
cwd: 'src/lib/', | ||
src: ['**/*.js'], | ||
dest: 'lib/', | ||
expand: true, | ||
ext: '.js' | ||
} | ||
, { | ||
cwd: 'src/components/', | ||
src: ['**/*.js'], | ||
dest: 'components/', | ||
expand: true, | ||
ext: '.js' | ||
} | ||
] | ||
} | ||
}, | ||
|
||
// Browser build of NoFlo | ||
noflo_browser: { | ||
options: { | ||
baseDir: './', | ||
webpack: { | ||
module: { | ||
rules: [{ | ||
test: /\.js$/, | ||
use: [{ | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['env'] | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
build: { | ||
files: { | ||
'browser/noflo.js': ['spec/fixtures/entry.js'] | ||
} | ||
} | ||
}, | ||
|
||
// BDD tests on Node.js | ||
mochaTest: { | ||
nodejs: { | ||
src: ['spec/*.js'], | ||
options: { | ||
reporter: 'spec', | ||
grep: process.env.TESTS | ||
} | ||
} | ||
}, | ||
|
||
// Web server for the browser tests | ||
connect: { | ||
server: { | ||
options: { | ||
port: 8000 | ||
} | ||
} | ||
}, | ||
|
||
// Generate runner.html | ||
noflo_browser_mocha: { | ||
all: { | ||
options: { | ||
scripts: [ | ||
"../browser/<%=pkg.name%>.js", | ||
"https://cdnjs.cloudflare.com/ajax/libs/coffee-script/1.7.1/coffee-script.min.js" | ||
] | ||
}, | ||
files: { | ||
'spec/runner.html': ['spec/*.js'] | ||
} | ||
} | ||
}, | ||
// BDD tests on browser | ||
mocha_phantomjs: { | ||
all: { | ||
options: { | ||
output: 'spec/result.xml', | ||
reporter: 'spec', | ||
urls: ['http://localhost:8000/spec/runner.html'], | ||
failWithOutput: true | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// Grunt plugins used for building | ||
this.loadNpmTasks('grunt-babel'); | ||
this.loadNpmTasks('grunt-noflo-browser'); | ||
|
||
// Grunt plugins used for testing | ||
this.loadNpmTasks('grunt-contrib-connect'); | ||
this.loadNpmTasks('grunt-mocha-test'); | ||
this.loadNpmTasks('grunt-mocha-phantomjs'); | ||
|
||
// Our local tasks | ||
this.registerTask('build', 'Build NoFlo for the chosen target platform', target => { | ||
if (target == null) { target = 'all'; } | ||
this.task.run('babel'); | ||
if ((target === 'all') || (target === 'browser')) { | ||
this.task.run('noflo_browser'); | ||
} | ||
}); | ||
|
||
this.registerTask('test', 'Build NoFlo and run automated tests', target => { | ||
if (target == null) { target = 'all'; } | ||
this.task.run(`build:${target}`); | ||
if ((target === 'all') || (target === 'nodejs')) { | ||
// The components directory has to exist for Node.js 4.x | ||
this.file.mkdir('components'); | ||
this.task.run('mochaTest'); | ||
} | ||
if ((target === 'all') || (target === 'browser')) { | ||
this.task.run('noflo_browser_mocha'); | ||
this.task.run('connect'); | ||
// this.task.run('mocha_phantomjs'); | ||
} | ||
}); | ||
|
||
this.registerTask('default', ['test']); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const noflo = require("noflo"); | ||
|
||
exports.getComponent = () => { | ||
const c = new noflo.Component; | ||
c.description = "Simple controller that says hello, user"; | ||
c.inPorts.add('in', | ||
{datatype: 'object'}); | ||
c.outPorts.add('out', | ||
{datatype: 'object'}); | ||
c.outPorts.add('data', | ||
{datatype: 'object'}); | ||
c.process((input, output) => { | ||
if (!input.hasData('in')) { return; } | ||
const request = input.getData('in'); | ||
output.sendDone({ | ||
out: request, | ||
data: { | ||
locals: { | ||
string: `Hello, ${request.req.remoteUser}` | ||
} | ||
} | ||
}); | ||
}); | ||
return c; | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.