Skip to content

Commit

Permalink
fix: project creation (#352)
Browse files Browse the repository at this point in the history
* fix: wrap with try/catch

* 1.17.4
  • Loading branch information
BatuhanW authored Jul 26, 2023
1 parent cf14f13 commit 46eab30
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superplate-cli",
"version": "1.17.3",
"version": "1.17.4",
"description": "The frontend boilerplate with superpowers",
"license": "MIT",
"repository": {
Expand Down
32 changes: 18 additions & 14 deletions src/saofile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,31 +169,35 @@ const saoConfig: GeneratorConfig = {
process.exit(1);
}

const result: { userEmail: string } = await prompt({
const emailPromptResult: { userEmail: string } = await prompt({
type: "input",
name: "userEmail",
message:
"Mind sharing your email? (We reach out to developers for free priority support, events, and SWAG kits. We never spam.)",
required: false,
skip: () => {
return !sao.opts.extras.projectType.includes("refine");
},
skip: () => !sao.opts.extras.projectType.includes("refine"),
});

let projectId = "";

if (result.userEmail) {
const res = await fetch("https://telemetry.refine.dev/projects", {
method: "POST",
body: JSON.stringify({
email: result.userEmail,
}),
headers: { "Content-Type": "application/json" },
});
try {
const createProjectResponse = await fetch(
"https://telemetry.refine.dev/projects",
{
method: "POST",
body: JSON.stringify({
email: emailPromptResult.userEmail,
}),
headers: { "Content-Type": "application/json" },
},
);

const data = await res.json();
const createProjectResponseData =
await createProjectResponse.json();

projectId = data.projectId;
projectId = createProjectResponseData.projectId;
} catch (_e) {
//
}

sao.opts.outDir = sao.opts.outDir + "/" + appName;
Expand Down

0 comments on commit 46eab30

Please sign in to comment.