-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(ng-add): syntax error due to ES2020 being used for ng-add with NodeJS 12.x #23744
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
fix(ng-add): syntax error due to ES2020 being used for ng-add with NodeJS 12.x #23744
Conversation
Updates the shared dev-infra package to the latest version which comes with a Bazel rule for running integration tests. We also install the CLI which we are going to test within some integration tests that are added at a later time.
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
I think there is improvements we can make long term as we improve/expand the integration_test rule and support for multiple node versions
44d6dbd
to
8bf0e03
Compare
Updates the build tooling to prepare NPM packages from the project `package.json` to be accessible to the Bazel-based integration tests. The idea is to build tarballs for all NPM packages which can be mapped into Bazel-based integration tests. This allows us to only have a single dependency on e.g. the CLI, instead of having to maintain/update multiple versions of the CLI and devkit (as an example). Additionally, we will expose tarballs for the first-party built NPM packages like the CDK or Angular Material. Lastly, we will populate the `0.0.0-PLACEHOLDER` with an actual version when stamping is disabled. This allows us to use the first-party built NPM packages in tests with `yarn`. Yarn would otherwise complain about an invalid version.
Sets up another toolchain for the NodeJS v12 version. This allows us to use Node v12 in integration tests without having to manually manage the Node version in the integration test which runs usually with the default Node workspace toolchain. Note that we need a small patch to `rules_nodejs` as the standalone node toolchain feature is technically internal (but shipped). Rules NodeJS is in progress of migrating from their current workspace name to `@rules_nodejs//`. We temporarily patch the external repository to work with the workspace name we use with `@build_bazel_rules_nodejs#v4`.
Sets up a new CLI project for testing that `ng update` works properly with APF v13. The CLI project is generated through `ng new`. Also the `ng add @angular/material` command has been executed and changes are incorporated into this commit.
Sets up the `ng update` v13 integration test to run with Bazel. The test will run `ng update` for the CDK and Material and will then compare the migrated files against some expectation files. like for custom theme file where the tilde should be removed.
This commit switches the schematic code to build as ES2015. This is necessary to support Node v12 which is still supported in LTS mode
Creates a CLI project for the `ng-add` integration test that we will configure to run in a followed commit.
Sets up the integration test for running `ng add` to run with Bazel. The test is also run with NodeJS v12 which does not support ES2020 output.
The CLI-generated projects for integration tests are not necessarily compliant with the lint rules and they should remain as unmodified as possible.
8bf0e03
to
2500c3c
Compare
Reenables normal integration tests. There weren't any before, so we had to comment out the CircleCI run command.
We updated the linker integration test to ESM, so that it works with the Angular compiler-cli ESM package. For this, the integration test utils are now ESM as well. This means that the ts-compat test relying on these ESM files needs to use ESM as well. The error didn't surface because with APF v13 switch we acidentally stopped running the test.
2500c3c
to
e284caa
Compare
…deJS 12.x (#23744) * build: update shared dev-infra package version and install CLI packages Updates the shared dev-infra package to the latest version which comes with a Bazel rule for running integration tests. We also install the CLI which we are going to test within some integration tests that are added at a later time. * build: prepare NPM packages for use in Bazel-based integration tests Updates the build tooling to prepare NPM packages from the project `package.json` to be accessible to the Bazel-based integration tests. The idea is to build tarballs for all NPM packages which can be mapped into Bazel-based integration tests. This allows us to only have a single dependency on e.g. the CLI, instead of having to maintain/update multiple versions of the CLI and devkit (as an example). Additionally, we will expose tarballs for the first-party built NPM packages like the CDK or Angular Material. Lastly, we will populate the `0.0.0-PLACEHOLDER` with an actual version when stamping is disabled. This allows us to use the first-party built NPM packages in tests with `yarn`. Yarn would otherwise complain about an invalid version. * build: setup toolchain for nodejs v12 for integration tests Sets up another toolchain for the NodeJS v12 version. This allows us to use Node v12 in integration tests without having to manually manage the Node version in the integration test which runs usually with the default Node workspace toolchain. Note that we need a small patch to `rules_nodejs` as the standalone node toolchain feature is technically internal (but shipped). Rules NodeJS is in progress of migrating from their current workspace name to `@rules_nodejs//`. We temporarily patch the external repository to work with the workspace name we use with `@build_bazel_rules_nodejs#v4`. * build: create CLI project for `ng update` v13 integration test Sets up a new CLI project for testing that `ng update` works properly with APF v13. The CLI project is generated through `ng new`. Also the `ng add @angular/material` command has been executed and changes are incorporated into this commit. * test: setup ng-update v13 integration test with Bazel Sets up the `ng update` v13 integration test to run with Bazel. The test will run `ng update` for the CDK and Material and will then compare the migrated files against some expectation files. like for custom theme file where the tilde should be removed. * build: ship schematic code with ES2015 as target This commit switches the schematic code to build as ES2015. This is necessary to support Node v12 which is still supported in LTS mode * build: create CLI project for `ng-add` integration test Creates a CLI project for the `ng-add` integration test that we will configure to run in a followed commit. * test: setup integration test for running `ng add` Sets up the integration test for running `ng add` to run with Bazel. The test is also run with NodeJS v12 which does not support ES2020 output. * ci: disable linting of the CLI integration test projects The CLI-generated projects for integration tests are not necessarily compliant with the lint rules and they should remain as unmodified as possible. * ci: re-enable normal integration tests on CI Reenables normal integration tests. There weren't any before, so we had to comment out the CircleCI run command. * build: update ts-compat integration test to work with ESM We updated the linker integration test to ESM, so that it works with the Angular compiler-cli ESM package. For this, the integration test utils are now ESM as well. This means that the ts-compat test relying on these ESM files needs to use ESM as well. The error didn't surface because with APF v13 switch we acidentally stopped running the test. (cherry picked from commit f698259)
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. |
Fixes that ng-add does not work because we ship ES2020 currently for schematic code. This commit changes
the target to ES2015 for schematics and also wires up integration tests for ng-add and ng-update. This is in preparation
of us having better testing for changes like APF v13.