travis-ci-com
488 of 805 branches covered (60.62%)
Branch coverage included in aggregate %.
1144 of 1261 relevant lines covered (90.72%)
24.7 hits per line
1 |
import * as fs from 'fs'; |
4✔ |
2 |
import {Fixture} from '../Fixture'; |
12✔ |
3 |
import {Git} from '../Git'; |
12✔ |
4 |
import {Log} from '../Log'; |
12✔ |
5 |
|
8✔ |
6 |
const enum Conf { |
8✔ |
7 |
FILE = '.releaserc.yml' |
|
8 |
} |
28✔ |
9 |
|
56✔ |
10 |
export function handle(): void { |
|
11 |
const hasReleaseRc: boolean = (() => {
|
|
12 |
const rds = fs.readdirSync(process.cwd(), 'utf8'); |
25✔ |
13 |
|
124✔ |
14 |
for (const f of rds) { |
|
15 |
if (f.startsWith('.releaserc')) { |
|
16 |
return true; |
50✔ |
17 |
} |
124✔ |
18 |
} |
|
19 |
|
|
20 |
return false; |
|
21 |
})(); |
|
22 |
|
25✔ |
23 |
if (hasReleaseRc) {
|
25✔ |
24 |
Log.info('Skipping .releaserc'); |
|
25 |
|
25✔ |
26 |
return;
|
1✔ |
27 |
} |
|
28 |
|
|
29 |
new Fixture('init').copy(Conf.FILE, Conf.FILE); |
|
30 |
Git.add(Conf.FILE); |
25✔ |
31 |
|
|
32 |
Log.success('Generated .releaserc'); |
25✔ |
33 |
} |