File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -7,20 +7,24 @@ const filePath = join(__dirname, 'gitmojis.json');
7
7
if ( ! existsSync ( filePath ) ) {
8
8
const url =
9
9
'https://raw.githubusercontent.com/carloscuesta/gitmoji/master/src/data/gitmojis.json' ;
10
+ try {
11
+ // eslint-disable-next-line global-require
12
+ const result = require ( 'child_process' ) . execFileSync (
13
+ 'curl' ,
14
+ [ '--silent' , '-L' , url ] ,
15
+ {
16
+ encoding : 'utf8' ,
17
+ maxBuffer : Infinity ,
18
+ } ,
19
+ ) ;
10
20
11
- // eslint-disable-next-line global-require
12
- const result = require ( 'child_process' ) . execFileSync (
13
- 'curl' ,
14
- [ '--silent' , '-L' , url ] ,
15
- {
16
- encoding : 'utf8' ,
17
- maxBuffer : Infinity ,
18
- } ,
19
- ) ;
20
-
21
- writeFileSync ( filePath , result ) ;
21
+ writeFileSync ( filePath , result ) ;
22
+ } catch ( e ) {
23
+ throw Error (
24
+ 'Failed to fetch gitmoji JSON, please refer to https://github.com/arvinxx/gitmoji-commit-workflow/tree/master/packages/plugin#fetch-error for help.' ,
25
+ ) ;
26
+ }
22
27
}
23
-
24
28
// eslint-disable-next-line import/no-dynamic-require
25
29
const { gitmojis } = require ( filePath ) ;
26
30
const gitmojiCodes : string [ ] = gitmojis . map ( ( gitmoji ) => gitmoji . code ) ;
You can’t perform that action at this time.
0 commit comments