-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
55 additions
and
42 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// For detailed configuration options, see the documentation: | ||
// https://www.cherrypush.com/docs | ||
// | ||
// In this configuration file, you can set up your repository information, | ||
// enable plugins, and build custom metrics for your codebase. | ||
|
||
module.exports = { | ||
repository: { | ||
host: 'github.com', | ||
owner: 'cherrypush', | ||
name: 'cherry-cli', | ||
subdir: '', | ||
}, | ||
plugins: { loc: {} }, | ||
metrics: [ | ||
{ | ||
name: 'TODO/FIXME', | ||
pattern: /(TODO|FIXME):/i, // the i flag makes the regex case insensitive | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import path from 'path' | ||
import { PermalinkFn, Repository } from './types.js' | ||
import { Host, PermalinkFn, Repository } from './types.js' | ||
|
||
export const buildRepoURL = (repository: Repository) => | ||
`https://${repository.host}/${repository.owner}/${repository.name}` | ||
|
@@ -34,15 +34,15 @@ export async function guessRepositoryInfo({ | |
remoteUrl: string | null | ||
configFile: string | null | ||
projectRoot: string | ||
}) { | ||
}): Promise<Repository> { | ||
if (remoteUrl === null) { | ||
throw new Error('Could not guess repository info: no remote URL found') | ||
} | ||
|
||
// For github ssh remotes such as git@github.com:cherrypush/cherry-cli.git | ||
if (remoteUrl.includes('[email protected]')) { | ||
return { | ||
host: 'github.com', | ||
host: Host.Github, | ||
owner: remoteUrl.split(':')[1].split('/')[0], | ||
name: remoteUrl.split('/')[1].replace('.git', ''), | ||
subdir: guessRepositorySubdir({ configFile, projectRoot }), | ||
|
@@ -52,7 +52,7 @@ export async function guessRepositoryInfo({ | |
// For github https remotes such as https://github.com/cherrypush/cherry-cli.git | ||
if (remoteUrl.includes('https://github.com')) { | ||
return { | ||
host: 'github.com', | ||
host: Host.Github, | ||
owner: remoteUrl.split('/')[3], | ||
name: remoteUrl.split('/')[4].replace('.git', ''), | ||
subdir: guessRepositorySubdir({ configFile, projectRoot }), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters