Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add ts and jest config * chore: add ts related deps * refactor: port is-ignored to ts * style: apply prettier rules
- Loading branch information
Showing
12 changed files
with
284 additions
and
233 deletions.
There are no files selected for viewing
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 @@ | ||
export * from "./lib"; |
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,2 @@ | ||
module.exports = require('./lib').default; | ||
module.exports.default = module.exports; |
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,4 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node' | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import semver from 'semver'; | ||
|
||
export type Matcher = (commit: string) => boolean; | ||
|
||
const isSemver = (c: string): boolean => { | ||
const firstLine = c.split('\n').shift(); | ||
|
||
if (typeof firstLine !== 'string') { | ||
return false; | ||
} | ||
|
||
const stripped = firstLine.replace(/^chore(\([^)]+\))?:/, '').trim(); | ||
return semver.valid(stripped) !== null; | ||
}; | ||
|
||
const test = (r: RegExp): ((c: string) => boolean) => r.test.bind(r); | ||
|
||
export const wildcards: Matcher[] = [ | ||
test( | ||
/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m | ||
), | ||
test(/^(R|r)evert (.*)/), | ||
test(/^(fixup|squash)!/), | ||
isSemver, | ||
test(/^Merged (.*?)(in|into) (.*)/), | ||
test(/^Merge remote-tracking branch (.*)/), | ||
test(/^Automatic merge(.*)/), | ||
test(/^Auto-merged (.*?) into (.*)/) | ||
]; |
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
export * from './is-ignored'; | ||
export {Matcher} from './defaults'; |
Oops, something went wrong.