Skip to content

Commit

Permalink
fix(Setup): Soften the build-time errors to warnings for non-standard…
Browse files Browse the repository at this point in the history
… configurations

* Fixes #322.

Change sass preprocessor error to a warning and update the wording.

* Wording change.

* Similar softening of the error when using less without the right bootstrap dependency.

* Refactor the warning message incantation into a method.
  • Loading branch information
srvance authored and simonihmig committed May 16, 2017
1 parent 7d74a86 commit fec690e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module.exports = {
let bowerDependencies = this.app.project.bowerDependencies();

if ('bootstrap' in bowerDependencies || 'bootstrap-sass' in bowerDependencies) {
this.ui.writeLine(chalk.yellow('The dependencies for ember-bootstrap can be outdated. Please run `ember generate ember-bootstrap` to install appropriate dependencies!'));
this.warn('The dependencies for ember-bootstrap may be outdated. Please run `ember generate ember-bootstrap` to install appropriate dependencies!');
}
},

Expand All @@ -88,15 +88,15 @@ module.exports = {
switch (name) {
case 'sass':
if (!('bootstrap-sass' in dependencies) && this.getBootstrapVersion() === 3) {
throw new SilentError('Npm package "bootstrap-sass" is missing, but required for SASS support. Please run `ember generate ember-bootstrap` to install the missing dependencies!');
this.warn('Npm package "bootstrap-sass" is missing, but is typically required for SASS support. Please run `ember generate ember-bootstrap` to install the missing dependencies!');
}
break;
case 'less':
if (this.getBootstrapVersion() === 4) {
throw new SilentError('There is no Less support for Bootstrap 4! Falling back to importing static CSS. Consider switching to Sass for preprocessor support!');
}
if (!('bootstrap' in dependencies)) {
throw new SilentError('Npm package "bootstrap" is missing, but required for Less support. Please run `ember generate ember-bootstrap` to install the missing dependencies!');
this.warn('Npm package "bootstrap" is missing, but is typically required for Less support. Please run `ember generate ember-bootstrap` to install the missing dependencies!');
}
break;
}
Expand Down Expand Up @@ -194,5 +194,9 @@ module.exports = {
if (type === 'body-footer' && config.environment !== 'test' && this.bootstrapOptions.insertEmberWormholeElementToDom !== false) {
return '<div id="ember-bootstrap-wormhole"></div>';
}
},

warn(message) {
this.ui.writeLine(chalk.yellow(message));
}
};

0 comments on commit fec690e

Please sign in to comment.