Skip to content

Commit

Permalink
Merge pull request #5 from warungpintar/adeyahya-patch-1
Browse files Browse the repository at this point in the history
fix spinner
  • Loading branch information
adeyahya committed Jul 26, 2021
2 parents 6213ef8 + 5cc332c commit 5bfad79
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Expand Up @@ -31,8 +31,6 @@ const parseToJSXComponent = (
outputPath: string,
callback?: () => any
) => {
const spinner = ora("generating components").start();

if (!filePath) {
spinner.stop();
process.exit(0);
Expand Down Expand Up @@ -69,6 +67,7 @@ const program = new Command();
program.argument("<sourceDir>").requiredOption("-o --output <value>");

program.action(async (sourcePath: string, { output }) => {
const spinner = ora("generating components").start();
const stats = fs.lstatSync(sourcePath);
const cwd = process.cwd();
const outputPath = output.match(/^(\~|\/)/) ? output : path.join(cwd, output);
Expand All @@ -88,6 +87,7 @@ program.action(async (sourcePath: string, { output }) => {
const iterate = () => {
const filePath = filesIterator.next().value;
parseToJSXComponent(filePath, outputPath, iterate);
spinner.text = `${filePath} converted successfully`
};

iterate();
Expand Down

0 comments on commit 5bfad79

Please sign in to comment.