Skip to content

Commit cd84ed3

Browse files
committed
chore: simplify template tarball lookup
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
1 parent f9021c4 commit cd84ed3

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

tools/prepare-template-artifact.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,14 @@ const STAGING_DIR = join(ROOT, outputDir);
5151
function getTarballName(
5252
dir: string,
5353
packageName: string,
54-
required?: true,
55-
): string;
56-
function getTarballName(
57-
dir: string,
58-
packageName: string,
59-
required: false,
60-
): string | undefined;
61-
function getTarballName(dir: string, packageName: string, required = true) {
54+
required = true,
55+
): string {
6256
const prefix = `databricks-${packageName}-`;
6357
const matches = readdirSync(dir).filter(
6458
(entry) => entry.startsWith(prefix) && entry.endsWith(".tgz"),
6559
);
6660
if (!required && matches.length === 0) {
67-
return undefined;
61+
return "";
6862
}
6963
if (matches.length !== 1) {
7064
console.error(
@@ -95,7 +89,7 @@ const APPKIT_TARBALL = getTarballName(appkitDir, "appkit");
9589
const APPKIT_UI_TARBALL = getTarballName(appkitUiDir, "appkit-ui");
9690
const LAKEBASE_TARBALL = existsSync(lakebaseDir)
9791
? getTarballName(lakebaseDir, "lakebase", false)
98-
: undefined;
92+
: "";
9993

10094
const appkitSrc = join(appkitDir, APPKIT_TARBALL);
10195
const appkitUiSrc = join(appkitUiDir, APPKIT_UI_TARBALL);
@@ -104,9 +98,7 @@ copyFileSync(appkitSrc, join(STAGING_DIR, APPKIT_TARBALL));
10498
copyFileSync(appkitUiSrc, join(STAGING_DIR, APPKIT_UI_TARBALL));
10599
console.log(`✓ Copied ${APPKIT_TARBALL} and ${APPKIT_UI_TARBALL}`);
106100

107-
const lakebaseSrc = LAKEBASE_TARBALL
108-
? join(lakebaseDir, LAKEBASE_TARBALL)
109-
: undefined;
101+
const lakebaseSrc = LAKEBASE_TARBALL ? join(lakebaseDir, LAKEBASE_TARBALL) : "";
110102
if (LAKEBASE_TARBALL && lakebaseSrc && existsSync(lakebaseSrc)) {
111103
copyFileSync(lakebaseSrc, join(STAGING_DIR, LAKEBASE_TARBALL));
112104
console.log(`✓ Copied ${LAKEBASE_TARBALL}`);

0 commit comments

Comments
 (0)