create-skybridge 0.0.0-dev.a4ea8e7 → 0.0.0-dev.bc5889f
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 +12 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,12 +8,13 @@ const argv = mri(process.argv.slice(2), {
|
|
|
8
8
|
alias: { h: "help" },
|
|
9
9
|
});
|
|
10
10
|
const cwd = process.cwd();
|
|
11
|
+
const TEMPLATE_REPO = "https://github.com/alpic-ai/apps-sdk-template";
|
|
11
12
|
const defaultProjectName = "skybridge-project";
|
|
12
13
|
// prettier-ignore
|
|
13
14
|
const helpMessage = `\
|
|
14
15
|
Usage: create-skybridge [OPTION]... [DIRECTORY]
|
|
15
16
|
|
|
16
|
-
Create a new Skybridge project by
|
|
17
|
+
Create a new Skybridge project by cloning the starter template.
|
|
17
18
|
|
|
18
19
|
Options:
|
|
19
20
|
-h, --help show this help message
|
|
@@ -110,23 +111,23 @@ async function init() {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
const root = path.join(cwd, targetDir);
|
|
113
|
-
// 3.
|
|
114
|
-
prompts.log.step(`
|
|
114
|
+
// 3. Clone the repository
|
|
115
|
+
prompts.log.step(`Cloning template from ${TEMPLATE_REPO}...`);
|
|
115
116
|
try {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
run(["cp", "-r", `${templateDir}/.`, root], {
|
|
119
|
-
stdio: "inherit",
|
|
120
|
-
});
|
|
121
|
-
// Set up .gitignore
|
|
122
|
-
run(["mv", path.join(root, "_gitignore"), path.join(root, ".gitignore")], {
|
|
117
|
+
// Clone directly to target directory
|
|
118
|
+
run(["git", "clone", "--depth", "1", TEMPLATE_REPO, root], {
|
|
123
119
|
stdio: "inherit",
|
|
124
120
|
});
|
|
121
|
+
// Remove .git directory to start fresh
|
|
122
|
+
const gitDir = path.join(root, ".git");
|
|
123
|
+
if (fs.existsSync(gitDir)) {
|
|
124
|
+
fs.rmSync(gitDir, { recursive: true, force: true });
|
|
125
|
+
}
|
|
125
126
|
prompts.log.success(`Project created in ${root}`);
|
|
126
127
|
prompts.outro(`Done! Next steps:\n\n cd ${targetDir}\n pnpm install\n pnpm dev`);
|
|
127
128
|
}
|
|
128
129
|
catch (error) {
|
|
129
|
-
prompts.log.error("Failed to
|
|
130
|
+
prompts.log.error("Failed to clone repository");
|
|
130
131
|
console.error(error);
|
|
131
132
|
process.exit(1);
|
|
132
133
|
}
|