From b6043167752a74582e8d095721cf5b3849951e06 Mon Sep 17 00:00:00 2001 From: EternalHeart <48346853+wh131462@users.noreply.github.com> Date: Thu, 14 Mar 2024 23:37:22 +0800 Subject: [PATCH 1/4] feat: ora loading (#54) --- CHANGELOG.md | 5 +---- common/utils/http/fetch_.js | 4 ++-- common/utils/loading/loading.js | 1 - package.json | 1 + scripts/loading.js | 5 ++--- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 642065b..bf60119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,8 @@ - - ## [1.0.9-3](https://github.com/wh131462/leetcode-practice/compare/cli-v1.0.9-2...cli-v1.0.9-3) (2024-03-14) - ### Bug Fixes -* fix check info log ([#52](https://github.com/wh131462/leetcode-practice/issues/52)) ([6b710a1](https://github.com/wh131462/leetcode-practice/commit/6b710a1a2ff088d9806d33153bf811e5a5e19306)) +- fix check info log ([#52](https://github.com/wh131462/leetcode-practice/issues/52)) ([6b710a1](https://github.com/wh131462/leetcode-practice/commit/6b710a1a2ff088d9806d33153bf811e5a5e19306)) ## [1.0.9-2](https://github.com/wh131462/leetcode-practice/compare/cli-v1.0.9-1...cli-v1.0.9-2) (2024-03-14) diff --git a/common/utils/http/fetch_.js b/common/utils/http/fetch_.js index 7c7ccb0..b8deddd 100644 --- a/common/utils/http/fetch_.js +++ b/common/utils/http/fetch_.js @@ -1,4 +1,5 @@ import { Loading } from '#common/utils/loading/loading.js' +import ora from 'ora' /** * 基础请求-直接返回JSON格式的值 @@ -8,8 +9,7 @@ import { Loading } from '#common/utils/loading/loading.js' * @private */ export async function fetch_(url, options) { - const loader = new Loading(options.loadText ?? 'loading...') - loader.start() + const loader = ora(options.loadText ?? 'loading...').start() const resp = await fetch(url, options).then((res) => res.json()) loader.stop() return resp diff --git a/common/utils/loading/loading.js b/common/utils/loading/loading.js index 3e12a6c..7a7f9fa 100644 --- a/common/utils/loading/loading.js +++ b/common/utils/loading/loading.js @@ -1,5 +1,4 @@ import chalk from 'chalk' - export class Loading { text = 'loading...' constructor(text) { diff --git a/package.json b/package.json index af7daa5..21f4e59 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "console-table-printer": "^2.12.0", "glob": "^10.3.10", "inquirer": "^9.2.14", + "ora": "^8.0.1", "realm": "^12.6.2" }, "devDependencies": { diff --git a/scripts/loading.js b/scripts/loading.js index 406d4c1..68a31ae 100644 --- a/scripts/loading.js +++ b/scripts/loading.js @@ -1,4 +1,3 @@ -import { Loading } from '#common/utils/loading/loading.js' +import ora from 'ora' -const loader = new Loading('旋转跳跃~我闭着眼~') -loader.start() +const loading = ora('LP!给我加载!!!!').start() From eb5903aad198a29172fca1049b225c8e2d74f9c2 Mon Sep 17 00:00:00 2001 From: EternalHeart Date: Thu, 14 Mar 2024 23:40:24 +0800 Subject: [PATCH 2/4] chore: fix lint --- scripts/loading.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/loading.js b/scripts/loading.js index 68a31ae..5399e09 100644 --- a/scripts/loading.js +++ b/scripts/loading.js @@ -1,3 +1,4 @@ import ora from 'ora' const loading = ora('LP!给我加载!!!!').start() +setTimeout(() => loading.stop(), 300000) From f491496f418c00f2539981ae9ed8210e5424189d Mon Sep 17 00:00:00 2001 From: EternalHeart Date: Thu, 14 Mar 2024 23:41:33 +0800 Subject: [PATCH 3/4] chore: fix lint --- common/utils/http/fetch_.js | 1 - common/utils/loading/loading.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/http/fetch_.js b/common/utils/http/fetch_.js index b8deddd..9f67186 100644 --- a/common/utils/http/fetch_.js +++ b/common/utils/http/fetch_.js @@ -1,4 +1,3 @@ -import { Loading } from '#common/utils/loading/loading.js' import ora from 'ora' /** diff --git a/common/utils/loading/loading.js b/common/utils/loading/loading.js index 7a7f9fa..3e12a6c 100644 --- a/common/utils/loading/loading.js +++ b/common/utils/loading/loading.js @@ -1,4 +1,5 @@ import chalk from 'chalk' + export class Loading { text = 'loading...' constructor(text) { From c36da8c51d83a30cf01abfb867b87f9725848f63 Mon Sep 17 00:00:00 2001 From: EternalHeart Date: Thu, 14 Mar 2024 23:42:07 +0800 Subject: [PATCH 4/4] chore: release v1.0.9-4 --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf60119..d58031c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ + + +## [1.0.9-4](https://github.com/wh131462/leetcode-practice/compare/cli-v1.0.9-3...cli-v1.0.9-4) (2024-03-14) + + +### Features + +* ora loading ([#54](https://github.com/wh131462/leetcode-practice/issues/54)) ([b604316](https://github.com/wh131462/leetcode-practice/commit/b6043167752a74582e8d095721cf5b3849951e06)) + ## [1.0.9-3](https://github.com/wh131462/leetcode-practice/compare/cli-v1.0.9-2...cli-v1.0.9-3) (2024-03-14) ### Bug Fixes diff --git a/package.json b/package.json index 21f4e59..34a1dcf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "leetcode-practice", "type": "module", - "version": "1.0.9-3", + "version": "1.0.9-4", "packageManager": "yarn@1.22.0", "description": "A powerful practice platform for leetcode.Using any way you want to create questions.", "author": {