File tree 1 file changed +19
-11
lines changed
1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -46,18 +46,10 @@ const showInstructions = kickStart => {
46
46
} ;
47
47
48
48
/**
49
- * Initialize all the tasks
50
- *
51
- * @returns {Promise<void> }
49
+ * Checks if there already is a directory called 'teachcode-solutions' in the present working directory
50
+ * and errors out if that is the case.
52
51
*/
53
-
54
- const initTasks = async ( ) => {
55
- await showBanner (
56
- 'teachcode' ,
57
- ` Learn to code effectively ${ `\t` . repeat ( 4 ) } Powered by MadHacks` ,
58
- ) ;
59
- console . log ( ) ;
60
-
52
+ const checkIfDirExists = ( ) => {
61
53
if (
62
54
fs . existsSync ( `${ process . cwd ( ) } /teachcode-solutions` ) ||
63
55
fs . existsSync ( `${ process . cwd ( ) } /config.json` )
@@ -75,6 +67,22 @@ const initTasks = async () => {
75
67
console . log ( ) ;
76
68
process . exit ( 1 ) ;
77
69
}
70
+ } ;
71
+
72
+ /**
73
+ * Initialize all the tasks
74
+ *
75
+ * @returns {Promise<void> }
76
+ */
77
+
78
+ const initTasks = async ( ) => {
79
+ await showBanner (
80
+ 'teachcode' ,
81
+ ` Learn to code effectively ${ `\t` . repeat ( 4 ) } Powered by MadHacks` ,
82
+ ) ;
83
+ console . log ( ) ;
84
+
85
+ checkIfDirExists ( ) ;
78
86
79
87
console . log ( ) ;
80
88
console . log (
You can’t perform that action at this time.
0 commit comments