Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monorepo structure #745

Merged
merged 189 commits into from
Mar 28, 2019
Merged

Monorepo structure #745

merged 189 commits into from
Mar 28, 2019

Conversation

aoberoi
Copy link
Contributor

@aoberoi aoberoi commented Mar 19, 2019

Summary

We're moving to a monorepo for v5 🎉!

This PR isn't yet complete, but when it is, it will accomplish the following:

  • Create individual packages for the WebClient (@slack/web-api), RTMClient (@slack/rtm-api), and IncomingWebhook (@slack/webhook) classes from this package.

  • Recreate @slack/client as a thin wrapper for the packages in the previous point, preserving the exports where possible. This means that breaking changes from v4 to v5 obviously will impact the exports, but you should be able to find the same things in the same place. As far as what's not possible, there's only one detail that cannot be unified: in a TypeScript project, the ErrorCode export will not be an enum, but instead a value (not in the type namespace).

  • Import the @slack/events-api and @slack/interactive-messages packages to live alongside the packages in this new monorepo structure.

  • Extract @slack/logger and @slack/types into independent packages for reuse. These are mainly expected to be used by the previously mentioned packages, but are also available to anyone who finds them useful.

  • Refactor documentation generation workflow and structure to include documentation for each individual package. Each package should also have its own README.md that describes its usage at a high level. The overall Getting Started tutorial should remain about the same, and we likely need to build new tutorials for the new packages in the future.

  • Revise documentation for references to old package names. Host the migration guide for v4 -> v5 in the documentation site and the GitHub Wiki.

  • Implement a combined CI workflow (Travis) that reports results for each individual package as an item in the test matrix. We will also need combined coverage reporting (Codecov).

  • Produce an updated maintainers guide for all the common workflows. This should include new information around how changelogs are published, new tag naming conventions, etc. There may need to be new documentation specific to managing the monorepo and some of the decisions that were put into this structure (thinking a high level philosophy and an FAQ). These materials are very important for continued collaboration with the community as well as onboarding new maintainers. Update maintainers guide for mono repo structure #748

  • Move examples from each of the packages into their own top-level directory called examples. Use lerna to manage each example as a package. Add examples to monorepo #747

  • Utilize the addAppMetadata() hook of the @slack/web-api package from the @slack/rtm-api package, so that we can continue to get information regarding the tools from the User-Agent header. Also add User-Agent header to IncomingWebhook, since its now independent.

  • Update issue template(s) to ask the reporter which package(s) their issue concerns. In the case of bug reports, this is especially important, since it changes how they answer the question regarding versions. Update issue templates and labels for monorepo #749

Other items that must be completed before this change can be shipped:

(The list above 👆 might also grow and contract before this PR merges.)

Fixes #677
Fixes #738
Fixes #742

Requirements (place an x in each [ ])

* created @slack/logger package to share logging code in
@slack/web-api and @slack/rtm-api (and potentially more)
* created @slack/types package to share types that are reusable shapes
* breaking changes to error codes - removed unused error codes (one in web-api
and one in rtm-api). also rewrote all the strings
stored in those constants
* non breaking changes to error codes - added more codes for rtm-api
* added a VSCode workspace with a folder for each package and one for the root
* go back to using npm script prepare for build, prepublishOnly was not the
right behavior
* make sire build is executed before test in npm scripts
* TLSOptions is now based on a type from @types/node instead of copy/pasted
* temporarily disables running on integration test in @slack/web-api,
  we likely need to do these tests in a lerna managed package so that
  installation doesn't fail.
* removes p-is-promise unecessary development dependency
* updates tests for minor differences
the strategy is to use a combination of environment variables with
lerna's scope argument to get individual builds for each package.
this depends on each package naming its scripts precisely the same
thing for certain operations: test, lint, and coverage. notably,
its okay for a script to be missing because lerna run will handle
only dispatching to packages where the script is defined.
@aoberoi aoberoi force-pushed the lernafy branch 4 times, most recently from 03a7c87 to 939cae2 Compare March 22, 2019 16:54
improve styles on documentation site to fix the header, tweak the in-page styles,
build an in-document focussed navigation.
@aoberoi aoberoi merged commit 62c247b into slackapi:dev-v5 Mar 28, 2019
@aoberoi aoberoi changed the title WIP: Monorepo structure Monorepo structure Mar 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants