verbose / verb-generate-readme

Generate your project's readme with verb. Requires verb v0.9.0 or higher.
MIT License
162 stars 17 forks source link

related is not a function #11

Closed doowb closed 7 years ago

doowb commented 7 years ago

After getting the latest verb-generate-readme, I'm getting the following error when running verb.

image

I haven't been able to track it down yet, but it looks like the related helper is being overridden by data (like the pkg.verb object is merge onto app.cache.data someplace).

jonschlinkert commented 7 years ago

Do you have a related property on data somewhere? I'm thinking that would be something you must have defined. The related helper always uses cache.data.verb.related.list

doowb commented 7 years ago

It's the related property from the package.json's verb property that's being put onto cache.data someplace.

jonschlinkert commented 7 years ago

Right, that's what's used in package.json. Which is on data as verb.related.list, not related.list

jonschlinkert commented 7 years ago

did you delete and reinstall global verb-generate-readme? I just published a new version a couple days ago, and you know how npm likes to rewire deps for no good reason

doowb commented 7 years ago

Here's the package.json from my repo:

{
  "name": "enquirer-auth",
  "description": "Enquirer prompt for getting user authentication information.",
  "version": "0.1.0",
  "homepage": "https://github.com/enquirer/enquirer-auth",
  "author": "Brian Woodward (https://github.com/doowb)",
  "repository": "enquirer/enquirer-auth",
  "bugs": {
    "url": "https://github.com/enquirer/enquirer-auth/issues"
  },
  "license": "MIT",
  "files": [
    "index.js",
    "LICENSE"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "test": "mocha"
  },
  "keywords": [
    "auth",
    "enquirer"
  ],
  "dependencies": {
    "cli-cursor": "^1.0.2",
    "co": "^4.6.0",
    "component-emitter": "^1.2.1",
    "define-property": "^0.2.5",
    "extend-shallow": "^2.0.1",
    "gulp-format-md": "^0.1.11",
    "log-utils": "^0.2.1",
    "prompt-base": "^0.5.0",
    "prompt-password": "^0.1.0",
    "prompt-radio": "^0.3.0",
    "repeat-string": "^1.5.4"
  },
  "devDependencies": {
    "enquirer": "^0.4.1"
  },
  "verb": {
    "toc": false,
    "layout": "default",
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "related": {
      "list": [
        "prompt-base",
        "prompt-password",
        "prompt-radio"
      ]
    },
    "reflinks": [
      "verb",
      "verb-generate-readme"
    ],
    "lint": {
      "reflinks": true
    }
  }
}

It has the verb.related property and somehow that value is getting onto cache.related which is overwriting the related helper when rendering the template.

did you delete and reinstall global verb-generate-readme?

I did and that's when this issue started. I can go through and delete more of the global modules that are common to verb and generate to see if there's something that npm is "reusing" incorrectly.

jonschlinkert commented 7 years ago

strange, yeah definitely keep me posted. thx

doowb commented 7 years ago

I think I tracked it down to this commit in normalize-pkg because the options at that point contain the "verb options" from the package.json.

At least that's the first place where it's added... and it starts from the app.options that are passed into expand-pkg in generate-data which is used in verb-repo-data.

jonschlinkert commented 7 years ago

Any ideas on a good fix?

tunnckoCore commented 7 years ago

It's not only npm related. I just moved to latest node 6.9 and started from clean install. Both latest versions verb#dev and verb-generate-readme@latest, cleaned and removed the cache - not helps. I'm using yarn on that clean node 6.9 install and results are the same.

I believe it is because that "fix" before few weeks that you removed verb-repo-data (? not sure for the name and if this is refixed in last weeks). Anyway.

I believe I can see the SHA of working verb-generate-readme from the 6.6 version.

doowb commented 7 years ago

I have some changes locally that I'll get pushed up soon.

tunnckoCore commented 7 years ago

Mm nope.

~/dev  
% 1 ❯ nvm use 6.6                                                                                       October 22, 02:36:19
Now using node v6.6.0 (npm v3.10.8)
~/dev  
% ❯ nvm uninstall 6.9                                                                                   October 22, 02:36:26
Uninstalled node v6.9.1
~/dev  
% ❯ nvm install 6.9                                                                                     October 22, 02:36:29
VERSION_PATH=''
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.9.1-linux-x64/node-v6.9.1-linux-x64.tar.xz
Now using node v6.9.1 (npm v3.10.8)
~/dev  
% ❯ npm i -g verbose/verb#dev verbose/verb-generate-readme#d64cee3ccccc64aba3fe83ba0357d65e6d1bb231     October 22, 02:36:39
/home/charlike/.nvm/versions/node/v6.9.1/bin/verb -> /home/charlike/.nvm/versions/node/v6.9.1/lib/node_modules/verb/bin/verb.js
/home/charlike/.nvm/versions/node/v6.9.1/lib
├─┬ verb@0.9.0  (git://github.com/verbose/verb.git#20f8a0d36e57a57a3b2faa7a6eea85e3aee4eaa0)

And actually while thinking... it's normal to not work, haha, because it installs latest versions of the deps.

I have some changes locally that I'll get pushed up soon.

Cool. Another thing can be to recursively lookup the versions/gitHash of all packages in my 6.6 version hahaha

edit: okey, ping when fix it please, meanwhile i'll stay with the working copy without changing and uninstalling.

doowb commented 7 years ago

@jonschlinkert @tunnckoCore I published normalize-pkg which is where the options were being merged.

I just pulled down the latest verb-generate-readme (to be able to get all the latest dependencies) and my issue is resolved.

I'm going to close this issue. If there are other issues, please create a new issue with the specifics.

tunnckoCore commented 7 years ago

damn... fast fingers... removed all my node versions so i'm starting from scratch. ;/ Hope this will fix the issues and no other issues, cuz i'm in streak and have much things to update from last 1-2 week(s).

tunnckoCore commented 7 years ago

@doowb @jonschlinkert cool! :tada: it works! great job :)

jonschlinkert commented 7 years ago

That's how we roll. I cause bugs, @doowb fixes them. Everyone wins.

tunnckoCore commented 7 years ago

Haha, and I help with finding some of them. :laughing: