Skip to content

Commit 1114f9e

Browse files
committed
added mail server template
1 parent b4fe14e commit 1114f9e

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

NPM-README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Available server types are:
2121
* [Auth Server](https://github.com/open-template-hub/auth-server-nodejs-template)
2222
* [File Storage Server](https://github.com/open-template-hub/file-storage-server-template)
2323
* [Analytics Server](https://github.com/open-template-hub/analytics-server-template)
24+
* [Mail Server](https://github.com/open-template-hub/mail-server-template)
2425

2526
## About the NPM Package
2627

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Available server types are:
2727
* [Auth Server](https://github.com/open-template-hub/auth-server-nodejs-template)
2828
* [File Storage Server](https://github.com/open-template-hub/file-storage-server-template)
2929
* [Analytics Server](https://github.com/open-template-hub/analytics-server-template)
30+
* [Mail Server](https://github.com/open-template-hub/mail-server-template)
3031

3132
## About the NPM Package
3233

src/constant.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const TemplateType = {
44
BasicInfoServer: '3',
55
FileStorageServer: '4',
66
AnalyticsServer: '5',
7+
MailServer: '6',
78
};
89

910
export const TEMPLATE_HUB_URL = 'https://github.com/open-template-hub';
@@ -16,6 +17,7 @@ export const ProjectName = {
1617
BasicInfoServer: 'basic-info-server-template',
1718
FileStorageServer: 'file-storage-server-template',
1819
AnalyticsServer: 'analytics-server-template',
20+
MailServer: 'mail-server-template',
1921
};
2022

2123
export const PackageName = {
@@ -24,4 +26,5 @@ export const PackageName = {
2426
BasicInfoServer: 'basic-info-server-template',
2527
FileStorageServer: 'file-storage-server-template',
2628
AnalyticsServer: 'analytics-server-template',
29+
MailServer: 'mail-server-template',
2730
};

src/index.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ const QUESTIONS = [
2525
' 3) Basic Info Server \n' +
2626
' 4) File Storage Server \n' +
2727
' 5) Analytics Server \n' +
28+
' 6) MİL Server \n' +
2829
' Please enter a server type you want to generate: ',
2930
when: () => !yargs.argv[ 'template' ],
3031
validate: ( input: string ) => {
31-
if ( /^[1 | 2 | 3 | 4 | 5]$/.test( input ) ) return true;
32+
if ( /^[1 | 2 | 3 | 4 | 5 | 6]$/.test( input ) ) return true;
3233
else
33-
return 'Please enter correct server type. Server type can be 1, 2, 3, 4 and 5.';
34+
return 'Please enter correct server type. Server type can be 1, 2, 3, 4, 5 and 6.';
3435
},
3536
},
3637
{
@@ -133,6 +134,10 @@ const updateProjectName = (
133134
repoConfig.projectName = ProjectName.AnalyticsServer;
134135
repoConfig.packageName = PackageName.AnalyticsServer;
135136
break;
137+
case TemplateType.MailServer:
138+
repoConfig.projectName = ProjectName.MailServer;
139+
repoConfig.packageName = PackageName.MailServer;
140+
break;
136141
}
137142

138143
let oldPath = path.join( targetPath, repoConfig.projectName );
@@ -215,6 +220,15 @@ const cloneTemplate = ( targetPath: string, templateType: string ) => {
215220
'/' +
216221
ProjectName.AnalyticsServer;
217222
break;
223+
case TemplateType.MailServer:
224+
cmd =
225+
clone +
226+
BRANCH_NAME +
227+
' ' +
228+
TEMPLATE_HUB_URL +
229+
'/' +
230+
ProjectName.MailServer;
231+
break;
218232
}
219233
console.log( 'command: ', cmd );
220234
const result = shell.exec( cmd );

0 commit comments

Comments
 (0)