From 6f95be81ea20eca54d1c6ee70eb30ef86372f3e5 Mon Sep 17 00:00:00 2001 From: Erik Trom Date: Wed, 4 May 2016 13:38:31 -0700 Subject: [PATCH] Fix npm 2.x build failures for angular-material-source dependency - Angular-material-source does not have a main node module, its only built to ./dist and published via bower. The first attempt to make this work with npm 3.x broke (some users) npm 2.x env's. - This aims to allow building a project that includes this addon for npme 2.x and 3.x for all versions of node. fixes #349 --- index.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 4dcfb38a2..8418a69b1 100644 --- a/index.js +++ b/index.js @@ -106,10 +106,19 @@ module.exports = { 'components/dialog/dialog-theme.scss' ]; - var pathBase = this.project.nodeModulesPath; - var angularMaterialPath = 'angular-material-source/src'; - - var angularScssFiles = new Funnel(path.join(pathBase,angularMaterialPath), { + /* + Find the angular-material-source module in a manner that works for npm 2.x + and 3.x in both the addon itself and projects that depend on this addon + + This is an edge case b/c angular-material-source does not have a main + module we can require.resolve through node itself and similarily ember-cli + does not have such a hack for the same reason. + + tl;dr - We want the non built scss files, and b/c this dep is only provided via + bower, we use this hack. Please change it if you read this and know a better way. + */ + var pathBase = path.resolve(this.nodeModulesPath, 'angular-material-source', 'src') + var angularScssFiles = new Funnel(pathBase, { files: scssFiles, destDir: 'angular-material', annotation: 'AngularScssFunnel'