Skip to content

Commit

Permalink
feat: loading indicator (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
devjiwonchoi authored Apr 26, 2024
1 parent 34aa9bd commit c371f9b
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"arg": "^5.0.2",
"clean-css": "^5.3.3",
"magic-string": "^0.30.10",
"ora": "^5.4.1",
"pretty-bytes": "^5.6.0",
"rollup": "^4.16.4",
"rollup-plugin-dts": "^6.1.0",
Expand Down
117 changes: 104 additions & 13 deletions pnpm-lock.yaml

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

9 changes: 9 additions & 0 deletions src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { CliArgs, BundleConfig } from '../types'

import path from 'path'
import arg from 'arg'
import ora from 'ora'
import { lint as lintPackage } from '../lint'
import { exit, getPackageMeta, hasPackageJson } from '../utils'
import { logger, paint } from '../logger'
Expand Down Expand Up @@ -147,14 +148,22 @@ async function run(args: CliArgs) {
// lint package
await lint(cwd)

const spinner = ora({
text: 'bundling...\n\n',
spinner: 'dots',
color: 'green',
})
try {
spinner.start()
await bundle(cliEntry, bundleConfig)
} catch (err: any) {
if (err.name === 'NOT_EXISTED') {
help()
return exit(err)
}
throw err
} finally {
spinner.stop()
}

// watching mode
Expand Down

0 comments on commit c371f9b

Please sign in to comment.