Skip to content

Commit 6480f30

Browse files
committed
feat(FR-954) setup BAI UI package environment
1 parent 89f912c commit 6480f30

File tree

11 files changed

+21507
-11513
lines changed

11 files changed

+21507
-11513
lines changed

package.json

Lines changed: 1 addition & 1 deletion
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": "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 -r build",
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

Lines changed: 21 additions & 0 deletions
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
Lines changed: 13 additions & 0 deletions
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

Lines changed: 35 additions & 0 deletions
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": "^19.0.0",
27+
"react-dom": "^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+
}
Lines changed: 22 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2016",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"skipLibCheck": true,
6+
"esModuleInterop": true,
7+
"allowSyntheticDefaultImports": true,
8+
"strict": true,
9+
"forceConsistentCasingInFileNames": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"module": "ESNext",
12+
"moduleResolution": "node",
13+
"jsx": "react-jsx",
14+
"declaration": true,
15+
"declarationDir": "./dist",
16+
"outDir": "./dist",
17+
"rootDir": "./src"
18+
},
19+
"include": ["src/**/*"],
20+
"exclude": ["node_modules"]
21+
}

0 commit comments

Comments
 (0)