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

regression in version 4.0.0-beta.19 compared to version 4.0.0-beta.18 - the build --github option no longer does anything #738

Closed
gkovacs opened this issue Apr 19, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@gkovacs
Copy link

gkovacs commented Apr 19, 2017

I am using the command

./node_modules/documentation/bin/documentation.js build src_gen/libs_frontend/*.js src_gen/libs_backend/*.js --github -f html -o docs

Using the default theme. With version 4.0.0-beta.18 and previous versions (tested with every version from 4.0.0-beta.14 to 4.0.0-beta.18) the github links correctly appear. However, with 4.0.0-beta.19 the github links are no longer shown (even though I'm still using the same command). This happens with every repository I have tested with, but if you need a sample example see https://github.com/habitlab/habitlab

@gkovacs
Copy link
Author

gkovacs commented Apr 19, 2017

I've located the issue: it seems in module.exports for lib/github.js the format has changed, but the default template doesn't seem to have been updated accordingly. As reverting back to the version of lib/github.js in 4.0.0-beta.18 fixes this issue:

'use strict';
/* @flow */

var path = require('path');
var findGit = require('../lib/git/find_git');
var getGithubURLPrefix = require('../lib/git/url_prefix');

/**
 * Attempts to link code to its place on GitHub.
 *
 * @name linkGitHub
 * @param {Object} comment parsed comment
 * @return {Object} comment with github inferred
 */
module.exports = function(comment /*: Comment*/) {
  var repoPath = findGit(comment.context.file);
  var root = repoPath ? path.dirname(repoPath) : '.';
  var urlPrefix = getGithubURLPrefix(root);
  var fileRelativePath = comment.context.file
    .replace(root + path.sep, '')
    .split(path.sep)
    .join('/');

  if (urlPrefix) {
    comment.context.github = urlPrefix +
        fileRelativePath +
        '#L' +
        comment.context.loc.start.line +
        '-' +
        'L' +
        comment.context.loc.end.line
    comment.context.path = fileRelativePath
  }
  return comment;
};

@tmcw tmcw self-assigned this Apr 19, 2017
@tmcw tmcw added this to the beta20 milestone Apr 19, 2017
@tmcw tmcw added the bug label Apr 19, 2017
@tmcw
Copy link
Member

tmcw commented Apr 19, 2017

Thanks for the error report! I'll be able to get this fixed in the next release.

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

2 participants