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
feat(bazel): update bazel-schematics to use Ivy and new rollup_bundle #33435
Conversation
76716dc
to
984164e
Compare
if (scripts) { | ||
const postInstall = findPropertyInAstObject(scripts, 'postinstall'); | ||
if (postInstall) { | ||
const command = `${postInstall.value}; ${ngcCommand}`; | ||
// Our `ngcc` command should go first so it is executed before before the CLI | ||
// generated ngcc command as if it goes after it does not work as expected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's strange that you could end up with two ngcc commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ng new with ivy adds "scripts": { "postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points" }
which doesn't work with bazel because of --first-only
and --create-ivy-entry-points
chatted with @filipesilva about this on slack and I think the better solution is to mutate the ngcc <options>
to just ngcc
in the bazel schematic instead of adding a second
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with just ngcc
, there are still two ngcc
commands aren't there?
I think Alex's point was, why not just one ngcc command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaned up. If there is an existing ngcc command then the schematic modified the one in-place removing --first-only
and --create-ivy-entry-points
:
if (/\bngcc\b/.test(value)) {
// `ngcc` is already in the postinstall script
value = value
.replace(/\s*--first-only\b/, '')
.replace(/\s*--create-ivy-entry-points\b/, '');
replacePropertyInAstObject(recorder, scripts, 'postinstall', value);
} else {
const command = `${postInstall.value}; ${ngccCommand}`;
replacePropertyInAstObject(recorder, scripts, 'postinstall', command);
}
/cc @kyliau |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also moves to bazel 1.1.0
? We should definitely be noting that in the commits/PR message.
👍 will add that note and cleanup the |
Actually, given bazelbuild/rules_nodejs#1307 I'll remove the Bazel update on this PR as it will break Windows users. |
c75a576
to
2261c57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Caretaker: assistance because there is a "cla/google" status that isn't turning green |
Removing |
Note: the @angular/bazel schematic now appends the package.json "script" field with 'ngcc --properties es2015 browser module main'. If there is an existing script field with ngcc then the schematic modifies it in place removing `--first-only` and `--create-ivy-entry-points`. ViewEngine sources under node_modules need to be updated in-place for Bazel as it does not know how to use the `__ivy__` entry points that are created by the non-bazel `ngcc` command that is added to "scripts" :`ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points`.
2261c57
to
c90303a
Compare
@caretaker Noticed the comment on the commit was outdated so updated it as it's a |
…angular#33435) Note: the @angular/bazel schematic now appends the package.json "script" field with 'ngcc --properties es2015 browser module main'. If there is an existing script field with ngcc then the schematic modifies it in place removing `--first-only` and `--create-ivy-entry-points`. ViewEngine sources under node_modules need to be updated in-place for Bazel as it does not know how to use the `__ivy__` entry points that are created by the non-bazel `ngcc` command that is added to "scripts" :`ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points`. PR Close angular#33435
…angular#33435) Note: the @angular/bazel schematic now appends the package.json "script" field with 'ngcc --properties es2015 browser module main'. If there is an existing script field with ngcc then the schematic modifies it in place removing `--first-only` and `--create-ivy-entry-points`. ViewEngine sources under node_modules need to be updated in-place for Bazel as it does not know how to use the `__ivy__` entry points that are created by the non-bazel `ngcc` command that is added to "scripts" :`ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points`. PR Close angular#33435
…angular#33435) Note: the @angular/bazel schematic now appends the package.json "script" field with 'ngcc --properties es2015 browser module main'. If there is an existing script field with ngcc then the schematic modifies it in place removing `--first-only` and `--create-ivy-entry-points`. ViewEngine sources under node_modules need to be updated in-place for Bazel as it does not know how to use the `__ivy__` entry points that are created by the non-bazel `ngcc` command that is added to "scripts" :`ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points`. PR Close angular#33435
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Note: the @angular/bazel schematic now appends the package.json "script" field with 'ngcc --properties es2015 browser module main'. If there is an existing script field with ngcc then the schematic modifies it in place removing
--first-only
and--create-ivy-entry-points
.ViewEngine sources under node_modules need to be updated in-place for Bazel as it does not know how to use the
__ivy__
entry points that are created by the non-bazelngcc
command that is added to "scripts" :ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points
.PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
@angular/bazel schematics was depending on the legacy rollup_bundle rule which will be removed for the nodejs rules 1.0 release and it was building ViewEngine
What is the new behavior?
@angular/bazel schematics updated to Ivy & to the new rollup_bundle rule
Does this PR introduce a breaking change?
Other information