Skip to content

Commit

Permalink
feat: add git fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
omeraplak committed Dec 13, 2022
1 parent e682f88 commit 6ca3bd9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 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.11.2",
"version": "1.11.3",
"description": "The frontend boilerplate with superpowers",
"license": "MIT",
"repository": {
Expand Down
11 changes: 6 additions & 5 deletions src/Helper/download/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { promisify } from "util";
import { exec } from "child_process";
import { mkdirSync } from "temp";

import ghdownload from "github-download";
Expand All @@ -22,12 +20,15 @@ export const DownloadHelper = {
ref: branch,
},
tempInfo,
).on("end", function () {
exec("tree", function (err, stdout, sderr) {
)
.on("end", () => {
resolve({ path: tempInfo });
})
.on("error", (err: unknown) => {
reject(err);
});
});
});

return tempInfo;
} catch (e) {
throw new Error(e instanceof Error ? e.message : (e as string));
Expand Down
6 changes: 4 additions & 2 deletions src/Helper/source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ export const get_source: GetSourceFn = async (source, branch, downloadType) => {
return { path: cloneResponse };
}
sourceSpinner.fail("Could not retrieve source repository.");

return { error: "Could not retrieve source repository." };
} catch (e) {
`${e}`;
sourceSpinner.fail("Could not retrieve source repository.");
return { error: "Could not retrieve source repository." };

sourceSpinner.text = "Try to use git instead of zip...";
return get_source(source, branch, "git");
}
} else {
/**
Expand Down

0 comments on commit 6ca3bd9

Please sign in to comment.