Skip to content

Commit

Permalink
perf: throttleTime 默认值修改为 3s
Browse files Browse the repository at this point in the history
  • Loading branch information
renxia committed Jul 28, 2024
1 parent 0f84c37 commit fd9d4af
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ jobs:
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# cache: 'pnpm'

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
with:
version: 8
version: 9

- name: Install dependencies
run: pnpm install --ignore-scripts
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ jobs:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.com

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@
"./template"
],
"dependencies": {
"@lzwme/fe-utils": "^1.7.3",
"@lzwme/fe-utils": "^1.7.5",
"micromatch": "^4.0.7"
},
"devDependencies": {
"@lzwme/fed-lint-helper": "^2.6.1",
"@types/node": "^20.14.2",
"@lzwme/fed-lint-helper": "^2.6.2",
"@types/node": "^22.0.2",
"base64-js": "^1.5.1",
"crypto-js": "^4.2.0",
"husky": "^9.0.11",
"prettier": "^3.3.1",
"husky": "^9.1.4",
"prettier": "^3.3.3",
"standard-version": "^9.5.0",
"typescript": "^5.4.5"
"typescript": "^5.5.4"
}
}
2 changes: 1 addition & 1 deletion src/lib/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function getConfig(useCache = true) {
);
}

config.throttleTime = Math.max(1, +config.throttleTime || 5);
config.throttleTime = Math.max(1, +config.throttleTime || 3);

if (!Array.isArray(config.ruleDirs)) config.ruleDirs = [config.ruleDirs as never as string];

Expand Down
2 changes: 1 addition & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface W2XScriptsConfig {
envConfFile?: string;
/** 缓存数据保存路径 */
cacheFile?: string;
/** 数据处理防抖时间间隔。单位为秒,默认为 10 (s) */
/** 数据处理防抖时间间隔。单位为秒,默认为 3 (s) */
throttleTime?: number;
/** 缓存数据有效时长。单位秒。默认为 12 小时(12 * 60 * 60) */
cacheDuration?: number;
Expand Down
4 changes: 2 additions & 2 deletions w2.x-scripts.config.sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const config = {
// envConfFile: 'env-config.sh',
/** 写入环境变量信息到本地文件的路径。若设置为空则不写入 */
// cacheFile: 'w2.x-scripts.cache.json',
/** 数据处理防抖时间间隔。单位为秒,默认为 5 (s) */
throttleTime: 5,
/** 数据处理防抖时间间隔。单位为秒,默认为 3 (s) */
throttleTime: 3,
/** 指定规则集文件路径或所在目录,尝试从该列表加载自定义的规则集 */
ruleDirs: [
// require.resolve('@lzwme/x-scripts-rules', { paths: require.main.paths }),
Expand Down

0 comments on commit fd9d4af

Please sign in to comment.