@vocoder/cli 0.1.14 → 0.1.15
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/bin.mjs +55 -7
- package/dist/bin.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -2332,20 +2332,68 @@ async function init(options = {}) {
|
|
|
2332
2332
|
p5.log.warn(
|
|
2333
2333
|
`Project limit reached \u2014 ${ws.projectCount}/${ws.maxProjects} on your ${chalk6.bold(ws.planId)} plan.`
|
|
2334
2334
|
);
|
|
2335
|
+
const hasRepoContext = !!identity?.repoCanonical;
|
|
2336
|
+
const options2 = [];
|
|
2337
|
+
if (hasRepoContext) {
|
|
2338
|
+
options2.push({
|
|
2339
|
+
value: "connect",
|
|
2340
|
+
label: "Connect this repo to an existing project"
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
options2.push({ value: "upgrade", label: "Upgrade plan" });
|
|
2344
|
+
options2.push({ value: "cancel", label: "Cancel" });
|
|
2335
2345
|
const limitAction = await p5.select({
|
|
2336
2346
|
message: "What would you like to do?",
|
|
2337
|
-
options:
|
|
2338
|
-
{ value: "upgrade", label: "Upgrade plan" },
|
|
2339
|
-
{ value: "cancel", label: "Cancel" }
|
|
2340
|
-
]
|
|
2347
|
+
options: options2
|
|
2341
2348
|
});
|
|
2342
2349
|
if (p5.isCancel(limitAction) || limitAction === "cancel") {
|
|
2343
2350
|
p5.cancel("Setup cancelled.");
|
|
2344
2351
|
return 1;
|
|
2345
2352
|
}
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2353
|
+
if (limitAction === "upgrade") {
|
|
2354
|
+
await tryOpenBrowser2(`${apiUrl}${SUBSCRIPTION_SETTINGS_PATH}`);
|
|
2355
|
+
p5.cancel("Upgrade your plan in the browser, then re-run `vocoder init`.");
|
|
2356
|
+
return 1;
|
|
2357
|
+
}
|
|
2358
|
+
const existingProjects = await api.listProjects(userToken, selectedWorkspaceId);
|
|
2359
|
+
if (existingProjects.length === 0) {
|
|
2360
|
+
p5.log.error("No projects found in this workspace.");
|
|
2361
|
+
return 1;
|
|
2362
|
+
}
|
|
2363
|
+
const chosenId = await p5.select({
|
|
2364
|
+
message: "Which project should this repo be connected to?",
|
|
2365
|
+
options: existingProjects.map((proj) => ({
|
|
2366
|
+
value: proj.id,
|
|
2367
|
+
label: proj.name
|
|
2368
|
+
}))
|
|
2369
|
+
});
|
|
2370
|
+
if (p5.isCancel(chosenId)) {
|
|
2371
|
+
p5.cancel("Setup cancelled.");
|
|
2372
|
+
return 1;
|
|
2373
|
+
}
|
|
2374
|
+
const chosen = existingProjects.find((proj) => proj.id === chosenId);
|
|
2375
|
+
const appResult = await runProjectAppCreate({
|
|
2376
|
+
api,
|
|
2377
|
+
userToken,
|
|
2378
|
+
projectId: chosen.id,
|
|
2379
|
+
projectName: chosen.name,
|
|
2380
|
+
organizationName: selectedWorkspaceName,
|
|
2381
|
+
repoCanonical: identity?.repoCanonical,
|
|
2382
|
+
defaultScopePath: identity?.repoScopePath,
|
|
2383
|
+
existingApps: []
|
|
2384
|
+
});
|
|
2385
|
+
if (!appResult) {
|
|
2386
|
+
p5.log.error("Setup failed. Run `vocoder init` again.");
|
|
2387
|
+
return 1;
|
|
2388
|
+
}
|
|
2389
|
+
runScaffold({
|
|
2390
|
+
projectName: appResult.projectName,
|
|
2391
|
+
organizationName: selectedWorkspaceName,
|
|
2392
|
+
sourceLocale: appResult.sourceLocale,
|
|
2393
|
+
branchTriggers: appResult.branchTriggers
|
|
2394
|
+
});
|
|
2395
|
+
p5.outro("You're all set.");
|
|
2396
|
+
return 0;
|
|
2349
2397
|
}
|
|
2350
2398
|
} catch {
|
|
2351
2399
|
}
|