Ember-cli reader configurations

I am trying to create hadron-cli addon and I want this addon to include a custom command. This is the part I already did by creating the file structure lib/commands

and including the script that will run the command and then use it includedCommands

in the addon index.js

.

The part I'm struggling with is that I want the command to be able to read the config file in the host applications directory. How can i do this? If I could find out the absolute path to the host applications, I would assume that I can parse the file using the built-in node tools, but how do I find that path?

If there are better ways to accomplish this task, I am all ears.

+3


source to share


2 answers


In your commands run

you can access this.project

which contains information about the project.



What you want to use is this.project.root

.. this is the root directory of the project.

+3


source


I managed to solve the problem. I don't know if this is the best. This way I can get the absolute path of the process in node only with process.cwd()

Then I can just add the config file name to the end of the line to get the absolute path to the config file.



If there are any special ways that I have to do, please let me know.

0


source







All Articles