Skip to content

Commit 3731272

Browse files
authored
fix: publishDocumentation inside step (#35)
* fix: resolve exec properly * fix: prepare and publish runExecCommand * yarn lint
1 parent 832dd9b commit 3731272

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/prepare.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ export const prepare = async (
3030
logger.log("Writing new version %s to `%s`", version, fullCabalPath);
3131

3232
logger.log("Running cabal sdist command");
33-
const { error, output } = await runExecCommand("cabal sdist");
33+
const { warn, output } = await runExecCommand("cabal sdist");
3434

35-
if (error) {
36-
logger.error(error);
37-
throw new Error(error);
35+
if (warn) {
36+
logger.warn(warn);
3837
}
3938

4039
logger.log(output);

src/publish.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,10 @@ export const publish = async (
7272
logger.log("Checking publishDocumentation plugin configuration: ", publishDocumentation);
7373
if (publishDocumentation) {
7474
logger.log("Generating documentation");
75-
const { error, output } = await runExecCommand(V2_HADDOCK_COMMAND);
75+
const { warn, output } = await runExecCommand(V2_HADDOCK_COMMAND);
7676

77-
if (error) {
78-
logger.error(error);
79-
throw new Error(error);
77+
if (warn) {
78+
logger.warn(warn);
8079
}
8180
logger.log(output);
8281
logger.log("Publishing documentation");

src/utils/exec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import { exec } from "child_process";
22

3-
export const runExecCommand = (command: string): Promise<{ error: string; output: string; }> => {
3+
interface OutputExec {
4+
output: string;
5+
warn?: string;
6+
}
7+
8+
export const runExecCommand = (command: string): Promise<OutputExec> => {
49
return new Promise((resolve, reject) => {
510
exec(command, (error, stdout, stderr) => {
6-
error !== null ? reject(error) : resolve({ error: stderr, output: stdout });
11+
error !== null ? reject(error) : resolve({ output: stdout, warn: stderr });
712
});
813
});
914
};

0 commit comments

Comments
 (0)