From b4508dbaa987edeef598db19e82286eeb724e8f5 Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:01:08 -0500 Subject: [PATCH 01/10] build: update .releaserc to publish from appropriate branches (#3341) * build: update `.releaserc` to publish from appropriate branches * chore: dry run new semantic release config --- .github/workflows/release.yml | 2 +- .releaserc | 6 +++++- package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1390787c0c..86ab69041f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,4 +35,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.OPENEDX_SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@22 + run: npx semantic-release@22 --dry-run diff --git a/.releaserc b/.releaserc index 2c101b5028..adf6f9c63c 100644 --- a/.releaserc +++ b/.releaserc @@ -1,5 +1,9 @@ { - "branches": ["master", "next"], + "branches": [ + { "name": "release-22.x", "range": "22.x", "channel": "22.x" }, + { "name": "release-23.x", "range": "23.x" }, + { "name": "next", "prerelease": true, "channel": "next" } + ], "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", diff --git a/package.json b/package.json index 9be7168e6b..0289784d0f 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "stylelint": "stylelint \"src/**/*.scss\" \"scss/**/*.scss\" \"www/src/**/*.scss\" --config .stylelintrc.json", "lint": "npm run stylelint && eslint --ext .js --ext .jsx --ext .ts --ext .tsx . && npm run lint --workspaces --if-present", "prepublishOnly": "npm run build", - "semantic-release": "semantic-release", + "semantic-release": "semantic-release --dry-run", "snapshot": "jest --updateSnapshot", "start": "npm start --workspace=www", "test": "jest --coverage", From 3a62f9ed29365f4622e7d22bcda1a2cea6b980e8 Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:55:19 -0500 Subject: [PATCH 02/10] chore: update gh actions workflows for new branching strategy (#3342) --- .github/workflows/lockfileversion-check.yml | 3 ++- .github/workflows/release.yml | 3 ++- .github/workflows/sync-master-alpha.yml | 30 --------------------- 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 .github/workflows/sync-master-alpha.yml diff --git a/.github/workflows/lockfileversion-check.yml b/.github/workflows/lockfileversion-check.yml index 916dcb40d2..4a3c01197c 100644 --- a/.github/workflows/lockfileversion-check.yml +++ b/.github/workflows/lockfileversion-check.yml @@ -5,7 +5,8 @@ name: Lockfile Version check on: push: branches: - - master + - next + - release-* pull_request: jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86ab69041f..f77c38e3bb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,8 @@ name: Release CI on: push: branches: - - master + - next + - release-* jobs: release: name: Release diff --git a/.github/workflows/sync-master-alpha.yml b/.github/workflows/sync-master-alpha.yml deleted file mode 100644 index 36d39e2ece..0000000000 --- a/.github/workflows/sync-master-alpha.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Sync alpha with master -on: - push: - branches: - - master - workflow_dispatch: - -jobs: - sync-branches: - runs-on: ubuntu-latest - name: Syncing branches - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Node - uses: actions/setup-node@v1 - with: - node-version: 18 - - name: Create Pull Request - id: cpr - uses: tretuna/sync-branches@1.4.0 - with: - GITHUB_TOKEN: ${{ secrets.requirements_bot_github_token }} - FROM_BRANCH: master - TO_BRANCH: alpha - - name: Enable Pull Request Automerge - uses: peter-evans/enable-pull-request-automerge@v2 - with: - token: ${{ secrets.requirements_bot_github_token }} - pull-request-number: ${{ steps.cpr.outputs.PULL_REQUEST_NUMBER }} From c6e1eb406a3402ea4dc3e573339ba8d68ea85f8b Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Wed, 11 Dec 2024 18:28:17 -0500 Subject: [PATCH 03/10] build: update `releaserc` to ensure we have a "release" branch (#3345) Semantic release requires at least 1 branch be configured as "release" (see https://github.com/semantic-release/semantic-release/blob/master/docs/usage/workflow-configuration.md#branches-properties) Before this change we had 2 "maintenance" branches and 1 "pre-release" branch, but no "release" branch. This led to an error https://github.com/openedx/paragon/actions/runs/12286316911/job/34286199225 --- .releaserc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.releaserc b/.releaserc index adf6f9c63c..94b6f78223 100644 --- a/.releaserc +++ b/.releaserc @@ -1,7 +1,7 @@ { "branches": [ { "name": "release-22.x", "range": "22.x", "channel": "22.x" }, - { "name": "release-23.x", "range": "23.x" }, + { "name": "release-23.x" }, { "name": "next", "prerelease": true, "channel": "next" } ], "plugins": [ From 2bea4c9d7b24f4e7850d006ada8d9a72f849f6b9 Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Wed, 11 Dec 2024 20:33:32 -0500 Subject: [PATCH 04/10] build: remove `--dry-run` semantic release argument (#3348) --- .github/workflows/release.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f77c38e3bb..84b4fcbd4b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,4 +36,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.OPENEDX_SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@22 --dry-run + run: npx semantic-release@22 diff --git a/package.json b/package.json index 0289784d0f..9be7168e6b 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "stylelint": "stylelint \"src/**/*.scss\" \"scss/**/*.scss\" \"www/src/**/*.scss\" --config .stylelintrc.json", "lint": "npm run stylelint && eslint --ext .js --ext .jsx --ext .ts --ext .tsx . && npm run lint --workspaces --if-present", "prepublishOnly": "npm run build", - "semantic-release": "semantic-release --dry-run", + "semantic-release": "semantic-release", "snapshot": "jest --updateSnapshot", "start": "npm start --workspace=www", "test": "jest --coverage", From e58002fc241ddde6f1ea519a2f2ffbe732a66e3d Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:20:53 -0500 Subject: [PATCH 05/10] docs: document where to target PRs in a table in the README (#3344) * docs: document where to target PRs in a table in the README * docs: remove redundant breaking change information --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1583346cdb..04bda87aca 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,14 @@ Note that if you are using ``@edx/frontend-platform``'s ``AppProvider`` componen ## Contributing +The branch to target with your PR depends on the type of change you are contributing to Paragon. + +| Branch to Target | Type of Change | Documentation Site | +| - | - | - | +| [`release-22.x`](https://github.com/openedx/paragon/tree/release-22.x) | Bug fix/security patch | https://paragon-openedx-v22.netlify.app/ | +| [`release-23.x`](https://github.com/openedx/paragon/tree/release-23.x) | Bug fix/security patch/new (non-breaking) feature | https://paragon-openedx-v23.netlify.app/ | +| [`next`](https://github.com/openedx/paragon/tree/next) | Breaking change | https://paragon-openedx.netlify.app/ | + Please refer to the ["How to Contribute"](https://openedx.org/r/how-to-contribute) documentation and [Code of Conduct](https://openedx.org/code-of-conduct/) from Open edX. The Paragon Working Group accepts bug fixes, new features, documentation, and security patches. You may find open issues [here](https://github.com/openedx/paragon/issues) or by visiting the Paragon Working Group [project board](https://github.com/orgs/openedx/projects/43/views/15). @@ -463,11 +471,6 @@ perf(pencil): remove graphiteWidth option BREAKING CHANGE: The graphiteWidth option has been removed. The default graphite width of 10mm is always used for performance reason. ``` -#### Opening Pull Requests for Breaking Changes - -Pull requests that include Breaking Changes must be opened against the `next` branch instead of `release-x.x`. -This ensures that breaking changes are accumulated and released together in the next major version, minimizing disruption for consumers. - ## Treeshaking Paragon is distributed on npm as ES6 modules. This means that webpack can use treeshaking on any Paragon components that a consuming app is not using, resulting in greatly reduced bundle sizes. From 8a828cf0935e214b8f04b46dff0594c058b06b44 Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:53:03 -0500 Subject: [PATCH 06/10] feat: use data uri for card fallback image (#3323) --- src/Card/CardFallbackDefaultImage.js | 1 + src/Card/CardImageCap.jsx | 2 +- src/Card/fallback-default.png | Bin 613 -> 0 bytes src/Card/tests/CardImageCap.test.jsx | 6 +++--- 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 src/Card/CardFallbackDefaultImage.js delete mode 100644 src/Card/fallback-default.png diff --git a/src/Card/CardFallbackDefaultImage.js b/src/Card/CardFallbackDefaultImage.js new file mode 100644 index 0000000000..e1df625d35 --- /dev/null +++ b/src/Card/CardFallbackDefaultImage.js @@ -0,0 +1 @@ +export const cardSrcFallbackImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAACMCAYAAAB/AhJnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH6SURBVHgB7dRBEYBADACxwuDf5j0QUXywiYhc7zk7APzd3gNAgvABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIp4BaNpp2Q/3/wfPkGyXOQAAAABJRU5ErkJggg=='; diff --git a/src/Card/CardImageCap.jsx b/src/Card/CardImageCap.jsx index e271246e43..eb27d912b2 100644 --- a/src/Card/CardImageCap.jsx +++ b/src/Card/CardImageCap.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import classNames from 'classnames'; import Skeleton from 'react-loading-skeleton'; import CardContext from './CardContext'; -import cardSrcFallbackImg from './fallback-default.png'; +import { cardSrcFallbackImg } from './CardFallbackDefaultImage'; const SKELETON_HEIGHT_VALUE = 140; const LOGO_SKELETON_HEIGHT_VALUE = 41; diff --git a/src/Card/fallback-default.png b/src/Card/fallback-default.png deleted file mode 100644 index b18d751d2639cff402d41d2eb7db5a4fe560b19c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 613 zcmeAS@N?(olHy`uVBq!ia0y~yV5|YMdpOvDWIdBmI*{Tl@Q5sCVBi)8VMc~ob0mO* zjKx9jP7LeL$-D$|SkfJR9T^xl_H+M9WChCo@^oK zZ0PKWd2eaW@aOJ5W{0K^j7ly10*W;a91odYIOG+aelQ3gV($>Jb7&cr8gijAk1^v` b=1u', () => { expect(logoImg.className).toEqual('pgn__card-logo-cap'); }); - it('hiding component if it isn`t fallbackSrc and src don`t work', () => { + it('renders the default image if both src and fallbackSrc fail to load', () => { render(); const srcImg = screen.getByAltText('Src alt text'); fireEvent.load(srcImg); fireEvent.error(srcImg); - // test-file-stub is what our fileMock.js returns for all images - expect(srcImg.src.endsWith('test-file-stub')).toEqual(true); + expect(srcImg.src).toEqual(cardSrcFallbackImg); }); }); From 47e26dfa4c719b0db4e0e97ba0064177b7980fd5 Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:35:38 -0500 Subject: [PATCH 07/10] chore(deps): update `@edx/eslint-config` from 4.2 to 4.3 (#3353) --- package-lock.json | 9 +++++---- package.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index d83b197cd6..21a52a8d94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,7 +72,7 @@ "@babel/preset-env": "^7.16.8", "@babel/preset-react": "^7.16.7", "@babel/preset-typescript": "^7.16.7", - "@edx/eslint-config": "^4.2.0", + "@edx/eslint-config": "^4.3.0", "@edx/stylelint-config-edx": "^2.3.0", "@edx/typescript-config": "^1.1.0", "@formatjs/cli": "^5.0.2", @@ -2615,10 +2615,11 @@ "license": "UNLICENSED" }, "node_modules/@edx/eslint-config": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@edx/eslint-config/-/eslint-config-4.2.0.tgz", - "integrity": "sha512-2wuIw49uyj6gRwS74qJ8WhBU+X2FOP4uot40sthIC4YU9qCM7WJOcOuAhkRPP1FvZKd3UQH3gZM7eJ85xzDBqA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@edx/eslint-config/-/eslint-config-4.3.0.tgz", + "integrity": "sha512-4W9wFG4ALr3xocakCsncgJbK67RHfSmDwHDXKHReFtjxl/FRkxhS6qayz189oChqfANieeV3zRCLaq44bLf+/A==", "dev": true, + "license": "MIT", "peerDependencies": { "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", diff --git a/package.json b/package.json index e8a5687d62..bffbca60ba 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "@babel/preset-env": "^7.16.8", "@babel/preset-react": "^7.16.7", "@babel/preset-typescript": "^7.16.7", - "@edx/eslint-config": "^4.2.0", + "@edx/eslint-config": "^4.3.0", "@edx/stylelint-config-edx": "^2.3.0", "@edx/typescript-config": "^1.1.0", "@formatjs/cli": "^5.0.2", From 265240ca19895a16a196991bd2c5648a38c03249 Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:17:51 -0500 Subject: [PATCH 08/10] chore: add workflow to sync next with 23.x (#3354) --- .github/workflows/sync-23-next.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/sync-23-next.yml diff --git a/.github/workflows/sync-23-next.yml b/.github/workflows/sync-23-next.yml new file mode 100644 index 0000000000..ccd8ec2126 --- /dev/null +++ b/.github/workflows/sync-23-next.yml @@ -0,0 +1,30 @@ +name: Sync next with 23.x +on: + push: + branches: + - release-23.x + workflow_dispatch: + +jobs: + sync-branches: + runs-on: ubuntu-latest + name: Syncing branches + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - name: Create Pull Request + id: cpr + uses: tretuna/sync-branches@1.4.0 + with: + GITHUB_TOKEN: ${{ secrets.requirements_bot_github_token }} + FROM_BRANCH: release-23.x + TO_BRANCH: next + - name: Enable Pull Request Automerge + uses: peter-evans/enable-pull-request-automerge@v2 + with: + token: ${{ secrets.requirements_bot_github_token }} + pull-request-number: ${{ steps.cpr.outputs.PULL_REQUEST_NUMBER }} From a633633344b7f104e945c6f10d045fc8e396f21e Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:28:16 -0500 Subject: [PATCH 09/10] chore: auto approve 23 -> next sync PRs (#3359) --- .github/workflows/sync-23-next.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/sync-23-next.yml b/.github/workflows/sync-23-next.yml index ccd8ec2126..611cc417c5 100644 --- a/.github/workflows/sync-23-next.yml +++ b/.github/workflows/sync-23-next.yml @@ -23,6 +23,11 @@ jobs: GITHUB_TOKEN: ${{ secrets.requirements_bot_github_token }} FROM_BRANCH: release-23.x TO_BRANCH: next + - name: Auto-approve pull request for sync + uses: hmarr/auto-approve-action@v2 + with: + pull-request-number: ${{ steps.cpr.outputs.PULL_REQUEST_NUMBER }} + github-token: ${{ secrets.requirements_bot_github_token }} - name: Enable Pull Request Automerge uses: peter-evans/enable-pull-request-automerge@v2 with: From 92c43c36c14b86b7fd8cb85f751ba2de9df2157a Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:54:41 -0500 Subject: [PATCH 10/10] chore: use `GITHUB_TOKEN` to create sync PRs (#3360) --- .github/workflows/sync-23-next.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-23-next.yml b/.github/workflows/sync-23-next.yml index 611cc417c5..816c823818 100644 --- a/.github/workflows/sync-23-next.yml +++ b/.github/workflows/sync-23-next.yml @@ -20,7 +20,7 @@ jobs: id: cpr uses: tretuna/sync-branches@1.4.0 with: - GITHUB_TOKEN: ${{ secrets.requirements_bot_github_token }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} FROM_BRANCH: release-23.x TO_BRANCH: next - name: Auto-approve pull request for sync