-
Notifications
You must be signed in to change notification settings - Fork 14
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
chore: Upgrade to Angular v14 #186
Conversation
__DESCRIPTION:__ Angular v13 support window ends [2023-05-04](https://angular.io/guide/releases#actively-supported-versions). Angular v16 is expected [2023-05-01](https://angular.io/guide/releases#release-schedule) (BTW [documentation](https://developers.transifex.com/docs/angular-sdk) does not express support for Angular v15 currently. But the [code](https://github.com/transifex/transifex-javascript/blob/master/packages/angular/projects/tx-native-angular-sdk/package.json#L19-L21) does. Should this be updated?) My analysis of the current Angular code shows nothing that is a breaking change from Angular v13 to v15. Additionally I have refreshed the dependencies and updated the lint configuration to current recommendations from Angular / @angular-eslint/eslint-plugin. All code changes are automatic formatting and fixing from tooling. Finally I have run `npx package-json-validator --warnings --recommendations` and `npx sort-package-json`. __STEPS TO TEST:__ 1. `ng lint` 2. `ng test` 3. `ng build` All linting and tests pass on my system. Build appears to be good as well. All of my future contributions to this library will likely be based off of these changes.
* chore: Upgrade to Angular v14 __DESCRIPTION:__ Angular v13 support window ends [2023-05-04](https://angular.io/guide/releases#actively-supported-versions). Angular v16 is expected [2023-05-01](https://angular.io/guide/releases#release-schedule) (BTW [documentation](https://developers.transifex.com/docs/angular-sdk) does not express support for Angular v15 currently. But the [code](https://github.com/transifex/transifex-javascript/blob/master/packages/angular/projects/tx-native-angular-sdk/package.json#L19-L21) does. Should this be updated?) My analysis of the current Angular code shows nothing that is a breaking change from Angular v13 to v15. Additionally I have refreshed the dependencies and updated the lint configuration to current recommendations from Angular / @angular-eslint/eslint-plugin. All code changes are automatic formatting and fixing from tooling. Finally I have run `npx package-json-validator --warnings --recommendations` and `npx sort-package-json`. __STEPS TO TEST:__ 1. `ng lint` 2. `ng test` 3. `ng build` All linting and tests pass on my system. Build appears to be good as well. All of my future contributions to this library will likely be based off of these changes. * trim white space
Merging this branch will close #187 |
@rgant I appreciate the effort you put in linting and cleaning the package. We in the beginning decided to go with the Airbnb linting standards in general for the TXNative repository, but I actually was aware of the specific linting rules and standards in Angular development. I'll check these changes and let you know how we decided to proceed. Again, thank you very much. |
I'll look into the error, but best I can tell that is a build error and has less to do with my code and more to do with old versions of lerna and old versions of Angular (14 is still old) with brand new versions of NodeJS v18. I tend to expect that Transifex isn't going to wholly accept my changes. Which is fine, but I did promise to suggest improvements before based on my company's experience using your tools. We have completely abandoned this Angular implementation because of problems with how it works. I will be completely re-writing everything here to work in (what I believe is) a more Angular-y way. It's up to you if you want to wait to see the final results before reviewing, or review individually. I won't open any other pull requests here, but I will be recording them in my fork for you to look at if you desire. |
@rgant It seems so, a build problem, indeed, but I don't know how to solve it yet. I'll look into it too. I'll be checking your changes in your forked repository a well, thank you! |
I believe the issue is that the library's package.json includes Angular 12 and 13. But I haven't had a chance yet to try and remove those. |
@rgant The problem was this part in the
this generates a I pushed a commit, let's see if now it's ok (locally the tests ran ok). |
Good catch, I will add documentation about removing that since that is the default when Angular v14 creates a library. |
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.
@rgant Looks good, but I want to test with older versions of Angular. Did you test in a project with v12/13 of Angular?
const component = fixture.componentInstance; | ||
|
||
fixture.detectChanges(); | ||
expect(tx.translate).toHaveBeenCalledTimes(2); // Why twice? |
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.
I think we can ignore this, and use a simple hasBeenCalled()
. I couldn't find any reason why it's called twice... probably some internal mechanism for decorators? Let's assume that is working fine.
const component = fixtureWithInstance.componentInstance; | ||
|
||
fixtureWithInstance.detectChanges(); | ||
expect(tx.translate).toHaveBeenCalledTimes(2); // Why twice? |
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.
I think we can ignore this, and use a simple hasBeenCalled()
. I couldn't find any reason why it's called twice... probably some internal mechanism for decorators? Let's assume that is working fine.
// when the instance is ready using a subscription | ||
if (this.instance && this.instance.alias) { | ||
if (this.instance.alias) { |
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.
Maybe use this.instance?.alias
just to be sure?
@rgant I have errors when compiling in Angular 12 and 13, like this one: using this PR is breaking those versions, is this expected? |
Angular 12 and 13 are no longer supported versions of Angular: https://angular.io/guide/releases#actively-supported-versions |
@rgant correct, I was thinking in creating a new release with the v14+ for angular and keep another release for upto v13. This way we can support older versions with the current implementation, and improve the new installations with your refactoring (when ready). From my side there is no problem, I would like to discuss this and back to you. |
@rgant correct, I was thinking in creating a new release with the v14+ for angular and keep another release for upto v13. This way we can support older versions with the current implementation, and improve the new installations with your refactoring (when ready). What do you think? |
That is one way. I think a more typical way is to say that users of old versions of frameworks should install old versions of add-ons. |
I agree with rgrant. And hope this can be merged :) |
@egilkh Due to vacations we cannot do it now, but we will as soon as possible. |
@rgant Can you please rebase and resolve conflict in this PR in order to move on and release? |
6f4a5d3
to
526e432
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.
@rgant I don't know what changed since last time, but there are errors in the compilation, related to angular dependencies, also notices that you added node and npm versions to package.json, that should not be there.
Last time we build this PR was good, I don't know what changed and now is breaking.
"typescript": "~4.4.4" | ||
"typescript": "~4.7.4" | ||
}, | ||
"engines": { |
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.
@rgant We need to remove this, I think.
@rgant I don't know what changed since last time, but there are errors in the compilation, related to angular dependencies, also notices that you added node and npm versions to package.json, that should not be there. Last time we build this PR was good, I don't know what changed and now is breaking. |
@rgant Closing this, we have fixed the build on another PR already merged. Feel free to let us know any other improvements that we can apply for the Angular 14 version we will release soon. And thank you very much again for the effort. |
DESCRIPTION:
Angular v13 support window ends 2023-05-04. Angular v16 is expected 2023-05-01 (BTW documentation does not express support for Angular v15 currently. But the code does. Should this be updated?)
My analysis of the current Angular code shows nothing that is a breaking change from Angular v13 to v15.
Additionally I have refreshed the dependencies and updated the lint configuration to current recommendations from Angular / @angular-eslint/eslint-plugin. All code changes are automatic formatting and fixing from tooling.
Finally I have run
npx package-json-validator --warnings --recommendations
andnpx sort-package-json
.STEPS TO TEST:
ng lint
ng test
ng build
All linting and tests pass on my system. Build appears to be good as well. All of my future contributions to this library will likely be based off of these changes.