From 266c619190ab162f57cf300bce8c98033ccfa4ea Mon Sep 17 00:00:00 2001 From: Benjamin Lupton Date: Thu, 28 Dec 2023 22:33:59 +0800 Subject: [PATCH] v4.1.1 - trim trailing slashes, update repo handling --- .github/workflows/bevry.yml | 2 +- HISTORY.md | 7 ++++ README.md | 17 +++++++-- package-lock.json | 54 ++++++++++++++-------------- package.json | 31 ++++++++++------ source/index.ts | 39 +++++++++++--------- test-fixtures/out-expected/README.md | 2 +- test-fixtures/src/README.md | 2 +- 8 files changed, 94 insertions(+), 60 deletions(-) diff --git a/.github/workflows/bevry.yml b/.github/workflows/bevry.yml index 715e377..b345305 100644 --- a/.github/workflows/bevry.yml +++ b/.github/workflows/bevry.yml @@ -57,7 +57,7 @@ jobs: - run: npm run our:compile - run: npm run our:meta - name: publish to npm - uses: bevry-actions/npm@v1.1.3 + uses: bevry-actions/npm@v1.1.5 with: npmAuthToken: ${{ secrets.NPM_AUTH_TOKEN }} npmBranchTag: ':next' diff --git a/HISTORY.md b/HISTORY.md index 60b6f15..7b48246 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,12 @@ # History +## v4.1.1 2023 December 28 + +- Update github-api and fellow deps, so trailing slashes no longer cause duplicates (they are now trimmed) and maintainer urls are now the homepage +- Support `.repository` that isn't github, if it is github however, update to the preferred format +- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) +- Thank you to the sponsors: [Andrew Nesbitt](https://nesbitt.io), [Balsa](https://balsa.com), [Codecov](https://codecov.io/), [Poonacha Medappa](https://poonachamedappa.com), [Rob Morris](https://github.com/Rob-Morris), [Sentry](https://sentry.io), [Syntax](https://syntax.fm) + ## v4.1.0 2023 December 28 - Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) diff --git a/README.md b/README.md index 231c1ea..69949cb 100644 --- a/README.md +++ b/README.md @@ -320,7 +320,7 @@ This package is published with the following editions: #### Maintainers -- [Benjamin Lupton](https://github.com/balupton) — Accelerating collaborative wisdom. +- [Benjamin Lupton](https://balupton.com) — Accelerating collaborative wisdom. #### Contributors @@ -350,7 +350,7 @@ This package is published with the following editions: - [Andrew Nesbitt](https://nesbitt.io) — Software engineer and researcher - [Balsa](https://balsa.com) — We're Balsa, and we're building tools for builders. -- [Codecov](https://codecov.io/) — Empower developers with tools to improve code quality and testing. +- [Codecov](https://codecov.io) — Empower developers with tools to improve code quality and testing. - [Poonacha Medappa](https://poonachamedappa.com) - [Rob Morris](https://github.com/Rob-Morris) - [Sentry](https://sentry.io) — Real-time crash reporting for your web apps, mobile apps, and games. @@ -359,19 +359,30 @@ This package is published with the following editions: #### Donors - [Andrew Nesbitt](https://nesbitt.io) +- [Armen Mkrtchian](https://mogoni.dev) - [Balsa](https://balsa.com) - [Chad](https://opencollective.com/chad8) -- [Codecov](https://codecov.io/) +- [Codecov](https://codecov.io) +- [dr.dimitru](https://veliovgroup.com) +- [Elliott Ditman](https://elliottditman.com) - [entroniq](https://gitlab.com/entroniq) +- [GitHub](https://github.com/about) +- [Hunter Beast](https://cryptoquick.com) - [Jean-Luc Geering](https://github.com/jlgeering) - [Michael Duane Mooring](https://mdm.cc) +- [Michael Harry Scepaniak](https://michaelscepaniak.com) - [Mohammed Shah](https://github.com/smashah) +- [Mr. Henry](https://mrhenry.be) +- [Nermal](https://arjunaditya.vercel.app) +- [Pleo](https://www.pleo.io) - [Poonacha Medappa](https://poonachamedappa.com) - [Rob Morris](https://github.com/Rob-Morris) +- [Robert de Forest](https://github.com/rdeforest) - [Sentry](https://sentry.io) - [ServieJS](https://github.com/serviejs) - [Skunk Team](https://skunk.team) - [Syntax](https://syntax.fm) +- [WriterJohnBuck](https://github.com/WriterJohnBuck) diff --git a/package-lock.json b/package-lock.json index bc1e1cb..f041164 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { "name": "projectz", - "version": "4.1.0", + "version": "4.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "projectz", - "version": "4.1.0", + "version": "4.1.1", "license": "Artistic-2.0", "dependencies": { "@bevry/argument": "^1.1.0", "@bevry/fs-list": "^2.5.0", "@bevry/fs-read": "^1.5.0", "@bevry/fs-write": "^1.5.0", - "@bevry/github-api": "^11.1.0", + "@bevry/github-api": "^11.3.1", "@bevry/json": "^2.3.0", "@bevry/render": "^1.1.0", "arrange-package-json": "^5.1.0", @@ -21,7 +21,7 @@ "caterpillar": "^8.1.0", "spdx-expression-parse": "^4.0.0", "spdx-license-list": "^6.8.0", - "trim-empty-keys": "^1.0.1", + "trim-empty-keys": "^1.1.0", "typechecker": "^9.3.0" }, "bin": { @@ -42,7 +42,7 @@ "safeps": "^11.5.0", "typedoc": "^0.25.4", "typescript": "5.3.3", - "valid-directory": "^4.7.0" + "valid-directory": "^4.8.0" }, "engines": { "node": ">=20" @@ -213,23 +213,23 @@ } }, "node_modules/@bevry/github-api": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/@bevry/github-api/-/github-api-11.1.0.tgz", - "integrity": "sha512-6+a9WEbgakYPpm0x3h+YUNTX3ubOgkEHEiPHsNplBwasKsJed9HLrF9prmXgyLlnVBigUjsecL3z76CMnq+BMQ==", + "version": "11.3.1", + "resolved": "https://registry.npmjs.org/@bevry/github-api/-/github-api-11.3.1.tgz", + "integrity": "sha512-ZA63VPHXquoMKNjn5xFnLWaOjSIdXtke8LhgoIZ0PAWirWOAESMaepvDSuLi6vbvhMBrWg6lF0r8jfehpvRJWw==", "dependencies": { "@bevry/argument": "^1.1.0", "@bevry/fs-readable": "^2.4.0", "@bevry/json": "^2.3.0", - "@bevry/list": "^2.3.0", + "@bevry/list": "^2.4.0", "@bevry/wait": "^2.5.0", "@octokit/graphql": "^7.0.2", "arrange-package-json": "^5.1.0", "errlop": "^8.3.0", - "fellow": "^7.1.0", + "fellow": "^7.1.1", "js-yaml": "^4.1.0", - "native-promise-pool": "^3.26.0", + "native-promise-pool": "^3.27.0", "simplytyped": "^3.3.0", - "trim-empty-keys": "^1.0.1" + "trim-empty-keys": "^1.1.0" }, "bin": { "github-backers": "bin.cjs" @@ -1520,9 +1520,9 @@ } }, "node_modules/fellow": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/fellow/-/fellow-7.1.0.tgz", - "integrity": "sha512-zIoE25/3rDYMsnP1WLNOFXW5mQC54yN4HQdAJzi7JQYzs3JzqTPTjJJuKKMkl8fL5jHAaR4Y4jXqv7w5RDf64A==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fellow/-/fellow-7.1.1.tgz", + "integrity": "sha512-iKKUKXO0TDmEjjrIk/VKsC9p1xUav0zhx927q1oaeb46hEeOy4ZSzAJBXHucOkK+8npsE6z0v7BVmVpWdIlM2A==", "dependencies": { "@bevry/render": "^1.1.0", "editions": "^6.20.0" @@ -2224,11 +2224,11 @@ } }, "node_modules/rfc-log-levels": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/rfc-log-levels/-/rfc-log-levels-4.1.0.tgz", - "integrity": "sha512-y+fVhL1sywPejgdtM8UypjvroP+CKLdtlqCV+QkwEfFDQh4IzFZuqQS7Z9pyZLHngc3wYmuQpy4K0sS/CI9z3A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/rfc-log-levels/-/rfc-log-levels-4.2.0.tgz", + "integrity": "sha512-CZ2+u5Hol5k+bfIrTkRzWGZfTSHvu/aKDtaJsBWYjUunIgOoAUAxJV6m4EnX2ctNhDuYB5ascFRys5ccKO1afQ==", "dependencies": { - "editions": "^6.19.0" + "editions": "^6.20.0" }, "engines": { "node": ">=4" @@ -2511,11 +2511,11 @@ } }, "node_modules/trim-empty-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-empty-keys/-/trim-empty-keys-1.0.1.tgz", - "integrity": "sha512-ewq4ybzbCpezfVXZHfOE5MYP8CBGJYOka6z3xTHsIdsDmO/NGDav0OyNY4IC/N+KQZxaLU2fJDT2nDDvsRg8lg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/trim-empty-keys/-/trim-empty-keys-1.1.0.tgz", + "integrity": "sha512-LxZzCVSQ6dTiVOYiBDcY8CTkzOYzdU8JI5S4sy5/LHaneGwHRG5jzsryOhKAqlGkEu4IaMQYgpJ2J9Lq8ejzkg==", "dependencies": { - "typechecker": "^9.2.0" + "typechecker": "^9.3.0" }, "engines": { "node": ">=8" @@ -2649,12 +2649,12 @@ } }, "node_modules/valid-directory": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/valid-directory/-/valid-directory-4.7.0.tgz", - "integrity": "sha512-DGxoViQM+cV9mZf2mGrMfcTcZNd5uJ2dOOitdgt1OmRjk3dkvLRilUoEFpeVtSgPga2xHtQzB9rcgZvSeIDh8A==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/valid-directory/-/valid-directory-4.8.0.tgz", + "integrity": "sha512-71SQWCDI/hk+gTQ2/u531ldpa5Qecl9U2oODwU5ubTGj+BE3GqdFdkLM8/OZa0QCsPYChZWl+62h9TZoZ4j3Wg==", "dev": true, "dependencies": { - "@bevry/valid-filename": "^2.4.0", + "@bevry/valid-filename": "^2.5.0", "fdir": "^6.1.1" }, "bin": { diff --git a/package.json b/package.json index bf26cde..9c27e76 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "title": "Projectz", "name": "projectz", - "version": "4.1.0", + "version": "4.1.1", "license": "Artistic-2.0", "description": "Stop wasting time syncing and updating your project's README and Package Files!", "homepage": "https://github.com/bevry/projectz", "funding": "https://bevry.me/fund", "repository": { "type": "git", - "url": "https://github.com/bevry/projectz.git" + "url": "git+https://github.com/bevry/projectz.git" }, "bugs": { "url": "https://github.com/bevry/projectz/issues" @@ -89,7 +89,7 @@ "Benjamin Lupton (https://balupton.com) (https://github.com/balupton)", "James George (https://github.com/jamesgeorge007)", "Oliver Lorenz (https://www.oliverlorenz.com) (https://github.com/oliverlorenz)", - "Peter C (https://www.linkedin.com/in/peterkc1/) (https://github.com/peterkc)", + "Peter C (https://www.linkedin.com/in/peterkc1) (https://github.com/peterkc)", "Peter Flannery (https://github.com/pflannery)", "Rob Loach (https://robloach.net) (https://github.com/RobLoach)", "Shahar \"Dawn\" Or (https://github.com/mightyiam)", @@ -100,7 +100,7 @@ "sponsors": [ "Andrew Nesbitt (https://nesbitt.io) (https://github.com/andrew): Software engineer and researcher", "Balsa (https://balsa.com) (https://github.com/balsa): We're Balsa, and we're building tools for builders.", - "Codecov (https://codecov.io/) (https://github.com/codecov): Empower developers with tools to improve code quality and testing.", + "Codecov (https://codecov.io) (https://github.com/codecov): Empower developers with tools to improve code quality and testing.", "Poonacha Medappa (https://poonachamedappa.com) (https://github.com/km-Poonacha)", "Rob Morris (https://github.com/Rob-Morris)", "Sentry (https://sentry.io) (https://github.com/getsentry): Real-time crash reporting for your web apps, mobile apps, and games.", @@ -108,19 +108,30 @@ ], "donors": [ "Andrew Nesbitt (https://nesbitt.io) (https://github.com/andrew)", + "Armen Mkrtchian (https://mogoni.dev) (https://github.com/Armenm)", "Balsa (https://balsa.com) (https://github.com/balsa)", "Chad (https://opencollective.com/chad8)", - "Codecov (https://codecov.io/) (https://github.com/codecov)", + "Codecov (https://codecov.io) (https://github.com/codecov)", + "dr.dimitru (https://veliovgroup.com) (https://github.com/dr-dimitru)", + "Elliott Ditman (https://elliottditman.com) (https://github.com/elliottditman)", "entroniq (https://gitlab.com/entroniq) (https://thanks.dev/d/gl/entroniq)", + "GitHub (https://github.com/about) (https://github.com/github)", + "Hunter Beast (https://cryptoquick.com) (https://github.com/cryptoquick)", "Jean-Luc Geering (https://github.com/jlgeering) (https://opencollective.com/jlgeering) (https://twitter.com/jlgeering)", "Michael Duane Mooring (https://mdm.cc) (https://github.com/mikeumus) (https://opencollective.com/mikeumus) (https://twitter.com/mikeumus)", + "Michael Harry Scepaniak (https://michaelscepaniak.com) (https://github.com/hispanic)", "Mohammed Shah (https://github.com/smashah) (https://thanks.dev/d/gh/smashah) (https://twitter.com/smashah)", + "Mr. Henry (https://mrhenry.be) (https://github.com/mrhenry)", + "Nermal (https://arjunaditya.vercel.app) (https://github.com/nermalcat69)", + "Pleo (https://www.pleo.io) (https://github.com/pleo-io)", "Poonacha Medappa (https://poonachamedappa.com) (https://github.com/km-Poonacha)", "Rob Morris (https://github.com/Rob-Morris)", + "Robert de Forest (https://github.com/rdeforest)", "Sentry (https://sentry.io) (https://github.com/getsentry)", "ServieJS (https://github.com/serviejs) (https://thanks.dev/d/gh/serviejs)", "Skunk Team (https://skunk.team) (https://github.com/skunkteam)", - "Syntax (https://syntax.fm) (https://github.com/syntaxfm)" + "Syntax (https://syntax.fm) (https://github.com/syntaxfm)", + "WriterJohnBuck (https://github.com/WriterJohnBuck)" ], "engines": { "node": ">=20" @@ -195,7 +206,7 @@ "@bevry/fs-list": "^2.5.0", "@bevry/fs-read": "^1.5.0", "@bevry/fs-write": "^1.5.0", - "@bevry/github-api": "^11.1.0", + "@bevry/github-api": "^11.3.1", "@bevry/json": "^2.3.0", "@bevry/render": "^1.1.0", "arrange-package-json": "^5.1.0", @@ -203,7 +214,7 @@ "caterpillar": "^8.1.0", "spdx-expression-parse": "^4.0.0", "spdx-license-list": "^6.8.0", - "trim-empty-keys": "^1.0.1", + "trim-empty-keys": "^1.1.0", "typechecker": "^9.3.0" }, "devDependencies": { @@ -221,7 +232,7 @@ "safeps": "^11.5.0", "typedoc": "^0.25.4", "typescript": "5.3.3", - "valid-directory": "^4.7.0" + "valid-directory": "^4.8.0" }, "scripts": { "our:bin": "node ./bin.cjs", @@ -234,7 +245,7 @@ "our:meta": "npm run our:meta:docs && npm run our:meta:projectz", "our:meta:docs": "npm run our:meta:docs:typedoc", "our:meta:docs:typedoc": "rm -rf ./docs && typedoc --exclude '**/+(*test*|node_modules)' --excludeExternals --out ./docs ./source", - "our:meta:projectz": "npm run our:bin", + "our:meta:projectz": "npm run our:bin -- --offline", "our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push", "our:release:check-changelog": "cat ./HISTORY.md | grep \"v$npm_package_version\" || (printf '%s\n' \"add a changelog entry for v$npm_package_version\" && exit -1)", "our:release:check-dirty": "git diff --exit-code", diff --git a/source/index.ts b/source/index.ts index 78ee3f4..b96cd38 100644 --- a/source/index.ts +++ b/source/index.ts @@ -17,6 +17,9 @@ import { getBackers, renderBackers, BackersRenderFormat, + getRepositoryWebsiteUrlFromGitHubSlugOrUrl, + getRepositoryIssuesUrlFromGitHubSlugOrUrl, + getRepositoryUrlFromGitHubSlugOrUrl, } from '@bevry/github-api' import { mh1, trim } from '@bevry/render' @@ -236,12 +239,9 @@ export class Projectz { // Ensure repository is an object if (typeof mergedPackageData.repository === 'string') { - const githubSlug = getGitHubSlugFromPackageData(mergedPackageData) - if (githubSlug) { - mergedPackageData.repository = { - type: 'git', - url: `https://github.com/${githubSlug}.git`, - } + mergedPackageData.repository = { + type: 'git', + url: mergedPackageData.repository, } } @@ -290,15 +290,19 @@ export class Projectz { if (githubSlug) { // Extract parts const [githubUsername, githubRepository] = githubSlug.split('/') - const githubUrl = 'https://github.com/' + githubSlug - const githubRepositoryUrl = githubUrl + '.git' + const githubRepositoryWebsiteUrl = + getRepositoryWebsiteUrlFromGitHubSlugOrUrl(githubSlug) || '' + const githubRepositoryUrl = + getRepositoryUrlFromGitHubSlugOrUrl(githubSlug) || '' + const githubIssuesUrl = + getRepositoryIssuesUrlFromGitHubSlugOrUrl(githubSlug) || '' // Github data github = { username: githubUsername, repository: githubRepository, slug: githubSlug, - url: githubUrl, + url: githubRepositoryWebsiteUrl, repositoryUrl: githubRepositoryUrl, } @@ -309,15 +313,18 @@ export class Projectz { githubSlug, }) - // Fallback bugs field by use of repo + // Fallback bugs field by use of slug if (!mergedPackageData.bugs) { - mergedPackageData.bugs = github && { - url: `https://github.com/${github.slug}/issues`, - } + mergedPackageData.bugs = githubIssuesUrl } - // Fetch contributors - // await getContributorsFromRepo(githubSlug) + // Fallback repository field by use of slug + if (!mergedPackageData.repository?.url) { + mergedPackageData.repository = { + type: 'git', + url: githubRepositoryUrl, + } + } } } @@ -328,8 +335,6 @@ export class Projectz { githubSlug: github?.slug, packageData: mergedPackageData, offline: this.offline, - sponsorCentsThreshold: 100, - donorCentsThreshold: 100, }) const renderedBackersForPackage = await renderBackers(backers, { format: BackersRenderFormat.string, diff --git a/test-fixtures/out-expected/README.md b/test-fixtures/out-expected/README.md index 99d085b..e48e2c5 100644 --- a/test-fixtures/out-expected/README.md +++ b/test-fixtures/out-expected/README.md @@ -126,7 +126,7 @@ console.log(result); // setTimeout - just like normal #### Maintainers -- [Benjamin Lupton](https://github.com/balupton) +- [Benjamin Lupton](https://balupton.com) #### Contributors diff --git a/test-fixtures/src/README.md b/test-fixtures/src/README.md index 99d085b..e48e2c5 100644 --- a/test-fixtures/src/README.md +++ b/test-fixtures/src/README.md @@ -126,7 +126,7 @@ console.log(result); // setTimeout - just like normal #### Maintainers -- [Benjamin Lupton](https://github.com/balupton) +- [Benjamin Lupton](https://balupton.com) #### Contributors