Skip to content

Commit

Permalink
Merge pull request #149 from storyblok/feature/loading-spinner
Browse files Browse the repository at this point in the history
feat: classy minimal spinner
  • Loading branch information
edodusi authored Jan 21, 2025
2 parents e48e870 + b59e089 commit 5ddd298
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"chalk": "^5.3.0",
"commander": "^12.1.0",
"dotenv": "^16.4.5",
"ora": "^8.1.1",
"storyblok-js-client": "^6.9.2"
},
"devDependencies": {
Expand Down
126 changes: 118 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/commands/languages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { session } from '../../session'
import { fetchLanguages, saveLanguagesToFile } from './actions'
import chalk from 'chalk'
import type { PullLanguagesOptions } from './constants'
import ora from 'ora'

const program = getProgram() // Get the shared singleton instance

Expand All @@ -21,7 +22,8 @@ languagesCommand
.option('-f, --filename <filename>', 'filename to save the file as <filename>.<suffix>.json')
.option('--su, --suffix <suffix>', 'suffix to add to the file name (e.g. languages.<suffix>.json). By default, the space ID is used.')
.action(async (options: PullLanguagesOptions) => {
konsola.title(` ${commands.LANGUAGES} `, colorPalette.LANGUAGES, 'Pulling languages...')
konsola.title(` ${commands.LANGUAGES} `, colorPalette.LANGUAGES)

// Global options
const verbose = program.opts().verbose
// Command options
Expand All @@ -41,8 +43,10 @@ languagesCommand
}

try {
const internationalization = await fetchLanguages(space, state.password, state.region)
const spinner = ora(`Fetching ${chalk.hex(colorPalette.LANGUAGES)('languages')}`).start()

const internationalization = await fetchLanguages(space, state.password, state.region)
spinner.succeed()
if (!internationalization || internationalization.languages?.length === 0) {
konsola.warn(`No languages found in the space ${space}`)
return
Expand Down
Loading

0 comments on commit 5ddd298

Please sign in to comment.