refactor: Continue refactoring after migrating to rsbuild
This commit is contained in:
120 files changed
+751
-483
No files matched your search
@@ -0,0 +1 @@
|
||||
export * from './lib/dev';
|
||||
@@ -1,59 +1 @@
|
||||
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,
|
||||
});
|
||||
}
|
||||
export * from './lib';
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './rsbuild';
|
||||
export * from './vitest';
|
||||
@@ -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/dev';
|
||||
* export default defineServiceConfig({
|
||||
* source: { entry: { index: './src/main.ts' } }
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function defineServiceConfig(config: RsbuildConfig = {}): RsbuildConfig {
|
||||
return defineConfig({
|
||||
plugins: [pluginReact(), pluginTypeCheck()],
|
||||
html: {
|
||||
template: './src/static/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/dev';
|
||||
* 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,
|
||||
});
|
||||
}
|
||||
+7
-1
@@ -1,6 +1,9 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
|
||||
/**
|
||||
* Base Vitest configuration for the monorepo.
|
||||
*/
|
||||
export const baseVitestConfig = defineConfig({
|
||||
plugins: [tsconfigPaths()],
|
||||
test: {
|
||||
@@ -15,11 +18,14 @@ export const baseVitestConfig = defineConfig({
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* React-specific Vitest configuration.
|
||||
*/
|
||||
export const reactVitestConfig = defineConfig({
|
||||
test: {
|
||||
...baseVitestConfig.test,
|
||||
environment: 'jsdom',
|
||||
setupFiles: ['./src/setupTests.ts'],
|
||||
setupFiles: ['./.config/vitest/setup.ts'],
|
||||
alias: {
|
||||
// Handle asset mocks if needed
|
||||
'\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
||||
@@ -0,0 +1 @@
|
||||
export * from './config';
|
||||
@@ -0,0 +1,2 @@
|
||||
// Runtime entry point (empty)
|
||||
export {};
|
||||
@@ -0,0 +1 @@
|
||||
export * from './config/vitest';
|
||||
@@ -0,0 +1 @@
|
||||
export * from './lib/testing';
|
||||
Reference in new issue
Block a user