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

Added the mattermost-webapp from the monorepo of mattermost #1074

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Kshitij-Katiyar
Copy link
Contributor

Summary

Added the mattermost-webapp from the mono repo of mattermost to add the newer mattermost-redux package. Took the reference from the https://github.com/mattermost/mattermost-plugin-calls/pull/555/files.

@hanzei hanzei added the 2: Dev Review Requires review by a core committer label May 7, 2024
Makefile Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

These seem like unrelated changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was facing a very peculiar error https://github.com/mattermost/mattermost-plugin-jira/actions/runs/8938919453/job/24553976441, so there was a package named file-hound of frontend, and after it was installed, it was creating an empty go file, and in the lint as well as test CI, we run commands like go test ./... which basically going to work on all files including the node modules and that's why we were getting the above error. So for now I have made the go commands to only work in the server folder and not outside of it.
@hanzei

Copy link
Member

Choose a reason for hiding this comment

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

I think the problem @hanzei may have with this is that the build folder is no longer being checked. Can we instead make it so only webapp exists in the monorepo checkout folder? Either we can do something replacing the whole repo with just the webapp directory like:

mv mattermost-webapp/webapp .
rm -rf mattermost-webapp
mv webapp mattermost-webapp

Naming the cloned directory just mattermost may make more sense here. Then this becomes:

mv mattermost/webapp .
rm -rf mattermost
mv webapp mattermost-webapp

Alternatively we can do a sparse checkout, but that seems more complicated https://stackoverflow.com/a/52270636

Copy link
Member

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Nice work on this @Kshitij-Katiyar 🚀

In general LGTM 👍 Just some comments for discussion, and one request to move the monorepo commit hash to package.json to keep all the dependency information in one place.

webapp/package.json Outdated Show resolved Hide resolved
webapp/package.json Show resolved Hide resolved
webapp/package.json Show resolved Hide resolved
webapp/install_mattermost_webapp.sh Outdated Show resolved Hide resolved
webapp/package.json Show resolved Hide resolved
@@ -6,7 +6,7 @@ import React from 'react';
import debounce from 'debounce-promise';
import AsyncSelect from 'react-select/async';

import {Theme} from 'mattermost-redux/types/preferences';
import {Theme} from 'mattermost-redux/selectors/entities/preferences';
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this come from @mattermost/types and not selectors? Same with other instances of this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Interesting, the Theme is indeed defined in mattermost-redux/selectors/entities/preferences.ts and not @mattermost/types/preferences.ts. @hmhealey Any ideas if this is intentional, and if it should be moved to @mattermost/types? And maybe or maybe not exported from selectors as well to keep backwards compatibility. Or we can view mattermost-redux as not following semver and make other projects reference @mattermost/types. Or we can just leave in selectors.

Copy link
Member

@hmhealey hmhealey May 15, 2024

Choose a reason for hiding this comment

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

Moving it to @mattermost/types makes sense to me. When we moved it to mattermost-redux a couple years ago for MM-46374, that had been our end goal. There's a couple weird/outdated fields in it that I wanted to get rid of, but I'd rather accept those if it helps get away from having plugins import from the web app directly

Copy link
Member

@mickmister mickmister May 7, 2024

Choose a reason for hiding this comment

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

Wondering how the changes in package-lock.json come up. Does this mean npm analyzes all of the dependencies that mattermost-webapp has? Or really just the three directories we're importing from there?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it does. If you open up the file, you'll see references to dependencies such as "mattermost-webapp/webapp/channels/node_modules/@hot-loader/react-dom"

Copy link
Member

Choose a reason for hiding this comment

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

@hmhealey @Kshitij-Katiyar Do you know if we are able to make it so the channels package is not affecting the package-lock.json here? Or does this method of cloning/importing mean that we need all deps from the core webapp?

Copy link
Member

Choose a reason for hiding this comment

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

mattermost-redux is in that package, so no, we can't. It'd need to be a separate package with its own package.json to not do that.

Unfortunately, to avoid moving around all the files in the web app, I avoided setting up a separate package for it when I moved it into the web app monorepo a few years ago, and then I did the same thing when moving it into the server monorepo because we had planned to ship a proper mattermost-redux replacement after that

Base automatically changed from upgrade_package to master May 30, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core committer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants