From 3fba83da314bca63c028324e7fb94611966c0301 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Mon, 16 Dec 2024 21:02:11 -0800 Subject: [PATCH 1/6] ci: attempt to test typescript samples without dev deps --- .github/workflows/samples.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/samples.yml b/.github/workflows/samples.yml index 9a6d34f0c..9a7edbfb9 100644 --- a/.github/workflows/samples.yml +++ b/.github/workflows/samples.yml @@ -22,7 +22,7 @@ jobs: node-version: ${{ matrix.node-version }} - uses: actions/checkout@v4 - name: Install dependencies and link bolt-js - run: npm i && npm link . + run: npm i --omit=dev --ignore-scripts && npm link . - name: Install example dependencies and link bolt-js working-directory: ${{ matrix.example }} run: npm i && npm link @slack/bolt @@ -48,7 +48,7 @@ jobs: path: ./bolt-js - name: Install and link bolt-js working-directory: ./bolt-js - run: npm i && npm link . + run: npm i --omit=dev --ignore-scripts && npm link . - name: Checkout ${{ matrix.sample }} uses: actions/checkout@v4 with: @@ -60,4 +60,3 @@ jobs: - name: Compile sample working-directory: ./sample run: npx tsc - From 3d8f5a36bfd10d2a607c20b13828f7e4f7148aff Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Mon, 16 Dec 2024 21:29:05 -0800 Subject: [PATCH 2/6] ci: package the changes instead of linking a checkout --- .github/workflows/samples.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/samples.yml b/.github/workflows/samples.yml index 9a7edbfb9..dafeec423 100644 --- a/.github/workflows/samples.yml +++ b/.github/workflows/samples.yml @@ -21,11 +21,11 @@ jobs: with: node-version: ${{ matrix.node-version }} - uses: actions/checkout@v4 - - name: Install dependencies and link bolt-js - run: npm i --omit=dev --ignore-scripts && npm link . - - name: Install example dependencies and link bolt-js + - name: Install dependencies and package bolt-js + run: npm i && npm pack . + - name: Install example dependencies and current bolt-js working-directory: ${{ matrix.example }} - run: npm i && npm link @slack/bolt + run: npm i && npm i ../slack-bolt-*.tgz - name: Compile sample working-directory: ${{ matrix.example }} run: npm run build @@ -46,17 +46,17 @@ jobs: uses: actions/checkout@v4 with: path: ./bolt-js - - name: Install and link bolt-js + - name: Install and package bolt-js working-directory: ./bolt-js - run: npm i --omit=dev --ignore-scripts && npm link . + run: npm i && npm pack . - name: Checkout ${{ matrix.sample }} uses: actions/checkout@v4 with: repository: ${{ matrix.sample }} path: ./sample - - name: Install sample dependencies and link bolt-js + - name: Install sample dependencies and current bolt-js working-directory: ./sample - run: npm i && npm link @slack/bolt + run: npm i && npm i ../bolt-js/slack-bolt-*.tgz - name: Compile sample working-directory: ./sample run: npx tsc From ab2504fd4bfe0b2f1951a18d3cb641189eca5bb7 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Mon, 16 Dec 2024 21:31:33 -0800 Subject: [PATCH 3/6] fix: jump two directories up to the packaged tgz --- .github/workflows/samples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/samples.yml b/.github/workflows/samples.yml index dafeec423..eb80361be 100644 --- a/.github/workflows/samples.yml +++ b/.github/workflows/samples.yml @@ -25,7 +25,7 @@ jobs: run: npm i && npm pack . - name: Install example dependencies and current bolt-js working-directory: ${{ matrix.example }} - run: npm i && npm i ../slack-bolt-*.tgz + run: npm i && npm i ../../slack-bolt-*.tgz - name: Compile sample working-directory: ${{ matrix.example }} run: npm run build From e5ad367e0cc29ddeaac1cc032b573e1f46ae4bd0 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Mon, 16 Dec 2024 22:03:58 -0800 Subject: [PATCH 4/6] ci: perform typechecking on the oauth express receiver js app --- .github/workflows/samples.yml | 1 + examples/oauth-express-receiver/package.json | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/samples.yml b/.github/workflows/samples.yml index eb80361be..0f664cd6b 100644 --- a/.github/workflows/samples.yml +++ b/.github/workflows/samples.yml @@ -15,6 +15,7 @@ jobs: example: - examples/getting-started-typescript - examples/custom-receiver + - examples/oauth-express-receiver steps: - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 diff --git a/examples/oauth-express-receiver/package.json b/examples/oauth-express-receiver/package.json index 3b07a1369..dcc6d7398 100644 --- a/examples/oauth-express-receiver/package.json +++ b/examples/oauth-express-receiver/package.json @@ -5,11 +5,14 @@ "main": "app.js", "scripts": { "start": "node app.js", - "test": "echo \"Error: no test specified\" && exit 1" + "build": "npx tsc --allowJs --noEmit --esModuleInterop app.js" }, "author": "Slack Technologies, Inc.", "license": "MIT", "dependencies": { "@slack/bolt": "^3.6.0" + }, + "devDependencies": { + "typescript": "^5.7.2" } } From 155d38bab3da071e840d1a6ab7518c99068f6ed0 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Mon, 16 Dec 2024 22:04:29 -0800 Subject: [PATCH 5/6] test: add a type statement that requires unmet dependencies --- examples/oauth-express-receiver/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/oauth-express-receiver/app.js b/examples/oauth-express-receiver/app.js index 779812ba9..988d2554f 100644 --- a/examples/oauth-express-receiver/app.js +++ b/examples/oauth-express-receiver/app.js @@ -1,5 +1,10 @@ const { App, ExpressReceiver, LogLevel, FileInstallationStore } = require('@slack/bolt'); +/** + * @type {import("@slack/bolt/dist/receivers/ParamsIncomingMessage").ParamsIncomingMessage}; + */ +const _example = null; + // Create an ExpressReceiver const receiver = new ExpressReceiver({ signingSecret: process.env.SLACK_SIGNING_SECRET, From 5ea64ca8e1ee627bda7ba439e346f4533165840a Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Mon, 16 Dec 2024 22:08:10 -0800 Subject: [PATCH 6/6] ci: remove bolt-js dependencies before testing apps --- .github/workflows/samples.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/samples.yml b/.github/workflows/samples.yml index 0f664cd6b..037e25aec 100644 --- a/.github/workflows/samples.yml +++ b/.github/workflows/samples.yml @@ -22,9 +22,9 @@ jobs: with: node-version: ${{ matrix.node-version }} - uses: actions/checkout@v4 - - name: Install dependencies and package bolt-js - run: npm i && npm pack . - - name: Install example dependencies and current bolt-js + - name: Package the latest changes to bolt-js + run: npm i && npm pack . && rm -rf node_modules + - name: Install example dependencies for testing working-directory: ${{ matrix.example }} run: npm i && npm i ../../slack-bolt-*.tgz - name: Compile sample @@ -47,15 +47,15 @@ jobs: uses: actions/checkout@v4 with: path: ./bolt-js - - name: Install and package bolt-js + - name: Package the latest changes to bolt-js working-directory: ./bolt-js - run: npm i && npm pack . + run: npm i && npm pack . && rm -rf node_modules - name: Checkout ${{ matrix.sample }} uses: actions/checkout@v4 with: repository: ${{ matrix.sample }} path: ./sample - - name: Install sample dependencies and current bolt-js + - name: Install sample dependencies for testing working-directory: ./sample run: npm i && npm i ../bolt-js/slack-bolt-*.tgz - name: Compile sample