Coder Social home page Coder Social logo

Comments (11)

lholmquist avatar lholmquist commented on September 24, 2024 1

@helio-frota i think we need to look at what the "origin remote" is for the correct github user,

from entente.

lance avatar lance commented on September 24, 2024 1

@helio-frota for the git.config values, all of the documentation I have seen recommends using your real, full name for user.name. See https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup and https://help.github.com/articles/setting-your-username-in-git/.

Take a look at the code @lholmquist referenced above https://github.com/npm/init-package-json/blob/master/default-input.js#L182-L202. This code is reading [projectdir]/.git/config, then parsing the URL for the origin repository, and using the username found in the path there. I believe this is what @lholmquist is suggesting we do, and I tend to agree. This should be more accurate in the long run, I believe.

from entente.

lholmquist avatar lholmquist commented on September 24, 2024

This is the code for what the default thing does, https://github.com/npm/init-package-json/blob/master/default-input.js#L182

perhaps we do a little copy/paste :)

from entente.

lance avatar lance commented on September 24, 2024

@lholmquist There might have been a race condition between your comment and my push. How do you feel about the prompt I added?

Also, we should probably add another issue to entente about using any existing package.json. By default, npm init will use any values it finds in an existing package.json as the defaults.

from entente.

lholmquist avatar lholmquist commented on September 24, 2024

@lance the default for npm init is to only create this "repository" section if the directory running npm init is under git control. We created it no matter what, which is probably ok, since most, if not all, packages we create will be on github.

I think the prompt works, but it is sort of a downgrade from what the default behavior did. However, i don't think we can use that default code to get the git user if the user hasn't done the git init/add remote yet since that code looks for the "origin" remote

the other thing is that when i do a npm init -y i get "Lucas Holmquist" as my git user, but i don't think we can really do anything about that, since we don't prompt

If we wanted to get crazy, we could prompt the user for there git username only if we don't find it in the .git folder(like the default code)

from entente.

lance avatar lance commented on September 24, 2024

Yeah - I noticed that problem with the git user using -y. I think we should go crazy. I'll look at it.

from entente.

helio-frota avatar helio-frota commented on September 24, 2024

Folks I don't know if has something different from linux and mac.
I have only one username : 'helio-frota' here on my machine inside ~/.gitconfig file.

After run this command on entente repository:

git log --pretty='%cn %an' -n3

cn - committer name
an - author name

It returns:

Lucas Holmquist Lucas Holmquist
Lucas Holmquist Lucas Holmquist
Lance Ball Lance Ball

Also I have no GIT_COMMITTER_NAME and no GIT_AUTHOR_NAME environment variables exported.

lance and lholmquist are your computer usernames right ? [$USER]

from entente.

helio-frota avatar helio-frota commented on September 24, 2024

@lholmquist @lance got it ! Thanks!

from entente.

helio-frota avatar helio-frota commented on September 24, 2024

Instructions for the functional tests I did are on the git comment:
c75d9ec

from entente.

lance avatar lance commented on September 24, 2024

@helio-frota so can this be closed?

from entente.

helio-frota avatar helio-frota commented on September 24, 2024

@lance Yes.

from entente.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.