Skip to content

Commit d423102

Browse files
committed
feat(FR-954) setup BAI UI package environment
1 parent a77b0a0 commit d423102

File tree

10 files changed

+1517
-937
lines changed

10 files changed

+1517
-937
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"test": "jest",
1616
"test:react": "pnpm test --prefix ./react test",
1717
"wsproxy": "node ./src/wsproxy/local_proxy.js",
18-
"build": "rm -rf build/rollup && mkdir -p build/rollup/src/components && pnpm run copyindex && pnpm run copywc && pnpm run copywa && pnpm run copyresource && pnpm run copyconfig && rollup -c rollup.config.ts --configPlugin typescript && pnpm run --prefix ./react build:copy",
18+
"build": "pnpm run --prefix ./backendai-ui build && rm -rf build/rollup && mkdir -p build/rollup/src/components && pnpm run copyindex && pnpm run copywc && pnpm run copywa && pnpm run copyresource && pnpm run copyconfig && rollup -c rollup.config.ts --configPlugin typescript && pnpm run --prefix ./react build:copy",
1919
"build:react-only": "pnpm run --prefix ./react build",
2020
"build:plugin": "rm -rf build/rollup/dist/plugins && mkdir -p build/rollup/dist/plugins && rollup -c rollup.plugins.config.ts --configPlugin typescript",
2121
"server:p": "serve build/rollup",

packages/backendai-ui/.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# misc
7+
.DS_Store
8+
.env.local
9+
.env.development.local
10+
.env.test.local
11+
.env.production.local
12+
13+
npm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*
16+
17+
!/public
18+
19+
merged_schema.graphql
20+
21+
**/__generated__/*.graphql.ts
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"tabWidth": 2,
3+
"semi": true,
4+
"singleQuote": true,
5+
"importOrderSeparation": true,
6+
"importOrderParserPlugins": ["typescript", "jsx"],
7+
"printWidth": 80,
8+
"bracketSpacing": true,
9+
"trailingComma": "all",
10+
"plugins": ["@trivago/prettier-plugin-sort-imports"],
11+
"singleAttributePerLine": false
12+
}
13+

packages/backendai-ui/package.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "backend.ai-ui",
3+
"version": "1.0.0",
4+
"private": true,
5+
"description": "Shared UI components for Backend.AI",
6+
"main": "./dist/index.js",
7+
"module": "./dist/index.js",
8+
"types": "./dist/index.d.ts",
9+
"sideEffects": false,
10+
"exports": {
11+
".": {
12+
"import": "./dist/index.js",
13+
"types": "./dist/index.d.ts"
14+
}
15+
},
16+
"files": [
17+
"dist"
18+
],
19+
"scripts": {
20+
"dev": "tsc --watch",
21+
"prebuild": "rimraf dist",
22+
"build": "tsc",
23+
"clean": "rimraf dist"
24+
},
25+
"peerDependencies": {
26+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
27+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
28+
},
29+
"devDependencies": {
30+
"@types/react": "^19.0.0",
31+
"@types/react-dom": "^19.0.0",
32+
"rimraf": "^5.0.5",
33+
"typescript": "^5.7.2"
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
2+
children: React.ReactNode;
3+
}
4+
5+
const Button = ({ children, ...props }: ButtonProps) => {
6+
return (
7+
<button
8+
style={{
9+
backgroundColor: 'yellow',
10+
color: 'white',
11+
padding: '10px 20px',
12+
border: 'none',
13+
borderRadius: '5px',
14+
}}
15+
{...props}
16+
>
17+
{children}
18+
</button>
19+
);
20+
};
21+
22+
export default Button;

packages/backendai-ui/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Export all components from this file
2+
export { default as Button } from './components/Button';
3+
// Add more component exports as you create them

packages/backendai-ui/tsconfig.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES5",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": false,
6+
"skipLibCheck": true,
7+
"esModuleInterop": true,
8+
"allowSyntheticDefaultImports": true,
9+
"strict": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"noFallthroughCasesInSwitch": true,
12+
"module": "ESNext",
13+
"moduleResolution": "node",
14+
"resolveJsonModule": true,
15+
"isolatedModules": true,
16+
"jsx": "react-jsx",
17+
"declaration": true,
18+
"declarationDir": "./dist",
19+
"outDir": "./dist",
20+
"rootDir": "./src",
21+
"sourceMap": true,
22+
"noEmit": false
23+
},
24+
"include": ["src/**/*"],
25+
"exclude": ["node_modules"]
26+
}

pnpm-lock.yaml

+1,394-936
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
packages:
22
- react
3+
- packages/backendai-ui
34
onlyBuiltDependencies:
45
- bufferutil
56
- core-js

react/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "25.5.0-alpha.0",
44
"private": true,
55
"dependencies": {
6+
"backend.ai-ui": "workspace:*",
67
"@ai-sdk/openai": "^1.3.3",
78
"@ai-sdk/react": "^1.2.2",
89
"@ant-design/charts": "^2.2.7",

0 commit comments

Comments
 (0)