Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ember-cli does not respect bower_directory environment variable #6290

Closed
orf opened this issue Sep 22, 2016 · 7 comments
Closed

ember-cli does not respect bower_directory environment variable #6290

orf opened this issue Sep 22, 2016 · 7 comments

Comments

@orf
Copy link
Contributor

orf commented Sep 22, 2016

I'm currently in docker hell, and I need to have my npm and bower packages in the directory above my app code. If my app is in /usr/code/app I need my bower_components to be in /usr/code/bower_components.

Bower lets you specify a bower_directory environment variable, and if I set this to ../bower_components then bower works just fine. However ember-cli seems to ignore this and only looks inside the .bowerrc file, but only in the current directory and not in any parent directories.

Pretty much it would be great if ember-cli could respect the config rules described here: https://bower.io/docs/config/

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

ember-cli: 2.6.3
http_parser: 2.7.0
node: 6.6.0
v8: 5.1.281.83
uv: 1.9.1
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 57.1
modules: 48
openssl: 1.0.2h
os: linux x64
3.10.3

@nathanhammond
Copy link
Contributor

Related:

@orf would you be willing to write a solution following the recommendations and discussion we've had on this topic in the past? The area where this would be implemented is here:

/**
Sets the name of the bower directory for this project
@private
@method setupBowerDirectory
*/
Project.prototype.setupBowerDirectory = function() {
var bowerrcPath = path.join(this.root, '.bowerrc');
logger.info('bowerrc path: %s', bowerrcPath);
if (existsSync(bowerrcPath)) {
try {
this.bowerDirectory = fs.readJsonSync(bowerrcPath).directory;
} catch (exception) {
logger.info('failed to parse bowerc: %s', exception);
this.bowerDirectory = null;
}
}
this.bowerDirectory = this.bowerDirectory || 'bower_components';
logger.info('bowerDirectory: %s', this.bowerDirectory);
};

@orf
Copy link
Contributor Author

orf commented Sep 22, 2016

Yes I would be willing to try, there is a 'bower-config' package that we
could use. I haven't seen any prior discussion, but surely adding
bower-config and using that would suffice?

On 22 Sep 2016 18:18, "Nathan Hammond" notifications@github.com wrote:

Related:

@orf https://github.com/orf would you be willing to write a solution
following the recommendations and discussion we've had on this topic in the
past? The area where this would be implemented is here:
https://github.com/ember-cli/ember-cli/blob/2bce175ce188ae0f
47a55fa23d6affe2d768ddfb/lib/models/project.js#L69-L91


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#6290 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA-sh-vlbkGau-T-pZYAhZrtk9CDPMbNks5qsrhHgaJpZM4KEGNJ
.

@nathanhammond
Copy link
Contributor

The discussion was with regards to node_modules in the aforelinked issues, but will also apply to bower_components. Let me know if you want help, you can find me and others who can help guide in #dev-ember-cli in the Ember Community Slack.

@orf
Copy link
Contributor Author

orf commented Sep 23, 2016

Oh, I just read your comment and realized what you meant. I've made a MR that uses bower-config but that could cause problems with nested projects if I understand correctly?

I can just add an explicit environment variable EMBER_BOWER_COMPONENTS and do that instead?

@orf
Copy link
Contributor Author

orf commented Sep 23, 2016

I did this in this commit: https://github.com/orf/ember-cli/commit/8a0c3b0031999b2338751425f4003ec3d27387a8

Let me know which you want, I can close my existing MR and make this one instead.

@orf
Copy link
Contributor Author

orf commented Sep 26, 2016

Hi @nathanhammond, which one of the commits would you like me to make a MR for? I've made #6292, but if you're concerned about nested projects I was thinking that perhaps ember-cli could detect this case?

I.e if there is a project inside /project/one/two, and no .bowerrc file in that directory and one inside /project/one, then that MR would pick up /project/one/.bowerrc file as the one to use. That would be incorrect, perhaps we could throw an error if we detect an ember-cli-build.js file /project/one and say you need to add a.bowerrcin/project/one/two`?

Or maybe this is too complex, we should just have an explicit environment variable as in https://github.com/orf/ember-cli/commit/8a0c3b0031999b2338751425f4003ec3d27387a8

@locks
Copy link
Contributor

locks commented Mar 28, 2020

Thank you for the original report for everyone involved in the discussion. Given that Bower itself is deprecated this does no longer seem relevant. If you feel otherwise please re-open the issue!

@locks locks closed this as completed Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants