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