Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ export interface WebpackEnv {
WEBPACK_BUILD: true;
platform?: string;
compress?: boolean;
["zip-filename-format"]?: string;
}
1 change: 1 addition & 0 deletions assets/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="digma-ui-version" content="<%= version %>" />
<style>
@font-face {
font-family: "JetBrains Mono";
Expand Down
1 change: 1 addition & 0 deletions assets/index.web.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="digma-ui-version" content="<%= version %>" />
<style>
@font-face {
font-family: "Alexandria";
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"prebuild": "rimraf dist && npm run download-jaeger-ui",
"build:dev": "npm run prebuild && webpack --progress --config webpack.dev.ts",
"build:dev:jetbrains": "npm run build:dev --env platform=JetBrains",
"build:dev:jetbrains:zip": "npm run build:dev:jetbrains -- --env compress=true",
"build:dev:jetbrains:zip": "npm run build:dev:jetbrains -- --env compress=true --env zip-filename-format=JetBrains",
"build:dev:web": "npm run build:dev --env platform=Web",
"build:dev:web:zip": "npm run build:dev:web -- --env zip=true",
"build:dev:web:zip": "npm run build:dev:web -- --env compress=true",
"build:prod": "npm run prebuild && webpack --progress --config webpack.prod.ts",
"build:prod:jetbrains": "npm run build:prod -- --env platform=JetBrains",
"build:prod:jetbrains:zip": "npm run build:prod:jetbrains -- --env compress=true",
"build:prod:jetbrains:zip": "npm run build:prod:jetbrains -- --env compress=true --env zip-filename-format=JetBrains",
"build:prod:web": "npm run build:prod -- --env platform=Web",
"build:prod:web:zip": "npm run build:prod:web -- --env zip=true",
"build:prod:web:zip": "npm run build:prod:web -- --env compress=true",
"precommit": "lint-staged",
"prepare": "husky"
},
Expand Down
6 changes: 5 additions & 1 deletion scripts/download-jaeger-ui.mts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ if (outputArgIndex !== -1 && process.argv[outputArgIndex + 1]) {
fs.mkdirSync(outputPath, { recursive: true });

const extractZip = (zipPath: string, extractPath: string) => {
if (fs.existsSync(extractPath)) {
fs.rmdirSync(extractPath, { recursive: true });
}

const zip = new AdmZip(zipPath);
zip.extractAllTo(extractPath, true);
zip.extractAllTo(extractPath);
};

const downloadReleaseAsset = async ({
Expand Down
27 changes: 19 additions & 8 deletions webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ interface PackageJson {
version: string;
}

const getZipFilename = (env: WebpackEnv): string => {
const ZIP_NAME_FORMATS: Record<string, string> = {
default: "dist-{platform}-v{version}",
JetBrains: "digma-ui-{version}"
};

const argFormat = env["zip-filename-format"];
const format =
(argFormat && ZIP_NAME_FORMATS[argFormat]) ?? ZIP_NAME_FORMATS.default;

return format
.replace("{platform}", (env.platform ?? "").toLocaleLowerCase())
.replace("{version}", (packageJson as PackageJson).version)
.replace(/-{2,}/g, "-");
};

const getConfig = (env: WebpackEnv): WebpackConfiguration => {
const entriesToBuild: Record<string, string> = Object.entries(appData)
.filter(
Expand Down Expand Up @@ -69,20 +85,15 @@ const getConfig = (env: WebpackEnv): WebpackConfiguration => {
minify: false,
scriptLoading: "blocking",
templateParameters: {
environmentVariables: appData[app]?.environmentVariables ?? []
environmentVariables: appData[app]?.environmentVariables ?? [],
version: (packageJson as PackageJson).version
}
});
}),
...(env.compress
? [
new ZipPlugin({
filename: [
"dist",
(env.platform ?? "").toLocaleLowerCase(),
`v${(packageJson as PackageJson).version}.zip`
]
.filter(Boolean)
.join("-")
filename: getZipFilename(env)
})
]
: [])
Expand Down
Loading