Skip to content

Conversation

@crisbeto
Copy link
Member

Adds a custom tslint rule that ensures that we've added all of the necessary external modules to the Rollup config. This is helpful, because forgetting to add a module will log a warning, but it won't break the build necessarily, which is why we occasionally need PRs like #5930.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 22, 2017
@crisbeto crisbeto force-pushed the rollup-globals-rule branch from 4a24929 to f769f72 Compare July 22, 2017 12:17
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

Good idea. I like that the globals are in a separate file.

const module = node.moduleSpecifier.getText().slice(1, -1);

// Check whether we match any of the scopes while missing the module from the config.
if (this._scope.some(p => p.test(module)) && !this._config[module]) {
Copy link
Member

Choose a reason for hiding this comment

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

More like a question. Why do we need such a scope field? Actually every package import should be listed in the globals config?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's primarily because we've only had issues with Angular and Rx packages until now since they're the only dependencies that we have. I can switch it to look for all external packages instead, if it makes sense.

Copy link
Member

@devversion devversion Jul 22, 2017

Choose a reason for hiding this comment

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

I see what you mean, but Rollup will not only complain about the dependencies/scopes you restricted the rule to. Basically every external import (that is not added to that list) will be problematic

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, I'll change it. While we're at it, I'm not too sure how to handle the @angular/material-examples package. Currently I've added an exception for it.

Copy link
Member

Choose a reason for hiding this comment

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

Can you explain what you mean? What's special for the examples package?

Copy link
Member Author

Choose a reason for hiding this comment

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

What is the proper Rollup mapping for it? E.g. for @angular/core it's ng.core, but I'm not sure whether the examples have something like that.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that doesn't really matter that much since it won't be really a public package.

As for convention I'd map it to something like ng.material-examples.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Also made it resolve the path relative to the project root, instead of the rule file.

@crisbeto crisbeto force-pushed the rollup-globals-rule branch 2 times, most recently from e724403 to 6bf2ff1 Compare July 22, 2017 14:19
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

LGTM

@devversion devversion added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Jul 22, 2017
@crisbeto crisbeto force-pushed the rollup-globals-rule branch from 6bf2ff1 to dd82287 Compare July 26, 2017 11:24
@andrewseguin
Copy link
Contributor

Please rebase

@crisbeto
Copy link
Member Author

Rebased @andrewseguin.

@andrewseguin
Copy link
Contributor

Got some lint errors coming up in this PR

@andrewseguin andrewseguin removed action: merge The PR is ready for merge by the caretaker pr: merge safe labels Jul 28, 2017
Adds a custom tslint rule that ensures that we've added all of the necessary external modules to the Rollup config. This is helpful, because forgetting to add a module will log a warning, but it won't break the build necessarily, which is why we occasionally need PRs like angular#5930.
@crisbeto crisbeto force-pushed the rollup-globals-rule branch from 5c046de to 321ee8b Compare July 29, 2017 08:30
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker pr: merge safe labels Jul 29, 2017
@tinayuangao tinayuangao merged commit d9e6f75 into angular:master Jul 31, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants