create-skybridge 0.0.0-dev.5766089 → 0.0.0-dev.580c9ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -43
- package/package.json +2 -2
- package/template/README.md +4 -4
- package/template/_gitignore +5 -0
- package/template/alpic.json +1 -2
- package/template/node_modules/.bin/mcp-inspector +2 -2
- package/template/node_modules/.bin/sb +21 -0
- package/template/node_modules/.bin/skybridge +21 -0
- package/template/node_modules/.bin/vite +2 -2
- package/template/package.json +12 -16
- package/template/server/src/index.ts +13 -10
- package/template/tsconfig.server.json +1 -1
- package/template/web/vite.config.ts +2 -2
- package/template/node_modules/.bin/shx +0 -21
package/dist/index.js
CHANGED
|
@@ -5,10 +5,6 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
import * as prompts from "@clack/prompts";
|
|
6
6
|
import mri from "mri";
|
|
7
7
|
const defaultProjectName = "skybridge-project";
|
|
8
|
-
const templates = [
|
|
9
|
-
{ value: "default", label: "a minimal implementation" },
|
|
10
|
-
{ value: "ecom", label: "a functional ecommerce carousel" },
|
|
11
|
-
];
|
|
12
8
|
// prettier-ignore
|
|
13
9
|
const helpMessage = `\
|
|
14
10
|
Usage: create-skybridge [OPTION]... [DIRECTORY]
|
|
@@ -19,10 +15,6 @@ Options:
|
|
|
19
15
|
-h, --help show this help message
|
|
20
16
|
--overwrite remove existing files in target directory
|
|
21
17
|
--immediate install dependencies and start development server
|
|
22
|
-
--template <template> use a specific template
|
|
23
|
-
|
|
24
|
-
Available templates:
|
|
25
|
-
${templates.map((t) => ` ${t.value.padEnd(23)} ${t.label}`).join("\n")}
|
|
26
18
|
|
|
27
19
|
Examples:
|
|
28
20
|
create-skybridge my-app
|
|
@@ -31,14 +23,13 @@ Examples:
|
|
|
31
23
|
export async function init(args = process.argv.slice(2)) {
|
|
32
24
|
const argv = mri(args, {
|
|
33
25
|
boolean: ["help", "overwrite", "immediate"],
|
|
34
|
-
alias: { h: "help"
|
|
26
|
+
alias: { h: "help" },
|
|
35
27
|
});
|
|
36
28
|
const argTargetDir = argv._[0]
|
|
37
29
|
? sanitizeTargetDir(String(argv._[0]))
|
|
38
30
|
: undefined;
|
|
39
31
|
const argOverwrite = argv.overwrite;
|
|
40
32
|
const argImmediate = argv.immediate;
|
|
41
|
-
const argTemplate = argv.template;
|
|
42
33
|
const help = argv.help;
|
|
43
34
|
if (help) {
|
|
44
35
|
console.log(helpMessage);
|
|
@@ -69,31 +60,7 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
69
60
|
targetDir = defaultProjectName;
|
|
70
61
|
}
|
|
71
62
|
}
|
|
72
|
-
// 2.
|
|
73
|
-
let templatePath = "../template";
|
|
74
|
-
if (!argTemplate && interactive) {
|
|
75
|
-
let message = "Please choose a template:";
|
|
76
|
-
const hasInvalidTemplate = argTemplate && !templates.some((t) => t.value === argTemplate);
|
|
77
|
-
if (hasInvalidTemplate) {
|
|
78
|
-
message = `${argTemplate} is not a valid template. Please choose one of the following:`;
|
|
79
|
-
}
|
|
80
|
-
const template = await prompts.select({
|
|
81
|
-
message,
|
|
82
|
-
options: templates.map((t) => ({
|
|
83
|
-
value: t.value,
|
|
84
|
-
label: `${t.value}: ${t.label}`,
|
|
85
|
-
})),
|
|
86
|
-
});
|
|
87
|
-
if (prompts.isCancel(template)) {
|
|
88
|
-
return cancel();
|
|
89
|
-
}
|
|
90
|
-
switch (template) {
|
|
91
|
-
case "ecom":
|
|
92
|
-
templatePath = "../../../examples/ecom-carousel";
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// 3. Handle directory if exist and not empty
|
|
63
|
+
// 2. Handle directory if exist and not empty
|
|
97
64
|
if (fs.existsSync(targetDir) && !isEmpty(targetDir)) {
|
|
98
65
|
let overwrite = argOverwrite ? "yes" : undefined;
|
|
99
66
|
if (!overwrite) {
|
|
@@ -133,20 +100,17 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
133
100
|
}
|
|
134
101
|
}
|
|
135
102
|
const root = path.join(process.cwd(), targetDir);
|
|
136
|
-
//
|
|
103
|
+
// 3. Copy the repository
|
|
137
104
|
prompts.log.step(`Copying template...`);
|
|
138
105
|
try {
|
|
139
|
-
const templateDir = fileURLToPath(new URL(
|
|
106
|
+
const templateDir = fileURLToPath(new URL("../template", import.meta.url));
|
|
140
107
|
// Copy template to target directory
|
|
141
108
|
fs.cpSync(templateDir, root, {
|
|
142
109
|
recursive: true,
|
|
143
110
|
filter: (src) => [".npmrc"].every((file) => !src.endsWith(file)),
|
|
144
111
|
});
|
|
145
|
-
//
|
|
146
|
-
fs.
|
|
147
|
-
dist/
|
|
148
|
-
.env*
|
|
149
|
-
.DS_store`);
|
|
112
|
+
// Rename _gitignore to .gitignore
|
|
113
|
+
fs.renameSync(path.join(root, "_gitignore"), path.join(root, ".gitignore"));
|
|
150
114
|
// Update project name in package.json
|
|
151
115
|
const name = path.basename(root);
|
|
152
116
|
const pkgPath = path.join(root, "package.json");
|
|
@@ -162,7 +126,7 @@ dist/
|
|
|
162
126
|
}
|
|
163
127
|
const userAgent = process.env.npm_config_user_agent;
|
|
164
128
|
const pkgManager = userAgent?.split(" ")[0]?.split("/")[0] || "npm";
|
|
165
|
-
//
|
|
129
|
+
// 4. Ask about immediate installation
|
|
166
130
|
let immediate = argImmediate;
|
|
167
131
|
if (immediate === undefined) {
|
|
168
132
|
if (interactive) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-skybridge",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.580c9ca",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alpic",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"typescript": "^5.9.3",
|
|
25
|
-
"vitest": "^4.0.
|
|
25
|
+
"vitest": "^4.0.17"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsc",
|
package/template/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Skybridge Starter
|
|
2
2
|
|
|
3
|
-
A minimal TypeScript template for building
|
|
3
|
+
A minimal TypeScript template for building ChatGPT and MCP Apps with widget rendering.
|
|
4
4
|
|
|
5
5
|
## Getting Started
|
|
6
6
|
|
|
@@ -40,7 +40,7 @@ bun dev
|
|
|
40
40
|
This command starts an Express server on port 3000. This server packages:
|
|
41
41
|
|
|
42
42
|
- an MCP endpoint on `/mcp` (the app backend)
|
|
43
|
-
- a React application on Vite HMR dev server (the UI elements to be displayed in
|
|
43
|
+
- a React application on Vite HMR dev server (the UI elements to be displayed in the host)
|
|
44
44
|
|
|
45
45
|
#### 3. Connect to ChatGPT
|
|
46
46
|
|
|
@@ -59,7 +59,7 @@ ngrok http 3000
|
|
|
59
59
|
|
|
60
60
|
#### 2. Edit widgets with Hot Module Replacement (HMR)
|
|
61
61
|
|
|
62
|
-
Edit and save components in `web/src/widgets/` — changes appear instantly in
|
|
62
|
+
Edit and save components in `web/src/widgets/` — changes appear instantly in the host
|
|
63
63
|
|
|
64
64
|
#### 3. Edit server code
|
|
65
65
|
|
package/template/alpic.json
CHANGED
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
12
|
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@
|
|
13
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules/@modelcontextprotocol/inspector/cli/build/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules/@modelcontextprotocol/inspector/cli/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules/@modelcontextprotocol/inspector/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules/@modelcontextprotocol/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
|
|
14
14
|
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@
|
|
15
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules/@modelcontextprotocol/inspector/cli/build/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules/@modelcontextprotocol/inspector/cli/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules/@modelcontextprotocol/inspector/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules/@modelcontextprotocol/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@24.10.9_@types+react-dom@19.2.3_@typ_e51ca4804aa9ecbdec52fc906fb17303/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../@modelcontextprotocol/inspector/cli/build/cli.js" "$@"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules/skybridge/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules/skybridge/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules/skybridge/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules/skybridge/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../skybridge/bin/run.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../skybridge/bin/run.js" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules/skybridge/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules/skybridge/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules/skybridge/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules/skybridge/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/skybridge@0.26.0_@modelcontextprotocol+sdk@1.25.2_hono@4.11.3_zod@4.3.5__@types+node@24_11793bd3b8e997e8d910f880b89e0f45/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../skybridge/bin/run.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../skybridge/bin/run.js" "$@"
|
|
21
|
+
fi
|
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
12
|
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.
|
|
13
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@24.10.9_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules/vite/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@24.10.9_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules/vite/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@24.10.9_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
|
|
14
14
|
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.
|
|
15
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@24.10.9_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules/vite/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@24.10.9_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules/vite/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@24.10.9_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
|
package/template/package.json
CHANGED
|
@@ -5,38 +5,34 @@
|
|
|
5
5
|
"description": "Alpic MCP Server Template",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"dev": "
|
|
9
|
-
"build": "
|
|
10
|
-
"start": "
|
|
11
|
-
"inspector": "mcp-inspector http://localhost:3000/mcp"
|
|
12
|
-
"server:build": "tsc -p tsconfig.server.json",
|
|
13
|
-
"server:start": "node server/dist/index.js",
|
|
14
|
-
"web:build": "tsc -b web && vite build -c web/vite.config.ts",
|
|
15
|
-
"web:preview": "vite preview -c web/vite.config.ts"
|
|
8
|
+
"dev": "skybridge dev",
|
|
9
|
+
"build": "skybridge build",
|
|
10
|
+
"start": "skybridge start",
|
|
11
|
+
"inspector": "mcp-inspector http://localhost:3000/mcp"
|
|
16
12
|
},
|
|
17
13
|
"dependencies": {
|
|
18
|
-
"@modelcontextprotocol/sdk": "^1.25.
|
|
14
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
15
|
+
"cors": "^2.8.5",
|
|
19
16
|
"express": "^5.2.1",
|
|
20
17
|
"react": "^19.2.3",
|
|
21
18
|
"react-dom": "^19.2.3",
|
|
22
|
-
"skybridge": ">=0.
|
|
23
|
-
"vite": "^7.3.
|
|
19
|
+
"skybridge": ">=0.26.0 <1.0.0",
|
|
20
|
+
"vite": "^7.3.1",
|
|
24
21
|
"zod": "^4.3.5"
|
|
25
22
|
},
|
|
26
23
|
"devDependencies": {
|
|
27
24
|
"@modelcontextprotocol/inspector": "^0.18.0",
|
|
28
|
-
"@skybridge/devtools": ">=0.
|
|
25
|
+
"@skybridge/devtools": ">=0.22.0 <1.0.0",
|
|
26
|
+
"@types/cors": "^2.8.19",
|
|
29
27
|
"@types/express": "^5.0.6",
|
|
30
|
-
"@types/react": "^19.2.
|
|
28
|
+
"@types/react": "^19.2.8",
|
|
31
29
|
"@types/react-dom": "^19.2.3",
|
|
32
30
|
"@vitejs/plugin-react": "^5.1.2",
|
|
33
31
|
"nodemon": "^3.1.11",
|
|
34
|
-
"shx": "^0.4.0",
|
|
35
32
|
"tsx": "^4.21.0",
|
|
36
33
|
"typescript": "^5.9.3"
|
|
37
34
|
},
|
|
38
|
-
"workspaces": [],
|
|
39
35
|
"engines": {
|
|
40
|
-
"node": ">=24.
|
|
36
|
+
"node": ">=24.13.0"
|
|
41
37
|
}
|
|
42
38
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import cors from "cors";
|
|
1
4
|
import express, { type Express } from "express";
|
|
2
|
-
import {
|
|
5
|
+
import { widgetsDevServer } from "skybridge/server";
|
|
3
6
|
import type { ViteDevServer } from "vite";
|
|
4
7
|
import { mcp } from "./middleware.js";
|
|
5
8
|
import server from "./server.js";
|
|
@@ -13,24 +16,24 @@ app.use(mcp(server));
|
|
|
13
16
|
const env = process.env.NODE_ENV || "development";
|
|
14
17
|
|
|
15
18
|
if (env !== "production") {
|
|
19
|
+
const { devtoolsStaticServer } = await import("@skybridge/devtools");
|
|
16
20
|
app.use(await devtoolsStaticServer());
|
|
17
21
|
app.use(await widgetsDevServer());
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
if (env === "production") {
|
|
25
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
26
|
+
const __dirname = path.dirname(__filename);
|
|
27
|
+
|
|
28
|
+
app.use("/assets", cors());
|
|
29
|
+
app.use("/assets", express.static(path.join(__dirname, "assets")));
|
|
30
|
+
}
|
|
31
|
+
|
|
20
32
|
app.listen(3000, (error) => {
|
|
21
33
|
if (error) {
|
|
22
34
|
console.error("Failed to start server:", error);
|
|
23
35
|
process.exit(1);
|
|
24
36
|
}
|
|
25
|
-
|
|
26
|
-
console.log(`Server listening on port 3000 - ${env}`);
|
|
27
|
-
console.log(
|
|
28
|
-
"Make your local server accessible with 'ngrok http 3000' and connect to ChatGPT with URL https://xxxxxx.ngrok-free.app/mcp",
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
if (env !== "production") {
|
|
32
|
-
console.log("Devtools available at http://localhost:3000");
|
|
33
|
-
}
|
|
34
37
|
});
|
|
35
38
|
|
|
36
39
|
process.on("SIGINT", async () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import react from "@vitejs/plugin-react";
|
|
3
3
|
import { skybridge } from "skybridge/web";
|
|
4
|
-
import { defineConfig } from "vite";
|
|
4
|
+
import { defineConfig, type PluginOption } from "vite";
|
|
5
5
|
|
|
6
6
|
// https://vite.dev/config/
|
|
7
7
|
export default defineConfig({
|
|
8
|
-
plugins: [skybridge(), react()],
|
|
8
|
+
plugins: [skybridge() as PluginOption, react()],
|
|
9
9
|
root: __dirname,
|
|
10
10
|
resolve: {
|
|
11
11
|
alias: {
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/shx@0.4.0/node_modules/shx/lib/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/shx@0.4.0/node_modules/shx/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/shx@0.4.0/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/shx@0.4.0/node_modules/shx/lib/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/shx@0.4.0/node_modules/shx/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/shx@0.4.0/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../shx/lib/cli.js" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../shx/lib/cli.js" "$@"
|
|
21
|
-
fi
|