@guardian/ophan-tracker-js 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/transmit.js CHANGED
@@ -2,7 +2,7 @@
2
2
  var buildQueryString, bumpViewId, generatePageViewId, isDefined, opanRemoteHost, ref, ref1, ref2, send, sendInitial, sendMore, smartEncode, viewId,
3
3
  hasProp = {}.hasOwnProperty;
4
4
 
5
- opanRemoteHost = (typeof window !== "undefined" && window !== null ? window.opanRemoteHost : void 0) || "//ophan.theguardian.com";
5
+ opanRemoteHost = (typeof window !== "undefined" && window !== null ? window.opanRemoteHost : void 0) || "https://ophan.theguardian.com";
6
6
 
7
7
  generatePageViewId = function() {
8
8
  return new Date().getTime().toString(36) + 'xxxxxxxxxxxx'.replace(/x/g, function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/ophan-tracker-js",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=16"
package/readme.md CHANGED
@@ -22,9 +22,7 @@ $ npm install ophan-tracker-js
22
22
  2. In one terminal window:
23
23
 
24
24
  ```
25
- .../ophan/tracker-js $ grunt
26
- .../ophan/tracker-js $ grunt watch
27
-
25
+ .../ophan/tracker-js $ npm run coffee-to-esm:watch
28
26
  ```
29
27
 
30
28
  3. In another terminal window:
@@ -50,46 +48,22 @@ to localhost 8000. (For me FoxyProxy needed a few switches on and off before it
50
48
 
51
49
  When you make a change to Tracker JS, you must release on *both* these systems:
52
50
 
53
- * The NPM package [`@guardian/ophan-tracker-js`](https://www.npmjs.com/package/ophan-tracker-js), commonly used on internally developed Guardian sites like Guardian Frontend and Support Frontend.
54
- * [https://j.ophan.co.uk/](https://j.ophan.co.uk/jobs.js) - CDN/S3, [deployed through RiffRaff](https://riffraff.gutools.co.uk/deployment/history?projectName=ophan%3A%3Aophan-tracker-js&page=1) and used by some Guardian sites like https://jobs.theguardian.com/. An advantage of this approach is that sites using it immediately get Tracker JS updates, without developer intervention.
55
-
56
- **Ensure that before you merge a change, you first bump the version in `package.json`. Please make sure you update the [changes.md](changes.md) file too. If you have added a new Ophan client to support a new platform, please add the path to the built output file to the files list in [`package.json`](https://github.com/guardian/ophan/blob/main/tracker-js/package.json#L4).**
57
-
58
- ### Publish to NPM
59
-
60
- Whenever the Tracker script is changed, [its `ophan-tracker-js` NPM package](https://www.npmjs.com/package/ophan-tracker-js/access) will
61
- need to be updated to a new version.
62
-
63
- If you don't already have an NPM account, be sure to set up two-factor authentification.
51
+ ##### NPM
64
52
 
65
- **Log into NPM**
53
+ We use `changesets` for automated publishing of the NPM package:
66
54
 
67
- ```
68
- $ npm login
69
- ```
70
-
71
- **Compile**
72
-
73
- ```
74
- .../ophan/tracker-js $ npm install
75
- ```
55
+ 1. Add a changeset, run the following command and follow the instructions
76
56
 
77
- **Publish**
57
+ ```
58
+ .../ophan/tracker-js $ npx changeset
59
+ ```
78
60
 
79
- ```
80
- .../ophan/tracker-js $ npm publish
81
- ```
61
+ 2. When you raise a PR, the changeset bot won’t correctly see that you have included a changeset – it only checks for the .changesets folder in the root of the repository, whereas we have it in a subdirectory. Don’t worry.
62
+
63
+ 3. When the PR is merged, the [`changesets` github action](https://github.com/changesets/action) will create a new PR, [example here](https://github.com/guardian/ophan/pull/5626). On merging this generated PR, the action will publish to NPM. (This checks the subdirectory correctly.)
82
64
 
83
- **You will need to be added as an owner of `ophan-tracker-js`. To find the current owners:**
65
+ _Note:_ This seems like an unnecessary extra step and another PR to merge. This action is useful for multi-package repos, and packages with more frequent changes where it consolidates changes from multiple PR's into a single release. This therefore does not apply to us, but we've had issues publishing straight to NPM via the initial action on merge to main.
84
66
 
85
- ```
86
- $ npm owner ls @guardian/ophan-tracker-js
87
- ```
67
+ ##### S3 Bucket
88
68
 
89
- **To add someone as an owner:**
90
-
91
- ```
92
- npm owner add npm.username @guardian/ophan-tracker-js
93
- ```
94
-
95
- More information on setting owners is available in [NPM's documentation](https://docs.npmjs.com/cli/v7/commands/npm-owner).
69
+ * [https://j.ophan.co.uk/](https://j.ophan.co.uk/jobs.js) - CDN/S3, [deployed through RiffRaff](https://riffraff.gutools.co.uk/deployment/history?projectName=ophan%3A%3Aophan-tracker-js&page=1) and used by some Guardian sites like https://jobs.theguardian.com/. An advantage of this approach is that sites using it immediately get Tracker JS updates, without developer intervention.