Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,11 @@ updates:
- "github_actions"
schedule:
interval: "monthly"

- package-ecosystem: "npm"
directory: "/"
labels:
- "dependencies"
- "javascript"
schedule:
interval: "weekly"
188 changes: 91 additions & 97 deletions .github/maintainers_guide.md
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📠 note: Apologies for noise in these changes, but a lot of formatting happened I fear.

Large diffs are not rendered by default.

63 changes: 23 additions & 40 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,31 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm --version
- run: npm install --verbose
working-directory: packages/${{ matrix.package }}
- name: Link dependent packages (*nix)
if: matrix.os == 'ubuntu-latest'
working-directory: packages/${{ matrix.package }}
- name: Install dependencies
run: |
# depending on which package we are testing, also npm link up dependent packages within this monorepo
case "$PWD" in
*/webhook) pushd ../types && npm i && popd && npm link ../types;;
*/web-api) pushd ../types && npm i && popd && npm link ../types && pushd ../logger && npm i && popd && npm link ../logger;;
*/oauth) pushd ../logger && npm i && popd && npm link ../logger && pushd ../web-api && npm i && popd && npm link ../web-api;;
*/socket-mode) pushd ../logger && npm i && popd && npm link ../logger && pushd ../web-api && npm i && popd && npm link ../web-api;;
*) ;; # default
esac
- name: Link dependent packages (Windows)
if: matrix.os == 'windows-latest'
working-directory: packages/${{ matrix.package }}
npm install --verbose
- name: Build packages
run: |
# Build packages without internal dependencies
npm run build --workspace=@slack/cli-hooks
npm run build --workspace=@slack/cli-test

# Build base dependencies
npm run build --workspace=@slack/logger
npm run build --workspace=@slack/types

# Build packages requiring base dependencies
npm run build --workspace=@slack/web-api
npm run build --workspace=@slack/webhook

# Build packages that depend on the Web API
npm run build --workspace=@slack/oauth
npm run build --workspace=@slack/rtm-api
npm run build --workspace=@slack/socket-mode
Comment on lines +47 to +64
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗣️ note: #2482 is an example of changing dependencies between packages being resolved as expected!

In that example, changes to @slack/types are required in @slack/web-api which cause tests on matching commit f2ac218 to fail in an unchanged branch. We might hope to include these changes as part of related PRs for confident CI without updates across prereleases 🫡

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also so much easier to read and maintain!

- name: Run tests
run: |
# depending on which package we are testing, also npm link up dependent packages within this monorepo
# NOTE: the following is PowerShell
echo "$pwd"
switch -Wildcard ( "$pwd" )
{
'*\webhook'
{
pushd ..\types && npm i && popd && npm link ..\types
}
'*\web-api'
{
pushd ..\types && npm i && popd && npm link ..\types && pushd ..\logger && npm i && popd && npm link ..\logger
}
'*\oauth'
{
pushd ..\logger && npm i && popd && npm link ..\logger && pushd ..\web-api && npm i && popd && npm link ..\web-api
}
'*\socket-mode'
{
pushd ..\logger && npm i && popd && npm link ..\logger && pushd ..\web-api && npm i && popd && npm link ..\web-api
}
}
- run: npm test
working-directory: packages/${{ matrix.package }}
npm run lint
npm test --workspace=@slack/${{ matrix.package }}
- name: Check for coverage report existence
id: check_coverage
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
Expand Down
35 changes: 34 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
}
}
},
"files": {
"includes": [
"packages/**",
"!!packages/client",
"!!packages/events-api",
"!!packages/interactive-messages"
]
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
Expand Down Expand Up @@ -44,5 +52,30 @@
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
},
"overrides": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

{
"includes": ["packages/web-api/src/types/response/**/*.ts"],
"linter": {
"rules": {
"complexity": {
"noBannedTypes": "off"
},
"suspicious": {
"noExplicitAny": "off"
}
}
}
},
{
"includes": ["packages/web-api/src/index.ts"],
"assist": {
"actions": {
"source": {
"organizeImports": "off"
}
}
}
}
]
}
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@slack",
"version": "0.0.0",
"private": true,
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/slackapi/node-slack-sdk.git"
},
"workspaces": [
"packages/cli-hooks",
"packages/cli-test",
"packages/logger",
"packages/oauth",
"packages/rtm-api",
"packages/socket-mode",
"packages/types",
"packages/web-api",
"packages/webhook"
],
"scripts": {
"lint": "npx @biomejs/biome check packages",
"lint:fix": "npx @biomejs/biome check --write packages"
},
Comment on lines +21 to +24
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪵 note: Linting becomes a global task with impressive speeds of biome - less than 1 second for all packages.

