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
34 changed files
with
12,044 additions
and
8,419 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,19 @@ | ||
{ | ||
"rules": { | ||
"subject-empty": [2, "never"], | ||
"type-empty": [2, "never"], | ||
"type-enum": [ | ||
2, | ||
"always", | ||
[ | ||
"Chore", | ||
"Fix", | ||
"New", | ||
"Update", | ||
"Breaking", | ||
"Docs", | ||
"Upgrade" | ||
] | ||
] | ||
} | ||
} |
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,36 @@ | ||
import { message, danger, warn, fail } from 'danger'; | ||
import lint from '@commitlint/lint'; | ||
import commitLintConfig from './.commitlintrc'; | ||
|
||
const src = danger.git.fileMatch('src/*'); | ||
const tests = danger.git.fileMatch('tests/*'); | ||
const system = danger.git.fileMatch('.*', '.*/**', 'LICENSE.md', 'package-lock.json', 'package.json'); | ||
const isOwner = danger.github.pr.user.login === danger.github.thisPR.owner; | ||
const modifiedList = danger.git.modified_files.join('\n - '); | ||
|
||
export default async function () { | ||
message(`Changed Files in this PR: \n - ${modifiedList}`); | ||
|
||
if (system.modified && !isOwner) { | ||
const files = system.getKeyedPaths().modified; | ||
|
||
fail(`Only owner can change system files [${files.join(', ')}], please provide issue instead`, files[0]); | ||
} | ||
|
||
if (!src.modified && !tests.modified) { | ||
warn('Source files were changed without tests'); | ||
} | ||
|
||
const promises = danger.github.commits.map(async commit => { | ||
const msg = commit.commit.message; | ||
const comitLintReport = await lint(msg, commitLintConfig.rules); | ||
|
||
if (!comitLintReport.valid) { | ||
const errors = comitLintReport.errors.map(e => e.message); | ||
|
||
fail(`Commit [${commit.sha}]:\n${msg} not mathing convention:\n${errors.join('\n')}`); | ||
} | ||
}); | ||
|
||
await Promise.all(promises); | ||
} |
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 @@ | ||
!.dangerfile.js |
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 |
---|---|---|
|
@@ -5,4 +5,5 @@ lib/* | |
coverage/* | ||
tmp/* | ||
logs/* | ||
*.log | ||
*.log | ||
*.tgz |
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 @@ | ||
_ |
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 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx commitlint --edit $1 |
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,9 @@ | ||
{ | ||
"threshold": 5, | ||
"reporters": ["html", "console"], | ||
"ignore": [], | ||
"output": "./reports/jscpd", | ||
"minLines": 3, | ||
"minTokens": 30, | ||
"ignoreCase": true | ||
} |
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
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,6 @@ | ||
#!/bin/bash | ||
rm -rf tmp/package | ||
PACKAGE="$(npm pack 2>&1 | tail -1)" | ||
mkdir -p tmp | ||
tar -xvzf $PACKAGE -C tmp | ||
#mv $PACKAGE ${PACKAGE/-[0-9.]*.tgz/.tgz} |
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
Oops, something went wrong.