From ba401172c4c26c78fcb724d3816fd658ca9bae60 Mon Sep 17 00:00:00 2001 From: Jared Scholz <57383574+redJ4y@users.noreply.github.com> Date: Mon, 19 Aug 2024 14:16:29 +1200 Subject: [PATCH 1/5] use typeof instead of isFunction --- src/raygun.tracekit.jquery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raygun.tracekit.jquery.js b/src/raygun.tracekit.jquery.js index 02228f09..c1a7f885 100644 --- a/src/raygun.tracekit.jquery.js +++ b/src/raygun.tracekit.jquery.js @@ -55,7 +55,7 @@ var keys = ['complete', 'error', 'success'], key; while(key = keys.pop()) { - if ($.isFunction(options[key])) { + if (typeof options[key] === "function") { options[key] = TraceKit.wrap(options[key]); } } From 4228e2e5eec642752a17d2ce671519d3c339bdeb Mon Sep 17 00:00:00 2001 From: Jared Scholz <57383574+redJ4y@users.noreply.github.com> Date: Mon, 19 Aug 2024 14:33:57 +1200 Subject: [PATCH 2/5] tests: automatically sync chrome and chromedriver versions --- .github/workflows/tests.yml | 16 ++++++++++++++- wdio.conf.js | 41 ++++++++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index be1e2d52..e328ceed 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,13 +13,27 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Use Node.js 20.x uses: actions/setup-node@v3 with: node-version: 20.x - - uses: browser-actions/setup-chrome@latest + + - name: Setup Chrome + id: setup-chrome + uses: browser-actions/setup-chrome@latest with: chrome-version: latest + install-chromedriver: true + + - name: Set Chrome and ChromeDriver paths + run: | + echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV + echo "CHROMEDRIVER_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> $GITHUB_ENV + - run: npm ci - run: npx grunt - run: npm test + env: + CHROME_BIN: ${{ env.CHROME_BIN }} + CHROMEDRIVER_PATH: ${{ env.CHROMEDRIVER_PATH }} diff --git a/wdio.conf.js b/wdio.conf.js index a7275eff..18310207 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -1,3 +1,24 @@ +const fs = require('fs'); +const path = require('path'); + +const chromeDriverExists = (path) => { + return fs.existsSync(path); +}; + +const githubActionsChromeDriver = process.env.CHROMEDRIVER_PATH; +const localChromeDriver = path.join(__dirname, 'node_modules', 'chromedriver', 'bin', 'chromedriver'); + +// If we are on a Continuous Integration server, use the ChromeDriver installed by browser-actions/setup-chrome. +// Otherwise, use the ChromeDriver installed as a devDependency. +let chromeDriverPath; +if (githubActionsChromeDriver && chromeDriverExists(githubActionsChromeDriver)) { + chromeDriverPath = githubActionsChromeDriver; +} else if (chromeDriverExists(localChromeDriver)) { + chromeDriverPath = localChromeDriver; +} else { + console.warn('ChromeDriver not found in expected locations. Using default.'); +} + exports.config = { // // ==================== @@ -48,9 +69,16 @@ exports.config = { capabilities: [{ maxInstances: 4, browserName: 'chrome', - 'goog:chromeOptions': { - args: ['headless', 'disable-gpu', 'no-sandbox'] - }, + 'goog:chromeOptions': (function() { + const options = { + args: ['headless', 'disable-gpu', 'no-sandbox'], + }; + // Use the CHROME_BIN environment variable if present. + if (process.env.CHROME_BIN) { + options.binary = process.env.CHROME_BIN; + } + return options; + })(), }], // // =================== @@ -112,8 +140,11 @@ exports.config = { { mount: '/fixtures', path: './tests/fixtures' }, { mount: '/dist', path: './dist' }, ] - } - ], 'chromedriver'], + }], + ['chromedriver', { + chromedriverCustomPath: chromeDriverPath + }] + ], chromeDriverArgs: ['--headless', '--disable-gpu'], // Framework you want to run your specs with. From 21d9efbee0500b83a37daf9f6e2c1b06dbc849ea Mon Sep 17 00:00:00 2001 From: Jared Scholz Date: Mon, 19 Aug 2024 16:49:28 +1200 Subject: [PATCH 3/5] Version bump and changelog --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f414aaa6..e6c97715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Unused normalize.css file --> + +## [3.1.1] + +### Fixed +- Resolved jQuery `isFunction` deprecation warnings. As of jQuery 3.3, `jQuery.isFunction()` is deprecated. It is replaced by `typeof x === "function"` - [source](https://api.jquery.com/jQuery.isFunction/). + ## [3.1.0] ### Added diff --git a/package.json b/package.json index 01692b67..c7eb99d3 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ ], "title": "Raygun4js", "description": "Raygun.com plugin for JavaScript", - "version": "3.1.0", + "version": "3.1.1", "homepage": "https://github.com/MindscapeHQ/raygun4js", "author": { "name": "MindscapeHQ", From 58c4a6e221c9265bfbc8c38662b861dd0886f734 Mon Sep 17 00:00:00 2001 From: Jared Scholz Date: Tue, 20 Aug 2024 10:43:50 +1200 Subject: [PATCH 4/5] revive prerelease.yml workflow --- .github/workflows/prerelease.yml | 127 +++++++++++++++++++++---------- .github/workflows/tests.yml | 4 +- 2 files changed, 87 insertions(+), 44 deletions(-) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 23feb537..bf6a6c19 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -1,53 +1,96 @@ name: Build & Publish Raygun4JS to the pre-release environment on: - push: - branches: [ master ] workflow_dispatch: - + jobs: build: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x] - + node-version: [ 20.x ] + steps: - - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Install Grunt - run: npm install -g grunt - - - name: Install node modules - run: npm install - - - name: Build - run: grunt build - - - name: Complete - run: echo Build successfully completed! - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }} - aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET }} - aws-region: ${{ secrets.AWS_REGION }} - - - name: Publish to S3 Pre-release - run: aws s3 sync ./dist ${{ secrets.AWS_PUBLISH_TARGET }} - - - name: Deployment Complete - run: echo A new version of Raygun4JS has been deployed to pre-release! - - - name: Notify Slack - id: slack - uses: slackapi/slack-github-action@v1.14.0 - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Grunt + run: npm install -g grunt + + - name: Install node modules + run: npm install + + - name: Build + id: build_step + run: grunt build + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }} + aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Publish to S3 Pre-release + id: publish_s3 + run: aws s3 sync ./dist ${{ secrets.AWS_PUBLISH_TARGET }} + + - name: Notify Slack + id: slack + uses: slackapi/slack-github-action@v1.26.0 + with: + payload: | + { + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "A new pre-release version of Raygun4JS has been published" + } + }, + { + "type": "section", + "text": { + "type": "plain_text", + "text": "The Cloudfront cache will need to be invalidated for changes to take effect immediately." + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Branch:*\n`${{ github.ref_name }}`" + }, + { + "type": "mrkdwn", + "text": "*Node version:*\n`${{ matrix.node-version }}`" + }, + { + "type": "mrkdwn", + "text": "*Build status:*\n_${{ steps.build_step.outcome }}_" + }, + { + "type": "mrkdwn", + "text": "*S3 sync status:*\n_${{ steps.publish_s3.outcome }}_" + } + ] + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e328ceed..0a5021dc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js 20.x - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20.x From a5fadcd29729c66784d5893ccd4140a676723f62 Mon Sep 17 00:00:00 2001 From: Jared Scholz Date: Tue, 20 Aug 2024 14:39:37 +1200 Subject: [PATCH 5/5] add cache invalidation to prerelease.yml --- .github/workflows/prerelease.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index bf6a6c19..64a7fe74 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -1,4 +1,4 @@ -name: Build & Publish Raygun4JS to the pre-release environment +name: Publish Raygun4JS to the pre-release environment on: workflow_dispatch: @@ -40,6 +40,13 @@ jobs: id: publish_s3 run: aws s3 sync ./dist ${{ secrets.AWS_PUBLISH_TARGET }} + - name: Create CloudFront Cache Invalidation + id: cache_invalidation + run: | + aws cloudfront create-invalidation \ + --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} \ + --paths "${{ secrets.AWS_CLOUDFRONT_INVALIDATION_PATH }}" + - name: Notify Slack id: slack uses: slackapi/slack-github-action@v1.26.0 @@ -54,13 +61,6 @@ jobs: "text": "A new pre-release version of Raygun4JS has been published" } }, - { - "type": "section", - "text": { - "type": "plain_text", - "text": "The Cloudfront cache will need to be invalidated for changes to take effect immediately." - } - }, { "type": "section", "text": { @@ -85,7 +85,11 @@ jobs: }, { "type": "mrkdwn", - "text": "*S3 sync status:*\n_${{ steps.publish_s3.outcome }}_" + "text": "*S3 publish status:*\n_${{ steps.publish_s3.outcome }}_" + }, + { + "type": "mrkdwn", + "text": "*CloudFront cache invalidation status:*\n_${{ steps.cache_invalidation.outcome }}_" } ] }