feat(infra): migrate to rsbuild
This commit is contained in:
95 files changed
+5582
-11282
No files matched your search
@@ -0,0 +1,59 @@
|
||||
import { defineConfig, type RsbuildConfig } from '@rsbuild/core';
|
||||
import { pluginReact } from '@rsbuild/plugin-react';
|
||||
import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
|
||||
import { pluginDts } from 'rsbuild-plugin-dts';
|
||||
|
||||
/**
|
||||
* Defines a standard Rsbuild configuration for services (apps).
|
||||
*
|
||||
* @param config - Optional Rsbuild configuration overrides
|
||||
* @returns A complete Rsbuild configuration object
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { defineServiceConfig } from '@ermnvldmr/rsbuild-config';
|
||||
* export default defineServiceConfig({
|
||||
* source: { entry: { index: './src/main.ts' } }
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function defineServiceConfig(config: RsbuildConfig = {}): RsbuildConfig {
|
||||
return defineConfig({
|
||||
plugins: [pluginReact(), pluginTypeCheck()],
|
||||
html: {
|
||||
template: './src/index.html',
|
||||
},
|
||||
...config,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a standard Rsbuild configuration for packages (libraries).
|
||||
*
|
||||
* @param config - Optional Rsbuild configuration overrides
|
||||
* @returns A complete Rsbuild configuration object
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { definePackageConfig } from '@ermnvldmr/rsbuild-config';
|
||||
* export default definePackageConfig({
|
||||
* output: { target: 'node' }
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function definePackageConfig(config: RsbuildConfig = {}): RsbuildConfig {
|
||||
return defineConfig({
|
||||
plugins: [pluginReact(), pluginTypeCheck(), pluginDts()],
|
||||
output: {
|
||||
distPath: {
|
||||
root: './dist',
|
||||
js: '.',
|
||||
},
|
||||
target: 'web',
|
||||
},
|
||||
tools: {
|
||||
htmlPlugin: false,
|
||||
},
|
||||
...config,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export const baseVitestConfig = defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'node',
|
||||
passWithNoTests: true,
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
reporter: ['text', 'json', 'html', 'lcov'],
|
||||
exclude: ['node_modules/**', 'dist/**', '**/*.d.ts', '**/*.config.*', '**/*.stories.tsx'],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const reactVitestConfig = defineConfig({
|
||||
test: {
|
||||
...baseVitestConfig.test,
|
||||
environment: 'jsdom',
|
||||
setupFiles: ['./src/setupTests.ts'],
|
||||
alias: {
|
||||
// Handle asset mocks if needed
|
||||
'\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user