add process.exit example of generateApi in README.md

Open Beginner friendly
#507 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
75/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
node.js, typescript
Domain
cli, documentation

Research direction

Look at the README.md file in the repository root. Find the section that documents the generateApi function. Add a code example showing how to use process.exit to ensure the program terminates after generation. Verify the example works by checking the existing generateApi usage patterns in the codebase.

Written by the indexing model from the issue text.

Description

Hi, thanks for this project, it makes life simpler.

But I hava a small recommendation that, it will be useful to add process.exit example of generateApi in README.md.
Since I would like to make a watch dog cli to detect changes of swagger.json and auto generate client.ts when swagger.json changes.
I found out that my program can not exit in expected.

And I found some similar case in https://github.com/acacode/swagger-typescript-api/pull/436
After adding process.exit, the hanging situation is resolved.
So my code finally looks like this.

generateApi(myConfig)
    .catch((error) => {
        console.error(error);
        process.exit(1);
    })
    .finally(() => {
        process.exit(0);
    });
Dominant language
TypeScript
Stars
4.1k
Forks
436
Avg merge
9d 7h
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from acacode/swagger-typescript-api

All issues in acacode/swagger-typescript-api

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.