ember-cli / ember-cli/blprnt

Call blueprint's origin hook

Open
#2 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Hi, considering this gist and its changes: https://gist.github.com/jgwhite/1e7871f886a9836c33d3/revisions

There is a need to "extend" blueprints in order to be able to easily change or extend the templates that the blueprints are using while not changing any installation logic (i.e. needed packages and the like). The current approach is to use `this.lookupBlueprint('name') and then call the appropriate method on it, like

``` js
afterInstall: function() {
return this.lookupBlueprint('name').afterInstall();
}
```

This currently can lead to errors if the parent blueprint invokes tasks like npm install because the context isn't correct. What would be nice is something like an `origin` method that does the exact same thing while taking care of the environment stuff.

``` js
someHook: function(options) {
return this.origin();
}
```

Simliar to `this.super` in ember.js it should take care of the arguments by itself. The method should still take arguments in order to be able to change them. I avoided the name `super` because its not actually the same concept as to call a "super" method.

If the need for calling different hooks from the origin there could be something like `originInvoke()`

``` js
someHook: function(options) {
return this.originInvoke("otherhook");
return this.invokeOnOirigin("otherhook");
return this.invokeOrigins("otherhook");
return this.callOrigins("otherhook");
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.