Skip to content

Commit

Permalink
Merge pull request #30 from noflo/noflo_component_loader
Browse files Browse the repository at this point in the history
Build using noflo-component-loader
  • Loading branch information
bergie committed Oct 27, 2017
2 parents cf4dbb5 + 9935b00 commit f6ac38e
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 248 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '4.2'
- '6'
before_script:
- npm install -g grunt-cli
script: grunt test
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -6,7 +6,7 @@ init:

environment:
matrix:
- nodejs_version: 4.2
- nodejs_version: 6

install:
- ps: Install-Product node $env:nodejs_version
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -28,7 +28,7 @@
"coffee-loader": "^0.7.2",
"coffee-script": "^1.10.0",
"fbp-loader": "^0.1.1",
"fbp-manifest": "^0.1.13",
"noflo-component-loader": "^0.1.1",
"webpack": "^3.0.0"
},
"devDependencies": {
Expand All @@ -39,7 +39,6 @@
"grunt-contrib-jshint": "^1.1.0",
"grunt-exec": "^1.0.0",
"grunt-mocha-phantomjs": "^4.0.0",
"grunt-noflo-manifest": "^0.1.12",
"mocha": "^4.0.0"
},
"peerDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions spec/fixtures/package.json
Expand Up @@ -14,11 +14,11 @@
},
"dependencies": {
"noflo": "0.x >= 0.8",
"noflo-math": "^0.0.8",
"noflo-core": "^0.2.3",
"noflo-objects": "^0.1.14",
"noflo-dom": "^0.1.1",
"noflo-css": "^0.0.2"
"noflo-math": "^0.2.0",
"noflo-core": "^0.4.0",
"noflo-objects": "^0.3.0",
"noflo-dom": "^0.2.0",
"noflo-css": "^0.1.0"
},
"devDependencies": {
"noflo-runtime-postmessage": "^0.8.0"
Expand Down
121 changes: 0 additions & 121 deletions src/build_loader.js

This file was deleted.

25 changes: 17 additions & 8 deletions src/webpack.js
Expand Up @@ -22,19 +22,28 @@ exports.configure = function (options) {
config.plugins = [];
}

// Custom component loader for this build
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/\.\/loader\/register/,
require.resolve(options.loaderPath)
)
);

// Configurable ignores
options.ignores.forEach(function (ignore) {
config.plugins.push(new webpack.IgnorePlugin(ignore));
});

// Inject noflo-component-loader
config.module.rules.push({
test: /noflo([\\]+|\/)lib([\\]+|\/)loader([\\]+|\/)register.js$/,
use: [
{
loader: 'noflo-component-loader',
options: {
graph: options.graph,
debug: options.debug,
baseDir: options.baseDir,
manifest: options.manifest,
runtimes: options.runtimes,
}
}
]
});

config.output = {
path: options.destDir,
filename: options.destName + '.js'
Expand Down
7 changes: 0 additions & 7 deletions tasks/noflo_browser.js
Expand Up @@ -11,7 +11,6 @@
var path = require('path');
var webpack = require('../src/webpack');
var createDemos = require('../src/create_demos');
var buildLoader = require('../src/build_loader');
var bluebird = require('bluebird');
var clone = require('clone');

Expand Down Expand Up @@ -130,19 +129,13 @@ module.exports = function(grunt) {
fileOptions.runtimes.push('noflo-browser');
}

var discover = bluebird.promisify(buildLoader.discover);
return discover(fileOptions);
}).then(function (components) {
fileOptions.loaderPath = buildLoader.save(components, grunt, fileOptions);

var config = webpack.configure(fileOptions);

grunt.log.debug('Generated webpack configuration:');
grunt.log.debug(JSON.stringify(config, null, 2));

return bluebird.promisify(webpack.run)(config);
}).then(function () {
grunt.file.delete(fileOptions.loaderPath);
if (fileOptions.generatedEntry) {
grunt.file.delete(fileOptions.webpack.entry);
}
Expand Down
103 changes: 0 additions & 103 deletions templates/componentloader.js

This file was deleted.

0 comments on commit f6ac38e

Please sign in to comment.