-
Notifications
You must be signed in to change notification settings - Fork 9
feat(progress-bar): setup basic #98
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
4f650bd
feat(progress-bar): setup basic
AugustinMauroy a3e7623
test: progress-bar
AugustinMauroy b96cfd0
fix: code style
AugustinMauroy 9180963
fix: code style
AugustinMauroy 3d1760f
fix: code style
AugustinMauroy 5e879ff
fix + update
AugustinMauroy 6297b0d
fix: codespell
AugustinMauroy 9e75a18
wip
AugustinMauroy 2cfc4e1
Merge branch 'main' into feat(progress-bar)
AugustinMauroy 4701dcb
remove
AugustinMauroy 2dbc286
add withe-spaces
AugustinMauroy aa799c5
remove useless await
AugustinMauroy 62f3486
WIP(spinner)
AugustinMauroy 076815d
use clack
AugustinMauroy c64aa3e
Merge branch 'main' into feat(progress-bar)
AugustinMauroy 5c5884c
hotfix: type and build fixes (#177)
ovflowd 8ec63c9
refactor(addon-verify): some improvements (#175)
araujogui cfee887
hotfix: correctly use dedent
ovflowd 1da598d
doc: improve accessibility of expandable lists
aduh95 a4ea425
doc: add "Skip to content" button
aduh95 cb66e80
doc: fix styles of the expandable TOC
aduh95 6c234f6
meta: bump actions/upload-artifact from 4.5.0 to 4.6.0 (#189)
dependabot[bot] bf1fe58
meta: bump actions/setup-node from 4.1.0 to 4.2.0 (#188)
dependabot[bot] ef6f16f
meta: bump step-security/harden-runner from 2.10.2 to 2.10.4 (#187)
dependabot[bot] 4019ac0
meta: bump github/codeql-action from 3.28.0 to 3.28.8 (#186)
dependabot[bot] 9091505
meta: bump lint-staged from 15.3.0 to 15.4.3 (#185)
dependabot[bot] 5321cb9
meta: bump glob from 11.0.0 to 11.0.1 (#184)
dependabot[bot] 5751332
meta: bump semver from 7.6.3 to 7.7.0 (#183)
dependabot[bot] 92b7f03
meta: bump commander from 13.0.0 to 13.1.0 (#182)
dependabot[bot] 8e3d276
meta: bump @types/node from 22.10.3 to 22.13.0 (#180)
dependabot[bot] 653672e
meta: bump shiki from 1.24.4 to 2.2.0 (#181)
dependabot[bot] 1c86005
meta: bump the lint group with 4 updates (#179)
dependabot[bot] 3452cf2
doc: make MDN links to global classes more consistent (#190)
aduh95 11a7953
feat apilinks.json generator (#153)
flakey5 20d1cac
meta: bump ossf/scorecard-action from 2.4.0 to 2.4.1 (#202)
dependabot[bot] 9a3c811
meta: bump step-security/harden-runner from 2.10.4 to 2.11.0 (#201)
dependabot[bot] 546f284
meta: bump actions/upload-artifact from 4.6.0 to 4.6.1 (#200)
dependabot[bot] 1206535
meta: bump github/codeql-action from 3.28.8 to 3.28.10 (#199)
dependabot[bot] c6c1408
meta: bump hastscript from 9.0.0 to 9.0.1 (#198)
dependabot[bot] 0a05afb
meta: bump semver from 7.7.0 to 7.7.1 (#197)
dependabot[bot] d162314
meta: bump remark-gfm from 4.0.0 to 4.0.1 (#195)
dependabot[bot] d896c77
meta: bump @types/node from 22.13.0 to 22.13.8 (#194)
dependabot[bot] 588d8f2
meta: bump the lint group with 4 updates (#193)
dependabot[bot] c26adb4
meta: bump prettier from 3.4.2 to 3.5.2 in the fromat group (#192)
dependabot[bot] adefb11
workflow(pr): improve (#203)
AugustinMauroy 4eb8286
feat(progress-bar): setup basic
AugustinMauroy 984022e
test: progress-bar
AugustinMauroy 766bae6
fix: code style
AugustinMauroy 5479cab
fix: code style
AugustinMauroy 2769920
fix: code style
AugustinMauroy 6b1308d
fix + update
AugustinMauroy 47c2765
fix: codespell
AugustinMauroy 3a00ed5
wip
AugustinMauroy 0c22339
remove
AugustinMauroy 89228fd
add withe-spaces
AugustinMauroy f311669
remove useless await
AugustinMauroy 9124051
WIP(spinner)
AugustinMauroy 89e377e
use clack
AugustinMauroy b45d230
Merge branch 'feat(progress-bar)' of https://github.com/nodejs/api-do…
AugustinMauroy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { styleText } from 'node:util'; | ||
|
||
import cliProgress from 'cli-progress'; | ||
|
||
/** | ||
* | ||
AugustinMauroy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @param {string} label | ||
* @returns {import('cli-progress').SingleBar} | ||
*/ | ||
export function createProgressBar(label = '') { | ||
const format = ` ${styleText(['bold', 'green'], '{bar}')} | ${label} {percentage}% | {value}/{total}`; | ||
|
||
return new cliProgress.SingleBar({ | ||
format, | ||
barCompleteChar: '\u2588', | ||
barIncompleteChar: '\u2591', | ||
hideCursor: true, | ||
}); | ||
} | ||
|
||
/** | ||
* | ||
* @param {import('cli-progress').SingleBar} bar | ||
* @param {number} total | ||
*/ | ||
export function startProgressBar(bar, total) { | ||
bar.start(total, 0); | ||
} | ||
|
||
/** | ||
* @param {import('cli-progress').SingleBar} bar | ||
* @param {number} value | ||
*/ | ||
export function updateProgressBar(bar, value = 1) { | ||
bar.update(value); | ||
} | ||
|
||
/** | ||
* @param {import('cli-progress').SingleBar} bar | ||
*/ | ||
export function stopProgressBar(bar) { | ||
bar.stop(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import assert from 'node:assert'; | ||
import { describe, it } from 'node:test'; | ||
|
||
import cliProgress from 'cli-progress'; | ||
|
||
import { | ||
createProgressBar, | ||
startProgressBar, | ||
stopProgressBar, | ||
} from '../progressBar.mjs'; | ||
|
||
describe('progressBar', () => { | ||
it('createProgressBar returns an instance of SingleBar', () => { | ||
const bar = createProgressBar(); | ||
assert.ok(bar instanceof cliProgress.SingleBar); | ||
}); | ||
|
||
it('startProgressBar sets the correct total value', () => { | ||
const bar = createProgressBar(); | ||
startProgressBar(bar, 100); | ||
assert.strictEqual(bar.getTotal(), 100); | ||
}); | ||
|
||
it('stopProgressBar stops the progress bar', () => { | ||
const bar = createProgressBar(); | ||
startProgressBar(bar, 100); | ||
stopProgressBar(bar); | ||
assert.strictEqual(bar.isActive, false); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.