create-skybridge 0.0.0-dev.558cd99 → 0.0.0-dev.5766089
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 +43 -7
- package/package.json +1 -2
- package/template/README.md +1 -1
- package/template/node_modules/.bin/mcp-inspector +2 -2
- package/template/node_modules/.bin/shx +2 -2
- package/template/node_modules/.bin/vite +2 -2
- package/template/package.json +19 -17
- package/template/_gitignore +0 -4
package/dist/index.js
CHANGED
|
@@ -5,6 +5,10 @@ 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
|
+
];
|
|
8
12
|
// prettier-ignore
|
|
9
13
|
const helpMessage = `\
|
|
10
14
|
Usage: create-skybridge [OPTION]... [DIRECTORY]
|
|
@@ -15,6 +19,10 @@ Options:
|
|
|
15
19
|
-h, --help show this help message
|
|
16
20
|
--overwrite remove existing files in target directory
|
|
17
21
|
--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")}
|
|
18
26
|
|
|
19
27
|
Examples:
|
|
20
28
|
create-skybridge my-app
|
|
@@ -23,13 +31,14 @@ Examples:
|
|
|
23
31
|
export async function init(args = process.argv.slice(2)) {
|
|
24
32
|
const argv = mri(args, {
|
|
25
33
|
boolean: ["help", "overwrite", "immediate"],
|
|
26
|
-
alias: { h: "help" },
|
|
34
|
+
alias: { h: "help", t: "template" },
|
|
27
35
|
});
|
|
28
36
|
const argTargetDir = argv._[0]
|
|
29
37
|
? sanitizeTargetDir(String(argv._[0]))
|
|
30
38
|
: undefined;
|
|
31
39
|
const argOverwrite = argv.overwrite;
|
|
32
40
|
const argImmediate = argv.immediate;
|
|
41
|
+
const argTemplate = argv.template;
|
|
33
42
|
const help = argv.help;
|
|
34
43
|
if (help) {
|
|
35
44
|
console.log(helpMessage);
|
|
@@ -60,7 +69,31 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
60
69
|
targetDir = defaultProjectName;
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
|
-
// 2.
|
|
72
|
+
// 2. Select a template
|
|
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
|
|
64
97
|
if (fs.existsSync(targetDir) && !isEmpty(targetDir)) {
|
|
65
98
|
let overwrite = argOverwrite ? "yes" : undefined;
|
|
66
99
|
if (!overwrite) {
|
|
@@ -100,17 +133,20 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
100
133
|
}
|
|
101
134
|
}
|
|
102
135
|
const root = path.join(process.cwd(), targetDir);
|
|
103
|
-
//
|
|
136
|
+
// 4. Copy the template
|
|
104
137
|
prompts.log.step(`Copying template...`);
|
|
105
138
|
try {
|
|
106
|
-
const templateDir = fileURLToPath(new URL(
|
|
139
|
+
const templateDir = fileURLToPath(new URL(templatePath, import.meta.url));
|
|
107
140
|
// Copy template to target directory
|
|
108
141
|
fs.cpSync(templateDir, root, {
|
|
109
142
|
recursive: true,
|
|
110
143
|
filter: (src) => [".npmrc"].every((file) => !src.endsWith(file)),
|
|
111
144
|
});
|
|
112
|
-
//
|
|
113
|
-
fs.
|
|
145
|
+
// Write .gitignore
|
|
146
|
+
fs.writeFileSync(path.join(root, ".gitignore"), `node_modules/
|
|
147
|
+
dist/
|
|
148
|
+
.env*
|
|
149
|
+
.DS_store`);
|
|
114
150
|
// Update project name in package.json
|
|
115
151
|
const name = path.basename(root);
|
|
116
152
|
const pkgPath = path.join(root, "package.json");
|
|
@@ -126,7 +162,7 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
126
162
|
}
|
|
127
163
|
const userAgent = process.env.npm_config_user_agent;
|
|
128
164
|
const pkgManager = userAgent?.split(" ")[0]?.split("/")[0] || "npm";
|
|
129
|
-
//
|
|
165
|
+
// 5. Ask about immediate installation
|
|
130
166
|
let immediate = argImmediate;
|
|
131
167
|
if (immediate === undefined) {
|
|
132
168
|
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.5766089",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alpic",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"mri": "^1.2.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/node": "^25.0.3",
|
|
25
24
|
"typescript": "^5.9.3",
|
|
26
25
|
"vitest": "^4.0.16"
|
|
27
26
|
},
|
package/template/README.md
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.
|
|
13
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/node_modules/@modelcontextprotocol/inspector/cli/build/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/node_modules/@modelcontextprotocol/inspector/cli/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/node_modules/@modelcontextprotocol/inspector/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/node_modules/@modelcontextprotocol/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/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.
|
|
15
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/node_modules/@modelcontextprotocol/inspector/cli/build/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/node_modules/@modelcontextprotocol/inspector/cli/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/node_modules/@modelcontextprotocol/inspector/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/node_modules/@modelcontextprotocol/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@modelcontextprotocol+inspector@0.18.0_@types+node@25.0.3_@types+react-dom@19.2.3_@type_cfe96c348f18ba1e580ab58ea63930bf/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" "$@"
|
|
@@ -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/shx@0.
|
|
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
14
|
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/shx@0.
|
|
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
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../shx/lib/cli.js" "$@"
|
|
@@ -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.
|
|
13
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.0_@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.0_@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.0_@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.
|
|
15
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.0_@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.0_@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.0_@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
|
@@ -15,26 +15,28 @@
|
|
|
15
15
|
"web:preview": "vite preview -c web/vite.config.ts"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
19
|
-
"express": "^5.1
|
|
20
|
-
"react": "^19.
|
|
21
|
-
"react-dom": "^19.
|
|
22
|
-
"skybridge": ">=0.16.
|
|
23
|
-
"vite": "^7.
|
|
24
|
-
"zod": "^4.
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
19
|
+
"express": "^5.2.1",
|
|
20
|
+
"react": "^19.2.3",
|
|
21
|
+
"react-dom": "^19.2.3",
|
|
22
|
+
"skybridge": ">=0.16.7 <1.0.0",
|
|
23
|
+
"vite": "^7.3.0",
|
|
24
|
+
"zod": "^4.3.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@modelcontextprotocol/inspector": "^0.
|
|
27
|
+
"@modelcontextprotocol/inspector": "^0.18.0",
|
|
28
28
|
"@skybridge/devtools": ">=0.16.2 <1.0.0",
|
|
29
|
-
"@types/express": "^5.0.
|
|
30
|
-
"@types/
|
|
31
|
-
"@types/react": "^19.
|
|
32
|
-
"@types/react-dom": "^19.1.9",
|
|
29
|
+
"@types/express": "^5.0.6",
|
|
30
|
+
"@types/react": "^19.2.7",
|
|
31
|
+
"@types/react-dom": "^19.2.3",
|
|
33
32
|
"@vitejs/plugin-react": "^5.1.2",
|
|
34
|
-
"nodemon": "^3.1.
|
|
35
|
-
"shx": "^0.
|
|
36
|
-
"tsx": "^4.
|
|
37
|
-
"typescript": "^5.
|
|
33
|
+
"nodemon": "^3.1.11",
|
|
34
|
+
"shx": "^0.4.0",
|
|
35
|
+
"tsx": "^4.21.0",
|
|
36
|
+
"typescript": "^5.9.3"
|
|
38
37
|
},
|
|
39
|
-
"workspaces": []
|
|
38
|
+
"workspaces": [],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=24.0.0"
|
|
41
|
+
}
|
|
40
42
|
}
|
package/template/_gitignore
DELETED