{"id":27987323,"url":"https://github.com/SlimIO/Async-cli-spinner","last_synced_at":"2025-05-08T10:01:51.907Z","repository":{"id":42570337,"uuid":"184546812","full_name":"TopCli/Spinner","owner":"TopCli","description":"Elegant Asynchronous Terminal (CLI) Spinner for Node.js","archived":false,"fork":false,"pushed_at":"2025-05-01T04:19:10.000Z","size":305,"stargazers_count":38,"open_issues_count":6,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-02T01:02:35.058Z","etag":null,"topics":["async","cli","ora","spinner"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TopCli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-05-02T08:30:55.000Z","updated_at":"2025-05-01T04:19:13.000Z","dependencies_parsed_at":"2023-02-14T14:31:29.492Z","dependency_job_id":"eeb110fe-cbf6-4912-b120-6c4e0293a476","html_url":"https://github.com/TopCli/Spinner","commit_stats":{"total_commits":172,"total_committers":8,"mean_commits":21.5,"dds":0.5930232558139534,"last_synced_commit":"4b32b1dbf5f6c41bddcc2b4da208c3034899f757"},"previous_names":["slimio/async-cli-spinner"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2FSpinner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2FSpinner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2FSpinner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2FSpinner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TopCli","download_url":"https://codeload.github.com/TopCli/Spinner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253042632,"owners_count":21845185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","cli","ora","spinner"],"created_at":"2025-05-08T10:01:00.828Z","updated_at":"2025-05-08T10:01:51.693Z","avatar_url":"https://github.com/TopCli.png","language":"TypeScript","readme":"# Spinner\n\n![version](https://img.shields.io/badge/dynamic/json.svg?style=for-the-badge\u0026url=https://raw.githubusercontent.com/TopCli/Spinner/main/package.json\u0026query=$.version\u0026label=Version)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=for-the-badge)](https://github.com/TopCli/Spinner/commit-activity)\n[![mit](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://github.com/TopCli/Spinner/blob/main/LICENSE)\n[![scorecard](https://api.securityscorecards.dev/projects/github.com/TopCli/Spinner/badge?style=for-the-badge)](https://ossf.github.io/scorecard-visualizer/#/projects/github.com/TopCli/Spinner)\n![build](https://img.shields.io/github/actions/workflow/status/TopCli/Spinner/node.js.yml?style=for-the-badge)\n\nAsynchronous CLI Spinner. This package has been created to handle simultaneous/multiple spinner at a time. The package has been inspired by [Ora](https://github.com/sindresorhus/ora) but asynchronous.\n\nAll available spinners are part of [cli-spinners](https://github.com/sindresorhus/cli-spinners#readme) package.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/SlimIO/Governance/blob/master/docs/images/cli_init.gif\"\u003e\n\u003c/p\u003e\n\n## Requirements\n\n- [Node.js](https://nodejs.org/en/) v20 or higher\n\n## Getting Started\n\nThis package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).\n\n```bash\n$ npm i @topcli/spinner\n# or\n$ yarn add @topcli/spinner\n```\n\n## Usage example\n\nCreate and wait multiple spinner at a time.\n\n```js\nimport * as timers from \"node:timers/promises\";\nimport { Spinner } from \"@topcli/spinner\";\n\nasync function fnWithSpinner(withPrefix, succeed = true) {\n    const spinner = new Spinner()\n      .start(\"Start working!\", { withPrefix });\n\n    await timers.setTimeout(1000);\n    spinner.text = \"Work in progress...\";\n    await timers.setTimeout(1000);\n\n    if (succeed) {\n        spinner.succeed(`All done in ${spinner.elapsedTime.toFixed(2)}ms !`);\n    }\n    else {\n        spinner.failed(\"Something wrong happened !\");\n    }\n}\n\nawait Promise.allSettled([\n    fnWithSpinner(),\n    fnWithSpinner(\"Item 1\"),\n    fnWithSpinner(\"Item 2\", false)\n]);\nSpinner.reset(); // reset internal count\nconsole.log(\"All spinners finished!\");\n```\n\nIf you want to only achieve one Spinner by one Spinner, use it like Ora (it will work)\n```js\nconst spinner = new Spinner().start(\"Start working!\");\n\nawait timers.setTimeout(1_000);\nspinner.text = \"Work in progress...\";\n\nawait timers.setTimeout(1_000);\nspinner.succeed(\"All done !\");\n```\n\n\u003e [!TIP]\n\u003e When you are working on a CLI that can be used as an API too, the **verbose** option allow you to disable the Spinner.\n\n## API\n\n\u003cdetails\u003e\u003csummary\u003econstructor(options?: ISpinnerOptions)\u003c/summary\u003e\n\u003cbr\u003e\n\nCreate a new Spinner. The **options** payload is described by the following TypeScript interface:\n\n```ts\nexport interface ISpinnerOptions {\n  /**\n   * Spinner name (from cli-spinners lib)\n   *\n   * @default \"dots\"\n   */\n  name?: cliSpinners.SpinnerName;\n  /**\n   * Spinner frame color\n   *\n   * @default \"white\"\n   */\n  color?: string;\n  /**\n   * Do not log anything when disabled\n   *\n   * @default true\n   */\n  verbose?: boolean;\n}\n```\n\n\u003e [!TIP]\n\u003e Check [cli-spinners](https://github.com/sindresorhus/cli-spinners#readme) for all the spinner name.\n\n```js\nnew Spinner({ name: \"dots2\" });\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003estart(text?: string, options?: IStartOptions): Spinner\u003c/summary\u003e\n\nStart the spinner and optionaly write the text passed as first parameter.\n\nThe **options** payload is described by the following TypeScript interface:\n\n```ts\nexport interface IStartOptions {\n  withPrefix?: string;\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003esucceed(text?: string): void\u003c/summary\u003e\n\nStop the spinner in the CLI, write the text passed in param and mark it as succeed with a symbol.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003efailed(text?: string): void\u003c/summary\u003e\n\nStop the spinner in the CLI, write the text passed in param and mark it as failed with a symbol.\n\n\u003c/details\u003e\n\u003cbr\u003e\n\n## Contributors ✨\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://www.linkedin.com/in/thomas-gentilhomme/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/4438263?v=4?s=100\" width=\"100px;\" alt=\"Gentilhomme\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eGentilhomme\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/TopCli/Spinner/commits?author=fraxken\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/Spinner/commits?author=fraxken\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/Spinner/pulls?q=is%3Apr+reviewed-by%3Afraxken\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"#security-fraxken\" title=\"Security\"\u003e🛡️\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/Spinner/issues?q=author%3Afraxken\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/AlexandreMalaj\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/32218832?v=4?s=100\" width=\"100px;\" alt=\"Alexandre Malaj\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAlexandre Malaj\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/TopCli/Spinner/commits?author=AlexandreMalaj\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/Spinner/commits?author=AlexandreMalaj\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/Spinner/issues?q=author%3AAlexandreMalaj\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/PierreDemailly\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/39910767?v=4?s=100\" width=\"100px;\" alt=\"PierreDemailly\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePierreDemailly\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/TopCli/Spinner/commits?author=PierreDemailly\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#maintenance-PierreDemailly\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://justie.dev\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/7118300?v=4?s=100\" width=\"100px;\" alt=\"Ben\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eBen\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/TopCli/Spinner/issues?q=author%3AJUSTIVE\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## License\nMIT\n","funding_links":[],"categories":["Packages"],"sub_categories":["CLI (TTY etc..)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSlimIO%2FAsync-cli-spinner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSlimIO%2FAsync-cli-spinner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSlimIO%2FAsync-cli-spinner/lists"}