mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: Fix generating tray icons and downloading binaries on windows
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
30f794d66d
commit
289d62caaa
3 files changed
+40
-15
No files matched your search
@@ -23,16 +23,31 @@ const options = arg({
|
||||
"--base-dir": String,
|
||||
});
|
||||
|
||||
const pathToPackage = options["--package"];
|
||||
const pathToBaseDir = options["--base-dir"];
|
||||
type Options = typeof options;
|
||||
|
||||
if (typeof pathToPackage !== "string") {
|
||||
throw new Error("--package is required");
|
||||
}
|
||||
const assertOption = <Key extends keyof Options>(key: Key): NonNullable<Options[Key]> => {
|
||||
const raw = options[key];
|
||||
|
||||
if (typeof pathToBaseDir !== "string") {
|
||||
throw new Error("--base-dir is required");
|
||||
}
|
||||
if (raw === undefined) {
|
||||
console.error(`missing ${key} option`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return raw;
|
||||
};
|
||||
|
||||
const joinWithInitCwd = (relativePath: string): string => {
|
||||
const { INIT_CWD } = process.env;
|
||||
|
||||
if (!INIT_CWD) {
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
return path.join(INIT_CWD, relativePath);
|
||||
};
|
||||
|
||||
const pathToPackage = joinWithInitCwd(assertOption("--package"));
|
||||
const pathToBaseDir = joinWithInitCwd(assertOption("--base-dir"));
|
||||
|
||||
function setTimeoutFor(controller: AbortController, timeout: number): void {
|
||||
const handle = setTimeout(() => controller.abort(), timeout);
|
||||
|
||||
Reference in new issue
Block a user