Skip to content

Commit

Permalink
dependency update and sms server added
Browse files Browse the repository at this point in the history
  • Loading branch information
furknyavuz committed Jan 29, 2022
1 parent 0e9e5d6 commit 0e3de5f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
3 changes: 0 additions & 3 deletions docs/OUTDATED.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ Open Template Hub - Server Generator v4

Following packages are not updated in the develop branch yet. So, if you want to update outdated packages on your own risk, update the package.json and install dependencies.

| Package | Current | Wanted | Latest | Location |
| --- | --- | --- | --- | --- |
| @types/node | 16.11.21 | 16.11.21 | 17.0.10 | @open-template-hub/server-generator |

<table align="right"><tr><td><a href="https://opentemplatehub.com"><img src="https://raw.githubusercontent.com/open-template-hub/open-template-hub.github.io/master/assets/logo/brand-logo.png" width="50px" alt="oth"/></a></td><td><b>Open Template Hub © 2021</b></td></tr></table>

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
"inquirer": "^8.2.0",
"ncp": "^2.0.0",
"rimraf": "^3.0.2",
"shelljs": "^0.8.2",
"yargs": "^17.3.0"
"shelljs": "^0.8.5",
"yargs": "^17.3.1"
},
"devDependencies": {
"@types/inquirer": "^8.1.3",
"@types/node": "^16.11.12",
"@types/shelljs": "^0.8.9",
"@types/yargs": "^17.0.4",
"@types/inquirer": "^8.2.0",
"@types/node": "^17.0.13",
"@types/shelljs": "^0.8.11",
"@types/yargs": "^17.0.8",
"ts-node": "^10.3.0",
"typescript": "^4.5.3"
"typescript": "^4.5.5"
},
"git repository": "https://github.com/open-template-hub/open-template-hub-server-generator",
"repository": {
Expand Down
3 changes: 3 additions & 0 deletions src/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const TemplateType = {
FileStorageServer: '4',
AnalyticsServer: '5',
MailServer: '6',
SmsServer: '7'
};

export const TEMPLATE_HUB_URL = 'https://github.com/open-template-hub';
Expand All @@ -18,6 +19,7 @@ export const ProjectName = {
FileStorageServer: 'file-storage-server-template',
AnalyticsServer: 'analytics-server-template',
MailServer: 'mail-server-template',
SmsServer: 'sms-server-template',
};

export const PackageName = {
Expand All @@ -27,4 +29,5 @@ export const PackageName = {
FileStorageServer: 'file-storage-server-template',
AnalyticsServer: 'analytics-server-template',
MailServer: 'mail-server-template',
SmsServer: 'sms-server-template',
};
18 changes: 16 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ const QUESTIONS = [
' 4) File Storage Server \n' +
' 5) Analytics Server \n' +
' 6) Mail Server \n' +
' 7) Sms Server \n' +
' Please enter a server type you want to generate: ',
when: () => yargs().argv,
validate: (input: string) => {
if (/^[1 | 2 | 3 | 4 | 5 | 6]$/.test(input)) return true;
if (/^[1 | 2 | 3 | 4 | 5 | 6 | 7]$/.test(input)) return true;
else
return 'Please enter correct server type. Server type can be 1, 2, 3, 4, 5 and 6.';
return 'Please enter correct server type. Server type can be 1, 2, 3, 4, 5, 6 and 7.';
},
},
{
Expand Down Expand Up @@ -142,6 +143,10 @@ const updateProjectName = (
repoConfig.projectName = ProjectName.MailServer;
repoConfig.packageName = PackageName.MailServer;
break;
case TemplateType.SmsServer:
repoConfig.projectName = ProjectName.SmsServer;
repoConfig.packageName = PackageName.SmsServer;
break;
}

let oldPath = path.join(targetPath, repoConfig.projectName);
Expand Down Expand Up @@ -231,6 +236,15 @@ const cloneTemplate = (targetPath: string, templateType: string) => {
'/' +
ProjectName.MailServer;
break;
case TemplateType.SmsServer:
cmd =
clone +
BRANCH_NAME +
' ' +
TEMPLATE_HUB_URL +
'/' +
ProjectName.SmsServer;
break;
}
console.log('command: ', cmd);
const result = shell.exec(cmd);
Expand Down

0 comments on commit 0e3de5f

Please sign in to comment.