Skip to content

Add check for existing package.json in packship init to prevent accidental misuse #6

@Charitha-Reddy6

Description

@Charitha-Reddy6

Describe the feature you'd like
--The init command does not verify whether a package.json already exists in the working directory. This can lead to confusion when running packship init in existing Node.js projects, or errors if the user hasn't initialized the project with npm init.

Where this feature should be added?
src/commands/init.ts

what should be done
--Before calling createPackage(), check for the existence of package.json in the current directory.
--If package.json is present:
Show a warning: “A Node.js project already exists in this directory. Do you want to proceed?”
--If it’s not present:
Show a message: “No package.json found. You may want to run npm init first.”

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions