cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v7

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

packages/mcp-server/build

56lines · modecode

1#!/usr/bin/env bash
2set -exuo pipefail
3
4rm -rf dist; mkdir dist
5
6# Copy src to dist/src and build from dist/src into dist, so that
7# the source map for index.js.map will refer to ./src/index.ts etc
8cp -rp src README.md dist
9
10for file in LICENSE; do
11 if [ -e "../../${file}" ]; then cp "../../${file}" dist; fi
12done
13
14for file in CHANGELOG.md; do
15 if [ -e "${file}" ]; then cp "${file}" dist; fi
16done
17
18# this converts the export map paths for the dist directory
19# and does a few other minor things
20PKG_JSON_PATH=../../packages/mcp-server/package.json node ../../scripts/utils/make-dist-package-json.cjs > dist/package.json
21
22# updates the `cloudflare` dependency to point to NPM
23node scripts/postprocess-dist-package-json.cjs
24
25# build to .js/.mjs/.d.ts files
26./node_modules/.bin/tsc-multi
27
28cp tsconfig.dist-src.json dist/src/tsconfig.json
29
30chmod +x dist/index.js
31
32DIST_PATH=./dist PKG_IMPORT_PATH=cloudflare-mcp/ node ../../scripts/utils/postprocess-files.cjs
33
34# mcp bundle
35rm -rf dist-bundle cloudflare_api.mcpb; mkdir dist-bundle
36
37# copy package.json
38PKG_JSON_PATH=../../packages/mcp-server/package.json node ../../scripts/utils/make-dist-package-json.cjs > dist-bundle/package.json
39
40# copy files
41node scripts/copy-bundle-files.cjs
42
43# install runtime deps
44cd dist-bundle
45npm install
46cd ..
47
48# pack bundle
49cp manifest.json dist-bundle
50
51npx mcpb pack dist-bundle cloudflare_api.mcpb
52
53npx mcpb sign cloudflare_api.mcpb --self-signed
54
55# clean up
56rm -rf dist-bundle
57