Skip to content

Commit

Permalink
Merge pull request #117 from Turbo87/rollup
Browse files Browse the repository at this point in the history
Use Rollup to bundle files
  • Loading branch information
Turbo87 authored Dec 20, 2016
2 parents b321f1f + 2a79323 commit fc46dbf
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 46 deletions.
55 changes: 44 additions & 11 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ var eslint = require('broccoli-lint-eslint');
var replace = require('broccoli-string-replace');
var gitVersion = require('git-repo-version');
var BabelTranspiler = require('broccoli-babel-transpiler');
var Rollup = require('broccoli-rollup');
var nodeResolve = require('rollup-plugin-node-resolve');
var alias = require('rollup-plugin-alias');

function compileES6(tree) {
return new BabelTranspiler(tree, {
Expand All @@ -25,16 +28,6 @@ module.exports = function(defaults) {
destDir: '/assets/'
});

var emberTestHelpersPath = path.dirname(resolve.sync('ember-test-helpers'));

var emberTestHelpers = new Funnel(emberTestHelpersPath, {
srcDir: '/',
include: [/\.js$/],
destDir: '/'
});

var deps = mergeTrees([emberTestHelpers]);

var lib = new Funnel('lib', {
srcDir: '/',
include: [/.js$/],
Expand All @@ -47,7 +40,47 @@ module.exports = function(defaults) {
destDir: '/tests'
});

var main = mergeTrees([deps, lib]);
var emberTestHelpersPath = path.dirname(resolve.sync('ember-test-helpers'));

var emberTestHelpersRollup = new Rollup(emberTestHelpersPath, {
rollup: {
entry: 'ember-test-helpers.js',
dest: 'ember-test-helpers.js',
external: ['ember'],
plugins: [
alias({
'ember-test-helpers/': './ember-test-helpers/',
}),
],
},
});

var mochaRollup = new Rollup(lib, {
rollup: {
entry: 'mocha.js',
dest: 'mocha.js',
external: ['mocha', 'ember'],
plugins: [
nodeResolve(),
],
},
});

var emberMochaRollup = new Rollup(lib, {
rollup: {
entry: 'ember-mocha.js',
dest: 'ember-mocha.js',
external: ['mocha', 'ember', 'ember-test-helpers'],
plugins: [
alias({
'ember-mocha/': './ember-mocha/',
}),
nodeResolve(),
],
},
});

var main = mergeTrees([emberTestHelpersRollup, mochaRollup, emberMochaRollup]);
main = concat(compileES6(main), {
inputFiles: ['**/*.js'],
outputFile: '/ember-mocha.amd.js'
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@
"broccoli-funnel": "^1.0.6",
"broccoli-lint-eslint": "^2.6.0",
"broccoli-merge-trees": "^1.1.4",
"broccoli-rollup": "^1.0.3",
"broccoli-string-replace": "^0.1.1",
"ember-cli": "^2.7.0",
"ember-cli-release": "^0.2.7",
"exists-sync": "0.0.3",
"git-repo-version": "^0.4.0",
"resolve": "^1.1.7"
"resolve": "^1.1.7",
"rollup-plugin-alias": "^1.2.0",
"rollup-plugin-node-resolve": "^2.0.0"
}
}
34 changes: 0 additions & 34 deletions tests/mocha-module-test.js

This file was deleted.

0 comments on commit fc46dbf

Please sign in to comment.