Skip to content

Commit

Permalink
Detect old sbt script version, and propose a fix. Fixes #17
Browse files Browse the repository at this point in the history
  • Loading branch information
raquo committed Nov 7, 2023
1 parent 2f94cf3 commit 04a9f07
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ function printSbtTask(task: string, cwd?: string): Promise<string> {
reject(new Error(`sbt invocation for Scala.js compilation could not start. Is it installed?\n${err}`));
});
child.on('close', code => {
if (code !== 0)
reject(new Error(`sbt invocation for Scala.js compilation failed with exit code ${code}.`));
else
if (code !== 0) {
let errorMessage = `sbt invocation for Scala.js compilation failed with exit code ${code}.`;
if (fullOutput.includes("Not a valid command: --")) {
errorMessage += "\nCause: Your sbt launcher script version is too old (<1.3.3)."
errorMessage += "\nFix: Re-install the latest version of sbt launcher script from https://www.scala-sbt.org/"
}
reject(new Error(errorMessage));
} else {
resolve(fullOutput.trimEnd().split('\n').at(-1)!);
}
});
});
}
Expand Down

0 comments on commit 04a9f07

Please sign in to comment.