ember-cli / ember-cli

The Ember.js command line utility.
https://cli.emberjs.com
MIT License
3.26k stars 1.16k forks source link

Default blueprint doesn't get executed automatically when running `ember install <local file path>` #8937

Open shankarsridhar opened 4 years ago

shankarsridhar commented 4 years ago

Could be closely related to https://github.com/ember-cli/ember-cli/issues/6833.

I am building an ember addon that requires a default blueprint to be run (that is, as part of ember install <addon-name>).

And I noticed that the default blueprint doesn't run when I use a file path: ember install <local path to addon folder>

After I publish the addon to the registry, the default blueprint from my addon works as expected - that is, files getting placed in the appropriate path in the consuming ember app.

ember install <addon-name(package.json#name)>

Is this expected ?

Current workaround(I guess I can call it a workaround ?) that I am doing: Add the "defaultBlueprint: key under the ember-addon section in the package.json as follows:

"ember-addon": {
    "defaultBlueprint": "@shankarscope/ember-imaginary-addon"
}

Thanks to info from source here: https://github.com/ember-cli/ember-cli/blob/master/lib/tasks/addon-install.js#L96

if (emberAddon && emberAddon.defaultBlueprint) {
  return emberAddon.defaultBlueprint;
}

Output from ember version --verbose && npm --version && yarn --version:

3.15.0-beta.1-master-73a2006723
ember-cli: 3.15.0-beta.1-master-73a2006723
2.8.0
http_parser: 2.8.0
10.15.0
node: 10.15.0
6.8.275.32-node.45
v8: 6.8.275.32-node.45
1.23.2
uv: 1.23.2
1.2.11
zlib: 1.2.11
1.15.0
ares: 1.15.0
64
modules: 64
1.34.0
nghttp2: 1.34.0
3
napi: 3
1.1.0j
openssl: 1.1.0j
62.1
icu: 62.1
11.0
unicode: 11.0
33.1
cldr: 33.1
2018e
tz: 2018e
darwin x64
os: darwin x64
6.4.1
rwjblue commented 4 years ago

Ya, definitely seems to be a bug. I suspect we are not properly grabbing hte name of the addon from the target package.json (or index.js), so we look for a default blueprint named ./some/whatever/addon-name instead of addon-name.