-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added ability to import code from ee folder (#18841)
We want to experiment with some conditional licensing of frontend code via the ee folder. --------- Co-authored-by: Paul D'Ambra <[email protected]>
- Loading branch information
1 parent
98c71d4
commit 4ad3928
Showing
9 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { PostHogEE } from '@posthog/ee/types' | ||
|
||
const myTestCode = (): void => { | ||
// eslint-disable-next-line no-console | ||
console.log('it works!') | ||
} | ||
|
||
const postHogEE: PostHogEE = { | ||
enabled: true, | ||
myTestCode, | ||
} | ||
|
||
export default postHogEE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { PostHogEE } from './types' | ||
|
||
const posthogEE: PostHogEE = { | ||
enabled: false, | ||
} | ||
|
||
export default posthogEE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = { | ||
enabled: boolean | ||
myTestCode?: () => void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import fs from 'fs' | ||
|
||
const eeFolderExists = fs.existsSync('ee/frontend/exports.ts') | ||
export const ifEeIt = eeFolderExists ? it : it.skip | ||
export const ifFossIt = !eeFolderExists ? it : it.skip | ||
|
||
import posthogEE from '@posthog/ee/exports' | ||
|
||
describe('ee importing', () => { | ||
ifEeIt('should import actual ee code', () => { | ||
expect(posthogEE.enabled).toBe(true) | ||
}) | ||
|
||
ifFossIt('should import actual ee code', () => { | ||
expect(posthogEE.enabled).toBe(false) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters