Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Dependency updates and decouple the addon from the rollbar library #108

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

paulcwatts
Copy link
Contributor

@paulcwatts paulcwatts commented Sep 14, 2017

I realize this is a large PR. I just wanted to get the conversation started.

The first part of this is an update to the latest dependencies, including ember-cli and updating to the latest ember-cli blueprint.

The second is a rewrite of the addon functionality that:

  1. Removes the included snippet, and instead includes the snippet from the rollbar node library.
  2. Use a default addon blueprint to add the rollbar package to the host app. This allows the host to update the rollbar package without having to upgrade ember-cli-rollbar.
  3. Use ember-cli-node-assets to include the vendor file.
  4. Use broccoli-file-writer to generate the config.

I've also updated the Fastboot functionality to be compliant with the Fastboot 1.0 changes, although I haven't had much ability to fully test that (none of my current projects use Fastboot).

Despite the lines of code change, it actually simplifies the addon significantly because it doesn't have to update the snippet and uses external addons to include files from node_modules.

I've been using this fork in an an internal project of mine for a few months now.

@davewasmer
Copy link
Owner

@paulcwatts - huge thanks for this PR. I've been meaning to investigate whether it would be possible to avoid the hardcoded snippet, both for increased flexibility and lower maintenance burden, so I'm super excited about this.

A couple thoughts:

  1. I'd like to separate the ember-cli upgrade from this refactor - in fact, I just merged another PR from @mansona to uprade ember-cli, so a quick rebase should leave us with just the rollbar snippet changes. This way, if things go wrong, we have an easy revert fallback

  2. You mentioned bringing in the rollbar node library - since you said you are using this approach on your own app in production, I assume the rollbar lib is universal/isomorphic? Does the structure of the library change at all, or are there semver guarantees about it? My concern is especially this line:

https://github.com/davewasmer/ember-cli-rollbar/pull/108/files#diff-168726dbe96b3ce427e7fedce31bb0bcR53

If that file location changes, we might have sudden failures on CIs as we try to bring in a file that no longer exists. I think the prerequisite for this approach would be (a) some confirmation that the snippet file location is at least under semver guarantees (i.e. the rollbar team will bump majors if they move it), and (b) this line needs to change to include the current major version number.

I'd rather err on the side of being too slow to update this lib to match Rollbar's latest, rather than introducing the potential for sudden, unexpected breakages in the future cause by a seemingly innocuous change by the Rollbar team.

This is basically a rewrite that:

1. Removes the included snippet, and instead includes the snippet from the rollbar node library.
2. Use a default addon blueprint to add the rollbar package to the host app. This allows the host to update the rollbar package without having to upgrade ember-cli-rollbar.
3. Use ember-cli-node-assets to include the vendor file.
4. Use broccoli-file-writer to generate the config.

This does not yet support Fastboot -- that's coming up.
Update to be consistent with the code style.
1. Using the new Fastboot standards, don't run the snippet
if Fastboot isn't defined, because the snippet requires 'document'.
2. Reference Rollbar using window.Rollbar in the vendor shim,
because 'Rollbar' is undefined in Fastboot.
3. Add a very basic test to test these.

Note this doesn't do much besides ensure that the app doesn't break
when Fastboot is enabled. The vendor shim won't work, and since
window.Rollbar won't be defined, it won't actually forward any of the calls.
@paulcwatts
Copy link
Contributor Author

@davewasmer I rebased the branch so it's only the implementation changes. Aside from the unnecessary files I found in #110, I also noticed that master no longer includes ember-cli-release. Did you use that? I can re-add it in a different PR.

With regard to the Rollbar library, it's been isomorphic since version 2.0.

As far as dealing with newer versions, it appears from their changelog they support semver. We can include a major version in the blueprint. However, it should be noted that with this new implementation, the host app decides what version to use, not the addon. The host app can always include a newer version its package.json that may be incompatible with this addon.

In case there are breaking changes, it's possible to use something like ember-cli-version-checker to support both.

Is there a reason to continue to support Node 4?

@paulcwatts
Copy link
Contributor Author

By the way, I have additional changes in the hopper:

paulcwatts@3f18a17

I didn't want to include it in this PR to limit the changes, but this change adds support for Ember.onerror which is needed to properly support source maps.

@paulcwatts
Copy link
Contributor Author

Hi @davewasmer, have you had a chance to look at the updates? The build is failing on Fastboot with Node 4, that's the reason why I'm asking whether Node 4 needs to be supported.

@mansona
Copy link
Contributor

mansona commented Oct 23, 2017

@paulcwatts it's not entirely clear to me from the file changes so I thought I would ask: does this implementation enable rollbar reporting in the fastboot Node environment or does it just disable/ignore it so that it doesn't crash the application?

@paulcwatts
Copy link
Contributor Author

paulcwatts commented Oct 23, 2017

@mansona It's the latter. I believe you still need to enable rollbar using their Express middleware, but to be honest I haven't done much Fastboot dev so I'm not exactly sure how Fastboot handles errors. It's possible the change to handle Ember.onerror in this commit might allow it to work automatically.

@mansona
Copy link
Contributor

mansona commented Oct 24, 2017

I just took a quick look and it doesn't look like it will work in the fastboot environment, but yes it will be much simpler to make it work.

The main problem that I have is that Rollbar is not technically isomorphic (I won't get into how that is a pipe-dream) because the one repo has many different build targets that come off it. So the asset you get in the frontend is not the same you get in the backend.

It adds a bit of complication but I'm sure we could figure it out. I would recommend that this PR get merged, because it is a nice simplification, and then any work I was planning to do could be done on top of it 👍

@paulcwatts
Copy link
Contributor Author

Thanks @mansona. I can disable the fastboot tests (or just allow them to fail on Travis) and tackle that at some later point.

@mansona
Copy link
Contributor

mansona commented Oct 25, 2017

sorry @paulcwatts I thought you had got this to work by disabling it in the fastboot environment 🤔

Just to be clear: I think that it should be disabled in fastboot for now and we can add an implementation that works in fastboot later after your PR is merged.

Also these are just my thoughts 😂 this is all really up to @davewasmer 👍

They don't work with Node 4, and Fastboot doesn't really work
to begin with.
@paulcwatts
Copy link
Contributor Author

This PR is now 2 months old. Are there still open questions? What needs to be done to get this merged?

@mansona
Copy link
Contributor

mansona commented Nov 17, 2017

My position still stands, I think @davewasmer should merge this 👍

@paulcwatts paulcwatts closed this Dec 21, 2017
@paulcwatts paulcwatts deleted the update-rollbar branch December 21, 2017 15:51
@paulcwatts paulcwatts restored the update-rollbar branch December 21, 2017 15:52
@paulcwatts
Copy link
Contributor Author

By the way, I've updated my fork with this change and a bunch of other things (including working Fastboot error notifications) here: https://github.com/paulcwatts/ember-cli-rollbar

I've also published this fork here: https://www.npmjs.com/package/ember-cli-rollbar2

@paulcwatts paulcwatts reopened this Dec 27, 2017
@williamweckl
Copy link

Using @paulcwatts fork and it work like a charm! Please, merge it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants