OpenAPITools / OpenAPITools/openapi-generator

[REQ] typescript-axios: make prepare script configurable

Open
#12,310 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
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

Open the contributing guide

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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.