Skip to content

Commit

Permalink
chore: Update tools
Browse files Browse the repository at this point in the history
  • Loading branch information
nuintun committed Dec 18, 2024
1 parent 25b2c77 commit 45e3300
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tools/bin/webpack.config.base.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @module webpack.config.base
* @description 基础 Webpack 配置.
* @description 基础 Webpack 配置
*/

import webpack from 'webpack';
Expand Down
2 changes: 1 addition & 1 deletion tools/bin/webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @module webpack.config.dev
* @description 开发环境 Webpack 配置.
* @description 开发环境 Webpack 配置
* @see https://github.com/facebook/create-react-app
*/

Expand Down
6 changes: 3 additions & 3 deletions tools/bin/webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @module webpack.config.prod
* @description 生产环境 Webpack 配置.
* @description 生产环境 Webpack 配置
* @see https://github.com/facebook/create-react-app
*/

Expand Down Expand Up @@ -28,7 +28,7 @@ async function getLightningTargets() {
configure.devtool = false;
configure.cache.name = 'prod';

// 使用自定义 minimizer 工具.
// 使用自定义 minimizer 工具
configure.optimization.minimizer = [
new CssMinimizerPlugin({
minimizerOptions: {
Expand All @@ -42,7 +42,7 @@ async function getLightningTargets() {
})
];

// 开启 webpack-bundle-analyzer 分析工具.
// 开启 webpack-bundle-analyzer 分析工具
if (process.argv[2] === '--report') {
configure.plugins.push(new BundleAnalyzerPlugin({ analyzerPort: 'auto' }));
}
Expand Down
16 changes: 8 additions & 8 deletions tools/interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @module interface
* @description 类型定义.
* @description 类型定义
*/

import { Configuration } from 'webpack';
Expand All @@ -9,19 +9,19 @@ import { Plugin, ProcessOptions } from 'postcss';
import { Options as SvgoOptions } from '@nuintun/svgo-loader';

/**
* @description Env 配置.
* @description Env 配置
*/
type Env = Record<string, unknown>;

/**
* @description Env 配置函数.
* @description Env 配置函数
*/
interface EnvFunction {
(mode: string, env: Env): Env | Promise<Env>;
}

/**
* @description 获取对象指定属性非空类型.
* @description 获取对象指定属性非空类型
*/
type Prop<T, K extends keyof T> = NonNullable<T[K]>;

Expand All @@ -31,27 +31,27 @@ type Prop<T, K extends keyof T> = NonNullable<T[K]>;
export { Options as SwcConfig } from '@swc/core';

/**
* @description Webpack 文件系统.
* @description Webpack 文件系统
*/
export type FileSystem = NonNullable<Options['fs']>;

/**
* @description Postcss 配置.
* @description Postcss 配置
*/
export interface PostcssConfig extends ProcessOptions {
plugins?: Plugin[];
sourceMap?: boolean;
}

/**
* @description Svgo 配置.
* @description Svgo 配置
*/
export interface SvgoConfig extends Omit<SvgoOptions, 'configFile'> {
path?: string;
}

/**
* @description App 配置.
* @description App 配置
*/
export interface AppConfig extends Pick<Configuration, 'context' | 'plugins' | 'externals'> {
lang: string;
Expand Down
2 changes: 1 addition & 1 deletion tools/lib/ip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @module ip
* @description 获取本机 IP 地址.
* @description 获取本机 IP 地址
*/

import os from 'node:os';
Expand Down
2 changes: 1 addition & 1 deletion tools/lib/rules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @module rules
* @description 配置 Webpack 规则.
* @description 配置 Webpack 规则
*/

import swcrc from '../../.swcrc.js';
Expand Down
2 changes: 1 addition & 1 deletion tools/lib/targets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @module targets
* @description 解析 browserslist 配置.
* @description 解析 browserslist 配置
*/

import { resolve } from 'node:path';
Expand Down

0 comments on commit 45e3300

Please sign in to comment.