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

Convert Talawa-Admin to use the NPM package manager #546

Closed
palisadoes opened this issue Mar 7, 2023 · 32 comments · Fixed by #802
Closed

Convert Talawa-Admin to use the NPM package manager #546

palisadoes opened this issue Mar 7, 2023 · 32 comments · Fixed by #802
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@palisadoes
Copy link
Contributor

Describe the bug

  1. Talawa-Admin currently uses Yarn v1. This is end of life.
  2. We need to upgrade the package manager to a current product
  3. For the sake of consistency, we want to use NPM like Talawa-API

This has caused problems with developing new code like this:

To Reproduce
Steps to reproduce the behavior:

  1. Update packages
  2. Incompatibility errors

Expected behavior

When updating packages:

  1. No deprecation warnings.
  2. No package incompatibilities

Actual behavior

  1. Deprecation warnings.
  2. Package incompatibilities

Screenshots

image

Additional details

  • See above

Potential internship candidates
Please read this if you are planning to apply for a Palisadoes Foundation internship PalisadoesFoundation/talawa#359

@palisadoes palisadoes added bug Something isn't working good first issue Good for newcomers labels Mar 7, 2023
@Shofiya2003
Copy link

Can I take up this issue?

@akankshat05
Copy link
Contributor

Hello @xoldyckk @Shofiya2003 If this issue is not getting addressed, I would like to be assigned and work on it. Thank you!

@Shofiya2003
Copy link

Shofiya2003 commented Mar 11, 2023 via email

@Shofiya2003
Copy link

@palisadoes do I need to upgrade the yarn version too or just change the package manager to npm?

@Shofiya2003
Copy link

I plan to remove yarn.lock from the repository and generate a package-lock.json file.

@palisadoes
Copy link
Contributor Author

  1. Change the package manager.
  2. Update the installation documentation to
    1. reference NPM
    2. have references to Yarn removed

@Shofiya2003
Copy link

@palisadoes
Should I change the pre-commit file since it uses yarn ?

@Shofiya2003
Copy link

Also, I changed .gitignore to include yarn.lock file and removed package-lock.json from it

@palisadoes
Copy link
Contributor Author

palisadoes commented Mar 11, 2023

Do you mean these files? Then yes.

  1. https://github.com/PalisadoesFoundation/talawa-admin/blob/develop/.github/workflows/pull-requests.yml
  2. https://github.com/PalisadoesFoundation/talawa-admin/blob/develop/.github/workflows/push.yml

They will need to be updated too. You can work with @xoldyckk on this. This is not an area of strength for me.

@xoldd
Copy link

xoldd commented Mar 12, 2023

Also, I changed .gitignore to include yarn.lock file and removed package-lock.json from it

Include both yarn.lock and pnpm-lock.yaml, if a user accidently installs packages with some other package manager the lock file just needs to be ignored. This'll prevent users from pushing lock files of yarn and pnpm along with their PRs.

Also, they can't make changes to package.json without those changes also reflecting in package-lock.json, so even if a different package manager is used to upgrade the packages or something, until and unless package-lock.json doesn't update along with it the PR won't be merged.

@Shofiya2003
Copy link

CONTRIBUTING.md , INSTALLATION.md , PR_GUIDELINES.md , pull-requests.yml , push.yml and post-merge hook file
These are the files that need changes. I am working on it. Will refer to talawa-api repository since it uses npm in case I am stuck.
@xoldyckk

@Shofiya2003
Copy link

Also, I changed .gitignore to include yarn.lock file and removed package-lock.json from it

Include both yarn.lock and pnpm-lock.yaml, if a user accidently installs packages with some other package manager the lock file just needs to be ignored. This'll prevent users from pushing lock files of yarn and pnpm along with their PRs.

Also, they can't make changes to package.json without those changes also reflecting in package-lock.json, so even if a different package manager is used to upgrade the packages or something, until and unless package-lock.json doesn't update along with it the PR won't be merged.

Do I need to implement the condition mentioned in the second paragraph or does it already exist?

@Shofiya2003
Copy link

@palisadoes @xoldyckk
Do we need this part of the doucmentation , since we are already using pre-commit hooks to run these commands here ?

@Shofiya2003
Copy link

