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

Adds BroccoliBuildError for better errors messages #10

Merged
merged 1 commit into from
Jun 20, 2017
Merged

Adds BroccoliBuildError for better errors messages #10

merged 1 commit into from
Jun 20, 2017

Conversation

twokul
Copy link
Contributor

@twokul twokul commented Jun 3, 2017

No description provided.

@jfelchner
Copy link

@twokul this is a huge foundational piece that I had zero clue how to do. This is going to be fantastic.

lib/builder.js Outdated
// it does not make sense to throw multiple build errors,
// we can just report a failure once.
if (!isThrown) {
isThrown = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatted with @twokul in slack, and he is going to update to ensure that this isThrown is reset when the next build starts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* broccoli plugins, such as error type, code frames,
* broccoli node name and package versions.
*/
function BroccoliBuildError(originalError, node) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the whole repo doesn't use classes and still specifies older versions of node; I felt it would make sense to convert everything in one go rather than in one place.

* broccoli node name and package versions.
*/
function BroccoliBuildError(originalError, node) {
var packageInfo = require(path.join(process.cwd(), 'package.json'));
Copy link
Contributor

@stefanpenner stefanpenner Jun 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process.cwd() can be literally anywhere not just in the projects root. I don't believe this approach will work.

I also don't feel broccoli should have any awareness of ember-cli, so a more loosely coupled solution is required.

I suspect rather, we may need to provide an option to broccoli-builder/middleware, so that ember-cli can provide a callback to "add additional information" to errors on the way out.

emberCLIVersion: null,
emberVersion: null,
emberDataVersion: null,
nodeJSVersion: nodeJSVersion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could add broccoli-builder version here?

*/
this.broccoliPayload = {
versions: {
emberCLIVersion: null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should likely not suffix these with version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also lets not camalize these.

instead:

versions: {
  'broccoli-builder': ...
}

that way its 1:1 with what all our version stuff (package.json etc, lockfiles use)

lib/builder.js Outdated
@@ -3,6 +3,9 @@ var mapSeries = require('promise-map-series')
var apiCompat = require('./api_compat')
var heimdall = require('heimdalljs');
var SilentError = require('silent-error');
var BroccoliBuildError = require('./broccoli-build-error');

var isThrown = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this module state and not builder instance state

@stefanpenner stefanpenner merged commit 9c49c21 into ember-cli:0-18-x Jun 20, 2017
@stefanpenner
Copy link
Contributor

released as v0.18.5 🎉

issue to remind us to forward port: #11

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

Successfully merging this pull request may close these issues.

None yet

4 participants