From d3e0c2e28722c3e25a10e789ba6d33a0f8522352 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Sat, 19 Oct 2024 13:34:23 +0100 Subject: [PATCH] feat(widget): automate adding copyright header --- widget/.eslintrc.json | 21 +++++++++++++++++++-- widget/src/vite-env.d.ts | 3 +++ widget/vite.config.ts | 25 ++++++++++++++++--------- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/widget/.eslintrc.json b/widget/.eslintrc.json index 8bb6ee1d..7586d22a 100644 --- a/widget/.eslintrc.json +++ b/widget/.eslintrc.json @@ -1,5 +1,10 @@ { - "plugins": ["@typescript-eslint/eslint-plugin", "import", "react"], + "plugins": [ + "@typescript-eslint/eslint-plugin", + "import", + "react", + "license-header" + ], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", @@ -46,7 +51,19 @@ { "blankLine": "never", "prev": ["const"], "next": "const" } ], "react/jsx-curly-brace-presence": "warn", - "react/self-closing-comp": "error" + "react/self-closing-comp": "error", + "license-header/header": [ + "error", + [ + "/*", + " * Copyright © 2024 Hexastack. All rights reserved.", + " *", + " * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:", + " * 1. The name \"Hexabot\" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.", + " * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's \"About\" section, documentation, and README file).", + " */" + ] + ] }, "settings": { "react": { diff --git a/widget/src/vite-env.d.ts b/widget/src/vite-env.d.ts index 3af59fbb..9a2d63de 100644 --- a/widget/src/vite-env.d.ts +++ b/widget/src/vite-env.d.ts @@ -5,3 +5,6 @@ * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ + +//added to bypass ESLint issue happing when we add an copyright header in a empty file +type empty = never; diff --git a/widget/vite.config.ts b/widget/vite.config.ts index 67d5795e..a39c6aa4 100644 --- a/widget/vite.config.ts +++ b/widget/vite.config.ts @@ -1,32 +1,39 @@ +/* + * Copyright © 2024 Hexastack. All rights reserved. + * + * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: + * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { resolve } from "path"; import react from "@vitejs/plugin-react"; import { defineConfig } from "vite"; import dts from "vite-plugin-dts"; - export default defineConfig(({ mode }) => { return { plugins: [react(), dts()], server: { - host: '0.0.0.0', + host: "0.0.0.0", }, define: { - 'process.env': - mode === 'development' ? { 'process.env': process.env } : {}, + "process.env": + mode === "development" ? { "process.env": process.env } : {}, }, build: { lib: { - entry: resolve(__dirname, 'src/ChatWidget.tsx'), - name: 'HexabotWidget', + entry: resolve(__dirname, "src/ChatWidget.tsx"), + name: "HexabotWidget", fileName: (format) => `hexabot-widget.${format}.js`, }, rollupOptions: { - external: ['react', 'react-dom'], + external: ["react", "react-dom"], output: { globals: { - react: 'React', - 'react-dom': 'ReactDOM', + react: "React", + "react-dom": "ReactDOM", }, }, },