This is a noticed change to the maintenance tasks I think, but --workspace commands are preferred for package scripts overall, which are run from the root:

$ npm run test --workspace=@slack/webhook

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌲 note: I'm so open to adding more scripts here too, but hope to keep this PR scoped to minimal improvements of workspaces to start:

  • Automatic dependent and deduplicated package resolution in development
  • Shared linting scripts
  • Test fixes and simplified linking related to dependencies

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep this PR minimal and scoped, but we can always add more to scripts in future work!

I think a root-level npm test script would be nice to match our npm run lint. Future work!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwbrooks Nice callout! A shared test script sounds so amazing for testing changes that span packages 🧪 ✨

"devDependencies": {
"@biomejs/biome": "^2.0.5"
}
}
4 changes: 0 additions & 4 deletions packages/cli-hooks/biome.json

This file was deleted.

6 changes: 1 addition & 5 deletions packages/cli-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@
"url": "https://github.com/slackapi/node-slack-sdk/issues"
},
"scripts": {
"prebuild": "shx rm -rf ./coverage",
"build": "shx chmod +x src/*.js",
"prebuild": "shx rm -rf ./coverage",
"prelint": "tsc --noemit --module es2022 --maxNodeModuleJsDepth 0 --project ./jsconfig.json",
"lint": "npx @biomejs/biome check .",
"lint:fix": "npx @biomejs/biome check --write .",
"pretest": "npm run lint",
"test": "c8 --config ./test/.c8rc.json mocha --config ./test/.mocharc.json src/*.spec.js"
},
"bin": {
Expand All @@ -55,7 +52,6 @@
"semver": "^7.5.4"
},
"devDependencies": {
"@biomejs/biome": "^2.0.5",
"@types/minimist": "^1.2.5",
"@types/mocha": "^10.0.6",
"@types/node": "^25.0.3",
Expand Down
4 changes: 0 additions & 4 deletions packages/cli-test/biome.json

This file was deleted.

7 changes: 2 additions & 5 deletions packages/cli-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,15 @@
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage",
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
"lint": "npx @biomejs/biome check .",
"lint:fix": "npx @biomejs/biome check --write .",
"prepare": "npm run build",
"mocha": "cross-env SLACK_CLI_PATH=/doesnt/matter mocha --config ./test/.mocharc.json src/*.spec.ts src/**/*.spec.ts src/**/**/*.spec.ts",
"test": "npm run lint && npm run build && c8 --config ./test/.c8rc.json npm run mocha"
"prepack": "npm run build",
"test": "npm run build && c8 --config ./test/.c8rc.json npm run mocha"
},
"dependencies": {
"tree-kill": "^1.2.2",
"winston": "^3.8.2"
},
"devDependencies": {
"@biomejs/biome": "^2.0.5",
"@tsconfig/recommended": "^1.0.6",
"@types/chai": "^4.3.16",
"@types/mocha": "^10.0.6",
Expand Down
4 changes: 0 additions & 4 deletions packages/logger/biome.json

This file was deleted.

7 changes: 2 additions & 5 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,17 @@
"url": "https://github.com/slackapi/node-slack-sdk/issues"
},
"scripts": {
"prepare": "npm run build",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage",
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
"lint": "npx @biomejs/biome check .",
"lint:fix": "npx @biomejs/biome check --write .",
"test": "npm run lint && npm run test:unit",
"prepack": "npm run build",
"test": "npm run test:unit",
"test:unit": "npm run build && node --import tsx --test src/index.test.ts"
},
"dependencies": {
"@types/node": ">=18.0.0"
},
"devDependencies": {
"@biomejs/biome": "^2.0.5",
"shx": "^0.4.0",
"source-map-support": "^0.5.21",
"tsx": "^4.20.6",
Expand Down
4 changes: 0 additions & 4 deletions packages/oauth/biome.json

This file was deleted.

9 changes: 3 additions & 6 deletions packages/oauth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@
"url": "https://github.com/slackapi/node-slack-sdk/issues"
},
"scripts": {
"prepare": "npm run build",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗣️ note: The prepare script is replaced with prepack in all packages!

This helps prevent installation and build errors between packages on an initial install. Otherwise, packages are built when dependencies are installed with the prepare script, and the oauth package requires web-api is built but these are packaged in alphabetical order. Overrides for this aren't obvious to me...

AFAICT this isn't a breaking change since the prepack script is run still when packages are installed from Git. FWIW I cannot figure out how to install packages in a monorepo with that method in both cases either 🤖

"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage",
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
"lint": "npx @biomejs/biome check .",
"lint:fix": "npx @biomejs/biome check --write .",
"test": "npm run lint && npm run coverage",
"coverage": "npm run build && c8 --config ./test/.c8rc.json npm run test:mocha",
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
"prepack": "npm run build",
"test": "npm run coverage",
"test:mocha": "mocha --config ./test/.mocharc.json src/*.spec.ts src/**/*.spec.ts",
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm run build"
},
Expand All @@ -47,7 +45,6 @@
"jsonwebtoken": "^9"
},
"devDependencies": {
"@biomejs/biome": "^2.0.5",
"@types/chai": "^4",
"@types/mocha": "^10",
"@types/sinon": "^21",
Expand Down
4 changes: 0 additions & 4 deletions packages/rtm-api/biome.json

This file was deleted.

7 changes: 2 additions & 5 deletions packages/rtm-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@
"url": "https://github.com/slackapi/node-slack-sdk/issues"
},
"scripts": {
"prepare": "npm run build",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist",
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
"lint": "npx @biomejs/biome check .",
"lint:fix": "npx @biomejs/biome check --write .",
"test": "npm run lint && npm run build && npm run test:integration",
"prepack": "npm run build",
"test": "npm run build && npm run test:integration",
"test:integration": "mocha --config .mocharc.json test/integration.spec.js"
},
"dependencies": {
Expand All @@ -54,7 +52,6 @@
"ws": "^8"
},
"devDependencies": {
"@biomejs/biome": "^2.0.5",
"@types/chai": "^4",
"@types/mocha": "^10",
"@types/sinon": "^17",
Expand Down
4 changes: 0 additions & 4 deletions packages/socket-mode/biome.json

This file was deleted.

9 changes: 3 additions & 6 deletions packages/socket-mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,14 @@
"url": "https://github.com/slackapi/node-slack-sdk/issues"
},
"scripts": {
"prepare": "npm run build",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage",
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
"lint": "npx @biomejs/biome check .",
"lint:fix": "npx @biomejs/biome check --write .",
"test:unit": "mocha --config ./test/.mocharc.json src/**/*.spec.ts",
"prepack": "npm run build",
"test": "npm run build && npm run test:coverage && npm run test:integration",
"test:coverage": "c8 --config ./test/.c8rc.json npm run test:unit",
"test:integration": "mocha --config ./test/.mocharc.json test/integration.spec.js",
"test": "npm run lint && npm run build && npm run test:coverage && npm run test:integration",
"test:unit": "mocha --config ./test/.mocharc.json src/**/*.spec.ts",
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm test"
},
"dependencies": {
Expand All @@ -57,7 +55,6 @@
"ws": "^8"
},
"devDependencies": {
"@biomejs/biome": "^2.0.5",
"@tsconfig/recommended": "^1.0.7",
"@types/chai": "^4",
"@types/mocha": "^10",
Expand Down
4 changes: 0 additions & 4 deletions packages/types/biome.json

This file was deleted.

7 changes: 2 additions & 5 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@
"url": "https://github.com/slackapi/node-slack-sdk/issues"
},
"scripts": {
"prepare": "npm run build",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist",
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
"lint": "npx @biomejs/biome check .",
"lint:fix": "npx @biomejs/biome check --write .",
"test": "npm run lint && npm run build && npm run test:types",
"prepack": "npm run build",
"test": "npm run build && npm run test:types",
"test:types": "tsd"
},
"devDependencies": {
"@biomejs/biome": "^2.0.5",
"shx": "^0.4.0",
"tsd": "^0.33.0",
"typedoc": "^0.28.7",
Expand Down
29 changes: 0 additions & 29 deletions packages/web-api/biome.json

This file was deleted.

Loading