create-skybridge 0.0.0-dev.5766089 → 0.0.0-dev.597cde9
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
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
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/vite@7.3.
|
|
13
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.0.3_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0/node_modules/vite/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.0.3_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0/node_modules/vite/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.0.3_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0/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@25.0.3_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0/node_modules/vite/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.0.3_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0/node_modules/vite/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.0.3_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0/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,27 +5,27 @@
|
|
|
5
5
|
"description": "Alpic MCP Server Template",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"dev": "
|
|
9
|
-
"build": "vite build -c web/vite.config.ts && shx rm -rf
|
|
10
|
-
"start": "node
|
|
8
|
+
"dev": "skybridge",
|
|
9
|
+
"build": "vite build -c web/vite.config.ts && shx rm -rf dist && tsc -p tsconfig.server.json && mkdir -p dist/assets && shx cp -r web/dist/. dist/assets",
|
|
10
|
+
"start": "node dist/index.js",
|
|
11
11
|
"inspector": "mcp-inspector http://localhost:3000/mcp",
|
|
12
12
|
"server:build": "tsc -p tsconfig.server.json",
|
|
13
|
-
"server:start": "node
|
|
13
|
+
"server:start": "node dist/index.js",
|
|
14
14
|
"web:build": "tsc -b web && vite build -c web/vite.config.ts",
|
|
15
15
|
"web:preview": "vite preview -c web/vite.config.ts"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@modelcontextprotocol/sdk": "^1.25.
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
19
19
|
"express": "^5.2.1",
|
|
20
20
|
"react": "^19.2.3",
|
|
21
21
|
"react-dom": "^19.2.3",
|
|
22
|
-
"skybridge": ">=0.
|
|
23
|
-
"vite": "^7.3.
|
|
22
|
+
"skybridge": ">=0.17.1 <1.0.0",
|
|
23
|
+
"vite": "^7.3.1",
|
|
24
24
|
"zod": "^4.3.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@modelcontextprotocol/inspector": "^0.18.0",
|
|
28
|
-
"@skybridge/devtools": ">=0.
|
|
28
|
+
"@skybridge/devtools": ">=0.17.1 <1.0.0",
|
|
29
29
|
"@types/express": "^5.0.6",
|
|
30
30
|
"@types/react": "^19.2.7",
|
|
31
31
|
"@types/react-dom": "^19.2.3",
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
"tsx": "^4.21.0",
|
|
36
36
|
"typescript": "^5.9.3"
|
|
37
37
|
},
|
|
38
|
-
"workspaces": [],
|
|
39
38
|
"engines": {
|
|
40
|
-
"node": ">=24.
|
|
39
|
+
"node": ">=24.12.0"
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import express, { type Express } from "express";
|
|
2
|
-
import {
|
|
2
|
+
import { widgetsDevServer } from "skybridge/server";
|
|
3
3
|
import type { ViteDevServer } from "vite";
|
|
4
4
|
import { mcp } from "./middleware.js";
|
|
5
5
|
import server from "./server.js";
|
|
@@ -13,6 +13,7 @@ app.use(mcp(server));
|
|
|
13
13
|
const env = process.env.NODE_ENV || "development";
|
|
14
14
|
|
|
15
15
|
if (env !== "production") {
|
|
16
|
+
const { devtoolsStaticServer } = await import("@skybridge/devtools");
|
|
16
17
|
app.use(await devtoolsStaticServer());
|
|
17
18
|
app.use(await widgetsDevServer());
|
|
18
19
|
}
|