Skip to content

Commit b604316

Browse files
authored
feat: ora loading (#54)
1 parent 11df50a commit b604316

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

CHANGELOG.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
2-
31
## [1.0.9-3](https://github.com/wh131462/leetcode-practice/compare/cli-v1.0.9-2...cli-v1.0.9-3) (2024-03-14)
42

5-
63
### Bug Fixes
74

8-
* fix check info log ([#52](https://github.com/wh131462/leetcode-practice/issues/52)) ([6b710a1](https://github.com/wh131462/leetcode-practice/commit/6b710a1a2ff088d9806d33153bf811e5a5e19306))
5+
- fix check info log ([#52](https://github.com/wh131462/leetcode-practice/issues/52)) ([6b710a1](https://github.com/wh131462/leetcode-practice/commit/6b710a1a2ff088d9806d33153bf811e5a5e19306))
96

107
## [1.0.9-2](https://github.com/wh131462/leetcode-practice/compare/cli-v1.0.9-1...cli-v1.0.9-2) (2024-03-14)
118

common/utils/http/fetch_.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Loading } from '#common/utils/loading/loading.js'
2+
import ora from 'ora'
23

34
/**
45
* 基础请求-直接返回JSON格式的值
@@ -8,8 +9,7 @@ import { Loading } from '#common/utils/loading/loading.js'
89
* @private
910
*/
1011
export async function fetch_(url, options) {
11-
const loader = new Loading(options.loadText ?? 'loading...')
12-
loader.start()
12+
const loader = ora(options.loadText ?? 'loading...').start()
1313
const resp = await fetch(url, options).then((res) => res.json())
1414
loader.stop()
1515
return resp

common/utils/loading/loading.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import chalk from 'chalk'
2-
32
export class Loading {
43
text = 'loading...'
54
constructor(text) {

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"console-table-printer": "^2.12.0",
5353
"glob": "^10.3.10",
5454
"inquirer": "^9.2.14",
55+
"ora": "^8.0.1",
5556
"realm": "^12.6.2"
5657
},
5758
"devDependencies": {

scripts/loading.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Loading } from '#common/utils/loading/loading.js'
1+
import ora from 'ora'
22

3-
const loader = new Loading('旋转跳跃~我闭着眼~')
4-
loader.start()
3+
const loading = ora('LP!给我加载!!!!').start()

0 commit comments

Comments
 (0)