diff --git a/circle.yml b/circle.yml index d6bbd41..24c9789 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: node: - version: 5.1.0 + version: 6.1.0 dependencies: override: diff --git a/lib/angular-app.js b/lib/angular-app.js index c88a164..0dc576b 100644 --- a/lib/angular-app.js +++ b/lib/angular-app.js @@ -11,7 +11,6 @@ const Funnel = require('broccoli-funnel'), uglifyJs = require('broccoli-uglify-js'), imagemin = require('broccoli-imagemin'), fingerprint = require('broccoli-asset-rev'), - amdNameResolver = require('amd-name-resolver').moduleResolve, amdLoader = require('broccoli-amd-loader'), Babel = require('broccoli-babel-transpiler'), unitTest = require('broccoli-karma-plugin'), @@ -126,13 +125,7 @@ export default config; let config = writeFile('/config/environment.js', file); - config = new Babel(config, { - moduleIds: true, - modules: 'amdStrict', - resolveModuleSource: amdNameResolver, - sourceRoot: 'config', - sourceMap: this.isProduction ? false : 'inline' - }); + config = babel(config, { sourceRoot: 'config' }); return config; }; @@ -325,12 +318,6 @@ AngularApp.prototype.processVendorStyles = function () { return vendorStyles; }; -function render (errors) { - return errors.map( - error => `${error.line}:${error.column} - ${error.message} (${error.ruleId})` - ).join('\n'); -} - AngularApp.prototype.runLinter = function (appScriptsTree, appStylesTree) { const lintScripts = eslint(appScriptsTree, { annotation: 'ESLint: Lint App Scripts', @@ -367,10 +354,7 @@ describe("ESLint | ${escape(relativePath)}", function () { }; AngularApp.prototype.runTests = function (appScriptsTree, addonsScriptsTree, vendorScriptsTree, lintingResults) { - const tests = new Babel(this.appTestsTree(), { - moduleIds: true, - sourceRoot: 'app' - }), + const tests = babel(this.appTestsTree(), { sourceMap: false }), karmaConfig = { singleRun: !this.isServing, autoWatch: this.isServing, @@ -392,7 +376,7 @@ AngularApp.prototype.runTests = function (appScriptsTree, addonsScriptsTree, ven }; AngularApp.prototype.toTree = function () { - const templates = this.processAngularTemplates(this.templateTree()); + const templates = this.processAngularTemplates(this.templateTree()); let html = this.htmlTree(), vendorScripts = this.processVendorScripts(), vendorStyles = this.processVendorStyles(), @@ -410,20 +394,8 @@ AngularApp.prototype.toTree = function () { lintingResults = this.runLinter(appScripts, appStyles); - appScripts = new Babel(mergeTrees([appScripts, templates]), { - moduleIds: true, - modules: 'amdStrict', - resolveModuleSource: amdNameResolver, - sourceRoot: 'app', - sourceMap: this.isProduction ? false : 'inline' - }); - addonsScripts = new Babel(addonsScripts, { - moduleIds: true, - modules: 'amdStrict', - resolveModuleSource: amdNameResolver, - sourceRoot: 'app', - sourceMap: this.isProduction ? false : 'inline' - }); + appScripts = babel(mergeTrees([appScripts, templates])); + addonsScripts = babel(addonsScripts); appScripts = ngAnnotate(appScripts , { add: true, annotation: 'Ng Annotate: App Scripts' }); addonsScripts = ngAnnotate(addonsScripts , { add: true, annotation: 'Ng Annotate: Addons Scripts' }); vendorScripts = ngAnnotate(vendorScripts , { add: true, annotation: 'Ng Annotate: Vendor Scripts' }); @@ -550,3 +522,17 @@ AngularApp.prototype.importScript = function (filePath) { AngularApp.prototype.importStyle = function (filePath) { this.vendorStyles.push(filePath); }; + +function babel (tree, options) { + return new Babel(tree, Object.assign({ + moduleIds: true, + sourceRoot: 'app', + sourceMap: this.isProduction ? false : 'inline', + }, options)); +} + +function render (errors) { + return errors.map( + error => `${error.line}:${error.column} - ${error.message} (${error.ruleId})` + ).join('\n'); +} diff --git a/package.json b/package.json index 34c0d34..2e19101 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-bro-app", - "version": "0.10.2", + "version": "0.11.0", "description": "Angular broccoli plugin and compilation routine", "main": "lib/angular-app.js", "scripts": { @@ -25,11 +25,11 @@ }, "homepage": "https://github.com/adambullmer/angular-bro-app#readme", "dependencies": { - "amd-name-resolver": "0.0.5", + "babel-plugin-transform-es2015-modules-amd": "^6.24.1", "broccoli-amd-loader": "^0.1.0", "broccoli-angular-templates-cache": "^1.0.3", "broccoli-asset-rev": "^2.4.2", - "broccoli-babel-transpiler": "^5.5.0", + "broccoli-babel-transpiler": "^6.1.1", "broccoli-concat": "^2.2.0", "broccoli-csslint": "^1.2.0", "broccoli-file-creator": "^1.1.0",