This is an automated email from the ASF dual-hosted git repository.
pawarprasad123 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new f8668c567 ATLAS-5367: Fix missing license headers in dist/n3 for WAR
packaging (#718)
f8668c567 is described below
commit f8668c567750c967341c9b28c7d5a60e4d8dedab
Author: Brijesh Bhalala <[email protected]>
AuthorDate: Tue Aug 4 15:08:37 2026 +0530
ATLAS-5367: Fix missing license headers in dist/n3 for WAR packaging (#718)
---
dashboard/pom.xml | 1 +
dashboard/vite.config.ts | 45 +++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/dashboard/pom.xml b/dashboard/pom.xml
index 48ee0efa7..ae1edf67d 100644
--- a/dashboard/pom.xml
+++ b/dashboard/pom.xml
@@ -146,6 +146,7 @@
<configuration>
<excludes combine.children="append">
<exclude>**/atlas-lineage/dist/**</exclude>
+ <exclude>**/.frontend-toolchain/**</exclude>
</excludes>
</configuration>
</plugin>
diff --git a/dashboard/vite.config.ts b/dashboard/vite.config.ts
index fd9246b97..c7c0f1a8c 100644
--- a/dashboard/vite.config.ts
+++ b/dashboard/vite.config.ts
@@ -15,14 +15,55 @@
* limitations under the License.
*/
-import { defineConfig } from "vite";
+import { defineConfig, Plugin } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
+import fs from "fs";
const proxyHost = "http://localhost:21000";
+let apacheLicense = "";
+let apacheHtmlLicense = "";
+try {
+ const viteConfigContent = fs.readFileSync(path.resolve(__dirname,
"vite.config.ts"), "utf-8");
+ const extracted =
viteConfigContent.substring(viteConfigContent.indexOf("/*"),
viteConfigContent.indexOf("*/") + 2);
+ if (extracted.includes("Licensed to the Apache Software Foundation")) {
+ apacheLicense = extracted + "\n";
+ apacheHtmlLicense = `\n<!--\n${extracted.replace('/*', '').replace('*/',
'').trim()}\n-->\n`;
+ } else {
+ console.warn("Warning: Could not safely extract the Apache License from
vite.config.ts!");
+ }
+} catch (e) {
+ console.warn("Warning: Failed to read vite.config.ts for license
extraction", e);
+}
+
+const addLicensePlugin = (): Plugin => {
+ return {
+ name: 'add-license',
+ apply: 'build' as const, // only run during build
+ generateBundle(_options: any, bundle: any) {
+ if (!apacheLicense) return;
+ for (const [fileName, chunk] of Object.entries(bundle)) {
+ if (fileName.endsWith('.js') || fileName.endsWith('.css')) {
+ if (chunk && typeof chunk === 'object') {
+ if ('type' in chunk && chunk.type === 'chunk' && 'code' in chunk) {
+ (chunk as any).code = apacheLicense + (chunk as any).code;
+ } else if ('type' in chunk && chunk.type === 'asset' && 'source'
in chunk && typeof (chunk as any).source === 'string') {
+ (chunk as any).source = apacheLicense + (chunk as any).source;
+ }
+ }
+ }
+ }
+ },
+ transformIndexHtml(html: string) {
+ if (!apacheHtmlLicense) return html;
+ return html.replace('<head>', `<head>${apacheHtmlLicense}`);
+ }
+ };
+};
+
export default defineConfig({
- plugins: [react()],
+ plugins: [react(), addLicensePlugin()],
base: "",
build: {
chunkSizeWarningLimit: 2000,