Also, documentation related to yarn is no longer required. I think we should have a link to the getting started page of NPM, which has installation steps.

@xoldd
Copy link

xoldd commented Mar 13, 2023

Also, I changed .gitignore to include yarn.lock file and removed package-lock.json from it

Include both yarn.lock and pnpm-lock.yaml, if a user accidently installs packages with some other package manager the lock file just needs to be ignored. This'll prevent users from pushing lock files of yarn and pnpm along with their PRs.
Also, they can't make changes to package.json without those changes also reflecting in package-lock.json, so even if a different package manager is used to upgrade the packages or something, until and unless package-lock.json doesn't update along with it the PR won't be merged.

Do I need to implement the condition mentioned in the second paragraph or does it already exist?

You don't need to implement some check for it, it'll need to be enforced while reviewing PRs.

@xoldd
Copy link

xoldd commented Mar 13, 2023

Also, documentation related to yarn is no longer required. I think we should have a link to the getting started page of NPM, which has installation steps.

Once migration to npm is successful, you may make the changes to docs.

@github-actions
Copy link

This issue did not get any activity in the past 10 days and will be closed in 365 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

@github-actions github-actions bot added the no-issue-activity No issue activity label Mar 24, 2023
@palisadoes
Copy link
Contributor Author

@Shofiya2003 Are you still working on this? The PR has errors that need to be fixed.

@Shofiya2003
Copy link

Shofiya2003 commented Mar 24, 2023

@anurag0006 already raised a PR for this issue.
It's not passing a test working on it.
Thanks a ton
@palisadoes

@anurag0006
Copy link
Contributor

anurag0006 commented Mar 24, 2023

Sorry, @Shofiya2003 i thought you weren't here

@Shofiya2003
Copy link

No worries @anurag0006

@palisadoes
Copy link
Contributor Author

@Shofiya2003 the PR has been unchanged for almost 2 weeks. Do you plan to update it soon? There are others who can work on this.

@Shofiya2003
Copy link

Shofiya2003 commented Mar 24, 2023

@palisadoes all the changes have been made.
I am encountering this error reduxjs/react-redux#1886 due to which one check in the CI pipeline fails.
I have tried solutions but none seem to work. Apologies for the delay.
@xoldyckk any suggestions

@Shofiya2003
Copy link

This error occurs because multiple packages use different versions of @types/react . I tried using resolutions in npm but to no avail

@palisadoes
Copy link
Contributor Author

Have you tried alternatives to those packages or upgrading them?

@Shofiya2003
Copy link

@palisadoes @xoldyckk I tried

  • Using npm explain @types/react to get different versions of @types/react being used. Upgraded the version of the package.
    Used https://www.npmjs.com/package/npm-force-resolutions to install the package version mentioned in resolution. But same error occurs when npm run typecheck runs

Interestingly, these errors do not occur when we use yarn.lock to install the node modules. Trying to find a solution that works

@Shofiya2003
Copy link

I cannot consider alternative to this package since it is a peer dependency of many prominently used packages like react-router-dom and redux . It is not directly used.

@Shofiya2003
Copy link

@xoldyckk I am stuck on this issue. I have made all the necessary changes. Just the npm run typecheck test is not passing.
Errors similar to this occur

error TS2786: 'Provider' cannot be used as a JSX component.
  Its instance type 'Provider<Action>'

I did use google and tried out solutions but to no avail
I need help. Thanks a ton

@github-actions github-actions bot removed the no-issue-activity No issue activity label Mar 25, 2023
@xoldd
Copy link

xoldd commented Mar 25, 2023

@Shofiya2003 You see I too tried doing this locally on my system, and I wasn't able to. That's why I opened it as an issue. This is related to the outdated packages talawa-admin uses. Unless they are upgraded, the fix will probably be some hack, which will keep breaking from time to time.

@anshgoyalevil
Copy link
Contributor

anshgoyalevil commented Mar 25, 2023

@xoldyckk @palisadoes

I would like to work on this issue. It has been more than 16 days, @Shofiya2003 is trying to resolve this.

@palisadoes
Copy link
Contributor Author

@Shofiya2003 I'm going to reassign this. This is a prerequisite for our planned summer projects that will kickoff soon.

@Shofiya2003
Copy link

No worries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
6 participants