OpenAPITools / OpenAPITools/openapi-generator
[REQ] typescript-axios: make prepare script configurable
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
Right now, the typescript-axios generator (and possibly the other TS generarors) creates a package.json with scripts like so:
"scripts": {
"build": "tsc --outDir dist/",
"prepare": "npm run build"
},
prepare is a "lifecycle script" for NPM and Yarn, which gets run whenever the package's dependencies are installed. Clearly, Typescript transpilation/building is not part of the dependency installation step, but I can understand why this was added: it's a very helpful convenience when consuming the module with NPM's git resolution, so you don't have to compile the generated sources yourself.
Nonetheless, in more general scenarios, this behavior is incorrect and likely unwanted. The problem can be worked around on the user side with the flag --ignore-scripts, so it's not really a huge issue. Still, it would be nice to have the option to disable it.
Describe the solution you'd like
A generator-specific configuration option that can preclude adding the prepare script
Describe alternatives you've considered
As mentioned above, --ignore-scripts is a tolerable workaround. Still, it would be nice not to need it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the typescript-axios generator and trace how it creates the generated package.json scripts. Define how a generator-specific option is supplied and verify that it controls whether the prepare script is included, while preserving the existing default behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100