Skip to content

Commit

Permalink
fix(docz-core): use of src config in edit button link (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpetetot authored and pedronauck committed Aug 3, 2018
1 parent 48fec58 commit 553f90c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/docz-core/src/Entries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class Entries {
public repoUrl: string | null

constructor(config: Config) {
this.repoUrl = repoInfo()
this.repoUrl = repoInfo(config.src)
this.all = new Map()
this.get = async () => this.getMap(config)
}
Expand Down
5 changes: 3 additions & 2 deletions packages/docz-core/src/utils/repo-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import findup from 'find-up'

import * as paths from '../config/paths'

export const repoInfo = (): string | null => {
export const repoInfo = (src: string | './'): string | null => {
try {
const project = path.parse(findup.sync('.git')).dir
const relative = path.relative(project, paths.root)
const root = path.join(paths.root, src);
const relative = path.relative(project, root)
const tree = path.join('/tree/master', relative)
const pkg = fs.readJsonSync(paths.appPackageJson)
const repo = getPkgRepo(pkg)
Expand Down

0 comments on commit 553f90c

Please sign in to comment.