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