From cf8cbbbcac2f0305220d66a3e85bd929604ae075 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:28:24 +0000 Subject: [PATCH 1/7] Bump prettier and @types/prettier Bumps [prettier](https://github.com/prettier/prettier) and [@types/prettier](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/prettier). These dependencies needed to be updated together. Updates `prettier` from 2.8.8 to 3.4.2 - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.4.2) Updates `@types/prettier` from 2.7.3 to 3.0.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/prettier) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:production update-type: version-update:semver-major - dependency-name: "@types/prettier" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 75 +++++++++++++++++----------- package.json | 4 +- packages/form-generator/package.json | 2 +- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 11967e17b2a..e07575388e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "@shopify/eslint-plugin": "^43.0.0", "@types/fs-extra": "^11.0.1", "@types/node": "^18.15.11", - "@types/prettier": "^2.7.3", + "@types/prettier": "^3.0.0", "@typescript-eslint/eslint-plugin": "^6.18.1", "@typescript-eslint/parser": "^6.18.1", "c8": "^7.13.0", @@ -50,7 +50,7 @@ "glob": "^10.1.0", "husky": "^8.0.3", "lint-staged": "^15.2.10", - "prettier": "^2.8.7", + "prettier": "^3.4.2", "rimraf": "^5.0.0", "semver": "^7.5.4", "tsx": "^4.6.1", @@ -13487,6 +13487,21 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/@changesets/apply-release-plan/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/@changesets/apply-release-plan/node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -13871,6 +13886,21 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/@changesets/write/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/@changesets/write/node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -16697,23 +16727,6 @@ } } }, - "node_modules/@shopify/eslint-plugin/node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", - "dev": true, - "license": "MIT", - "peer": true, - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, "node_modules/@sindresorhus/merge-streams": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz", @@ -17922,11 +17935,14 @@ } }, "node_modules/@types/prettier": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", - "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-mFMBfMOz8QxhYVbuINtswBp9VL2b4Y0QqYHwqLz3YbgtfAcat2Dl6Y1o4e22S/OVE6Ebl9m7wWiMT2lSbAs1wA==", + "deprecated": "This is a stub types definition. prettier provides its own type definitions, so you do not need this installed.", "dev": true, - "license": "MIT" + "dependencies": { + "prettier": "*" + } }, "node_modules/@types/semver": { "version": "7.5.8", @@ -28379,15 +28395,14 @@ } }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "license": "MIT", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -32984,7 +32999,7 @@ "@graphql-codegen/typescript": "^2.8.3", "graphql": "^15.8.0", "node-fetch": "^3.3.2", - "prettier": "^2.8.7" + "prettier": "^3.4.2" } }, "packages/integration-tests": { diff --git a/package.json b/package.json index 064c496cf6d..2c5cd8107a2 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@shopify/eslint-plugin": "^43.0.0", "@types/fs-extra": "^11.0.1", "@types/node": "^18.15.11", - "@types/prettier": "^2.7.3", + "@types/prettier": "^3.0.0", "@typescript-eslint/eslint-plugin": "^6.18.1", "@typescript-eslint/parser": "^6.18.1", "c8": "^7.13.0", @@ -91,7 +91,7 @@ "glob": "^10.1.0", "husky": "^8.0.3", "lint-staged": "^15.2.10", - "prettier": "^2.8.7", + "prettier": "^3.4.2", "rimraf": "^5.0.0", "semver": "^7.5.4", "tsx": "^4.6.1", diff --git a/packages/form-generator/package.json b/packages/form-generator/package.json index 31a56527203..c5126a33669 100644 --- a/packages/form-generator/package.json +++ b/packages/form-generator/package.json @@ -31,6 +31,6 @@ "@graphql-codegen/typescript": "^2.8.3", "graphql": "^15.8.0", "node-fetch": "^3.3.2", - "prettier": "^2.8.7" + "prettier": "^3.4.2" } } From 0a43b1f44c5add7925ef4a35a89e722f6b73f8d5 Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Thu, 2 Jan 2025 11:04:35 -0800 Subject: [PATCH 2/7] test --- .github/workflows/health_checks.yml | 2 +- .../components/dependabot_version_update_handler.ts | 11 +++++++++++ scripts/dependabot_handle_version_update.ts | 8 ++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/health_checks.yml b/.github/workflows/health_checks.yml index bf2d63289bf..2e4555696f7 100644 --- a/.github/workflows/health_checks.yml +++ b/.github/workflows/health_checks.yml @@ -270,7 +270,7 @@ jobs: mkdir api-validation-projects npx tsx scripts/check_api_changes.ts base-branch-content api-validation-projects handle_dependabot_version_update: - if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' + if: github.event_name == 'pull_request' runs-on: ubuntu-latest needs: - install diff --git a/scripts/components/dependabot_version_update_handler.ts b/scripts/components/dependabot_version_update_handler.ts index 6e8739c8054..916a5333cea 100644 --- a/scripts/components/dependabot_version_update_handler.ts +++ b/scripts/components/dependabot_version_update_handler.ts @@ -35,20 +35,24 @@ export class DependabotVersionUpdateHandler { * - PR already has a changeset in list of files changed */ handleVersionUpdate = async () => { + console.log(this._ghContext.payload); if (!this._ghContext.payload.pull_request) { // event is not a pull request, return early + console.log('Event is not a pull request'); return; } const branch = await this.gitClient.getCurrentBranch(); if (!branch.startsWith('dependabot/')) { // if branch is not a dependabot branch, return early + console.log('Branch is not a dependabot branch'); return; } const changedFiles = await this.gitClient.getChangedFiles(this.baseRef); if (changedFiles.find((file) => file.startsWith('.changeset'))) { // if changeset file already exists, return early + console.log('Found changeset file,'); return; } @@ -81,6 +85,12 @@ export class DependabotVersionUpdateHandler { `.changeset/dependabot-${this.headRef}.md` ); const versionUpdates = await this.getVersionUpdates(); + console.log( + `Found the following lines in the PR for version updates:${EOL}` + ); + console.log(versionUpdates.join(EOL)); + + console.log('Creating changeset file'); await this.createChangesetFile(fileName, versionUpdates, packageNames); await this.gitClient.status(); await this.gitClient.commitAllChanges('add changeset'); @@ -112,6 +122,7 @@ export class DependabotVersionUpdateHandler { } else { content = `---${EOL}${frontmatterContent}${EOL}---${EOL}${EOL}${message.trim()}${EOL}`; } + console.log(`Changeset file content:${EOL}${content}`); await fsp.writeFile(fileName, content); }; diff --git a/scripts/dependabot_handle_version_update.ts b/scripts/dependabot_handle_version_update.ts index da9c92de1b9..9be512ca1a2 100644 --- a/scripts/dependabot_handle_version_update.ts +++ b/scripts/dependabot_handle_version_update.ts @@ -4,12 +4,16 @@ import { DependabotVersionUpdateHandler } from './components/dependabot_version_ const baseRef = process.argv[2]; if (baseRef === undefined) { - throw new Error('No base ref specified for generate changeset check'); + throw new Error( + 'No base ref specified for handle dependabot version update check' + ); } const headRef = process.argv[3]; if (headRef === undefined) { - throw new Error('No head ref specified for generate changeset check'); + throw new Error( + 'No head ref specified for handle dependabot version update check' + ); } const dependabotVersionUpdateHandler = new DependabotVersionUpdateHandler( From 2d625f3816a8f14383603a0a65c89244e8b497ff Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Thu, 2 Jan 2025 11:17:37 -0800 Subject: [PATCH 3/7] test --- scripts/components/dependabot_version_update_handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/components/dependabot_version_update_handler.ts b/scripts/components/dependabot_version_update_handler.ts index 916a5333cea..81c39b532c1 100644 --- a/scripts/components/dependabot_version_update_handler.ts +++ b/scripts/components/dependabot_version_update_handler.ts @@ -35,7 +35,6 @@ export class DependabotVersionUpdateHandler { * - PR already has a changeset in list of files changed */ handleVersionUpdate = async () => { - console.log(this._ghContext.payload); if (!this._ghContext.payload.pull_request) { // event is not a pull request, return early console.log('Event is not a pull request'); @@ -43,6 +42,7 @@ export class DependabotVersionUpdateHandler { } const branch = await this.gitClient.getCurrentBranch(); + console.log(`Branch is ${branch}`); if (!branch.startsWith('dependabot/')) { // if branch is not a dependabot branch, return early console.log('Branch is not a dependabot branch'); From 2a7a69b116bed039f4916e41997a569fc7dcf76e Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Thu, 2 Jan 2025 11:39:12 -0800 Subject: [PATCH 4/7] test --- .github/workflows/health_checks.yml | 3 +-- .../dependabot_version_update_handler.test.ts | 10 ++++++---- .../components/dependabot_version_update_handler.ts | 8 +++----- scripts/dependabot_handle_version_update.ts | 8 -------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/workflows/health_checks.yml b/.github/workflows/health_checks.yml index 2e4555696f7..95766167058 100644 --- a/.github/workflows/health_checks.yml +++ b/.github/workflows/health_checks.yml @@ -285,10 +285,9 @@ jobs: node-version: 18 cdk-version: ${{ needs.resolve_inputs.outputs.cdk_version }} - name: Handle Dependabot version update pull request - run: npx tsx scripts/dependabot_handle_version_update.ts "$BASE_SHA" "$HEAD_SHA" + run: npx tsx scripts/dependabot_handle_version_update.ts "$BASE_SHA" env: BASE_SHA: ${{ github.event.pull_request.base.sha }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} # The dependabot_handler_version_update script needs to add the 'run-e2e' pull request label GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} do_include_e2e: diff --git a/scripts/components/dependabot_version_update_handler.test.ts b/scripts/components/dependabot_version_update_handler.test.ts index 8d9b612f1e2..e52bf9786fa 100644 --- a/scripts/components/dependabot_version_update_handler.test.ts +++ b/scripts/components/dependabot_version_update_handler.test.ts @@ -117,6 +117,10 @@ void describe('dependabot version update handler', async () => { pull_request: { number: 1, body: pullRequestBody, + head: { + ref: 'dependabot/test_version_update_branch', + sha: 'abcd1234', // used for naming the changeset file + }, }, }, issue: { @@ -131,15 +135,13 @@ void describe('dependabot version update handler', async () => { }; // Update package.json files for both packages and commit to match what Dependabot will do for a version update PR - await gitClient.switchToBranch('dependabot/test_update'); + await gitClient.switchToBranch('dependabot/test_version_update_branch'); await setPackageDependencies(cantaloupePackagePath, { testDep: '^1.1.0' }); await setPackageDependencies(platypusPackagePath, { testDep: '^1.1.0' }); await gitClient.commitAllChanges('Bump dependencies'); - const headRef = await gitClient.getHashForCurrentCommit(); const dependabotVersionUpdateHandler = new DependabotVersionUpdateHandler( baseRef, - headRef, gitClient, githubClient, testWorkingDir, @@ -150,7 +152,7 @@ void describe('dependabot version update handler', async () => { const changesetFilePath = path.join( testWorkingDir, - `.changeset/dependabot-${headRef}.md` + `.changeset/dependabot-abcd1234.md` ); await assertChangesetFile( diff --git a/scripts/components/dependabot_version_update_handler.ts b/scripts/components/dependabot_version_update_handler.ts index 81c39b532c1..9867390177c 100644 --- a/scripts/components/dependabot_version_update_handler.ts +++ b/scripts/components/dependabot_version_update_handler.ts @@ -16,7 +16,6 @@ export class DependabotVersionUpdateHandler { */ constructor( private readonly baseRef: string, - private readonly headRef: string, private readonly gitClient: GitClient, private readonly ghClient: GithubClient, private readonly _rootDir: string = process.cwd(), @@ -41,8 +40,7 @@ export class DependabotVersionUpdateHandler { return; } - const branch = await this.gitClient.getCurrentBranch(); - console.log(`Branch is ${branch}`); + const branch = await this._ghContext.payload.pull_request.head.ref; if (!branch.startsWith('dependabot/')) { // if branch is not a dependabot branch, return early console.log('Branch is not a dependabot branch'); @@ -52,7 +50,7 @@ export class DependabotVersionUpdateHandler { const changedFiles = await this.gitClient.getChangedFiles(this.baseRef); if (changedFiles.find((file) => file.startsWith('.changeset'))) { // if changeset file already exists, return early - console.log('Found changeset file,'); + console.log('Changeset file already exists'); return; } @@ -82,7 +80,7 @@ export class DependabotVersionUpdateHandler { // Create and commit the changeset file, then add the 'run-e2e' label and force push to the PR const fileName = path.join( this._rootDir, - `.changeset/dependabot-${this.headRef}.md` + `.changeset/dependabot-${this._ghContext.payload.pull_request.head.sha}.md` ); const versionUpdates = await this.getVersionUpdates(); console.log( diff --git a/scripts/dependabot_handle_version_update.ts b/scripts/dependabot_handle_version_update.ts index 9be512ca1a2..c24012d51af 100644 --- a/scripts/dependabot_handle_version_update.ts +++ b/scripts/dependabot_handle_version_update.ts @@ -9,16 +9,8 @@ if (baseRef === undefined) { ); } -const headRef = process.argv[3]; -if (headRef === undefined) { - throw new Error( - 'No head ref specified for handle dependabot version update check' - ); -} - const dependabotVersionUpdateHandler = new DependabotVersionUpdateHandler( baseRef, - headRef, new GitClient(), new GithubClient() ); From 5a08a4810590f3e9a53a6efe0fdd5aebac18e3cb Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Thu, 2 Jan 2025 11:53:02 -0800 Subject: [PATCH 5/7] test --- .github/workflows/health_checks.yml | 2 ++ scripts/components/dependabot_version_update_handler.ts | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/health_checks.yml b/.github/workflows/health_checks.yml index 95766167058..7589a19b5f8 100644 --- a/.github/workflows/health_checks.yml +++ b/.github/workflows/health_checks.yml @@ -277,6 +277,8 @@ jobs: - resolve_inputs steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # version 4.1.4 + with: + fetch-depth: 0 - uses: ./.github/actions/setup_node with: node-version: 18 diff --git a/scripts/components/dependabot_version_update_handler.ts b/scripts/components/dependabot_version_update_handler.ts index 9867390177c..b8ac1c36199 100644 --- a/scripts/components/dependabot_version_update_handler.ts +++ b/scripts/components/dependabot_version_update_handler.ts @@ -83,12 +83,6 @@ export class DependabotVersionUpdateHandler { `.changeset/dependabot-${this._ghContext.payload.pull_request.head.sha}.md` ); const versionUpdates = await this.getVersionUpdates(); - console.log( - `Found the following lines in the PR for version updates:${EOL}` - ); - console.log(versionUpdates.join(EOL)); - - console.log('Creating changeset file'); await this.createChangesetFile(fileName, versionUpdates, packageNames); await this.gitClient.status(); await this.gitClient.commitAllChanges('add changeset'); @@ -120,7 +114,6 @@ export class DependabotVersionUpdateHandler { } else { content = `---${EOL}${frontmatterContent}${EOL}---${EOL}${EOL}${message.trim()}${EOL}`; } - console.log(`Changeset file content:${EOL}${content}`); await fsp.writeFile(fileName, content); }; From dfade1a9081b2579f504c96c21ad49c45c4ff0dd Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Thu, 2 Jan 2025 12:09:13 -0800 Subject: [PATCH 6/7] test --- scripts/components/dependabot_version_update_handler.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/components/dependabot_version_update_handler.ts b/scripts/components/dependabot_version_update_handler.ts index b8ac1c36199..3ddf3704546 100644 --- a/scripts/components/dependabot_version_update_handler.ts +++ b/scripts/components/dependabot_version_update_handler.ts @@ -40,10 +40,13 @@ export class DependabotVersionUpdateHandler { return; } - const branch = await this._ghContext.payload.pull_request.head.ref; + await this.gitClient.switchToBranch( + this._ghContext.payload.pull_request.head.ref + ); + const branch = await this.gitClient.getCurrentBranch(); if (!branch.startsWith('dependabot/')) { // if branch is not a dependabot branch, return early - console.log('Branch is not a dependabot branch'); + console.log(`${branch} is not a dependabot branch`); return; } From 454cbd1fe811df40510e5e7a504df234688a68c4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Jan 2025 20:12:38 +0000 Subject: [PATCH 7/7] add changeset --- .../dependabot-dfade1a9081b2579f504c96c21ad49c45c4ff0dd.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/dependabot-dfade1a9081b2579f504c96c21ad49c45c4ff0dd.md diff --git a/.changeset/dependabot-dfade1a9081b2579f504c96c21ad49c45c4ff0dd.md b/.changeset/dependabot-dfade1a9081b2579f504c96c21ad49c45c4ff0dd.md new file mode 100644 index 00000000000..af6191c2dea --- /dev/null +++ b/.changeset/dependabot-dfade1a9081b2579f504c96c21ad49c45c4ff0dd.md @@ -0,0 +1,6 @@ +--- +'@aws-amplify/form-generator': patch +--- + +Updates `prettier` from 2.8.8 to 3.4.2 +Updates `@types/prettier` from 2.7.3 to 3.0.0