Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ora loading #54

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

4 changes: 2 additions & 2 deletions common/utils/http/fetch_.js
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion common/utils/loading/loading.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import chalk from 'chalk'

export class Loading {
text = 'loading...'
constructor(text) {
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
5 changes: 2 additions & 3 deletions scripts/loading.js
Original file line number Diff line number Diff line change
@@ -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()