Skip to content

Commit

Permalink
fix: build types
Browse files Browse the repository at this point in the history
  • Loading branch information
sendya committed Mar 10, 2022
1 parent e664158 commit e8bbe58
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 23 deletions.
7 changes: 4 additions & 3 deletions packages/pro-layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "3.2.0-alpha.1",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit --skipLibCheck && vite build",
"types": "tsc --emitDeclarationOnly",
"build": "vue-tsc --noEmit && vite build",
"types": "vue-tsc --declaration --emitDeclarationOnly",
"preview": "vite preview --port 5050",
"test:unit": "vitest --environment jsdom",
"typecheck": "vue-tsc --noEmit && vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
Expand All @@ -15,6 +15,7 @@
],
"main": "./dist/pro-layout.umd.js",
"module": "./dist/pro-layout.es.js",
"typings": "./dist/main.d.ts",
"exports": {
".": {
"import": "./dist/pro-layout.es.js",
Expand All @@ -23,7 +24,7 @@
},
"dependencies": {
"@ant-design/icons-vue": "^6.0.1",
"ant-design-vue": "^3.0.0-beta.10",
"ant-design-vue": "^3.0.0-beta.13",
"omit.js": "^2.0.2",
"vue": "^3.2.31",
"vue-router": "^4.0.12"
Expand Down
9 changes: 9 additions & 0 deletions packages/pro-layout/src/index.less
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
@import './default.less';

@import './BasicLayout.less';
@import './Header.less';
@import './components/FooterToolbar/index.less';
@import './components/GlobalFooter/index.less';
@import './components/GlobalHeader/index.less';
@import './components/GridContent/index.less';
@import './components/PageContainer/index.less';
@import './components/SiderMenu/index.less';
@import './components/TopNavHeader/index.less';
5 changes: 5 additions & 0 deletions packages/pro-layout/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import './default.less'
import './index.less'

export * from './RouteContext'
export * from './typings'
export * from './utils/getMenuData'
Expand Down Expand Up @@ -26,3 +29,5 @@ export type { WaterMarkProps } from './components/WaterMark'

export { default } from './BasicLayout'
export type { BasicLayoutProps } from './BasicLayout'

export { default as ProLayout } from './BasicLayout'
14 changes: 14 additions & 0 deletions packages/pro-layout/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "examples/**/*.vue"],
"exclude": ["src/**/__tests__/*", "node_modules"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@ant-design-vue/pro-layout":["./src/index.ts"]

}
}
}
16 changes: 7 additions & 9 deletions packages/pro-layout/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "examples/**/*.vue"],
"exclude": ["src/**/__tests__/*", "node_modules"],
"include": ["src/**/*.ts", "src/**/*.d.ts"],
"compilerOptions": {
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@ant-design-vue/pro-layout":["./src/index.ts"]
}
"declaration": true,
"declarationDir": "./dist"
},
"files": [],
"references": [
{
"path": "./tsconfig.vite-config.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.vitest.json"
}
Expand Down
2 changes: 0 additions & 2 deletions packages/pro-layout/tsconfig.vite-config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*"],
"exclude": ["node_modules"],
"compilerOptions": {
"skipLibCheck": true,
"composite": true,
"types": ["node", "vitest"]
}
Expand Down
9 changes: 3 additions & 6 deletions packages/pro-layout/tsconfig.vitest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["src/**/__tests__/*"],
"extends": "./tsconfig.app.json",
"exclude": [],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"lib": [],
"types": ["node", "jsdom"]
}
}
7 changes: 4 additions & 3 deletions packages/pro-layout/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const distDir = fileURLToPath(new URL('./dist', import.meta.url))

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx(), lessCopy()],
plugins: [vue(), vueJsx()],
resolve: {
alias: {
'@ant-design-vue/pro-layout': srcDir,
Expand All @@ -38,6 +38,7 @@ export default defineConfig({
rollupOptions: {
external: ['vue', 'vue-router', '@ant-design/icons-vue', '@ant-design/icons-svg', 'ant-design-vue', 'moment'],
output: {
exports: 'named',
// Provide global variables to use in the UMD build
// for externalized deps`
globals: {
Expand All @@ -52,9 +53,9 @@ export default defineConfig({
plugins: [
typescript({
target: 'es2020',
rootDir: srcDir,
rootDir: './src',
declaration: true,
declarationDir: distDir,
declarationDir: './dist',
exclude: 'node_modules/**',
allowSyntheticDefaultImports: true,
}),
Expand Down

0 comments on commit e8bbe58

Please sign in to comment.