posthog-js
Advanced tools
Comparing version 1.11.2 to 1.11.3
@@ -0,1 +1,7 @@ | ||
## 1.11.3 - 2021-06-14 | ||
- Capture viewport height and width (#246) | ||
- Add extra local development instructions (#235) | ||
- Update README.md (#243) | ||
## 1.11.2 - 2021-06-07 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "posthog-js", | ||
"version": "1.11.2", | ||
"version": "1.11.3", | ||
"description": "Posthog-js allows you to automatically capture usage and send events to PostHog.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/PostHog/posthog-js", |
@@ -1,2 +0,2 @@ | ||
# PostHog.js | ||
# PostHog Browser JS Library | ||
@@ -6,10 +6,9 @@ [![npm package](https://img.shields.io/npm/v/posthog-js?style=flat-square)](https://www.npmjs.com/package/posthog-js) | ||
Please see the main [PostHog docs](https://posthog.com/docs). | ||
Please see [PostHog Docs](https://posthog.com/docs). | ||
Specifically, [browser JS library details](https://posthog.com/docs/libraries/js). | ||
Specifically, the [JS integration](https://posthog.com/docs/integrations/js-integration) details. | ||
## Testing | ||
Unit tests: run `yarn test` | ||
Cypress: run `yarn serve` to have a test server running and separately `yarn cypress` to launch Cypress test engine | ||
Unit tests: run `yarn test`. | ||
Cypress: run `yarn serve` to have a test server running and separately `yarn cypress` to launch Cypress test engine. | ||
@@ -20,39 +19,59 @@ ### Running TestCafe E2E tests with BrowserStack | ||
1. Run `posthog` locally on port 8000 (`DEBUG=1 TEST=1 ./bin/start`) | ||
2. Run `python manage.py setup_dev --no-data` on posthog repo, which sets up a demo account | ||
3. Optional: rebuild array.js on changes: `nodemon -w src/ --exec bash -c "yarn build-array"` | ||
4. Export browserstack credentials: `export BROWSERSTACK_USERNAME=xxx BROWSERSTACK_ACCESS_KEY=xxx` | ||
5. Run tests: `npx testcafe "browserstack:ie" testcafe/e2e.spec.js` | ||
1. Run `posthog` locally on port 8000 (`DEBUG=1 TEST=1 ./bin/start`). | ||
2. Run `python manage.py setup_dev --no-data` on posthog repo, which sets up a demo account. | ||
3. Optional: rebuild array.js on changes: `nodemon -w src/ --exec bash -c "yarn build-array"`. | ||
4. Export browserstack credentials: `export BROWSERSTACK_USERNAME=xxx BROWSERSTACK_ACCESS_KEY=xxx`. | ||
5. Run tests: `npx testcafe "browserstack:ie" testcafe/e2e.spec.js`. | ||
## Developing together with another repo | ||
Update dependency in package.json to e.g. `"posthog-js": "link:../posthog-js"`, `yarn` and run `yarn build && yarn build-module` | ||
Use [`yarn link`](https://classic.yarnpkg.com/en/docs/cli/link/). Run `yarn link` in `posthog-js`, and then `yarn link posthog-js` in `posthog`. Once you're done, remember to `yarn unlink posthog-js` in `posthog`, and `yarn unlink` in `posthog-js`. | ||
An alternative is to update dependency in package.json to e.g. `"posthog-js": "link:../posthog-js"`, `yarn` and run `yarn build && yarn build-module` | ||
### Developing with main PostHog repo | ||
The `posthog-js` snippet for a website loads static js from the main `PostHog/posthog` repo. Which means, when testing the snippet with a website, there's a bit of extra setup required: | ||
1. Run `PostHog/posthog` locally | ||
2. Link the `posthog-js` dependency to your local version (see above) | ||
3. Run `yarn serve` in `posthog-js`. (This ensures `dist/array.js` is being generated) | ||
4. In your locally running `PostHog/posthog` build, run `yarn copy-scripts`. (This copies the scripts generated in step 3 to the static assets folder for `PostHog/posthog`) | ||
Further, it's a good idea to modify `start-http` script to add development mode: `webpack serve --mode development`, which doesn't minify the resulting js (which you can then read in your browser). | ||
## Releasing a new version | ||
Add a label `bump X` label to a PR before merging (e.g. `bump patch`). | ||
Just bump up `version` in `package.json` on the main branch and the new version will be published automatically, | ||
with a matching PR in the [main PostHog repo](https://github.com/posthog/posthog) created. | ||
This will create a new npm version, update tags, changelog and create a PR [in the main repo](https://github.com/posthog/posthog). | ||
It's advised to use `bump patch/minor/major` label on PRs - that way the above will be done automatically | ||
when the PR is merged. | ||
### Alternative (manual) | ||
Courtesy of GitHub Actions. | ||
To release a new version, make sure you're logged in to NPM (`npm login`) | ||
### Manual steps | ||
To release a new version, make sure you're logged into npm (`npm login`). | ||
We tend to follow the following steps: | ||
1. Merge your changes into master | ||
2. Release changes as a beta version | ||
1. Merge your changes into master. | ||
2. Release changes as a beta version: | ||
- `npm version 1.x.x-beta.0` | ||
- `npm publish --tag beta` | ||
- `git push --tags` | ||
3. Create a PR linking to this version [in the main repo](https://github.com/posthog/posthog) | ||
3. Create a PR linking to this version in the [main PostHog repo](https://github.com/posthog/posthog). | ||
4. Once deployed and tested, write up CHANGELOG.md, and commit. | ||
5. Release a new version | ||
5. Release a new version: | ||
- `npm version 1.x.x` | ||
- `npm publish` | ||
- `git push --tags` | ||
6. Create a PR linking to this version [in the main repo](https://github.com/posthog/posthog) | ||
6. Create a PR linking to this version in the [main PostHog repo](https://github.com/posthog/posthog). | ||
## Questions? | ||
### [Join our Slack community.](https://join.slack.com/t/posthogusers/shared_invite/enQtOTY0MzU5NjAwMDY3LTc2MWQ0OTZlNjhkODk3ZDI3NDVjMDE1YjgxY2I4ZjI4MzJhZmVmNjJkN2NmMGJmMzc2N2U3Yjc3ZjI5NGFlZDQ) | ||
### [Join our Slack community.](https://posthog.com/slack) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
594852
12391
76