Skip to content

Commit

Permalink
Fixed bug where only top level files were deployed
Browse files Browse the repository at this point in the history
  • Loading branch information
danechitoaie committed Jan 20, 2022
1 parent 26b96f2 commit 43a1614
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 4,
"printWidth": 160
}
2 changes: 1 addition & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function run() {
const prefix = `${pkg.name}/bld`;
const cwd = path.resolve(__dirname, "../dist/build");

const fileList = await globby("*", { cwd });
const fileList = await globby("**/*", { cwd });
await tar.create({ file, prefix, cwd }, fileList);
setOutput(fileList.join("\n "));
});
Expand Down
21 changes: 14 additions & 7 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function run() {
return;
}

await new Promise<void>((resolve, reject) => {
await new Promise<string>((resolve, reject) => {
yargs
.usage("Usage: $0 [options]")
.option("username", { type: "string", description: "Username", demandOption: true })
Expand All @@ -28,13 +28,11 @@ async function run() {
.help()
.parse(process.argv, async (yargsErr: Error | undefined, argv: yargs.ArgumentsCamelCase<DeployArguments>, output: string) => {
if (yargsErr) {
setError(yargsErr);
reject(yargsErr);
return;
}

if (output) {
setOutput(output);
reject(output);
return;
}
Expand Down Expand Up @@ -71,21 +69,30 @@ async function run() {
body,
});

if (res.status === 401) {
const message = await res.text();
reject(message);
return;
}

const { message } = await res.json();

if (res.ok) {
setOutput(message);
resolve(message);
} else {
setError(message);
reject(message);
}
} catch (fetchErr) {
setError(fetchErr as Error);
reject(fetchErr);
}
});
});
})
.then((output) => {
setOutput(output);
})
.catch((output) => {
setError(output);
});
});
}

Expand Down

0 comments on commit 43a1614

Please sign in to comment.