forked from jd-solanki/anu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: separate config files and use inheritance
- Loading branch information
1 parent
88d3817
commit e4523d2
Showing
10 changed files
with
138 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,34 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"baseUrl": "src", | ||
"target": "esnext", | ||
"useDefineForClassFields": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"strict": true, | ||
"jsx": "preserve", | ||
"forceConsistentCasingInFileNames": true, | ||
"sourceMap": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"esModuleInterop": true, | ||
"outDir": "dist/types", | ||
"lib": [ | ||
"esnext", | ||
"dom" | ||
], | ||
"skipLibCheck": true, | ||
"paths": { | ||
"@/*": [ | ||
"*" | ||
], | ||
"anu-vue": [ | ||
"." | ||
] | ||
}, | ||
"types": [ | ||
"vitest/globals", | ||
"unplugin-vue-macros/macros-global" | ||
] | ||
}, | ||
"vueCompilerOptions": { | ||
"target": 3, | ||
"plugins": [ | ||
"@vue-macros/volar/define-options", | ||
"@vue-macros/volar/define-models", | ||
"@vue-macros/volar/define-props", | ||
"@vue-macros/volar/define-props-refs", | ||
"@vue-macros/volar/short-vmodel", | ||
"@vue-macros/volar/define-slots", | ||
"@vue-macros/volar/export-props" | ||
] | ||
}, | ||
"include": [ | ||
"src/**/*.ts", | ||
"src/**/*.d.ts", | ||
"src/**/*.tsx", | ||
"src/**/*.vue", | ||
"auto-imports.d.ts", | ||
"shims.d.ts", | ||
"volar.d.ts" | ||
"./src/**/*.ts", | ||
"./src/**/*.d.ts", | ||
"./src/**/*.tsx", | ||
"./src/**/*.vue", | ||
"./auto-imports.d.ts", | ||
"./shims.d.ts", | ||
"./volar.d.ts" | ||
], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.node.json" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
"include": [ | ||
"vite.config.ts" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { defineConfig, mergeConfig } from 'vitest/config' | ||
import vitestBaseConfig from '../../vitest.config' | ||
import viteConfig from './vite.config' | ||
|
||
const vitestConfig = mergeConfig(vitestBaseConfig, defineConfig({ | ||
test: { | ||
browser: { | ||
enabled: true, | ||
|
||
// @ts-expect-error ignore, we don't have the type here | ||
enableUI: true, | ||
name: 'chrome', | ||
headless: !!process.env.HEADLESS, | ||
provider: 'webdriverio', | ||
}, | ||
}, | ||
})) | ||
|
||
export default mergeConfig(viteConfig, vitestConfig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"types": [ | ||
"node" | ||
] | ||
}, | ||
"include": [ | ||
"src/**/*", | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"types": [ | ||
"node" | ||
] | ||
} | ||
}, | ||
"include": [ | ||
"src/**/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import path from 'path' | ||
import * as url from 'url' | ||
import path from 'node:path' | ||
import * as url from 'node:url' | ||
|
||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) | ||
|
||
export const repoRoot = path.join(__dirname, '..') | ||
export const anuVuePkgRoot = path.join(__dirname, '..', 'packages', 'anu-vue') | ||
export const packagesDir = path.join(repoRoot, 'packages') | ||
|
||
export const anuVuePkgRoot = path.join(packagesDir, 'anu-vue') | ||
export const anuVueSrc = path.join(anuVuePkgRoot, 'src') | ||
export const anuVueComponentsDir = path.join(anuVuePkgRoot, 'src', 'components') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import vue from '@vitejs/plugin-vue' | ||
import vueJsx from '@vitejs/plugin-vue-jsx' | ||
import VueMacros from 'unplugin-vue-macros/vite' | ||
import { defineConfig } from 'vite' | ||
import { anuVueSrc, packagesDir } from './scripts/paths' | ||
|
||
const externals = [ | ||
'vue', | ||
'@floating-ui/vue', | ||
'colord', | ||
'defu', | ||
] | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [ | ||
VueMacros({ | ||
plugins: { | ||
vue: vue(), | ||
}, | ||
}), | ||
vueJsx(), | ||
], | ||
resolve: { | ||
dedupe: ['vue'], | ||
alias: { | ||
// TODO: This should be `repoRoot`. We will update it in internal refactor task. | ||
'@': anuVueSrc, | ||
'@anu-vue': packagesDir, | ||
}, | ||
}, | ||
optimizeDeps: { | ||
include: [ | ||
...externals, | ||
], | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { join } from 'node:path' | ||
import { defineConfig } from 'vitest/config' | ||
import { anuVuePkgRoot } from './scripts/paths' | ||
|
||
function noop() {} | ||
|
||
export default defineConfig({ | ||
test: { | ||
open: !process.env.HEADLESS, | ||
isolate: false, | ||
reporters: ['json', { | ||
onInit: noop, | ||
onPathsCollected: noop, | ||
onCollected: noop, | ||
onFinished: noop, | ||
onTaskUpdate: noop, | ||
onTestRemoved: noop, | ||
onWatcherStart: noop, | ||
onWatcherRerun: noop, | ||
onServerRestart: noop, | ||
onUserConsoleLog: noop, | ||
}, 'default'], | ||
setupFiles: [join(anuVuePkgRoot, 'test', 'setup.vitest.ts')], | ||
}, | ||
}) |