comment.js icon indicating copy to clipboard operation
comment.js copied to clipboard

How to enable config.json?

Open oshihirii opened this issue 8 years ago • 6 comments

I have this directory structure:

Desktop
 config.json
 - docs
  - index.html
   - css
   - img
   - js
   code-src.html
   index.html

The contents of config.json are:

{
  "title": "my documentation title"
}

When I run commentjs config.json from Desktop directory in terminal, I get:

No files found for []

Which directory should the config.json file be in?

Which directory should I be in when running commentjs config.json?

Thank You.

oshihirii avatar Jun 12 '16 11:06 oshihirii

Hmm, I have kept the same directory structure, but changed the contents of config.json to:

{
  "title": "my documentation title",
  "source": [{
  "path": "/var/www/html/my-site/wsgi/static/js/code.js",
  "link": "https://github.com/user/my-repo/blob/master/wsgi/static/js/code.js"
}],
"output": "docs/index.html"
}

And I am getting this error when running commentjs config.json from Desktop:

/usr/local/lib/node_modules/commentjs/node_modules/minimatch/minimatch.js:138
    throw new TypeError("glob pattern string required")
    ^

TypeError: glob pattern string required
    at new Minimatch (/usr/local/lib/node_modules/commentjs/node_modules/minimatch/minimatch.js:138:11)
    at new Glob (/usr/local/lib/node_modules/commentjs/node_modules/glob/glob.js:157:29)
    at glob (/usr/local/lib/node_modules/commentjs/node_modules/glob/glob.js:57:11)
    at Function.globSync [as sync] (/usr/local/lib/node_modules/commentjs/node_modules/glob/glob.js:76:10)
    at Object.file.expand (/usr/local/lib/node_modules/commentjs/lib/util/file.js:72:20)
    at null.<anonymous> (/usr/local/lib/node_modules/commentjs/lib/scanner.js:87:28)
    at Object._.forEach (/usr/local/lib/node_modules/commentjs/lib/util/util.js:22:16)
    at Scanner.scan (/usr/local/lib/node_modules/commentjs/lib/scanner.js:51:11)
    at Commentjs.run (/usr/local/lib/node_modules/commentjs/lib/comment.js:43:31)
    at Object.<anonymous> (/usr/local/lib/node_modules/commentjs/bin/commentjs:20:22)

oshihirii avatar Jun 12 '16 12:06 oshihirii

This config.json file works, but doesn't utilise the link feature:

{
"title": "my documentation title",
"source": "/var/www/html/my-site/wsgi/static/js/code.js",
"output": "docs/index.html"
}

Anyone know how I can get it to work with the link feature?

The TypeError: glob pattern string required error mentioned above is discussed in a few places, such as:

https://github.com/jedmao/codepainter/issues/21

In case this has something to do with my node installation, this is how I installed node:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs 
sudo apt-get install -y npm  // did this so i could install comment.js
sudo npm install -g commentjs // wouldn't work without sudo

Then had to run sudo ln -s /usr/bin/nodejs /usr/bin/node as per:

http://stackoverflow.com/a/26320915/1063287

nodejs --version returnsv4.2.6.

oshihirii avatar Jun 12 '16 12:06 oshihirii

can you describe better your issue please? what exactly is not working for you? On 12 Jun 2016 2:28 p.m., "oshihirii" [email protected] wrote:

This works, but doesn't utilise the link feature:

{ "title": "my documentation title", "source": "/var/www/html/my-site/wsgi/static/js/code.js", "output": "docs/index.html" }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dciccale/comment.js/issues/4#issuecomment-225429716, or mute the thread https://github.com/notifications/unsubscribe/AAg7msHlrQ_bYeqNJq_T1Ap6fEc_68Zkks5qK_tRgaJpZM4Izxcw .

dciccale avatar Jun 12 '16 15:06 dciccale

Steps to replicate:

Directory Structure

Desktop
 config.json
 - docs
  - index.html
   - css
   - img
   - js
   code-src.html
   index.html

config.json

{
  "title": "my documentation title",
  "source": [{
  "path": "/var/www/html/my-site/wsgi/static/js/code.js",
  "link": "https://github.com/user/my-repo/blob/master/wsgi/static/js/code.js"
}],
"output": "docs/index.html"
}

Run:

me@my-computer:~/Desktop$ commentjs config.json

Error:

/usr/local/lib/node_modules/commentjs/node_modules/minimatch/minimatch.js:138
    throw new TypeError("glob pattern string required")
    ^

TypeError: glob pattern string required
    at new Minimatch (/usr/local/lib/node_modules/commentjs/node_modules/minimatch/minimatch.js:138:11)
    at new Glob (/usr/local/lib/node_modules/commentjs/node_modules/glob/glob.js:157:29)
    at glob (/usr/local/lib/node_modules/commentjs/node_modules/glob/glob.js:57:11)
    at Function.globSync [as sync] (/usr/local/lib/node_modules/commentjs/node_modules/glob/glob.js:76:10)
    at Object.file.expand (/usr/local/lib/node_modules/commentjs/lib/util/file.js:72:20)
    at null.<anonymous> (/usr/local/lib/node_modules/commentjs/lib/scanner.js:87:28)
    at Object._.forEach (/usr/local/lib/node_modules/commentjs/lib/util/util.js:22:16)
    at Scanner.scan (/usr/local/lib/node_modules/commentjs/lib/scanner.js:51:11)
    at Commentjs.run (/usr/local/lib/node_modules/commentjs/lib/comment.js:43:31)
    at Object.<anonymous> (/usr/local/lib/node_modules/commentjs/bin/commentjs:20:22)

The process works, however, if I only use this in config.json (but then i can't show a link to github):

{
"title": "my documentation title",
"source": "/var/www/html/my-site/wsgi/static/js/code.js",
"output": "docs/index.html"
}

I hope that is clear.

Thank you, I'm really enjoying learning how to use comment.js! It's really fast and has a great design!

Edit: I have installed Node v6.2.1 and am still getting the same error.

/usr/lib/node_modules/commentjs/node_modules/minimatch/minimatch.js:138
    throw new TypeError("glob pattern string required")
    ^

TypeError: glob pattern string required
    at new Minimatch (/usr/lib/node_modules/commentjs/node_modules/minimatch/minimatch.js:138:11)
    at new Glob (/usr/lib/node_modules/commentjs/node_modules/glob/glob.js:157:29)
    at glob (/usr/lib/node_modules/commentjs/node_modules/glob/glob.js:57:11)
    at Function.globSync [as sync] (/usr/lib/node_modules/commentjs/node_modules/glob/glob.js:76:10)
    at Object.file.expand (/usr/lib/node_modules/commentjs/lib/util/file.js:72:20)
    at .<anonymous> (/usr/lib/node_modules/commentjs/lib/scanner.js:87:28)
    at Object._.forEach (/usr/lib/node_modules/commentjs/lib/util/util.js:22:16)
    at Scanner.scan (/usr/lib/node_modules/commentjs/lib/scanner.js:51:11)
    at Commentjs.run (/usr/lib/node_modules/commentjs/lib/comment.js:43:31)
    at Object.<anonymous> (/usr/lib/node_modules/commentjs/bin/commentjs:20:22)

oshihirii avatar Jun 13 '16 01:06 oshihirii

Ok thx, I will take a better look asap

dciccale avatar Jun 13 '16 05:06 dciccale

actually I see that the link feature is not working for now. I will need a while to fix it and I will let you know

dciccale avatar Jun 14 '16 08:06 dciccale