Deewendra Shrestha
Deewendra Shrestha

Reputation: 2465

Is there an easier way to debug ember addons

I have been just starting out with ember addon and one of the difficulty I am facing is to debug it. I have a separate repo for my addon(lets name it my-addon for now), and everytime I make any change, I have to

1) commit it

2) push the changes

3) go to consuming app and then re install the app from git(atleast re-run npm install git:address so I get the latest changes)

4) run ember g my-addon (because I am in older cli)

5) do build

6) and check if things are working

This process is kinda tedious, I was wondering if I can place the addon(all of it) within the consuming app itself, atleast in the dev phase so I can just build my ember app and test the addon in the consuming app itself, and once I feel good about, push it to my local git repo.

Any thoughts or approach on how you folks do it - or may be I am just missing out something and doing it wrong!

Thanks, Dee

Upvotes: 1

Views: 548

Answers (3)

snewcomer
snewcomer

Reputation: 2135

The top answer is best here. I just wanted to offer an alternative that is useful in certain situations. npm pack at root of in development addon. Then cd back to parent project. npm install ../ember-composable-helpers-2.2.0.tgz. And then check if things are working.

npm pack will create a tarball as if published on npm.

Upvotes: 0

Deewendra Shrestha
Deewendra Shrestha

Reputation: 2465

I am pretty sure the solution provided by @GUL must work too, but what worked for me was:

1) in the consuming dev app, I created a folder called addons and placed all my addon code there 2) in consuming dev app, in package.json I added :

"ember-addon": { "paths": [ "addons/ember-chart" ] }

and that worked for me!

Upvotes: 0

GUL
GUL

Reputation: 1195

If you use ember-cli you can link your local addon in the consuming app. You can find all details in the user guide

Note that watchman doesn't observe local addon symlinked (there are couple of issues opened both on ember-cli and watchman). I've resolved removing watchman falling back to NodeWatcher (I'm on mac)

Upvotes: 3

Related Questions