Skip to content

Commit

Permalink
fix: window system clean script execution problems (#4513)
Browse files Browse the repository at this point in the history
* fix: fix window system clean script execution problems

* fix: lint error

* chore: remove test code
  • Loading branch information
vince292007 authored Sep 26, 2024
1 parent a46c85d commit a72b8ac
Show file tree
Hide file tree
Showing 13 changed files with 336 additions and 404 deletions.
2 changes: 1 addition & 1 deletion docs/src/en/guide/essentials/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The execution command is: `pnpm run [script]` or `npm run [script]`.
// Check types
"check:type": "turbo run typecheck",
// Clean the project (delete node_modules, dist, .turbo, etc.)
"clean": "vsh clean",
"clean": "node ./scripts/clean.mjs",
// Commit code
"commit": "czg",
// Start the project (by default, the dev scripts of all packages in the entire repository will run)
Expand Down
17 changes: 0 additions & 17 deletions docs/src/en/guide/project/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ Check the dependency situation of the entire project and output `unused dependen
pnpm vsh check-dep
```

### vsh clean

Delete the project's `node_modules`, `dist`, `.turbo` directories, etc., to clean the project.

#### Usage

```bash
pnpm vsh clean
```

#### Options

| Option | Description |
| --- | --- |
| `-r,--recursive` | Recursively delete the entire project, default `true` |
| `--del-lock` | Whether to delete the `pnpm-lock.yaml` file, default `true` |

### vsh lint

Lint checks the project to see if the code in the project conforms to standards.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/guide/essentials/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ npm 脚本是项目常见的配置,用于执行一些常见的任务,比如
// 检查类型
"check:type": "turbo run typecheck",
// 清理项目(删除node_modules、dist、.turbo)等目录
"clean": "vsh clean",
"clean": "node ./scripts/clean.mjs",
// 提交代码
"commit": "czg",
// 启动项目(默认会运行整个仓库所有包的dev脚本)
Expand Down
10 changes: 0 additions & 10 deletions docs/src/guide/project/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ pnpm vsh check-circular
pnpm vsh check-dep
```

### vsh clean

删除项目的`node_modules``dist``.turbo`等目录,清理项目。

#### 用法

```bash
pnpm vsh clean
```

#### 选项

| 选项 | 说明 |
Expand Down
2 changes: 1 addition & 1 deletion internal/lint-configs/eslint-config/src/custom-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const customConfig: Linter.Config[] = [
},
},
{
files: ['internal/**/**'],
files: ['internal/**/**', 'scripts/**/**'],
rules: {
'no-console': 'off',
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"check:cspell": "cspell lint **/*.ts **/README.md .changeset/*.md --no-progress",
"check:dep": "vsh check-dep",
"check:type": "turbo run typecheck",
"clean": "vsh clean",
"clean": "node ./scripts/clean.mjs",
"commit": "czg",
"dev": "turbo-run dev",
"dev:antd": "pnpm -F @vben/web-antd run dev",
Expand Down
48 changes: 24 additions & 24 deletions packages/@core/preferences/__tests__/preferences.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,30 @@ describe('preferences', () => {
expect(preferences).toEqual(defaultPreferences);
});

// it('initializes preferences with overrides', async () => {
// const overrides: any = {
// app: {
// locale: 'en-US',
// },
// };
// await preferenceManager.initPreferences({
// namespace: 'testNamespace',
// overrides,
// });

// // 等待防抖动操作完成
// // await new Promise((resolve) => setTimeout(resolve, 300)); // 等待100毫秒

// const expected = {
// ...defaultPreferences,
// app: {
// ...defaultPreferences.app,
// ...overrides.app,
// },
// };

// expect(preferenceManager.getPreferences()).toEqual(expected);
// });
it('initializes preferences with overrides', async () => {
const overrides: any = {
app: {
locale: 'en-US',
},
};
await preferenceManager.initPreferences({
namespace: 'testNamespace',
overrides,
});

// 等待防抖动操作完成
// await new Promise((resolve) => setTimeout(resolve, 300)); // 等待100毫秒

const expected = {
...defaultPreferences,
app: {
...defaultPreferences.app,
...overrides.app,
},
};

expect(preferenceManager.getPreferences()).toEqual(expected);
});

it('updates theme mode correctly', () => {
preferenceManager.updatePreferences({
Expand Down
2 changes: 1 addition & 1 deletion packages/@core/preferences/src/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class PreferenceManager {
const mergedPreference = merge(
{},
// overrides,
this.loadCachedPreferences() || defaultPreferences,
this.loadCachedPreferences() || {},
this.initialPreferences,
);

Expand Down
Loading

0 comments on commit a72b8ac

Please sign in to comment.