feat(widget): automate adding copyright header

This commit is contained in:
yassinedorbozgithub 2024-10-19 13:34:23 +01:00
parent 516737ac4b
commit d3e0c2e287
3 changed files with 38 additions and 11 deletions

View File

@ -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": {

View File

@ -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;

View File

@ -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",
},
},
},