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