diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9d0b7ad63..534a89f83 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - master jobs: check-package-version: diff --git a/.github/workflows/library-ci.yml b/.github/workflows/library-ci.yml index 690e9c9c1..7e91f7e86 100644 --- a/.github/workflows/library-ci.yml +++ b/.github/workflows/library-ci.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - master + - main jobs: unit: diff --git a/CHANGELOG.md b/CHANGELOG.md index 357ba44d7..a0e7e20f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - feat: safer rrweb events and regular full snapshots (#973) - chore: update rollup (#974) -- chore: re-enable bundle checker now master and branches both use pnpm (#972) +- chore: re-enable bundle checker now main and branches both use pnpm (#972) ## 1.103.0 - 2024-01-26 diff --git a/README.md b/README.md index eb451efc6..5e806c19b 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Install Yalc to link a local version of `posthog-js` in another JS project: `npm Just put a `bump patch/minor/major` label on your PR! Once the PR is merged, a new version with the appropriate version bump will be released, and the dependency will be updated in [posthog/PostHog](https://github.com/posthog/PostHog) – automatically. -If you want to release a new version without a PR (e.g. because you forgot to use the label), check out the `master` branch and run `npm version [major | minor | patch] && git push --tags` - this will trigger the automated release process just like the label. +If you want to release a new version without a PR (e.g. because you forgot to use the label), check out the `main` branch and run `npm version [major | minor | patch] && git push --tags` - this will trigger the automated release process just like the label. ### Prereleases @@ -79,7 +79,7 @@ To release an alpha or beta version, you'll need to use the CLI locally: 1. Make sure you're a collaborator on `posthog-js` in npm ([check here](https://www.npmjs.com/package/posthog-js)). 2. Make sure you're logged into the npm CLI (`npm login`). -3. Check out your work-in-progress branch (do not release an alpha/beta from `master`). +3. Check out your work-in-progress branch (do not release an alpha/beta from `main`). 4. Run the following commands, using the same bump level (major/minor/patch) as your PR: ```bash npm version [premajor | preminor | prepatch] --preid=beta diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 8388c799e..f7922db75 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -77,7 +77,7 @@ enum InitType { let init_type: InitType // TODO: the type of this is very loose. Sometimes it's also PostHogLib itself -let posthog_master: Record & { +let posthog_main: Record & { init: (token: string, config: Partial, name: string) => void } @@ -180,7 +180,7 @@ const create_phlib = function ( ): PostHog { let instance: PostHog const target = - name === PRIMARY_INSTANCE_NAME || !posthog_master ? posthog_master : name ? posthog_master[name] : undefined + name === PRIMARY_INSTANCE_NAME || !posthog_main ? posthog_main : name ? posthog_main[name] : undefined const callbacksHandled = { initComplete: false, syncCode: false, @@ -376,10 +376,10 @@ export class PostHog { } const instance: PostHog = create_phlib(token, config, name, (instance: PostHog) => { - posthog_master[name] = instance + posthog_main[name] = instance instance._loaded() }) - posthog_master[name] = instance + posthog_main[name] = instance return instance } @@ -2116,7 +2116,7 @@ const extend_mp = function () { // add all the sub posthog instances _each(instances, function (instance, name) { if (name !== PRIMARY_INSTANCE_NAME) { - posthog_master[name] = instance + posthog_main[name] = instance } }) } @@ -2124,23 +2124,23 @@ const extend_mp = function () { const override_ph_init_func = function () { // we override the snippets init function to handle the case where a // user initializes the posthog library after the script loads & runs - posthog_master['init'] = function (token?: string, config?: Partial, name?: string) { + posthog_main['init'] = function (token?: string, config?: Partial, name?: string) { if (name) { // initialize a sub library - if (!posthog_master[name]) { - posthog_master[name] = instances[name] = create_phlib( + if (!posthog_main[name]) { + posthog_main[name] = instances[name] = create_phlib( token || '', config || {}, name, (instance: PostHog) => { - posthog_master[name] = instances[name] = instance + posthog_main[name] = instances[name] = instance instance._loaded() } ) } - return posthog_master[name] + return posthog_main[name] } else { - let instance: PostHog = posthog_master as any as PostHog + let instance: PostHog = posthog_main as any as PostHog if (instances[PRIMARY_INSTANCE_NAME]) { // main posthog lib already initialized @@ -2154,9 +2154,9 @@ const override_ph_init_func = function () { instances[PRIMARY_INSTANCE_NAME] = instance } - ;(posthog_master as any) = instance + ;(posthog_main as any) = instance if (init_type === InitType.INIT_SNIPPET) { - assignableWindow[PRIMARY_INSTANCE_NAME] = posthog_master + assignableWindow[PRIMARY_INSTANCE_NAME] = posthog_main } extend_mp() return instance @@ -2203,23 +2203,23 @@ export function init_from_snippet(): void { if (_isUndefined(assignableWindow.posthog)) { assignableWindow.posthog = [] } - posthog_master = assignableWindow.posthog + posthog_main = assignableWindow.posthog - if (posthog_master['__loaded'] || (posthog_master['config'] && posthog_master['persistence'])) { + if (posthog_main['__loaded'] || (posthog_main['config'] && posthog_main['persistence'])) { // lib has already been loaded at least once; we don't want to override the global object this time so bomb early logger.critical('PostHog library has already been downloaded at least once.') return } // Load instances of the PostHog Library - _each(posthog_master['_i'], function (item: [token: string, config: Partial, name: string]) { + _each(posthog_main['_i'], function (item: [token: string, config: Partial, name: string]) { if (item && _isArray(item)) { instances[item[2]] = create_phlib(...item) } }) override_ph_init_func() - ;(posthog_master['init'] as any)() + ;(posthog_main['init'] as any)() // Fire loaded events after updating the window's posthog object _each(instances, function (instance) { @@ -2231,11 +2231,11 @@ export function init_from_snippet(): void { export function init_as_module(): PostHog { init_type = InitType.INIT_MODULE - ;(posthog_master as any) = new PostHog() + ;(posthog_main as any) = new PostHog() override_ph_init_func() - ;(posthog_master['init'] as any)() + ;(posthog_main['init'] as any)() add_dom_loaded_handler() - return posthog_master as any + return posthog_main as any }