package.json file already exists in target directory
- Dominant language
- JavaScript
- Stars
- 733
- Forks
- 177
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 3
Description
### Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the bug has not already been reported
### Fastify version
4.25.2
### Plugin version
_No response_
### Node.js version
21.6.1
### Operating system
Linux
### Operating system version (i.e. 20.04, 11.3, 10)
Clear Linux OS installed version 40410
### Description
fastify generate should update the package.json file and not error out that the package.json file already exists. Basically there should be a check for the file and if it exists then read it into a json object then work with adding new key,values that are needed for the generated typescript or javascript project boilerplate. This should be done for the tsconfig.json as well. The npm pkg can be used for this as well npm pkg set
See: https://docs.npmjs.com/cli/v7/commands/npm-pkg
### Steps to Reproduce
I run
`bun init `
to generate a package.json file and tsconfig.json file
then I run
`fastify generate --lang=ts .`
to generate a typescript project in the current directory and get the error:
`a package.json file already exists in target directory`
### Expected Behavior
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.