creek 0.3.0-alpha.3 → 0.3.0-alpha.4

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.
@@ -52,15 +52,15 @@ export const deployCommand = defineCommand({
52
52
  // Sandbox deploy — no account, auto-detect framework
53
53
  // ============================================================================
54
54
  async function deploySandbox(cwd, skipBuild) {
55
- consola.info("No account found. Deploying to sandbox (60 min preview).");
55
+ consola.info("Deploying to sandbox (60 min preview).");
56
56
  consola.info("");
57
- // Auto-detect framework
57
+ // No package.json → offer to scaffold a project
58
58
  const pkgPath = join(cwd, "package.json");
59
59
  if (!existsSync(pkgPath)) {
60
- consola.error("No package.json found. Make sure you're in a project directory.");
61
- process.exit(1);
60
+ cwd = await scaffoldProject(cwd);
61
+ skipBuild = false; // always build freshly scaffolded projects
62
62
  }
63
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
63
+ const pkg = JSON.parse(readFileSync(join(cwd, "package.json"), "utf-8"));
64
64
  const framework = detectFramework(pkg);
65
65
  const projectName = pkg.name ?? basename(cwd);
66
66
  if (framework) {
@@ -207,6 +207,47 @@ function cleanupDir(dir) {
207
207
  }
208
208
  }
209
209
  // ============================================================================
210
+ // Interactive scaffold — create a project from scratch
211
+ // ============================================================================
212
+ const STARTERS = [
213
+ { label: "React", value: "react-ts", framework: "vite" },
214
+ { label: "Vue", value: "vue-ts", framework: "vite" },
215
+ { label: "Svelte", value: "svelte-ts", framework: "vite" },
216
+ { label: "Vanilla", value: "vanilla-ts", framework: "vite" },
217
+ ];
218
+ async function scaffoldProject(cwd) {
219
+ consola.info("No project found. Let's create one!\n");
220
+ const choice = await consola.prompt("Pick a starter:", {
221
+ type: "select",
222
+ options: STARTERS.map((s) => s.label),
223
+ });
224
+ if (!choice || typeof choice !== "string") {
225
+ consola.error("No starter selected.");
226
+ process.exit(1);
227
+ }
228
+ const starter = STARTERS.find((s) => s.label === choice);
229
+ consola.start(`Creating ${starter.label} project...`);
230
+ try {
231
+ execFileSync("npm", [
232
+ "create", "vite@latest", ".", "--", "--template", starter.value,
233
+ ], { cwd, stdio: "pipe" });
234
+ }
235
+ catch {
236
+ consola.error("Failed to scaffold project. Make sure npm is installed.");
237
+ process.exit(1);
238
+ }
239
+ consola.start("Installing dependencies...");
240
+ try {
241
+ execFileSync("npm", ["install"], { cwd, stdio: "pipe" });
242
+ }
243
+ catch {
244
+ consola.error("Failed to install dependencies.");
245
+ process.exit(1);
246
+ }
247
+ consola.success(`${starter.label} project created!`);
248
+ return cwd;
249
+ }
250
+ // ============================================================================
210
251
  // Authenticated deploy — existing flow
211
252
  // ============================================================================
212
253
  async function deployAuthenticated(cwd, configPath, token, skipBuild) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "creek",
3
- "version": "0.3.0-alpha.3",
3
+ "version": "0.3.0-alpha.4",
4
4
  "description": "CLI for the Creek deployment platform",
5
5
  "type": "module",
6
6
  "bin": {