-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[v2] Мonorepo, sdk-client, sdk-server, sdk-core package split
#1279
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
base: main
Are you sure you want to change the base?
Changes from all commits
be2e264
cfa0615
8922ada
ebeacac
d372e75
4db8d1b
617f14e
0446560
a089abc
647e5f0
6c0818f
ea354fc
951a234
a7e60b9
9d1e86c
236e934
f20be12
c9fcc39
f939900
d9cd7fe
f057363
c3be975
c3353c9
f1c45f2
3e0657f
9f519c5
3c11e9f
c182b5d
3275de7
2020e7f
c21a566
d957fc0
7e92ba4
7bd609c
15b27d0
ea2fc03
5662909
b5390d4
228097e
76a86a5
2dee387
b532047
a942551
2ff0cc5
88573af
3ad9577
f01e323
9c9d10b
7eb6fe3
8bbd59f
3f6e352
60de202
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Changesets | ||
|
|
||
| Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
| with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
| find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
|
||
| We have a quick list of common questions to get you started engaging with this project in | ||
| [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json", | ||
| "changelog": ["@changesets/changelog-github", { "repo": "@modelcontextprotocol/typescript-sdk" }], | ||
| "commit": false, | ||
| "fixed": [], | ||
| "linked": [], | ||
| "access": "public", | ||
| "baseBranch": "main", | ||
| "updateInternalDependencies": "patch", | ||
| "ignore": [ | ||
| "@modelcontextprotocol/sdk-examples-client", | ||
| "@modelcontextprotocol/sdk-examples-server", | ||
| "@modelcontextprotocol/sdk-examples-shared" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@modelcontextprotocol/sdk-client': patch | ||
| '@modelcontextprotocol/sdk-server': patch | ||
| --- | ||
|
|
||
| Initial 2.0.0-alpha.0 client and server package |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| name: Publish Any Commit | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
|
|
@@ -14,14 +16,26 @@ jobs: | |
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we merge this on main, will we still be able to ship
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We would be able to, because the .yml version would still be the old one on the v1 branch. |
||
| with: | ||
| run_install: false | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24 | ||
| cache: npm | ||
| cache: pnpm | ||
| cache-dependency-path: pnpm-lock.yaml | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Build packages | ||
| run: pnpm run build:all | ||
|
|
||
| - run: npm ci | ||
| - name: Build | ||
| run: npm run build | ||
| - name: Publish | ||
| run: npx pkg-pr-new publish | ||
| - name: Publish preview packages | ||
| run: pnpm dlx pkg-pr-new publish --packageManager=pnpm --pnpm './packages/server' './packages/client' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| name: Release | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| run_install: false | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24 | ||
| cache: pnpm | ||
| cache-dependency-path: pnpm-lock.yaml | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Create Release Pull Request or Publish to npm | ||
| id: changesets | ||
| uses: changesets/action@v1 | ||
| with: | ||
| publish: pnpm run build:all && pnpm changeset publish | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // @ts-check | ||
| import path from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
|
|
||
| import eslint from '@eslint/js'; | ||
| import { defineConfig } from 'eslint/config'; | ||
| import eslintConfigPrettier from 'eslint-config-prettier/flat'; | ||
| import importPlugin from 'eslint-plugin-import'; | ||
| import nodePlugin from 'eslint-plugin-n'; | ||
| import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort'; | ||
| import { configs } from 'typescript-eslint'; | ||
|
|
||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| export default defineConfig( | ||
| eslint.configs.recommended, | ||
| ...configs.recommended, | ||
| importPlugin.flatConfigs.recommended, | ||
| importPlugin.flatConfigs.typescript, | ||
| { | ||
| languageOptions: { | ||
| parserOptions: { | ||
| // Ensure consumers of this shared config get a stable tsconfig root | ||
| tsconfigRootDir: __dirname | ||
| } | ||
| }, | ||
| linterOptions: { | ||
| reportUnusedDisableDirectives: false | ||
| }, | ||
| plugins: { | ||
| n: nodePlugin, | ||
| 'simple-import-sort': simpleImportSortPlugin | ||
| }, | ||
| settings: { | ||
| 'import/resolver': { | ||
| typescript: { | ||
| // Let the TS resolver handle NodeNext-style imports like "./foo.js" | ||
| extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts'], | ||
| // Use the tsconfig in each package root (when running ESLint from that package) | ||
| project: 'tsconfig.json' | ||
| } | ||
| } | ||
| }, | ||
| rules: { | ||
| '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], | ||
| 'n/prefer-node-protocol': 'error', | ||
| '@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }], | ||
| 'simple-import-sort/imports': 'warn', | ||
| 'simple-import-sort/exports': 'warn', | ||
| 'import/no-extraneous-dependencies': [ | ||
| 'error', | ||
| { | ||
| devDependencies: [ | ||
| '**/test/**', | ||
| '**/*.test.ts', | ||
| '**/*.test.tsx', | ||
| '**/scripts/**', | ||
| '**/vitest.config.*', | ||
| '**/tsdown.config.*', | ||
| '**/eslint.config.*', | ||
| '**/vitest.setup.*' | ||
| ], | ||
| optionalDependencies: false, | ||
| peerDependencies: true | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| // Ignore generated protocol types everywhere | ||
| ignores: ['**/spec.types.ts'] | ||
| }, | ||
| { | ||
| files: ['packages/client/**/*.ts', 'packages/server/**/*.ts'], | ||
| ignores: ['**/*.test.ts'], | ||
| rules: { | ||
| 'no-console': 'error' | ||
| } | ||
| }, | ||
| eslintConfigPrettier | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "name": "@modelcontextprotocol/eslint-config", | ||
felixweinberger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "private": true, | ||
| "main": "eslint.config.mjs", | ||
| "type": "module", | ||
| "exports": { | ||
| ".": "./eslint.config.mjs" | ||
| }, | ||
| "dependencies": { | ||
| "typescript": "catalog:devTools" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/modelcontextprotocol/typescript-sdk.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/modelcontextprotocol/typescript-sdk/issues" | ||
| }, | ||
| "homepage": "https://github.com/modelcontextprotocol/typescript-sdk/tree/develop/common/eslint-config", | ||
| "publishConfig": { | ||
| "registry": "https://npm.pkg.github.com/" | ||
| }, | ||
| "version": "2.0.0", | ||
| "devDependencies": { | ||
| "@eslint/js": "catalog:devTools", | ||
| "eslint": "catalog:devTools", | ||
| "eslint-config-prettier": "catalog:devTools", | ||
| "eslint-import-resolver-typescript": "^4.4.4", | ||
| "eslint-plugin-import": "^2.32.0", | ||
| "eslint-plugin-n": "catalog:devTools", | ||
| "eslint-plugin-simple-import-sort": "^12.1.1", | ||
| "prettier": "catalog:devTools", | ||
| "typescript": "catalog:devTools", | ||
| "typescript-eslint": "catalog:devTools" | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we changing to
pnpm? Does it give us any advantages?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm does not support monorepo workspaces and convenience features
pnpmis currently one of the most popular (if not the most) package manager for monorepos. A lot of it is very similar tonpm, but it has a lot of features (incl monorepo) on top.