|
| 1 | +# Development |
| 2 | + |
| 3 | +This guide provides instructions for setting up your development environment to contribute to the `@toolbox/core` package, which is part of the `mcp-toolbox-sdk-js` monorepo. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +Before you begin, ensure you have the following installed: |
| 8 | + |
| 9 | +* Node.js ([LTS version recommended](https://nodejs.org/en/download/)) |
| 10 | + |
| 11 | +## Setup |
| 12 | + |
| 13 | +These steps will guide you through setting up the monorepo and this specific package for development. |
| 14 | + |
| 15 | +1. Clone the repository: |
| 16 | + |
| 17 | + ```bash |
| 18 | + git clone https://github.com/googleapis/mcp-toolbox-sdk-js.git |
| 19 | + ``` |
| 20 | + |
| 21 | +2. Navigate to the **package directory**: |
| 22 | + |
| 23 | + ```bash |
| 24 | + cd mcp-toolbox-sdk-js/packages/toolbox-core |
| 25 | + ``` |
| 26 | + |
| 27 | +3. Install dependencies for your package: |
| 28 | + |
| 29 | + ```bash |
| 30 | + npm install |
| 31 | + ``` |
| 32 | + |
| 33 | +4. Local Testing |
| 34 | + If you need to test changes in `@toolbox/core` against another local project |
| 35 | + or another package that consumes `@toolbox/core`, you can use npm link |
| 36 | + |
| 37 | + * In packages/toolbox-core |
| 38 | + |
| 39 | + ```bash |
| 40 | + npm link |
| 41 | + ``` |
| 42 | + |
| 43 | + * In your consuming project |
| 44 | + |
| 45 | + ```bash |
| 46 | + npm link @toolbox/core |
| 47 | + ``` |
| 48 | + |
| 49 | + This creates a symbolic link, allowing changes in `@toolbox/core` to be |
| 50 | + immediately reflected in the consuming project without reinstallation. |
| 51 | + |
| 52 | + Don't forget to npm unlink / yarn unlink when done! |
| 53 | +
|
| 54 | +## Testing |
| 55 | +
|
| 56 | +Ensure all tests pass before submitting your changes. Tests are typically run from within the `packages/toolbox-core` directory. |
| 57 | +
|
| 58 | +> [!IMPORTANT] |
| 59 | +> Dependencies (including testing tools) should have been installed during the initial `npm install` at the monorepo root. |
| 60 | +
|
| 61 | +1. **Run Unit Tests:** |
| 62 | +
|
| 63 | + ```bash |
| 64 | + npm run test:unit |
| 65 | + ``` |
| 66 | +
|
| 67 | +1. **Run End-to-End (E2E) / Integration Tests:** |
| 68 | +
|
| 69 | + ```bash |
| 70 | + npm run test:e2e |
| 71 | + ``` |
| 72 | +
|
| 73 | +## Linting and Formatting |
| 74 | +
|
| 75 | +This project uses linters (e.g., ESLint) and formatters (e.g., Prettier) to maintain code quality and consistency. |
| 76 | +
|
| 77 | +1. **Run Linter:** |
| 78 | + Check your code for linting errors: |
| 79 | +
|
| 80 | + ```bash |
| 81 | + npm run lint |
| 82 | + ``` |
| 83 | +
|
| 84 | +2. **Fix Lint/Format Issues:** |
| 85 | + Automatically fix fixable linting and formatting issues: |
| 86 | +
|
| 87 | + ```bash |
| 88 | + npm run fix |
| 89 | + ``` |
| 90 | +
|
| 91 | +## Committing Changes |
| 92 | +
|
| 93 | +* **Branching:** Create a new branch for your feature or bug fix (e.g., `feature/my-new-feature` or `fix/issue-123`). |
| 94 | +* **Commit Messages:** Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit message conventions. |
| 95 | +* **Pre-submit checks:** On any PRs, presubmit checks like linters, unit tests |
| 96 | + and integration tests etc. are run. Make sure all checks are green before |
| 97 | + proceeding. |
| 98 | +* **Submitting a PR:** On approval by a repo maintainer, *Squash and Merge* your PR. |
| 99 | +
|
| 100 | +## Further Information |
| 101 | +
|
| 102 | +* If you encounter issues or have questions, please open an [issue](https://github.com/googleapis/mcp-toolbox-sdk-js/issues) on the GitHub repository. |
0 commit comments