gatsby-plugin-newrelic 2.0.2 → 2.2.2

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.
@@ -49,7 +49,7 @@ jobs:
49
49
  - name: Setup Node.js
50
50
  uses: actions/setup-node@v1
51
51
  with:
52
- node-version: 10.x
52
+ node-version: 16.x
53
53
 
54
54
  - name: Cache node_modules
55
55
  id: cache-node-modules
@@ -90,7 +90,7 @@ jobs:
90
90
  - name: Setup Node.js
91
91
  uses: actions/setup-node@v1
92
92
  with:
93
- node-version: 10.x
93
+ node-version: 16.x
94
94
 
95
95
  - name: Download Cached Deps
96
96
  id: cache-node-modules
@@ -211,7 +211,7 @@ jobs:
211
211
  - name: Setup Node.js
212
212
  uses: actions/setup-node@v1
213
213
  with:
214
- node-version: 10.x
214
+ node-version: 16.x
215
215
 
216
216
  - name: Download Cached Deps
217
217
  id: cache-node-modules
package/CONTRIBUTING.md CHANGED
@@ -18,6 +18,19 @@ Before submitting an Issue, please search for similar ones in the
18
18
  2. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
19
19
  3. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
20
20
 
21
+ ## Publishing next versions to NPM
22
+
23
+ A [Github workflow](https://github.com/newrelic/gatsby-plugin-newrelic/blob/main/.github/workflows/release.yml) which uses NPX [semantic-release](https://semantic-release.gitbook.io/semantic-release/usage/configuration#branches) exists to assist in publishing next versions of this plugin to NPM.
24
+
25
+ > If you wish to publish a latest version to NPM follow these steps but ensure you change the tag in [package.json](package.json) to latest
26
+
27
+ 1. Make your changes on a local branch from main.
28
+ 2. After pulling down the code, run `git fetch && git pull` to ensure you have the latest code for main.
29
+ 3. Commit your changes and submit a PR to the `next` branch.
30
+ 4. Ensure that you [bump the version of the package](https://cloudfour.com/thinks/how-to-publish-an-updated-version-of-an-npm-package/#the-standard-release-process) by using semantic versioning using the `NPM version` command.
31
+ 5. This will kick off the workflow to publish a next version to NPM.
32
+ 6. Go to [NPM](https://www.npmjs.com/package/gatsby-plugin-newrelic) to view the next branch.
33
+
21
34
  ## Contributor License Agreement
22
35
 
23
36
  Keep in mind that when you submit your Pull Request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at opensource@newrelic.com.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![Community Project header](https://github.com/newrelic/open-source-office/raw/master/examples/categories/images/Community_Project.png)](https://github.com/newrelic/open-source-office/blob/master/examples/categories/index.md#community-project)
2
2
 
3
3
  # New Relic Gatsby Plugin
4
+
4
5
  [![Known Vulnerabilities][3]][4]
5
6
  [![npm status badge][1]][2]
6
7
 
@@ -8,12 +9,12 @@ The New Relic Gatsby Plugin provides a simple to use configuration option for in
8
9
 
9
10
  ## Installation
10
11
 
11
- 1. If you don't already have a New Relic account, [sign-up for our free forever tier - no credit-card required!](https://newrelic.com/signup)
12
- 1. Go to [https://rpm.newrelic.com](https://rpm.newrelic.com)
13
- 1. Select the "Browser" product from the navigation
14
- 1. Click on "Add more" to add your website
12
+ 1. If you don't already have a New Relic account, [sign-up for our free forever tier - no credit-card required!](https://trynewrelic.com/gatsby)
13
+ 1. Go to [https://one.newrelic.com](https://one.newrelic.com)
14
+ 1. Click on "Add more data" to add your website
15
+ 1. In the "Browser metrics" section, select "New Relic Browser"
15
16
  1. Select "Copy/Paste Javascript code" and copy the code
16
- 1. Under "Choose your instrumentation" select Lite, Pro, or Pro + SPA
17
+ 1. Follow the steps to configure your instrumentation
17
18
  1. Enter your app name
18
19
  1. Click "Enable"
19
20
  1. Paste the JS snippet provided into a text editor
@@ -27,32 +28,11 @@ The New Relic Gatsby Plugin provides a simple to use configuration option for in
27
28
 
28
29
  and turn it into a `gatsby-config`, adding it to `gatsby-config.js` as a plugin
29
30
 
30
- ```js
31
+ ```js
31
32
  {
32
33
  resolve: 'gatsby-plugin-newrelic',
33
34
  options: {
34
- configs: {
35
- dev: {
36
- instrumentationType: 'proAndSPA',
37
- accountId: '<some integer>',
38
- trustKey: '<some integer>',
39
- agentID: '<some integer>',
40
- licenseKey: '<the license key>',
41
- applicationID: '<some integer>',
42
- beacon: 'bam.nr-data.net',
43
- errorBeacon: 'bam.nr-data.net'
44
- },
45
- staging: {
46
- instrumentationType: 'proAndSPA',
47
- accountId: '<some integer>',
48
- trustKey: '<some integer>',
49
- agentID: '<some integer>',
50
- licenseKey: '<the license key>',
51
- applicationID: '<some integer>',
52
- beacon: 'bam.nr-data.net',
53
- errorBeacon: 'bam.nr-data.net'
54
- },
55
- production: {
35
+ config: {
56
36
  instrumentationType: 'proAndSPA',
57
37
  accountId: '<some integer>',
58
38
  trustKey: '<some integer>',
@@ -61,25 +41,24 @@ The New Relic Gatsby Plugin provides a simple to use configuration option for in
61
41
  applicationID: '<some integer>',
62
42
  beacon: 'bam.nr-data.net',
63
43
  errorBeacon: 'bam.nr-data.net'
64
- }
65
44
  }
66
45
  }
67
46
  }
68
47
  ```
69
48
 
70
- If you have no need for multiple environments, you can simply pass a single object like:
49
+ If you have a need for multiple environments, you can configure this like:
71
50
 
72
51
  ```js
73
52
  {
74
53
  resolve: 'gatsby-plugin-newrelic',
75
54
  options: {
76
- configs: {
77
- instrumentationType: 'proAndSPA',
55
+ config: {
56
+ instrumentationType: 'proAndSPA',
78
57
  accountId: '<some integer>',
79
58
  trustKey: '<some integer>',
80
59
  agentID: '<some integer>',
81
60
  licenseKey: '<the license key>',
82
- applicationID: '<some integer>',
61
+ applicationID: process.env.YOUR_ENVIRONMENT_KEY === "production" ? '<some integer>' : '<some other integer>',
83
62
  beacon: 'bam.nr-data.net',
84
63
  errorBeacon: 'bam.nr-data.net'
85
64
  }
@@ -87,18 +66,6 @@ The New Relic Gatsby Plugin provides a simple to use configuration option for in
87
66
  }
88
67
  ```
89
68
 
90
- Note - `instrumentationType` can be `lite`, `pro`, `proAndSPA`, corresponding with levels of our browser agent.
91
-
92
- 1. Set the `GATSBY_NEWRELIC_ENV` to point at the appropriate config. For local dev you would add `GATSBY_NEWRELIC_ENV=dev` to the front of your "develop" script in your project's `package.json`. For "production" you would add `GATSBY_NEWRELIC_ENV=production` to the front of the Gatsby "build" command.
93
- Ex. `package.json`:
94
-
95
- ```js
96
- "scripts": {
97
- "build": "GATSBY_NEWRELIC_ENV=production gatsby build",
98
- "build:dev": "GATSBY_NEWRELIC_ENV=dev npm run build",
99
- }
100
- ```
101
-
102
69
  ## Getting Started
103
70
 
104
71
  Navigate to [https://one.newrelic.com](https://one.newrelic.com), select the _Entity Explorer_ and then select your browser application to monitor metrics of your site.
@@ -32,7 +32,7 @@ code, the source code can be found at [https://github.com/newrelic/gatsby-plugin
32
32
 
33
33
  ### @babel/runtime
34
34
 
35
- This product includes source derived from [@babel/runtime](https://github.com/babel/babel) ([v7.13.10](https://github.com/babel/babel/tree/v7.13.10)), distributed under the [MIT License](https://github.com/babel/babel/blob/v7.13.10/LICENSE):
35
+ This product includes source derived from [@babel/runtime](https://github.com/babel/babel) ([v7.16.7](https://github.com/babel/babel/tree/v7.16.7)), distributed under the [MIT License](https://github.com/babel/babel/blob/v7.16.7/LICENSE):
36
36
 
37
37
  ```
38
38
  MIT License
@@ -95,7 +95,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
95
95
 
96
96
  ### @babel/core
97
97
 
98
- This product includes source derived from [@babel/core](https://github.com/babel/babel) ([v7.13.15](https://github.com/babel/babel/tree/v7.13.15)), distributed under the [MIT License](https://github.com/babel/babel/blob/v7.13.15/LICENSE):
98
+ This product includes source derived from [@babel/core](https://github.com/babel/babel) ([v7.16.7](https://github.com/babel/babel/tree/v7.16.7)), distributed under the [MIT License](https://github.com/babel/babel/blob/v7.16.7/LICENSE):
99
99
 
100
100
  ```
101
101
  MIT License
@@ -125,7 +125,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
125
125
 
126
126
  ### @babel/plugin-proposal-private-methods
127
127
 
128
- This product includes source derived from [@babel/plugin-proposal-private-methods](https://github.com/babel/babel) ([v7.13.0](https://github.com/babel/babel/tree/v7.13.0)), distributed under the [MIT License](https://github.com/babel/babel/blob/v7.13.0/LICENSE):
128
+ This product includes source derived from [@babel/plugin-proposal-private-methods](https://github.com/babel/babel) ([v7.16.7](https://github.com/babel/babel/tree/v7.16.7)), distributed under the [MIT License](https://github.com/babel/babel/blob/v7.16.7/LICENSE):
129
129
 
130
130
  ```
131
131
  MIT License
package/docs/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
1
+ ## [2.2.2](https://github.com/newrelic/gatsby-plugin-newrelic/compare/v2.2.1...v2.2.2) (2022-02-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * publishes a latest version ([c2e68bb](https://github.com/newrelic/gatsby-plugin-newrelic/commit/c2e68bbe191c1ee4ea7657ecd44f953bc7213a2b))
7
+
8
+ ## [2.2.1](https://github.com/newrelic/gatsby-plugin-newrelic/compare/v2.2.0...v2.2.1) (2022-02-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bumps release ([c33fc1b](https://github.com/newrelic/gatsby-plugin-newrelic/commit/c33fc1b490f0ed45ff079f695cd4d0e784bfc810))
14
+
15
+ # [2.2.0](https://github.com/newrelic/gatsby-plugin-newrelic/compare/v2.1.1...v2.2.0) (2022-01-14)
16
+
17
+
18
+ ### Features
19
+
20
+ * Update package.json ([055d741](https://github.com/newrelic/gatsby-plugin-newrelic/commit/055d741013585b1cec6d6f5441104cfca8170ff5))
21
+
22
+ ## [2.1.1](https://github.com/newrelic/gatsby-plugin-newrelic/compare/v2.1.0...v2.1.1) (2022-01-10)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * updated contributing guide ([af6aa1c](https://github.com/newrelic/gatsby-plugin-newrelic/commit/af6aa1c48603a36641099b7ab6c2612e31fa11bc))
28
+
29
+ # [2.1.0](https://github.com/newrelic/gatsby-plugin-newrelic/compare/v2.0.2...v2.1.0) (2022-01-06)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * bumped the node version ([bc7f7ee](https://github.com/newrelic/gatsby-plugin-newrelic/commit/bc7f7ee43f68a07a6381fded83195786783399a6))
35
+ * update ci node version ([7fec128](https://github.com/newrelic/gatsby-plugin-newrelic/commit/7fec128c63852a78f8be23a3bb06cb65c7322c65))
36
+
37
+
38
+ ### Features
39
+
40
+ * adds support for gatsby 4 ([a7b5ba3](https://github.com/newrelic/gatsby-plugin-newrelic/commit/a7b5ba3c21aa772e7c300af167f894cf5019dd45))
41
+
1
42
  ## [2.0.2](https://github.com/newrelic/gatsby-plugin-newrelic/compare/v2.0.1...v2.0.2) (2021-08-06)
2
43
 
3
44
 
@@ -13,8 +13,9 @@ var _latest = require("../browser-agents/latest");
13
13
 
14
14
  var _default = function _default(_ref, pluginOptions) {
15
15
  var setHeadComponents = _ref.setHeadComponents;
16
- var userConfigs = pluginOptions.configs;
17
- var requiredConfigs = {
16
+ var userConfigs = pluginOptions.configs,
17
+ userConfig = pluginOptions.config;
18
+ var requiredConfig = {
18
19
  accountId: '',
19
20
  trustKey: '',
20
21
  agentID: '',
@@ -26,19 +27,15 @@ var _default = function _default(_ref, pluginOptions) {
26
27
 
27
28
  };
28
29
  var env = process.env.GATSBY_NEWRELIC_ENV;
30
+ var userEnvConfig = env ? userConfigs[env] : userConfig;
29
31
 
30
- if (!env) {
31
- // TO DO - Error/Warn about envVariable not being set
32
- console.warn('GATSBY_NEWRELIC_ENV env variable is not set');
32
+ if (!userEnvConfig) {
33
+ console.warn("gatsby-plugin-newrelic is missing the configuration" + (env ? " for the " + env + " environment" : ''));
33
34
  return;
34
35
  }
35
36
 
36
- var userEnvConfig = userConfigs[env] ? userConfigs[env] : userConfigs;
37
-
38
- if (!userEnvConfig) {
39
- // TO DO - Error/Warn about missing config option for a given env
40
- console.warn('gatsby-plugin-newrelic is missing the configuration for the ' + env + ' environment');
41
- return;
37
+ if (env) {
38
+ console.warn('gatsby-plugin-newrelic has deprecated using GATSBY_NEWRELIC_ENV for multiple environments');
42
39
  }
43
40
 
44
41
  var allowedInstrumentationTypes = ['lite', 'pro', 'proAndSPA'];
@@ -49,7 +46,7 @@ var _default = function _default(_ref, pluginOptions) {
49
46
  if (!itExists) {// TO DO - Error/Warn about wrong instrumentation type
50
47
  }
51
48
 
52
- var options = (0, _extends2["default"])({}, requiredConfigs, userEnvConfig);
49
+ var options = (0, _extends2["default"])({}, requiredConfig, userEnvConfig);
53
50
  var instrumentationType = options.instrumentationType;
54
51
  var emptyOptions = Object.entries(options).filter(function (_ref2) {
55
52
  var v = _ref2[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-plugin-newrelic",
3
- "version": "2.0.2",
3
+ "version": "2.2.2",
4
4
  "description": "Gatsby plugin for implementing the New Relic Browser agent",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "homepage": "https://opensource.newrelic.com/projects/newrelic/gatsby-plugin-newrelic",
21
21
  "peerDependencies": {
22
- "gatsby": "^3.0.0",
22
+ "gatsby": "3.x || 4.x",
23
23
  "react": "^17.0.0",
24
24
  "react-dom": "^17.0.0"
25
25
  },
@@ -42,7 +42,7 @@
42
42
  "cross-env": "^5.2.1"
43
43
  },
44
44
  "engines": {
45
- "node": ">=10.13.0"
45
+ "node": ">=16.3.1"
46
46
  },
47
47
  "private": false,
48
48
  "publishConfig": {
@@ -3,10 +3,11 @@ import { liteAgent, proAgent, proAndSpaAgent } from '../browser-agents/latest';
3
3
 
4
4
  export default ({ setHeadComponents }, pluginOptions) => {
5
5
  const {
6
- configs: userConfigs
6
+ configs: userConfigs,
7
+ config: userConfig
7
8
  } = pluginOptions;
8
9
 
9
- const requiredConfigs = {
10
+ const requiredConfig = {
10
11
  accountId: '',
11
12
  trustKey: '',
12
13
  agentID: '',
@@ -19,17 +20,14 @@ export default ({ setHeadComponents }, pluginOptions) => {
19
20
 
20
21
  const env = process.env.GATSBY_NEWRELIC_ENV;
21
22
 
22
- if (!env) {
23
- // TO DO - Error/Warn about envVariable not being set
24
- console.warn('GATSBY_NEWRELIC_ENV env variable is not set');
23
+ const userEnvConfig = env ? userConfigs[env] : userConfig;
24
+ if (!userEnvConfig) {
25
+ console.warn(`gatsby-plugin-newrelic is missing the configuration${env ? ` for the ${env} environment` : ''}`);
25
26
  return;
26
27
  }
27
28
 
28
- const userEnvConfig = userConfigs[env] ? userConfigs[env] : userConfigs;
29
- if (!userEnvConfig) {
30
- // TO DO - Error/Warn about missing config option for a given env
31
- console.warn('gatsby-plugin-newrelic is missing the configuration for the ' + env + ' environment');
32
- return;
29
+ if (env) {
30
+ console.warn('gatsby-plugin-newrelic has deprecated using GATSBY_NEWRELIC_ENV for multiple environments');
33
31
  }
34
32
 
35
33
  const allowedInstrumentationTypes = ['lite', 'pro', 'proAndSPA'];
@@ -40,7 +38,7 @@ export default ({ setHeadComponents }, pluginOptions) => {
40
38
  // TO DO - Error/Warn about wrong instrumentation type
41
39
  }
42
40
 
43
- const options = { ...requiredConfigs, ...userEnvConfig };
41
+ const options = { ...requiredConfig, ...userEnvConfig };
44
42
  const instrumentationType = options.instrumentationType;
45
43
 
46
44
  const emptyOptions = Object.entries(options).filter(([, v]) => v === '');
@@ -66,7 +64,7 @@ export default ({ setHeadComponents }, pluginOptions) => {
66
64
  ;NREUM.info={beacon:"${options.beacon}",errorBeacon:"${options.errorBeacon}",licenseKey:"${options.licenseKey}",applicationID:"${options.applicationID}",sa:1}
67
65
  `;
68
66
 
69
- if (agent && configs) {
67
+ if (agent && configs) {
70
68
  setHeadComponents([
71
69
  <script
72
70
  key="gatsby-plugin-newrelic"
@@ -1,22 +1,22 @@
1
1
  {
2
- "lastUpdated": "Fri Aug 06 2021 21:07:45 GMT+0000 (Coordinated Universal Time)",
2
+ "lastUpdated": "Fri Jan 14 2022 22:34:47 GMT+0000 (Coordinated Universal Time)",
3
3
  "projectName": "gatsby-plugin-newrelic",
4
4
  "projectUrl": "https://github.com/newrelic/gatsby-plugin-newrelic",
5
- "includeDev": true,
6
5
  "includeOptDeps": false,
6
+ "includeDev": true,
7
7
  "dependencies": {
8
- "@babel/runtime@7.13.10": {
8
+ "@babel/runtime@7.16.7": {
9
9
  "name": "@babel/runtime",
10
- "version": "7.13.10",
10
+ "version": "7.16.7",
11
11
  "range": "^7.12.5",
12
12
  "licenses": "MIT",
13
13
  "repoUrl": "https://github.com/babel/babel",
14
- "versionedRepoUrl": "https://github.com/babel/babel/tree/v7.13.10",
14
+ "versionedRepoUrl": "https://github.com/babel/babel/tree/v7.16.7",
15
15
  "licenseFile": "node_modules/@babel/runtime/LICENSE",
16
- "licenseUrl": "https://github.com/babel/babel/blob/v7.13.10/LICENSE",
16
+ "licenseUrl": "https://github.com/babel/babel/blob/v7.16.7/LICENSE",
17
17
  "licenseTextSource": "file",
18
- "publisher": "Sebastian McKenzie",
19
- "email": "sebmck@gmail.com"
18
+ "publisher": "The Babel Team",
19
+ "url": "https://babel.dev/team"
20
20
  }
21
21
  },
22
22
  "devDependencies": {
@@ -33,29 +33,31 @@
33
33
  "publisher": "The Babel Team",
34
34
  "url": "https://babel.dev/team"
35
35
  },
36
- "@babel/core@7.13.15": {
36
+ "@babel/core@7.16.7": {
37
37
  "name": "@babel/core",
38
- "version": "7.13.15",
38
+ "version": "7.16.7",
39
39
  "range": "^7.0.0",
40
40
  "licenses": "MIT",
41
41
  "repoUrl": "https://github.com/babel/babel",
42
- "versionedRepoUrl": "https://github.com/babel/babel/tree/v7.13.15",
42
+ "versionedRepoUrl": "https://github.com/babel/babel/tree/v7.16.7",
43
43
  "licenseFile": "node_modules/@babel/core/LICENSE",
44
- "licenseUrl": "https://github.com/babel/babel/blob/v7.13.15/LICENSE",
44
+ "licenseUrl": "https://github.com/babel/babel/blob/v7.16.7/LICENSE",
45
45
  "licenseTextSource": "file",
46
- "publisher": "Sebastian McKenzie",
47
- "email": "sebmck@gmail.com"
46
+ "publisher": "The Babel Team",
47
+ "url": "https://babel.dev/team"
48
48
  },
49
- "@babel/plugin-proposal-private-methods@7.13.0": {
49
+ "@babel/plugin-proposal-private-methods@7.16.7": {
50
50
  "name": "@babel/plugin-proposal-private-methods",
51
- "version": "7.13.0",
51
+ "version": "7.16.7",
52
52
  "range": "^7.8.3",
53
53
  "licenses": "MIT",
54
54
  "repoUrl": "https://github.com/babel/babel",
55
- "versionedRepoUrl": "https://github.com/babel/babel/tree/v7.13.0",
55
+ "versionedRepoUrl": "https://github.com/babel/babel/tree/v7.16.7",
56
56
  "licenseFile": "node_modules/@babel/plugin-proposal-private-methods/LICENSE",
57
- "licenseUrl": "https://github.com/babel/babel/blob/v7.13.0/LICENSE",
58
- "licenseTextSource": "file"
57
+ "licenseUrl": "https://github.com/babel/babel/blob/v7.16.7/LICENSE",
58
+ "licenseTextSource": "file",
59
+ "publisher": "The Babel Team",
60
+ "url": "https://babel.dev/team"
59
61
  },
60
62
  "@semantic-release/changelog@5.0.1": {
61
63
  "name": "@semantic-release/changelog",