grunt-verb icon indicating copy to clipboard operation
grunt-verb copied to clipboard

Warning: No config object or "package.json" was found

Open MickeyKay opened this issue 7 years ago • 13 comments

Hi there, first off great project! Love it.

Secondly, no matter what I do, whether I manually configure a Gruntfile task or not, I get the following:

› grunt verb -v
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ build, build_js, build_less, default, docs, lint

Running tasks: verb

Loading "grunt-verb" plugin

Registering "/srv/nerdwallet/wp/node_modules/grunt-verb/tasks" tasks.
Loading "verb.js" tasks...OK
+ verb

Running "verb" task

Running "verb:data" (verb) task
Verifying property verb.data exists in config...OK
Files: package.json -> data
Options: sep="\n", ext=".md", data=["docs/*.{json,yml}"], prefixBase, cwd="/srv/nerdwallet/wp", destBase="/srv/nerdwallet/wp", docs="docs"
Reading package.json...OK
Warning: No config object or "package.json" was found Use --force to continue.

MickeyKay avatar Mar 04 '17 10:03 MickeyKay

Does the project have a package.json?

jonschlinkert avatar Mar 04 '17 19:03 jonschlinkert

Yes it does. Are we there any specific requirements for its contents?

On Sat, Mar 4, 2017 at 11:46 AM Jon Schlinkert [email protected] wrote:

Does the project have a package.json?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/verbose/grunt-verb/issues/12#issuecomment-284176051, or mute the thread https://github.com/notifications/unsubscribe-auth/ADCrriwEYRIuKNdY71N_qwUCM3Q0edPxks5rib9_gaJpZM4MTDJY .

MickeyKay avatar Mar 04 '17 21:03 MickeyKay

Honestly, I don't remember lol, this runs on a really old version of verb. I'm planning on updating this to use the latest verb as soon as we merge the dev branch. I'm not sure if I'll have time to debug this, but I'll report back if I do.

jonschlinkert avatar Mar 04 '17 22:03 jonschlinkert

Gotcha, and what's the reason to use grunt-verb vs grunt-assemble? I've been following the rabbit hole down starting with grunt-readme (which was great btw!), and I'm honestly having some trouble understanding the different use cases for one vs the other. In the case of just wanting a better readme (TOC, split out files, etc), which tool do you most strongly recommend?

On Sat, Mar 4, 2017 at 2:45 PM, Jon Schlinkert [email protected] wrote:

Honestly, I don't remember lol, this runs on a really old version of verb. I'm planning on updating this to use the latest verb as soon as we merge the dev branch. I'm not sure if I'll have time to debug this, but I'll report back if I do.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/verbose/grunt-verb/issues/12#issuecomment-284190309, or mute the thread https://github.com/notifications/unsubscribe-auth/ADCrrhWsWL2Rn0VfS7KQxpP2VKlUaiHBks5riemdgaJpZM4MTDJY .

MickeyKay avatar Mar 04 '17 23:03 MickeyKay

Also, just to confirm - am I understanding correctly that this project is basically in a broken state right now?

On Sat, Mar 4, 2017 at 3:02 PM, Mickey Kay [email protected] wrote:

Gotcha, and what's the reason to use grunt-verb vs grunt-assemble? I've been following the rabbit hole down starting with grunt-readme (which was great btw!), and I'm honestly having some trouble understanding the different use cases for one vs the other. In the case of just wanting a better readme (TOC, split out files, etc), which tool do you most strongly recommend?

On Sat, Mar 4, 2017 at 2:45 PM, Jon Schlinkert [email protected] wrote:

Honestly, I don't remember lol, this runs on a really old version of verb. I'm planning on updating this to use the latest verb as soon as we merge the dev branch. I'm not sure if I'll have time to debug this, but I'll report back if I do.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/verbose/grunt-verb/issues/12#issuecomment-284190309, or mute the thread https://github.com/notifications/unsubscribe-auth/ADCrrhWsWL2Rn0VfS7KQxpP2VKlUaiHBks5riemdgaJpZM4MTDJY .

MickeyKay avatar Mar 04 '17 23:03 MickeyKay

UPDATE: so I think I just got to the bottom of the error in question - check this out:

