-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: add entity and service commands
Showing
14 changed files
with
153 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"problemMatcher": "$tsc-watch", | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"problemMatcher": "$tsc-watch", | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
import { eError } from '../enums/error.enum'; | ||
import { ALL_ENTITY_TYPES, ALL_ENTITY_TYPES_VALUES, eEntityType } from '../enums/type.enum'; | ||
import { execShell } from '../functions/exec-shell.function'; | ||
import { capitalizeFirstLetter } from '../functions/utils.function'; | ||
|
||
export async function generateEntity(uri: vscode.Uri) { | ||
const path = uri.fsPath; | ||
|
||
const entityType: eEntityType = (await vscode.window.showQuickPick(ALL_ENTITY_TYPES_VALUES)) as eEntityType; | ||
|
||
if (!entityType) { | ||
return vscode.window.showErrorMessage(eError.RESOURCE_TYPE_REQUIRED); | ||
} | ||
|
||
const entityName = await vscode.window.showInputBox({ | ||
placeHolder: `Enter the ${entityType} name`, | ||
}); | ||
|
||
if (!entityName) { | ||
return vscode.window.showErrorMessage(eError.NAME_REQUIRED); | ||
} | ||
|
||
const entityTypes = ALL_ENTITY_TYPES[entityType]; | ||
const serviceType = await vscode.window.showQuickPick(entityTypes); | ||
|
||
await execShell(`ngxd g ${entityType} ${serviceType} ${entityName} --path ${path}`); | ||
|
||
const capitalizedEntityType = capitalizeFirstLetter(entityType); | ||
|
||
vscode.window.showInformationMessage(`${capitalizedEntityType} ${entityName} created in ${path}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
import { eError } from '../enums/error.enum'; | ||
import { ALL_SERVICE_TYPES } from '../enums/type.enum'; | ||
import { execShell } from '../functions/exec-shell.function'; | ||
|
||
export async function generateService(uri: vscode.Uri) { | ||
const path = uri.fsPath; | ||
|
||
const serviceName = await vscode.window.showInputBox({ | ||
placeHolder: "Enter the service name", | ||
}); | ||
|
||
if (!serviceName) { | ||
return vscode.window.showErrorMessage(eError.NAME_REQUIRED); | ||
} | ||
|
||
const serviceType = await vscode.window.showQuickPick(ALL_SERVICE_TYPES); | ||
|
||
if (!serviceType) { | ||
return vscode.window.showErrorMessage(eError.SERVICE_TYPE_REQUIRED); | ||
} | ||
|
||
await execShell(`ngxd g s ${serviceType} ${serviceName} --path ${path}`); | ||
|
||
vscode.window.showInformationMessage(`Service ${serviceName} created in ${path}`); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export enum eCommandKey { | ||
GENERATE_COMPONENT = "ngxd-console-test.generate-component", | ||
GENERATE_SERVICE = "ngxd-console-test.generate-service", | ||
GENERATE_ENTITY = "ngxd-console-test.generate-entity", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function capitalizeFirstLetter(str: string) { | ||
return str.charAt(0).toUpperCase() + str.slice(1); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters