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

Chore/nx migration #3715

Closed
wants to merge 1 commit into from
Closed

Chore/nx migration #3715

wants to merge 1 commit into from

Conversation

mariojsnunes
Copy link
Collaborator

PR Checklist

PR Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Developer experience (improves developer workflows for contributing to the project)

Description

What this PR does

Git Issues

Closes #

Screenshots/Videos

If useful, provide screenshot or capture to highlight main changes


What happens next?

Thanks for the contribution! We try to make sure all PRs are reviewed ahead of our monthly maintainers call (first Monday of the month)

If the PR is working as intended it'll be merged and included in the next platform release, if not changes will be requested and re-reviewed once updated.

If you need more immediate feedback you can try reaching out on Discord in the Community Platform development channel.

@benfurber benfurber linked an issue Jul 1, 2024 that may be closed by this pull request
Copy link
Member

@benfurber benfurber left a comment

Choose a reason for hiding this comment

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

The routes unit tests are too complex and go beyond the responsibility of routes. Can't just comment them out of course. If user engagement (e.g. clicking something) is needed to get to a routes expectation, that's a smell.

Need to sure what the routes tests are covering is tested somewhere.

Comment on lines -50 to -51
"import/newline-after-import": "error",
"import/no-named-as-default": "off",
Copy link
Member

Choose a reason for hiding this comment

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

Why remove these?

@@ -40,15 +38,6 @@
"accessorPairPositioning": "getThenSet"
}
],
"import/no-duplicates": "error",
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the import plugin was preventing nx from running. (maybe due to commonjs?)

Comment on lines -17 to -18
"plugin:import/recommended",
"plugin:import/typescript",
Copy link
Member

Choose a reason for hiding this comment

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

Why remove these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the import plugin was preventing nx from running. (maybe due to commonjs?)

Copy link
Member

Choose a reason for hiding this comment

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

Reasoning for this being a seperate file?

work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Precious Plastic Community</title>
Copy link
Member

Choose a reason for hiding this comment

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

Should be generic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we have a script that replaces this before serving, but it's something to confirm.

href="https://firebasestorage.googleapis.com"
crossorigin
/>
<noscript><link rel="stylesheet" href="path/to/stylesheet.css" /></noscript>
Copy link
Member

Choose a reason for hiding this comment

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

path/to/stylesheet.css?

<meta property="og:title" content="Community Platform" />
<meta
property="og:description"
content="A series of tools for the Precious Plastic community to collaborate around the world. Connect, share and meet each other to tackle plastic waste."
Copy link
Member

Choose a reason for hiding this comment

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

Should be generic

content="A series of tools for the Precious Plastic community to collaborate around the world. Connect, share and meet each other to tackle plastic waste."
/>
<meta property="og:image" content="./social-image.jpg" />
<meta property="og:url" content="https://community.preciousplastic.com" />
Copy link
Member

Choose a reason for hiding this comment

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

Should be generic

<meta name="twitter:title" content="Community Platform" />
<meta
name="twitter:description"
content="A series of tools for the Precious Plastic community to collaborate around the world. Connect, share and meet each other to tackle plastic waste."
Copy link
Member

Choose a reason for hiding this comment

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

Should be generic

Comment on lines +14 to +17
import { trackEvent } from '../../../../common/Analytics'
import { useCommonStores } from '../../../../common/hooks/useCommonStores'
import { Breadcrumbs } from '../../../../pages/common/Breadcrumbs/Breadcrumbs'
import { seoTagsUpdate } from '../../../../utils/seo'
Copy link
Member

Choose a reason for hiding this comment

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

General point, just picking this as an example. The depth of these relative paths is annoying. No other option?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be fixed by splitting up the code in libraries. ex:
import { Breadcrumbs } from '@onearmy.apps/shared'

@mariojsnunes
Copy link
Collaborator Author

thanks @benfurber will consider all your comments on the next try.

Important info from discord:

The NX migration requires more structural changes than anticipated. Mostly due to the e2e tests. Ultimately, this means a better project structure.
Before detailing the new structure, there are two concepts to understand: apps and libs.
Libs can be standalone like our UI components. Or can depend on other libs.
Apps can reference libs. But nothing should reference apps.
These concepts ensure we keep a good project structure and avoid complex or hard to maintain dependencies. It is enforced by a 'module boundaries' eslint rule.

So why does it require more changes than I anticipated?
Our cypress tests will exist in an app (community-platform-e2e). Which means we cannot reference the main community-platform app. And currently we reference it to access constant variables.
To solve this the community-platform app must be splitted in multiple libs (a good NX practice).

What does it look like?
apps:
community-platform
community-platform-e2e

libs:
components
shared
howtos
research
questions
profile
maps
...

Abandoning this PR as I found a few components that are coupling things up too much:

  • Breadcrumbs
  • useCommonStores
  • deprecated CategoriesSelect used by Howtos
  • likely more

fixing them first before proceeding with the migration (as fixing them means changing code, not just moving things around)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Use Nx
2 participants