Skip to content

Commit

Permalink
Remove Bower support.
Browse files Browse the repository at this point in the history
Retrieving `ember-template-compiler` from `bower_components` is only
required when using Ember versions older than 2.12. Bower itself is
essentially deprecated, this removes the fallback code to use
`bower_components/ember/ember-template-compiler.js` and improves the
error message when we can't actually find `ember-source`.

You can still provide a custom path to the template compiler (and
therefore use Bower if you wish) by:

```js
// ember-cli-build.js

module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    'ember-cli-htmlbars': {
      templateCompilerPath: `some_path/to/ember-template-compiler.js`,
    }
  });
};
```
  • Loading branch information
rwjblue committed Apr 9, 2020
1 parent 7026bb0 commit 1b21e24
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
20 changes: 9 additions & 11 deletions lib/ember-addon-main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const path = require('path');
const SilentError = require('silent-error');
const utils = require('./utils');

let registryInvocationCounter = 0;
Expand Down Expand Up @@ -191,20 +191,18 @@ module.exports = {
let templateCompilerPath =
config['ember-cli-htmlbars'] && config['ember-cli-htmlbars'].templateCompilerPath;

let ember = this.project.findAddonByName('ember-source');
if (ember) {
return ember.absolutePaths.templateCompiler;
} else if (!templateCompilerPath) {
templateCompilerPath = this.project.bowerDirectory + '/ember/ember-template-compiler';
if (templateCompilerPath) {
return templateCompilerPath;
}

let absolutePath = path.resolve(this.project.root, templateCompilerPath);

if (path.extname(absolutePath) === '') {
absolutePath += '.js';
let ember = this.project.findAddonByName('ember-source');
if (ember) {
throw new SilentError(
`ember-cli-htmlbars: Cannot find the ember-source addon as part of the project, please ensure that 'ember-source' is in your projects dependencies or devDependencies`
);
}

return absolutePath;
return ember.absolutePaths.templateCompiler;
},

htmlbarsOptions() {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"heimdalljs-logger": "^0.1.10",
"json-stable-stringify": "^1.0.1",
"semver": "^6.3.0",
"silent-error": "^1.1.1",
"strip-bom": "^4.0.0",
"walk-sync": "^2.0.2"
},
Expand Down
12 changes: 9 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7072,9 +7072,8 @@ mocha@^7.1.1:
yargs-unparser "1.6.0"

"module-name-inliner@link:./tests/dummy/lib/module-name-inliner":
version "0.1.0"
dependencies:
ember-cli-version-checker "*"
version "0.0.0"
uid ""

morgan@^1.9.1:
version "1.9.1"
Expand Down Expand Up @@ -8402,6 +8401,13 @@ resolve@^1.1.3, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.
dependencies:
path-parse "^1.0.6"

resolve@^1.13.1:
version "1.15.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8"
integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==
dependencies:
path-parse "^1.0.6"

responselike@1.0.2, responselike@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7"
Expand Down

0 comments on commit 1b21e24

Please sign in to comment.