Skip to content

Commit be1beb1

Browse files
authored
add license banner for ui packages (#184)
* feat: add license banner for translators/dashboard/terminal/xterm-addon-overlay/xterm-addon-zmodem Signed-off-by: warjiang <[email protected]> * chore: ignore license check for node_modules、husky Signed-off-by: warjiang <[email protected]> * ci: switch to turbo build Signed-off-by: warjiang <[email protected]> --------- Signed-off-by: warjiang <[email protected]>
1 parent a69df28 commit be1beb1

File tree

21 files changed

+245
-21
lines changed

21 files changed

+245
-21
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
echo "Start build"
4949
pnpm --version
5050
cd ui
51-
pnpm install --filter @karmada/dashboard
52-
pnpm run dashboard:build
51+
pnpm install
52+
pnpm turbo build
5353
build-bin:
5454
name: build-bin
5555
runs-on: ubuntu-22.04

hack/karmada-license.tpl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
Copyright {{year}} The Karmada Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/

hack/verify-license.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ missing_license_header_files="$($ADDLICENSE_BIN \
4040
-ignore "**/*.yml" \
4141
-ignore "**/*.json" \
4242
-ignore ".idea/**" \
43+
-ignore "**/*/node_modules/**" \
44+
-ignore "ui/.husky/**" \
4345
.)" || true
4446

4547
if [[ "$missing_license_header_files" ]]; then

ui/apps/dashboard/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
]
2727
},
2828
"dependencies": {
29-
"@karmada/dashboard": "link:",
30-
"@karmada/i18n-tool": "link:",
29+
"@karmada/i18n-tool": "workspace:*",
30+
"@karmada/utils": "workspace:*",
3131
"@monaco-editor/react": "^4.6.0",
3232
"@tanstack/react-query": "^5.59.8",
3333
"@uidotdev/usehooks": "^2.4.1",
@@ -65,6 +65,7 @@
6565
"tailwindcss": "^3.4.13",
6666
"typescript": "^5.6.3",
6767
"vite": "^5.4.8",
68+
"vite-plugin-banner": "^0.8.0",
6869
"vite-plugin-dynamic-base": "^1.1.0",
6970
"vite-plugin-svgr": "^4.2.0"
7071
}

ui/apps/dashboard/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import react from '@vitejs/plugin-react';
1919
import svgr from 'vite-plugin-svgr';
2020
import path from 'path';
2121
import { dynamicBase } from 'vite-plugin-dynamic-base';
22+
import banner from 'vite-plugin-banner';
23+
import { getLicense } from '@karmada/utils';
2224

2325
const replacePathPrefixPlugin = (): Plugin => {
2426
return {
@@ -34,10 +36,13 @@ const replacePathPrefixPlugin = (): Plugin => {
3436

3537
// https://vitejs.dev/config/
3638
export default defineConfig(({ mode }) => {
39+
const license = getLicense();
40+
3741
const env = loadEnv(mode, process.cwd(), '');
3842
return {
3943
base: process.env.NODE_ENV === 'development' ? '' : '/static',
4044
plugins: [
45+
banner(license) as Plugin,
4146
react(),
4247
svgr(),
4348
replacePathPrefixPlugin(),

ui/packages/terminal/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"dependencies": {
3232
"@karmada/xterm-addon-overlay": "workspace:*",
3333
"@karmada/xterm-addon-zmodem": "workspace:*",
34+
"@karmada/utils": "workspace:*",
3435
"@xterm/addon-canvas": "^0.7.0",
3536
"@xterm/addon-clipboard": "^0.1.0",
3637
"@xterm/addon-fit": "^0.10.0",

ui/packages/terminal/tsup.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ limitations under the License.
1515
*/
1616

1717
import { defineConfig } from 'tsup';
18+
import { getLicense } from '@karmada/utils';
19+
20+
const license = getLicense();
1821

1922
export default defineConfig({
2023
entry: ['src/index.tsx'],
@@ -23,5 +26,10 @@ export default defineConfig({
2326
clean: true,
2427
format: ['cjs', 'esm'],
2528
// external: ['react'],
26-
dts: true,
29+
dts: {
30+
banner: license,
31+
},
32+
banner: {
33+
js: license,
34+
},
2735
});

ui/packages/translators/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
},
2424
"dependencies": {
2525
"got": "^14.4.2",
26-
"openai": "^4.63.0"
26+
"openai": "^4.63.0",
27+
"@karmada/utils": "workspace:*"
2728
}
2829
}

ui/packages/translators/tsup.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ limitations under the License.
1515
*/
1616

1717
import { defineConfig } from 'tsup';
18+
import {getLicense} from '@karmada/utils';
1819

20+
const license = getLicense()
1921
export default defineConfig({
2022
entry: ['src/index.ts'],
2123
splitting: false,
2224
sourcemap: true,
2325
clean: true,
2426
format: ['cjs', 'esm'],
2527
dts: false,
28+
banner: {
29+
js: license
30+
}
2631
});

ui/packages/utils/.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
build
3+
coverage
4+
dist
5+
pnpm-*

0 commit comments

Comments
 (0)