{ TypeError: Path must be a string. Received [ '/srv/nerdwallet/wp/package.json' ]
  at assertPath (path.js:7:11)
  at Object.extname (path.js:1433:5)
  at Function.plasma.normalizeObject (/srv/nerdwallet/wp/node_modules/plasma/index.js:416:16)
  at Function.plasma.normalize (/srv/nerdwallet/wp/node_modules/plasma/index.js:460:31)
  at Function.plasma.normalizeString (/srv/nerdwallet/wp/node_modules/plasma/index.js:177:17)
  at Function.plasma.normalize (/srv/nerdwallet/wp/node_modules/plasma/index.js:456:31)
  at Function.plasma.load (/srv/nerdwallet/wp/node_modules/plasma/index.js:488:19)
  at plasma (/srv/nerdwallet/wp/node_modules/plasma/index.js:23:17)
  at Object.module.exports [as config] (/srv/nerdwallet/wp/node_modules/verb/lib/config.js:26:14)
  at Object.verb.process (/srv/nerdwallet/wp/node_modules/verb/index.js:115:35)
  at /srv/nerdwallet/wp/node_modules/grunt-verb/tasks/verb.js:52:23
  at Array.forEach (native)
  at Object.<anonymous> (/srv/nerdwallet/wp/node_modules/grunt-verb/tasks/verb.js:36:16)
  at Object.<anonymous> (/srv/nerdwallet/wp/node_modules/grunt/lib/grunt/task.js:255:15)
  at Object.thisTask.fn (/srv/nerdwallet/wp/node_modules/grunt/lib/grunt/task.js:73:16)
  at Object.fn (/srv/nerdwallet/wp/node_modules/jit-grunt/lib/jit-grunt.js:126:30)
  at Object.<anonymous> (/srv/nerdwallet/wp/node_modules/grunt/lib/util/task.js:294:30)
  at Task.runTaskFn (/srv/nerdwallet/wp/node_modules/grunt/lib/util/task.js:244:24)
  at Task.<anonymous> (/srv/nerdwallet/wp/node_modules/grunt/lib/util/task.js:293:12)
  at /srv/nerdwallet/wp/node_modules/grunt/lib/util/task.js:220:11
  at _combinedTickCallback (internal/process/next_tick.js:67:7)
  at process._tickCallback (internal/process/next_tick.js:98:9)
  at Module.runMain (module.js:577:11)
  at run (bootstrap_node.js:352:7)
  at startup (bootstrap_node.js:144:9)
  at bootstrap_node.js:467:3

  origin: '/srv/nerdwallet/wp/node_modules/verb/lib/config.js' }

Looks like plasma needs to receive a string, but grunt-verb is passing it an array :(

MickeyKay avatar Mar 04 '17 23:03 MickeyKay

this project is basically in a broken state right now?

It seems to be for you, so I'd say yes lol. This repo hasn't been updated for a couple of years. But verb and the verb plugin ecosystem are very active, and it's used on thousands of projects. I just haven't used grunt in a while. But like I said, I plan to update this soon.

I'm honestly having some trouble understanding the different use cases for one vs the other.

No problem, I'll try to clarify.

tldr;

  • verb => markdown
  • assemble => HTML

We built both applications on top of base, which gives them a similar API and allows them to share plugins. But they are used very differently, have different default settings and plugins, and the CLIs behave differently.

I know you asked about the grunt-* tools, but I thought it would help to clarify what the parent libs are focused on. I'd be happy to provide more detail if it would help.

jonschlinkert avatar Mar 05 '17 00:03 jonschlinkert

@MickeyKay btw it might be worth trying the dev branch of verb directly (not as a grunt plugin). Not every project has grunt, but every project should have a readme.

I can tell you how to get set up if you want, then there are just a couple of minor differences that I'd be happy to walk you through. Up to you, no worries either way on my end.

jonschlinkert avatar Mar 05 '17 01:03 jonschlinkert

Thanks @jonschlinkert, much appreciated. I would love know how to integrate vanilla verb into our existing build flow, which is Grunt-based at this point in time. I can play around with the dev branch for sure, however I'll still need to at least integrate a basic Grunt wrapper, or somehow kick off the task elsewhere in our build process. It's interesting to me though, because when I look at the bottom of various readme's, I see things like: image and image

I'm curious, has the former readme (grunt-assemble) just not been updated in that long, and would the build job currently break?

And for the latter (assemble), how is verb-generate-readme being run? Surely it's not just called manually, right?

MickeyKay avatar Mar 05 '17 17:03 MickeyKay

And for the latter (assemble)

Where is assemble? Or grunt-assemble? I don't see either one in the screens. Sorry I may have missed something

jonschlinkert avatar Mar 06 '17 01:03 jonschlinkert

Those are respectively at the bottom of the readme's for grunt-assemble and assemble. So clearly those readme's were built using grunt-verb and verb-generate-readme.

MickeyKay avatar Mar 07 '17 06:03 MickeyKay

Those are respectively at the bottom of the readme's for grunt-assemble and assemble.

Oooh, got it. Sorry, we use verb on 1k+ packages. those footers had not special significance to me. Makes sense now.

Both readme's were built by running the verb command at the command line. Verb's CLI automatically finds, loads, and registers any globally or locally installed "generators" (like verb-generate-readme), as well as any plugins, helpers or middleware that were defined by the user. Any other documentation generator could be a plugin or generator for verb.

To run the readme generator from the command line, you would do:

$ verb readme

This technically runs the default task on the readme generator (tasks in generators are just like tasks in grunt or gulp) .

Or, you can add a verb object to package.json, and define the tasks to run as an array on verb.tasks, and verb's CLI will automatically run those tasks when you run verb from the command line.

hope that helps.

jonschlinkert avatar Mar 08 '17 04:03 jonschlinkert

I recently added this grunt-verb package into one of my own projects, and I was receiving this same error. For anyone else who may stumble upon this same thread hoping to find answers, I managed to get this working by merging my project's package.json data into the verb task's options.config object like so:

var pkg = grunt.file.readJSON('package.json');

grunt.initConfig({
  pkg,
  verb: {
    options: {
      config: Object.assign({}, pkg)
    },
    readme: {
      files: [{
        src: '.verb.md',
        dest: 'README.md'
      }]
    }
  }
});

laurenhamel avatar Oct 30 '19 16:10 laurenhamel