Skip to content

Commit ad4f66a

Browse files
committed
split tsconfig
1 parent 386d63c commit ad4f66a

File tree

5 files changed

+54
-39
lines changed

5 files changed

+54
-39
lines changed

web/common/package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@
2424
"default": "./dist/sqlmesh-common.umd.js"
2525
}
2626
},
27-
"./styles/design/index.css": "./dist/styles/design/index.css",
28-
"./styles/design/*": "./dist/styles/design/*",
29-
"./design": "./dist/styles/design/index.css",
27+
"./styles/*": "./dist/styles/*",
3028
"./design/*": "./dist/styles/design/*",
31-
"./configs/*": "./dist/configs/*",
32-
"./tailwind.base.config.js": "./dist/configs/tailwind.base.config.js",
33-
"./styles/tailwind.min.css": "./dist/styles/tailwind.min.css"
29+
"./configs/*": "./dist/configs/*"
3430
},
3531
"scripts": {
3632
"ci": "pnpm run lint && pnpm run build",
37-
"build": "pnpm run build:css && tsc -p tsconfig.build.json && vite build --base './'",
33+
"build": "tsc -p tsconfig.build.json && vite build --base './' && pnpm run build:css",
3834
"build:css": "tailwindcss -i ./src/styles/index.css -o ./dist/styles/tailwind.min.css --minify",
3935
"build:storybook": "storybook build",
4036
"dev": "storybook dev -p 6006",

web/common/tsconfig.base.json

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

web/common/tsconfig.build.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
2-
"extends": "./tsconfig.json",
2+
"extends": "./tsconfig.base.json",
33
"include": ["src/**/*.ts", "src/**/*.tsx"],
4-
"exclude": ["src/**/*.stories.tsx", "src/**/*.test.ts", "src/**/*.test.tsx"],
4+
"exclude": [
5+
"**/*.test.ts",
6+
"**/*.test.tsx",
7+
"**/*.stories.tsx",
8+
"tests/**/*"
9+
],
510
"compilerOptions": {
611
"noEmit": false,
712
"allowImportingTsExtensions": false,

web/common/tsconfig.json

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,7 @@
11
{
2+
"extends": "./tsconfig.base.json",
23
"include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts"],
34
"compilerOptions": {
4-
"target": "ES2022",
5-
"jsx": "react-jsx",
6-
"module": "ESNext",
7-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
8-
"types": ["vite/client", "@testing-library/jest-dom"],
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-
}
5+
"types": ["vite/client", "@testing-library/jest-dom"]
346
}
357
}

web/common/vite.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default defineConfig({
1010
dts({
1111
insertTypesEntry: true,
1212
declarationMap: true,
13+
tsconfigPath: './tsconfig.build.json',
1314
}),
1415
viteStaticCopy({
1516
targets: [
@@ -30,6 +31,7 @@ export default defineConfig({
3031
},
3132
},
3233
build: {
34+
cssMinify: true,
3335
lib: {
3436
entry: path.resolve(__dirname, 'src/index.ts'),
3537
name: 'sqlmesh-common',
@@ -55,6 +57,12 @@ export default defineConfig({
5557
'class-variance-authority': 'classVarianceAuthority',
5658
'@radix-ui/react-slot': 'radixSlot',
5759
},
60+
assetFileNames: assetInfo => {
61+
if (assetInfo.name && assetInfo.name.endsWith('.css')) {
62+
return 'styles/[name].min[extname]'
63+
}
64+
return '[name][extname]'
65+
},
5866
},
5967
},
6068
sourcemap: process.env.NODE_ENV !== 'production',

0 commit comments

Comments
 (0)