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

feat: Added ability to import code from ee folder #18841

Merged
merged 11 commits into from
Nov 23, 2023
Merged

Conversation

benjackwhite
Copy link
Contributor

Problem

We want to experiment with some conditional licensing of frontend code via the ee folder.

Changes

  • Adds an ee/frontend/ folder that allows to export via single point

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

How did you test this code?

@pauldambra
Copy link
Member

Cool 🙌

I guess we need a test that shows something works when ee is available and one when the ee folder is deleted?

We tried that with Python and the tests don't run with the ee folder deleted (even though the app will run 🫠)

Copy link
Contributor

github-actions bot commented Nov 23, 2023

Size Change: 0 B

Total Size: 1.83 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.83 MB

compressed-size-action

@@ -0,0 +1,5 @@
// NOTE: All exported items from the EE module _must_ be optionally defined to ensure we work well with FOSS
export type PostHogEE = {
Copy link
Member

Choose a reason for hiding this comment

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

this is really neat though! one or more types in here that define expectation and then a FOSS and EE licensed version.

Is it just typescript magic that ensure the EE version overwrites the FOSS version?

I.e. imagine the case where we want code present in both versions but different behavoiur? Which might simply be something we explicitly say we don't support (or don't support this way...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will cross that bridge when we come to it tbh.
Typescript will import in order of the files mentioned which is how it works. So if the EE folder isn't present it will fallback to the base folder.

@benjackwhite benjackwhite marked this pull request as ready for review November 23, 2023 11:12
Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

Do we need license files or README updates or....

:shipit:

.github/workflows/ci-frontend.yml Show resolved Hide resolved
frontend/src/lib/ee.test.ts Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Ah, we'll need the paths filter for front end CI updated to watch for changes in this folder!

Copy link
Member

Choose a reason for hiding this comment

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

and maybe the reverse too. changes to the ee/frontend folder shouldn't trigger the backend tests

Copy link
Member

Choose a reason for hiding this comment

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

switched to approved in case you want to merge this and then follow-up with CI changes... easy either way

@benjackwhite
Copy link
Contributor Author

Do we need license files or README updates or....

:shipit:

I don't believe we do as it's covered the same way as all the other EE stuff. @timgl any thoughts?

@pauldambra
Copy link
Member

Ah, yeah, because the code is in the EE folder which is already licensed 🤦

Maybe a pass over the docs to make sure we're not saying "python code in the EE folder" or something but even that would only be misleading rather than break the license

@benjackwhite
Copy link
Contributor Author

Ah, yeah, because the code is in the EE folder which is already licensed 🤦

Maybe a pass over the docs to make sure we're not saying "python code in the EE folder" or something but even that would only be misleading rather than break the license

Checked with the big dogs and it is all a-okay 👍

@pauldambra
Copy link
Member

Checked with the big dogs
🤣

@pauldambra
Copy link
Member

Ah, you'll need to update required jobs in GitHub...

Easiest thing is probably to remove jest from required tests without adding new ones.
Then merge
Tell everyone they'll need to update
and then add the new ones as required jobs

(or just do all of that fast enough that it doesn't matter what order 🤣)

@pauldambra
Copy link
Member

@pauldambra
Copy link
Member

hmmm dorny paths filter doesn't support excluding paths... let's not worry about infrequently triggering the backend CI for now

@pauldambra pauldambra merged commit 4ad3928 into master Nov 23, 2023
78 checks passed
@pauldambra pauldambra deleted the frontend-ee branch November 23, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants