mirror of
https://github.com/pezkuwichain/pezkuwi-dev.git
synced 2026-11-14 02:37:07 +00:00
build-ts: keep a package homepage that points outside the repository (0.86.9) (#34)
* build-ts: keep a package homepage that points outside the repository orderPackageJson derived homepage from repository.url on every build, so a package could not link its npm page to its API reference: the build put the repository readme back and the clean-tree check failed. A homepage inside the repository, or none, is still derived as before. * Release dev, dev-test and dev-ts together as 0.86.9
This commit is contained in:
1 parent
07e75fff9b
commit
467c8b99bd
10 files changed
+74
-14
No files matched your search
@@ -146,6 +146,24 @@ export function engineVersionSplit (ver) {
|
||||
return [parseInt(parts[0] || '0', 10), parseInt(parts[1] || '0', 10), parseInt(parts[2] || '0', 10)];
|
||||
}
|
||||
|
||||
/**
|
||||
* The homepage written into a package.json. One the author pointed outside the
|
||||
* repository (an API reference, a product site) is kept; anything else, and an
|
||||
* absent one, is derived from the repository.
|
||||
*
|
||||
* @param {string} repoBase e.g. https://git.example.org/owner/repo
|
||||
* @param {string | null} dir package directory under packages/, null for the root
|
||||
* @param {string} [current] the homepage the package.json carries now
|
||||
* @returns {string}
|
||||
*/
|
||||
export function packageHomepage (repoBase, dir, current) {
|
||||
const inRepo = !current || current === repoBase || current.startsWith(`${repoBase}/`) || current.startsWith(`${repoBase}#`);
|
||||
|
||||
return inRepo
|
||||
? `${repoBase}${dir ? `/tree/master/packages/${dir}` : ''}#readme`
|
||||
: current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process execution
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user