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

author fields not being parsed correctly #5

Closed
pdehaan opened this issue Mar 29, 2014 · 5 comments
Closed

author fields not being parsed correctly #5

pdehaan opened this issue Mar 29, 2014 · 5 comments
Labels

Comments

@pdehaan
Copy link
Contributor

pdehaan commented Mar 29, 2014

Steps to reproduce:

  1. $ touch index.js (optional)
  2. $ npm init (finish wizard, this step probably is a bit inconsistent based on your current npm config setup.)
  3. $ normalize

Actual results:

  "author": {
    "name": "Peter deHaan <peter@deseloper.com> (http://nodeexamples.com/)",
    "url": ""
  },

Expected results:

"author": {
  "name": "Peter deHaan",
  "url": "http://nodeexamples.com/",
  "email": "peter@deseloper.com"
},
...
@pdehaan
Copy link
Contributor Author

pdehaan commented Mar 29, 2014

Just for giggles, here's the full version of my normalized package.json file:

{
  "name": "pkg2",
  "version": "0.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": {
    "name": "Peter deHaan <peter@deseloper.com> (http://nodeexamples.com/)",
    "url": ""
  },
  "repository": {
    "type": "",
    "url": ""
  },
  "bugs": {
    "url": ""
  },
  "licenses": [
    {
      "type": "WTFPL"
    }
  ],
  "keywords": []
}

And the pre-normalized version was:

{
  "name": "pkg2",
  "version": "0.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Peter deHaan <peter@deseloper.com> (http://nodeexamples.com/)",
  "license": "WTFPL"
}

@jonschlinkert
Copy link
Owner

Here, look what I did with Verb: https://github.com/assemble/verb/blob/master/lib/utils/authors.js

I'll move that into a separate repo and use that to parse the author field. It didn't occur to me to do that for some reason. We can also look for an AUTHORS file and conditionally use the results from that (like if the authors field is missing and/or to fill in missing data, etc)

@jonschlinkert
Copy link
Owner

is this technically a bug, or a request to parse the string?

@pdehaan
Copy link
Contributor Author

pdehaan commented Mar 29, 2014

I think it's a bug as it is currently.
I'm using the shorthand notation to specify a name/email/url (Peter deHaan <peter@deseloper.com> (http://nodeexamples.com/)), but we're currently just treating it as a name.

@doowb
Copy link
Collaborator

doowb commented Mar 31, 2017

The normalized author field is now the string version so it's not expanded into an object.

@doowb doowb closed this as completed Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants