Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.gitignore is being overwrittern by prisma init #8496

Closed
BenjaminGuzman opened this issue Jul 29, 2021 · 7 comments · Fixed by #8946
Closed

.gitignore is being overwrittern by prisma init #8496

BenjaminGuzman opened this issue Jul 29, 2021 · 7 comments · Fixed by #8946
Assignees
Labels
good first issue Always wanted to get involved in an open source project but don’t know where to begin? Welcome! kind/improvement An improvement to existing feature and code. team/client Issue for team Client. topic: prisma init CLI: prisma init
Milestone

Comments

@BenjaminGuzman
Copy link

Bug description

When you run npx prisma init everything executes without problems but the .gitignore file is being overwritten with the following content mentioned in Issue #3400

How to reproduce

  1. Create an empty npm project
  2. Create and add some contents to .gitignore
  3. Run npx prisma init
  4. Open the .gitignore file and notice it was overwritten

Expected behavior

The expected behavior may be simply not overwrite the .gitignore if it already exists, instead just output some message like: Be sure to exclude node_modules and .env files inside .gitignore.

Prisma information

Nothing. I'm just starting prisma

Environment & setup

  • OS: Fedora
  • Database: I don't think this is relevant
  • Node.js version: v14.17.0

Prisma Version

prisma               : 2.28.0
@prisma/client       : Not found
Current platform     : rhel-openssl-1.1.x
Query Engine         : query-engine 89facabd0366f63911d089156a7a70125bfbcd27 (at node_modules/@prisma/engines/query-engine-rhel-openssl-1.1.x)
Migration Engine     : migration-engine-cli 89facabd0366f63911d089156a7a70125bfbcd27 (at node_modules/@prisma/engines/migration-engine-rhel-openssl-1.1.x)
Introspection Engine : introspection-core 89facabd0366f63911d089156a7a70125bfbcd27 (at node_modules/@prisma/engines/introspection-engine-rhel-openssl-1.1.x)
Format Binary        : prisma-fmt 89facabd0366f63911d089156a7a70125bfbcd27 (at node_modules/@prisma/engines/prisma-fmt-rhel-openssl-1.1.x)
Default Engines Hash : 89facabd0366f63911d089156a7a70125bfbcd27
Studio               : 0.417.0
@BenjaminGuzman BenjaminGuzman added the kind/bug A reported bug. label Jul 29, 2021
@janpio janpio added kind/improvement An improvement to existing feature and code. topic: prisma init CLI: prisma init team/client Issue for team Client. and removed kind/bug A reported bug. labels Jul 29, 2021
@pantharshit00 pantharshit00 added the good first issue Always wanted to get involved in an open source project but don’t know where to begin? Welcome! label Jul 30, 2021
@ShubhankarKG
Copy link
Contributor

What should be the expected behavior if .gitignore exists? Is it as suggested by OP or something else as well?

@pantharshit00
Copy link
Contributor

@ShubhankarKG If a .gitignore already exists we should not override it and maybe print a warning.

@mustofa-id
Copy link

modify/append the content seems much better.

@janpio
Copy link
Member

janpio commented Aug 5, 2021

Yes, but the complexity of that is much higher for a edgecase feature. Choosing the simpler way to just skip the file sounds perfectly fine in this case - and is much less to maintain.

@dlandry-siesde
Copy link

dlandry-siesde commented Aug 13, 2021

Came here from adding Prisma to an existing project. The "Prisma Getting Started: Add to an existing project" guide instructs to run npx prisma init. It appended a db connection string to my .env, and replaced my .gitignore file.

@janpio
Copy link
Member

janpio commented Aug 13, 2021

There is an open PR at #8509 that should solve the .gitignore problem. That was definitely not intended.

@janpio
Copy link
Member

janpio commented Sep 21, 2021

New PR: #8946

@Jolg42 Jolg42 modified the milestones: 3.1.0, 3.2.0 Sep 23, 2021
@Jolg42 Jolg42 self-assigned this Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Always wanted to get involved in an open source project but don’t know where to begin? Welcome! kind/improvement An improvement to existing feature and code. team/client Issue for team Client. topic: prisma init CLI: prisma init
Projects
None yet
7 participants