Skip to content

Commit 05a1e24

Browse files
committed
init
1 parent b448d1c commit 05a1e24

File tree

7 files changed

+128
-0
lines changed

7 files changed

+128
-0
lines changed

web/shared_ui/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
dist
3+
tsconfig.tsbuildinfo

web/shared_ui/package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "sqlmesh-shared-ui",
3+
"version": "0.0.1",
4+
"private": false,
5+
"type": "module",
6+
"files": [
7+
"/dist"
8+
],
9+
"main": "dist/sqlmesh-shared-ui.umd.js",
10+
"module": "dist/sqlmesh-shared-ui.es.js",
11+
"types": "dist/index.d.ts",
12+
"exports": {
13+
".": {
14+
"import": "./dist/sqlmesh-shared-ui.es.js",
15+
"require": "./dist/sqlmesh-shared-ui.umd.js"
16+
}
17+
},
18+
"scripts": {
19+
"build": "tsc -b && vite build --base './'",
20+
"build:storybook": "storybook build",
21+
"dev": "storybook dev -p 6006",
22+
"lint": "eslint --max-warnings 0 --fix .",
23+
"pretty": "prettier --write .",
24+
"format": "pnpm run pretty && pnpm run lint",
25+
"test": "vitest",
26+
"test:watch": "vitest watch",
27+
"test:ui": "vitest --ui"
28+
},
29+
"devDependencies": {
30+
"@types/react": "^18.3.23",
31+
"@types/react-dom": "^18.3.7",
32+
"@vitejs/plugin-react": "^4.7.0",
33+
"typescript": "^5.8.3",
34+
"vite": "^6.3.5",
35+
"vite-plugin-dts": "^4.5.4"
36+
},
37+
"peerDependencies": {
38+
"react": "^18.3.1",
39+
"react-dom": "^18.3.1"
40+
}
41+
}

web/shared_ui/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from '@/utils'
2+
export * from '@/types'

web/shared_ui/src/types/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export type Nil = undefined | null
2+
export type Optional<T> = T | undefined
3+
export type Maybe<T> = T | Nil

web/shared_ui/src/utils/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { Nil } from '@/types'
2+
3+
export function isNil(value: unknown): value is Nil {
4+
return value == null
5+
}
6+
export function notNil(value: unknown): value is NonNullable<unknown> {
7+
return value != null
8+
}

web/shared_ui/tsconfig.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"include": ["**/*.ts", "**/*.tsx", "vitest.config.js"],
3+
"compilerOptions": {
4+
"target": "ES2022",
5+
"jsx": "react-jsx",
6+
"module": "ESNext",
7+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
8+
"types": ["vite/client"],
9+
10+
/* Bundler mode */
11+
"moduleResolution": "bundler",
12+
"allowImportingTsExtensions": true,
13+
"verbatimModuleSyntax": true,
14+
"noEmit": true,
15+
16+
/* Linting */
17+
"skipLibCheck": true,
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true,
22+
"noUncheckedSideEffectImports": true,
23+
24+
/* Declaration */
25+
"declaration": true,
26+
"declarationDir": "./dist",
27+
"emitDeclarationOnly": false,
28+
29+
/* Paths */
30+
"baseUrl": ".",
31+
"paths": {
32+
"@/*": ["./src/*"]
33+
}
34+
}
35+
}

web/shared_ui/vite.config.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { defineConfig } from 'vite'
2+
import react from '@vitejs/plugin-react'
3+
import path from 'path'
4+
import dts from 'vite-plugin-dts'
5+
6+
export default defineConfig({
7+
plugins: [
8+
react(),
9+
dts({
10+
insertTypesEntry: true,
11+
}),
12+
],
13+
resolve: {
14+
alias: {
15+
'@': path.resolve(__dirname, './src'),
16+
},
17+
},
18+
build: {
19+
lib: {
20+
entry: path.resolve(__dirname, 'src/index.ts'),
21+
name: 'sqlmesh-shared-ui',
22+
fileName: format => `sqlmesh-shared-ui.${format}.js`,
23+
},
24+
rollupOptions: {
25+
external: ['react', 'react-dom'],
26+
output: {
27+
globals: {
28+
react: 'React',
29+
'react-dom': 'ReactDOM',
30+
},
31+
},
32+
},
33+
sourcemap: true,
34+
outDir: 'dist',
35+
},
36+
})

0 commit comments

Comments
 (0)