From 15e04059d056eb51589b3e7edeab867be451e794 Mon Sep 17 00:00:00 2001 From: Andrew Hammond <445764+ahammond@users.noreply.github.com> Date: Wed, 20 Sep 2023 13:29:07 -0700 Subject: [PATCH] feat(node): bump minNodeVersion to v18 [CLK-321581] (#214) * feat: bump minNodeVersion to v18 [CLK-321581] * update tests * chore: self mutation Signed-off-by: github-actions --------- Signed-off-by: github-actions Co-authored-by: github-actions --- .github/workflows/build.yml | 6 +++- .github/workflows/release.yml | 33 +++++++++++++++++++-- .github/workflows/update-projen-main.yml | 4 +++ .projen/deps.json | 2 +- .projen/tasks.json | 2 +- .projenrc.ts | 8 +++++ package.json | 5 +++- src/utils/parameters.ts | 2 +- test/__snapshots__/clickup-cdk.test.ts.snap | 12 ++++---- test/__snapshots__/clickup-ts.test.ts.snap | 4 +-- test/clickup-ts.test.ts | 4 +-- yarn.lock | 8 ++--- 12 files changed, 69 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f629868..917b390a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,10 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.17.1 - name: Install dependencies run: yarn install --check-files - name: build @@ -92,7 +96,7 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.17.1 - name: Download build artifacts uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34790fa6..234f1186 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,10 @@ jobs: run: |- git config user.name "github-actions" git config user.email "github-actions@github.com" + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.17.1 - name: Install dependencies run: yarn install --check-files --frozen-lockfile - name: release @@ -56,7 +60,7 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.17.1 - name: Download build artifacts uses: actions/download-artifact@v3 with: @@ -86,7 +90,7 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.17.1 - name: Download build artifacts uses: actions/download-artifact@v3 with: @@ -109,3 +113,28 @@ jobs: NPM_REGISTRY: npm.pkg.github.com NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npx -p publib@latest publib-npm + send_release_event_to_slack: + name: Send Release Alert to Slack + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + if: needs.release.outputs.latest_commit == github.sha + steps: + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifact + path: dist + - name: Get version + id: event_metadata + run: echo "release_tag=$(cat dist/releasetag.txt)" >> $GITHUB_OUTPUT + - name: Send Slack webhook event + uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 + env: + SLACK_TITLE: ${{ github.repository }}@${{ steps.event_metadata.outputs.release_tag }} released! + SLACK_MESSAGE: "View the release notes here: https://github.com/${{ github.repository }}/releases/tag/${{ steps.event_metadata.outputs.release_tag }}" + SLACK_WEBHOOK: ${{ secrets.PROJEN_RELEASE_SLACK_WEBHOOK }} + SLACK_FOOTER: "" + SLACK_COLOR: success + MSG_MINIMAL: "true" diff --git a/.github/workflows/update-projen-main.yml b/.github/workflows/update-projen-main.yml index 14f27e94..8488eb60 100644 --- a/.github/workflows/update-projen-main.yml +++ b/.github/workflows/update-projen-main.yml @@ -18,6 +18,10 @@ jobs: uses: actions/checkout@v3 with: ref: main + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.17.1 - name: Install dependencies run: yarn install --check-files --frozen-lockfile - name: Upgrade dependencies diff --git a/.projen/deps.json b/.projen/deps.json index a3b012d6..61f517f6 100644 --- a/.projen/deps.json +++ b/.projen/deps.json @@ -6,7 +6,7 @@ }, { "name": "@types/node", - "version": "^16", + "version": "^18", "type": "build" }, { diff --git a/.projen/tasks.json b/.projen/tasks.json index b930eb17..9ddc9b97 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -221,7 +221,7 @@ "description": "Run tests", "steps": [ { - "exec": "jest --passWithNoTests --updateSnapshot", + "exec": "jest --passWithNoTests --coverageProvider=v8 --updateSnapshot", "receiveArgs": true }, { diff --git a/.projenrc.ts b/.projenrc.ts index 7ad27dfa..b18ceaf8 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -2,11 +2,14 @@ import { cdk, github, javascript, TextFile, YamlFile } from 'projen'; import { addToProjectWorkflow } from './src/add-to-project'; import { renovateWorkflow } from './src/renovate-workflow'; import { semgrepWorkflow } from './src/semgrep-workflow'; +import { slackAlert } from './src/slack-alert'; import { updateProjen } from './src/update-projen'; import { parameters } from './src/utils/parameters'; const bundledDeps = ['cson-parser', 'semver', 'ts-deepmerge']; +const minNodeVersion = '18.17.1'; + const project = new cdk.JsiiProject({ name: '@time-loop/clickup-projen', author: 'ClickUp DevOps', @@ -16,6 +19,9 @@ const project = new cdk.JsiiProject({ jsiiVersion: '5.0.x', // Apache open source license, to match projen license + minNodeVersion, + workflowNodeVersion: minNodeVersion, + defaultReleaseBranch: 'main', // release: true, // default npmRegistryUrl: 'https://npm.pkg.github.com', @@ -86,6 +92,8 @@ const project = new cdk.JsiiProject({ codeCovTokenSecret: 'CODECOV_TOKEN', }); +slackAlert.addReleaseEvent(project); + new YamlFile(project, 'codecov.yml', { obj: { coverage: { diff --git a/package.json b/package.json index 7594845d..e45cb5b3 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ }, "devDependencies": { "@types/jest": "^29.5.4", - "@types/node": "^16", + "@types/node": "^18", "@types/semver": "^7.5.1", "@typescript-eslint/eslint-plugin": "^6", "@typescript-eslint/parser": "^6", @@ -74,6 +74,9 @@ "semver", "ts-deepmerge" ], + "engines": { + "node": ">= 18.17.1" + }, "main": "lib/index.js", "license": "Apache-2.0", "publishConfig": { diff --git a/src/utils/parameters.ts b/src/utils/parameters.ts index 3ad0b551..2be8aa62 100644 --- a/src/utils/parameters.ts +++ b/src/utils/parameters.ts @@ -1,4 +1,4 @@ export class parameters { - static PROJEN_MIN_ENGINE_NODE_VERSION: string = '14.18.0'; + static PROJEN_MIN_ENGINE_NODE_VERSION: string = '18.17.1'; static PROJEN_NODE_VERSION: string = '18.17.1'; } diff --git a/test/__snapshots__/clickup-cdk.test.ts.snap b/test/__snapshots__/clickup-cdk.test.ts.snap index cb4a82f4..2ca979f4 100644 --- a/test/__snapshots__/clickup-cdk.test.ts.snap +++ b/test/__snapshots__/clickup-cdk.test.ts.snap @@ -10,7 +10,7 @@ exports[`ClickUpCdkConstructLibrary defaults package.json 1`] = ` }, "devDependencies": { "@types/jest": "*", - "@types/node": "^14", + "@types/node": "^18", "@typescript-eslint/eslint-plugin": "^6", "@typescript-eslint/parser": "^6", "aws-cdk-lib": "2.91.0", @@ -39,7 +39,7 @@ exports[`ClickUpCdkConstructLibrary defaults package.json 1`] = ` "typescript": "*", }, "engines": { - "node": ">= 14.18.0", + "node": ">= 18.17.1", }, "jest": { "clearMocks": true, @@ -496,7 +496,7 @@ exports[`ClickUpCdkTypeScriptApp defaults package.json 1`] = ` }, "devDependencies": { "@types/jest": "*", - "@types/node": "^14", + "@types/node": "^18", "@typescript-eslint/eslint-plugin": "^6", "@typescript-eslint/parser": "^6", "aws-cdk": "^2.91.0", @@ -519,7 +519,7 @@ exports[`ClickUpCdkTypeScriptApp defaults package.json 1`] = ` "typescript": "*", }, "engines": { - "node": ">= 14.18.0", + "node": ">= 18.17.1", }, "jest": { "clearMocks": true, @@ -1071,7 +1071,7 @@ exports[`cdk-diff additions - ClickUpCdkTypeScriptApp package.json 1`] = ` "devDependencies": { "@time-loop/cdk-log-parser": "latest", "@types/jest": "*", - "@types/node": "^14", + "@types/node": "^18", "@typescript-eslint/eslint-plugin": "^6", "@typescript-eslint/parser": "^6", "aws-cdk": "^2.91.0", @@ -1094,7 +1094,7 @@ exports[`cdk-diff additions - ClickUpCdkTypeScriptApp package.json 1`] = ` "typescript": "*", }, "engines": { - "node": ">= 14.18.0", + "node": ">= 18.17.1", }, "jest": { "clearMocks": true, diff --git a/test/__snapshots__/clickup-ts.test.ts.snap b/test/__snapshots__/clickup-ts.test.ts.snap index 49108c6f..dfdba246 100644 --- a/test/__snapshots__/clickup-ts.test.ts.snap +++ b/test/__snapshots__/clickup-ts.test.ts.snap @@ -222,7 +222,7 @@ exports[`ClickUpTypeScriptProject defaults package.json 1`] = ` }, "devDependencies": { "@types/jest": "*", - "@types/node": "^14", + "@types/node": "^18", "@typescript-eslint/eslint-plugin": "^6", "@typescript-eslint/parser": "^6", "esbuild": "*", @@ -246,7 +246,7 @@ exports[`ClickUpTypeScriptProject defaults package.json 1`] = ` "typescript": "*", }, "engines": { - "node": ">= 14.18.0", + "node": ">= 18.17.1", }, "jest": { "clearMocks": true, diff --git a/test/clickup-ts.test.ts b/test/clickup-ts.test.ts index b6c172d0..c8aa9a63 100644 --- a/test/clickup-ts.test.ts +++ b/test/clickup-ts.test.ts @@ -26,8 +26,8 @@ describe('ClickUpTypeScriptProject', () => { test('jest is enabled', () => { expect(p.jest).toBeTruthy(); }); - test('min node version is 14', () => { - expect(synth['package.json'].engines.node).toBe('>= 14.18.0'); + test('min node version is 18', () => { + expect(synth['package.json'].engines.node).toBe('>= 18.17.1'); }); // TODO: soooo many more tests need to be written here. }); diff --git a/yarn.lock b/yarn.lock index b9491a03..bfa9cedf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1047,10 +1047,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.10.tgz#73c9480791e3ddeb4887a660fc93a7f59353ad45" integrity sha512-vwzFiiy8Rn6E0MtA13/Cxxgpan/N6UeNYR9oUu6kuJWxu6zCk98trcDp8CBhbtaeuq9SykCmXkFr2lWLoPcvLg== -"@types/node@^16": - version "16.18.40" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.40.tgz#968d64746d20cac747a18ca982c0f1fe518c031c" - integrity sha512-+yno3ItTEwGxXiS/75Q/aHaa5srkpnJaH+kdkTVJ3DtJEwv92itpKbxU+FjPoh2m/5G9zmUQfrL4A4C13c+iGA== +"@types/node@^18": + version "18.17.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.17.18.tgz#acae19ad9011a2ab3d792232501c95085ba1838f" + integrity sha512-/4QOuy3ZpV7Ya1GTRz5CYSz3DgkKpyUptXuQ5PPce7uuyJAOR7r9FhkmxJfvcNUXyklbC63a+YvB3jxy7s9ngw== "@types/normalize-package-data@^2.4.0": version "2.4.1"