travis-ci-com
381 of 627 branches covered (60.77%)
Branch coverage included in aggregate %.
1467 of 1724 relevant lines covered (85.09%)
21.74 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 |
} |
56✔ |
9 |
|
56✔ |
10 |
export function handle(): void { |
|
11 |
const hasReleaseRc: boolean = (() => {
|
|
12 |
const rds = fs.readdirSync(process.cwd(), 'utf8'); |
50✔ |
13 |
|
248✔ |
14 |
for (const f of rds) { |
|
15 |
if (f.startsWith('.releaserc')) { |
|
16 |
return true; |
75✔ |
17 |
} |
124✔ |
18 |
} |
|
19 |
|
|
20 |
return false; |
|
21 |
})(); |
|
22 |
|
50✔ |
23 |
if (hasReleaseRc) {
|
50✔ |
24 |
Log.info('Skipping .releaserc'); |
|
25 |
|
50✔ |
26 |
return;
|
2✔ |
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 |
} |