My First Dive into Big Open Source: Tackling Blocksuite
Published: 2023-11-25 23:13:02

## Introduction

In the bustling realm of open source collaboration, I recently took a plunge into the Blocksuite project—a robust playground with 3.1k stars and a thriving community of 102 contributors. My mission? Tackling a TypeScript type error lurking in the shadows of `vite.config.size.ts` ([PR #5412](https://github.com/toeverything/blocksuite/pull/5412)). This journey was a profound exploration, not just into code but also into the collaborative spirit that powers open source development.

## The Challenge Unveiled

The challenge at hand was a TypeScript type error that surfaced in the [`vite.config.size.ts` file](https://github.com/toeverything/blocksuite/issues/5408). The crux of the issue lay in the type inference of the 'base' configuration. While TypeScript anticipated a function call, it turned out that 'base' was a function itself. The consequences were disruptions in the build process, creating a less-than-ideal development environment.

## Crafting the Solution

To tackle this challenge head-on, I implemented a two-fold solution. First, I introduced explicit type annotations to define the type of the 'base' configuration in `vite.config.size.ts`. Second, I ensured that the 'base' function received the necessary parameter `{ mode: process.env.NODE_ENV }`. These changes were carefully crafted not only to resolve the TypeScript type errors but also to pave the way for a more seamless build process.

- **Modified `vite.config.size.ts`:** Invoked the 'base' function with the required parameter.

## Testing the Waters

Before presenting my contribution to the broader Blocksuite community, I conducted comprehensive local testing. The goal was clear: ensure that the modifications eradicated TypeScript type errors and that the build process ran effortlessly.

## The Pull Request Odyssey

The journey of my [pull request](https://github.com/toeverything/blocksuite/pull/5412) was more than a mere submission. It evolved through multiple commits, with each commit addressing a specific aspect of the codebase. As an advocate for clean and organized code, linting became a prominent feature of this coding adventure.

## Automated Checks and Reviews

The Blocksuite project boasted a robust set of automated checks and reviews. The CI workflow, Size Report workflow, and 10 ECE Playground checks played a pivotal role in validating the integrity of my contribution. The Vercel deployment previews provided a tangible preview of the impact of my changes.

## The CLA Hurdle

The open-source adventure presented an unexpected twist in the form of the [Contributor License Agreement (CLA)](https://github.com/toeverything/blocksuite/blob/master/.github/CLA.md). Signing the CLA was a necessary step, symbolizing a commitment to the collaborative spirit of open source.

## Title Lint Challenge

One unexpected challenge surfaced during the PR title lint check. Adjustments were made to align with the supported scopes, ensuring that the pull request adhered to the project's conventions.

## Merge and Approval

After navigating through these challenges, the moment of truth arrived. The changes were reviewed, approved, and officially [merged into the Blocksuite project](https://github.com/toeverything/blocksuite/pull/5412#issuecomment-1190966034). This collaborative effort was made possible with the guidance of project maintainers and contributors, notably @doodlewind.

## Conclusion

My inaugural journey into a significant open source project like Blocksuite was more than a coding challenge; it was an enriching experience. From decoding TypeScript errors to navigating the intricacies of testing and review processes, each step brought valuable lessons. As I conclude this chapter, I carry not just the satisfaction of resolving an issue but also a deeper understanding of collaborative coding in the open source community. This adventure marks a milestone in my journey as a contributor, and I eagerly anticipate more challenges and collaborations in the vibrant world of open source.