Commit 9110e551179f40de7b323d7fd8cfcbd41bac8e8d
Make npm links more consistent
cel committed on 9/22/2017, 8:59:45 PMParent: 1e2dc6de6b0d0d59f61e42f99899fcfa2b0abcbe
Files changed
lib/render.js | changed |
lib/serve.js | changed |
lib/render.js | ||
---|---|---|
@@ -422,12 +422,12 @@ | ||
422 | 422 … | var self = this |
423 | 423 … | var done = multicb({pluck: 1, spread: true}) |
424 | 424 … | var base = '/npm/' + (opts.author ? u.escapeId(link.author) + '/' : '') |
425 | 425 … | var pathWithAuthor = opts.withAuthor ? '/npm/' + |
426 | - u.escapeId(link.author) + '/' + | |
427 | - (opts.name ? opts.name + '/' + | |
428 | - (opts.version ? opts.version + '/' + | |
429 | - (opts.distTag ? opts.distTag + '/' : '') : '') : '') : '' | |
426 … | + u.escapeId(link.author) + | |
427 … | + (opts.name ? '/' + opts.name + | |
428 … | + (opts.version ? '/' + opts.version + | |
429 … | + (opts.distTag ? '/' + opts.distTag + '/' : '') : '') : '') : '' | |
430 | 430 … | self.app.getAbout(link.author, done()) |
431 | 431 … | self.app.getBlobState(link.link, done()) |
432 | 432 … | done(function (err, about, blobState) { |
433 | 433 … | if (err) return cb(err) |
@@ -440,13 +440,13 @@ | ||
440 | 440 … | href: self.toUrl(base + name), |
441 | 441 … | title: 'package name' |
442 | 442 … | }, name), ' '), |
443 | 443 … | h('td', version ? [h('a', { |
444 | - href: self.toUrl(base + name + '/' + version + '/'), | |
444 … | + href: self.toUrl(base + name + '/' + version), | |
445 | 445 … | title: 'package version' |
446 | 446 … | }, version), ' '] : ''), |
447 | 447 … | h('td', distTag ? [h('a', { |
448 | - href: self.toUrl(base + name + '//' + distTag + '/'), | |
448 … | + href: self.toUrl(base + name + '//' + distTag), | |
449 | 449 … | title: 'dist-tag' |
450 | 450 … | }, distTag), ' '] : ''), |
451 | 451 … | h('td', {align: 'right'}, link.size != null ? [h('span', { |
452 | 452 … | title: 'tarball size' |
lib/serve.js | ||
---|---|---|
@@ -1889,12 +1889,12 @@ | ||
1889 | 1889 … | (distTag ? distTag + ':' : '') : '') : '') |
1890 | 1890 … | |
1891 | 1891 … | var render = self.app.render |
1892 | 1892 … | var base = '/npm/' + (author ? u.escapeId(author) + '/' : '') |
1893 | - var pathWithoutAuthor = '/npm/' + | |
1894 | - (name ? name + '/' + | |
1895 | - (version ? version + '/' + | |
1896 | - (distTag ? distTag + '/' : '') : '') : '') | |
1893 … | + var pathWithoutAuthor = '/npm' + | |
1894 … | + (name ? '/' + name + | |
1895 … | + (version ? '/' + version + | |
1896 … | + (distTag ? '/' + distTag : '') : '') : '') | |
1897 | 1897 … | return pull( |
1898 | 1898 … | ph('section', {}, [ |
1899 | 1899 … | ph('h3', [ph('a', {href: render.toUrl('/npm/')}, 'npm'), ' : ', |
1900 | 1900 … | author ? [ |
@@ -1907,9 +1907,9 @@ | ||
1907 | 1907 … | distTag ? [ph('a', {href: render.toUrl(base + name + '/' + version + '/' + distTag)}, distTag)] : '' |
1908 | 1908 … | ]), |
1909 | 1909 … | ph('table', [ |
1910 | 1910 … | ph('thead', ph('tr', [ |
1911 | - !author ? ph('td', 'publisher') : '', | |
1911 … | + ph('td', 'publisher'), | |
1912 | 1912 … | ph('td', 'package'), |
1913 | 1913 … | ph('td', 'version'), |
1914 | 1914 … | ph('td', 'tag'), |
1915 | 1915 … | ph('td', 'size'), |
@@ -1925,9 +1925,9 @@ | ||
1925 | 1925 … | return link.name.split(':')[3] === distTag |
1926 | 1926 … | }), |
1927 | 1927 … | paramap(function (link, cb) { |
1928 | 1928 … | self.app.render.npmPackageMention(link, { |
1929 | - withAuthor: !author, | |
1929 … | + withAuthor: true, | |
1930 | 1930 … | author: author, |
1931 | 1931 … | name: name, |
1932 | 1932 … | version: version, |
1933 | 1933 … | distTag: distTag, |
Built with git-ssb-web