File tree 2 files changed +19
-18
lines changed
2 files changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { Merge } from 'type-fest';
5
5
import { Arguments , Argv } from 'yargs' ;
6
6
import checkProjectStructure from '../checks/project-structure' ;
7
7
import { downloadTemplate , fetchListOfTemplates } from '../templating/actions' ;
8
- import { setLogLevelByName } from '../utils/logger' ;
8
+ import { setLogLevelByName , logger } from '../utils/logger' ;
9
9
import { baseCliOptions , BaseFlags , ExternalCliOptions } from './shared' ;
10
10
import { CliInfo } from './types' ;
11
11
import { getFullCommand } from './utils' ;
@@ -112,7 +112,11 @@ export async function handler(
112
112
113
113
const sanitizedNamespace = flags . namespace . replace ( / \. j s $ / , '' ) ;
114
114
115
- downloadTemplate ( flags . template , sanitizedNamespace , targetDirectory ) ;
115
+ try {
116
+ await downloadTemplate ( flags . template , sanitizedNamespace , targetDirectory ) ;
117
+ } catch ( error ) {
118
+ logger . error ( error . message , error . name ) ;
119
+ }
116
120
}
117
121
118
122
export const cliInfo : CliInfo = {
Original file line number Diff line number Diff line change @@ -9,22 +9,19 @@ export async function downloadTemplate(
9
9
namespace : string ,
10
10
targetDirectory : string
11
11
) : Promise < void > {
12
- try {
13
- const files = await getTemplateFiles ( templateName ) ;
14
- await writeFiles ( files , targetDirectory , namespace , templateName ) ;
15
- logger . info (
16
- chalk `{green SUCCESS} Downloaded new template into the "${ namespace } " subdirectories.`
17
- ) ;
18
- logger . info (
19
- `Check ${ path . join (
20
- 'readmes' ,
21
- namespace ,
22
- `${ templateName } .md`
23
- ) } for template instructions.`
24
- ) ;
25
- } catch ( err ) {
26
- logger . error ( err . message , err . name ) ;
27
- }
12
+ const files = await getTemplateFiles ( templateName ) ;
13
+
14
+ await writeFiles ( files , targetDirectory , namespace , templateName ) ;
15
+ logger . info (
16
+ chalk `{green SUCCESS} Downloaded new template into the "${ namespace } " subdirectories.`
17
+ ) ;
18
+ logger . info (
19
+ `Check ${ path . join (
20
+ 'readmes' ,
21
+ namespace ,
22
+ `${ templateName } .md`
23
+ ) } for template instructions.`
24
+ ) ;
28
25
}
29
26
30
27
export { fetchListOfTemplates } from './data' ;
You can’t perform that action at this time.
0 commit comments