Skip to content

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented Jan 26, 2026

Summary

This PR sets up workspaces for improved package management.

Requirements

@zimeg zimeg self-assigned this Jan 26, 2026
@zimeg zimeg added semver:patch area:performance issues where performance is a meaningful concern pkg:web-api applies to `@slack/web-api` pkg:rtm-api applies to `@slack/rtm-api` pkg:webhook applies to `@slack/webhook` pkg:logger applies to `@slack/logger` pkg:types applies to `@slack/types` pkg:oauth applies to `@slack/oauth` pkg:socket-mode applies to `@slack/socket-mode` pkg:cli-hooks applies to `@slack/cli-hooks` pkg:cli-test applies to `@slack/cli-test` javascript Pull requests that update Javascript code labels Jan 26, 2026
@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.09%. Comparing base (a1112e3) to head (a2205af).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2478      +/-   ##
==========================================
- Coverage   93.09%   93.09%   -0.01%     
==========================================
  Files          40       40              
  Lines       11240    11239       -1     
  Branches      713      713              
==========================================
- Hits        10464    10463       -1     
  Misses        764      764              
  Partials       12       12              
Flag Coverage Δ
cli-hooks 95.23% <ø> (ø)
cli-test 94.79% <ø> (ø)
oauth 77.39% <ø> (ø)
socket-mode 61.87% <ø> (ø)
web-api 98.11% <ø> (-0.01%) ⬇️
webhook 96.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

📬 A few messages for the kind reviewers!

Comment on lines +47 to +64
- 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
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!


The script places the reference markdown files in `/docs/english/reference/package-name`.

### 🚀 Releases
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: These steps are verbose now but I'm hoping to fast follow this change with some enhancement to the release process! For now these steps still package as expected, testing with the following:

$ npm pack --workspace=@slack/web-api --dry-run

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.

"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 🤖

Comment on lines +21 to +24
"scripts": {
"lint": "npx @biomejs/biome check packages",
"lint:fix": "npx @biomejs/biome check --write packages"
},
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 🧪 ✨

@zimeg zimeg marked this pull request as ready for review January 29, 2026 05:07
@zimeg zimeg requested a review from a team as a code owner January 29, 2026 05:07
Copy link
Contributor

@srtaalej srtaalej left a comment

Choose a reason for hiding this comment

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

looking forward to using this ⭐ 🤩

@mwbrooks mwbrooks changed the title build: setup monorepo workspace for dependent packages build: setup monorepo npm workspace for dependent packages Jan 29, 2026
Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

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

✅ Praise goes to @zimeg and this pull request!

  • Significantly simplifies the CI workflow
  • Centralized linting and reduced biome duplication
  • Dependabot tracks the root-level npm dependency

Comment on lines +47 to +64
- 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
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!


Labels are used to run issues through an organized workflow. Here are the basic definitions:

* `bug`: A confirmed bug report. A bug is considered confirmed when reproduction steps have been documented and the
Copy link
Member

Choose a reason for hiding this comment

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

praise: Nice find!

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 Thanks for taking notice! The leading * can be confusing with later bold formatting and the linter I use replaces this kind!

🔗 https://github.com/artempyanykh/marksman

"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.

❤️

Comment on lines +21 to +24
"scripts": {
"lint": "npx @biomejs/biome check packages",
"lint:fix": "npx @biomejs/biome check --write packages"
},
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!


```sh
npm install path/to/node-slack-sdk/packages/slack-web-api-*.tgz
npm install path/to/node-slack-sdk/slack-web-api-*.tgz
Copy link
Member

Choose a reason for hiding this comment

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

question: Is this path correct? Or, should it include /packages/?

Suggested change
npm install path/to/node-slack-sdk/slack-web-api-*.tgz
npm install path/to/node-slack-sdk/packages/slack-web-api-*.tgz

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 I fear the earlier change was missing the actual package path itself! But now in a monorepo setup these packages are built at the top level 🎁

Copy link
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

🔭 A final note on documentation before merging soon!

Comment on lines -54 to +60
npm run docs
npm run docs --workspace packages/web-api
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 existence of workspaces adds more information to reference that I think is meaningful to keep, but I want to call this out as a change:

- Defined in: [src/errors.ts:13](https://github.com/slackapi/node-slack-sdk/blob/main/packages/webhook/src/errors.ts#L13)
+ Defined in: [packages/webhook/src/errors.ts:13](https://github.com/slackapi/node-slack-sdk/blob/main/packages/webhook/src/errors.ts#L13)

@zimeg
Copy link
Member Author

zimeg commented Jan 29, 2026

@srtaalej @mwbrooks Huge thanks in helping bring these changes to the finish line 🏁

At least for now! We might find more improvements toward maintenance in #2483 but let's merge this now for adjacent tests of #2484!

This might also be noted as effort toward #2359 as the latest features of node and npm become encouraged 🐢 ✨

@zimeg zimeg merged commit 45452bc into main Jan 29, 2026
58 checks passed
@zimeg zimeg deleted the zimeg-build-workspaces branch January 29, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:performance issues where performance is a meaningful concern javascript Pull requests that update Javascript code pkg:cli-hooks applies to `@slack/cli-hooks` pkg:cli-test applies to `@slack/cli-test` pkg:logger applies to `@slack/logger` pkg:oauth applies to `@slack/oauth` pkg:rtm-api applies to `@slack/rtm-api` pkg:socket-mode applies to `@slack/socket-mode` pkg:types applies to `@slack/types` pkg:web-api applies to `@slack/web-api` pkg:webhook applies to `@slack/webhook` semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants