@@ -2,81 +2,65 @@ const fs = require('fs-extra');
22const path = require ( 'path' ) ;
33const argv = require ( 'yargs' ) . argv ;
44
5- const type = process . argv [ 2 ] ;
6- const name = process . argv [ 3 ] ;
5+ const source = argv . source || path . join ( __dirname , 'LoginSignUp' ) ;
6+ const destination = argv . destination || path . join ( process . cwd ( ) , 'src/components/LoginSignUp' ) ;
77
8- if ( ! type || ! name ) {
9- console . error ( 'Please provide Valied Command' ) ;
10- process . exit ( 1 ) ;
11- }
12- let fileContent ;
13- let filePath ;
14-
15- if ( type === 'loginSignUp' ) {
16- const source = argv . source || path . join ( __dirname , 'LoginSignUp' ) ;
17- const destination = argv . destination || path . join ( process . cwd ( ) , 'src/components/LoginSignUp' ) ;
18-
19- async function RunReactLoginSignIn ( ) {
20- try {
21- await fs . copy ( source , destination ) ;
22- console . log ( 'The Login and SignUp templete Successfully Createed' ) ;
23- } catch ( err ) {
24- console . error ( 'Error copying folder:' , err ) ;
25- }
26- }
27-
28- module . exports = RunReactLoginSignIn
29- }
30-
31- // console.log(`${type.charAt(0).toUpperCase() + type.slice(1)} ${name} created at ${filePath}`);
32-
33-
34- // const sourceApp = argv.source || path.join(__dirname, 'App');
35- // const destinationApp = argv.destination || path.join(process.cwd(), 'src/');
8+ const sourceApp = argv . source || path . join ( __dirname , 'App' ) ;
9+ const destinationApp = argv . destination || path . join ( process . cwd ( ) , 'src/' ) ;
3610
37- // const sourceTW = argv.source || path.join(__dirname, 'LoginSignUpTW');
38- // const destinationTW = argv.destination || path.join(process.cwd(), 'src/components/LoginSignUpTW');
11+ const sourceTW = argv . source || path . join ( __dirname , 'LoginSignUpTW' ) ;
12+ const destinationTW = argv . destination || path . join ( process . cwd ( ) , 'src/components/LoginSignUpTW' ) ;
3913
40- // const sourceAppTW = argv.source || path.join(__dirname, 'AppTW');
41- // const destinationAppTW = argv.destination || path.join(process.cwd(), 'src/');
14+ const sourceAppTW = argv . source || path . join ( __dirname , 'AppTW' ) ;
15+ const destinationAppTW = argv . destination || path . join ( process . cwd ( ) , 'src/' ) ;
4216
43- // const sourcePR = argv.source || path.join(__dirname, 'PrivateRoute');
44- // const destinationPR = argv.destination || path.join(process.cwd(), 'src/components/PrivateRoute');
17+ const sourcePR = argv . source || path . join ( __dirname , 'PrivateRoute' ) ;
18+ const destinationPR = argv . destination || path . join ( process . cwd ( ) , 'src/components/PrivateRoute' ) ;
4519
46- // const sourceDash = argv.source || path.join(__dirname, 'Dashboard');
47- // const destinationDash = argv.destination || path.join(process.cwd(), 'src/components/Dashboard');
48-
49- // const sourceBackendMysqlNoMVC = argv.source || path.join(__dirname, 'BackEndMysqlNoMVC');
50- // const destinationBackendMysqlNoMVC = argv.destination || path.join(process.cwd(), '../');
20+ const sourceDash = argv . source || path . join ( __dirname , 'Dashboard' ) ;
21+ const destinationDash = argv . destination || path . join ( process . cwd ( ) , 'src/components/Dashboard' ) ;
5122
23+ const sourceBackendMysqlNoMVC = argv . source || path . join ( __dirname , 'BackEndMysqlNoMVC' ) ;
24+ const destinationBackendMysqlNoMVC = argv . destination || path . join ( process . cwd ( ) , '../' ) ;
5225
5326
27+ async function RunReactLoginSignIn ( ) {
28+ try {
29+ await fs . copy ( source , destination ) ;
30+ await fs . copy ( sourceApp , destinationApp ) ;
31+ await fs . copy ( sourcePR , destinationPR ) ;
32+ await fs . copy ( sourceDash , destinationDash ) ;
33+ console . log ( 'The Login and SignUp templete Successfully Createed' ) ;
34+ } catch ( err ) {
35+ console . error ( 'Error copying folder:' , err ) ;
36+ }
37+ }
5438
5539
5640
57- // async function RunReactLoginSignInTW() {
58- // try {
59- // await fs.copy(sourceTW, destinationTW);
60- // await fs.copy(sourceAppTW, destinationAppTW);
61- // await fs.copy(sourcePR, destinationPR);
62- // await fs.copy(sourceDash, destinationDash);
63- // console.log('The Login and SignUp templete Successfully Createed');
64- // } catch (err) {
65- // console.error('Error copying folder:', err);
66- // }
67- // }
41+ async function RunReactLoginSignInTW ( ) {
42+ try {
43+ await fs . copy ( sourceTW , destinationTW ) ;
44+ await fs . copy ( sourceAppTW , destinationAppTW ) ;
45+ await fs . copy ( sourcePR , destinationPR ) ;
46+ await fs . copy ( sourceDash , destinationDash ) ;
47+ console . log ( 'The Login and SignUp templete Successfully Createed' ) ;
48+ } catch ( err ) {
49+ console . error ( 'Error copying folder:' , err ) ;
50+ }
51+ }
6852
69- // async function RunBackendMysqlNoMVC() {
70- // try {
71- // await fs.copy(sourceBackendMysqlNoMVC, destinationBackendMysqlNoMVC);
72- // console.log('Backend Development Enviroment Created Successful');
73- // } catch (err) {
74- // console.error('Error copying folder:', err);
75- // }
76- // }
53+ async function RunBackendMysqlNoMVC ( ) {
54+ try {
55+ await fs . copy ( sourceBackendMysqlNoMVC , destinationBackendMysqlNoMVC ) ;
56+ console . log ( 'Backend Development Enviroment Created Successful' ) ;
57+ } catch ( err ) {
58+ console . error ( 'Error copying folder:' , err ) ;
59+ }
60+ }
7761
78- // module.exports = {
79- // RunReactLoginSignIn,
80- // RunReactLoginSignInTW,
81- // RunBackendMysqlNoMVC
82- // }
62+ module . exports = {
63+ RunReactLoginSignIn,
64+ RunReactLoginSignInTW,
65+ RunBackendMysqlNoMVC
66+ }
0 commit comments