bmd-extension 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +14 -0
- package/.vscode/settings.json +1 -0
- package/CHANGELOG.md +9 -0
- package/DEPLOY.md +4 -0
- package/README.md +17 -0
- package/README_PRIVATE.md +1 -0
- package/build.sh +5 -0
- package/logo.png +0 -0
- package/media/dark/add.svg +40 -0
- package/media/dark/block.svg +1 -0
- package/media/dark/checklist-1.svg +1 -0
- package/media/dark/checklist.svg +1 -0
- package/media/dark/control.svg +1 -0
- package/media/dark/create.svg +1 -0
- package/media/dark/delete-1.svg +1 -0
- package/media/dark/delete.svg +1 -0
- package/media/dark/deploy-1.svg +2 -0
- package/media/dark/deploy.svg +2 -0
- package/media/dark/documents.svg +66 -0
- package/media/dark/earth.svg +68 -0
- package/media/dark/exe.svg +15 -0
- package/media/dark/export.svg +1 -0
- package/media/dark/function.svg +1 -0
- package/media/dark/game-controller.svg +77 -0
- package/media/dark/get.svg +1 -0
- package/media/dark/id-card.svg +59 -0
- package/media/dark/identity.svg +81 -0
- package/media/dark/import.svg +1 -0
- package/media/dark/information.svg +1 -0
- package/media/dark/interface.svg +1 -0
- package/media/dark/layout.svg +41 -0
- package/media/dark/leaf.svg +54 -0
- package/media/dark/list.svg +13 -0
- package/media/dark/logo.svg +249 -0
- package/media/dark/mockup.svg +1 -0
- package/media/dark/needle.svg +1 -0
- package/media/dark/pass.svg +46 -0
- package/media/dark/plus.svg +1 -0
- package/media/dark/post.svg +1 -0
- package/media/dark/quit.svg +1 -0
- package/media/dark/rocket.svg +28 -0
- package/media/dark/service.svg +1 -0
- package/media/dark/settings.svg +98 -0
- package/media/dark/social.svg +1 -0
- package/media/dark/spaceship-1.svg +1 -0
- package/media/dark/spaceship-2.svg +1 -0
- package/media/dark/spaceship.svg +1 -0
- package/media/dark/support.svg +88 -0
- package/media/dark/transfer.svg +1 -0
- package/media/dark/transform.svg +92 -0
- package/media/dark/update.svg +45 -0
- package/media/dark/upload-1.svg +1 -0
- package/media/dark/upload.svg +41 -0
- package/media/dark/vaccine.svg +1 -0
- package/media/dark/vr-gaming.svg +1 -0
- package/media/light/add.svg +40 -0
- package/media/light/block.svg +1 -0
- package/media/light/checklist-1.svg +1 -0
- package/media/light/checklist.svg +1 -0
- package/media/light/control.svg +1 -0
- package/media/light/create.svg +1 -0
- package/media/light/delete-1.svg +1 -0
- package/media/light/delete.svg +1 -0
- package/media/light/deploy-1.svg +2 -0
- package/media/light/deploy.svg +2 -0
- package/media/light/documents.svg +66 -0
- package/media/light/earth.svg +68 -0
- package/media/light/exe.svg +15 -0
- package/media/light/export.svg +1 -0
- package/media/light/function.svg +1 -0
- package/media/light/game-controller.svg +77 -0
- package/media/light/get.svg +1 -0
- package/media/light/id-card.svg +59 -0
- package/media/light/identity.svg +81 -0
- package/media/light/import.svg +1 -0
- package/media/light/information.svg +1 -0
- package/media/light/interface.svg +1 -0
- package/media/light/layout.svg +41 -0
- package/media/light/leaf.svg +54 -0
- package/media/light/list.svg +13 -0
- package/media/light/logo.svg +249 -0
- package/media/light/mockup.svg +1 -0
- package/media/light/needle.svg +1 -0
- package/media/light/pass.svg +46 -0
- package/media/light/plus.svg +1 -0
- package/media/light/post.svg +1 -0
- package/media/light/quit.svg +1 -0
- package/media/light/rocket.svg +28 -0
- package/media/light/service.svg +1 -0
- package/media/light/settings.svg +98 -0
- package/media/light/social.svg +1 -0
- package/media/light/spaceship-1.svg +1 -0
- package/media/light/spaceship-2.svg +1 -0
- package/media/light/spaceship.svg +1 -0
- package/media/light/support.svg +88 -0
- package/media/light/transfer.svg +1 -0
- package/media/light/transform.svg +92 -0
- package/media/light/update.svg +45 -0
- package/media/light/upload-1.svg +1 -0
- package/media/light/upload.svg +41 -0
- package/media/light/vaccine.svg +1 -0
- package/media/light/vr-gaming.svg +1 -0
- package/package-lock.json +6430 -0
- package/package.json +540 -0
- package/snippets-tsr.json +512 -0
- package/snippets.json +761 -0
- package/src/API.ts +14 -0
- package/src/FsProvider.ts +105 -0
- package/src/Request.ts +24 -0
- package/src/assets/api/api.txt +27 -0
- package/src/assets/configuration/AdminConfigurationController.ts.txt +72 -0
- package/src/assets/configuration/Configuration.ts.txt +37 -0
- package/src/assets/configuration/ConfigurationService.ts.txt +26 -0
- package/src/assets/contentDefine/AdminContentDefineController.ts.txt +91 -0
- package/src/assets/contentDefine/ContentDefine.ts.txt +45 -0
- package/src/assets/contentDefine/ContentDefineService.ts.txt +19 -0
- package/src/assets/contentDefine/CustomerContentDefineController.ts.txt +34 -0
- package/src/assets/controller/controller.txt +46 -0
- package/src/assets/controller/controllerResource.txt +103 -0
- package/src/assets/entity/entity.txt +22 -0
- package/src/assets/entity-request/entity-request.txt +18 -0
- package/src/assets/init/.env.example.txt +37 -0
- package/src/assets/init/.env.production.txt +37 -0
- package/src/assets/init/.gitignore.txt +8 -0
- package/src/assets/init/config.ts.txt +55 -0
- package/src/assets/init/deploy.sh.txt +46 -0
- package/src/assets/init/package-lock.json.txt +4184 -0
- package/src/assets/init/package.json.txt +79 -0
- package/src/assets/init/src/Server.ts.txt +167 -0
- package/src/assets/init/src/controllers/admin/AuthController.ts.txt +96 -0
- package/src/assets/init/src/controllers/admin/CustomerController.ts.txt +107 -0
- package/src/assets/init/src/controllers/admin/RoleController.ts.txt +143 -0
- package/src/assets/init/src/controllers/admin/StaffController.ts.txt +192 -0
- package/src/assets/init/src/controllers/customer/AuthController.ts.txt +170 -0
- package/src/assets/init/src/controllers/customer/CustomerController.ts.txt +32 -0
- package/src/assets/init/src/core/entity/CoreEntity.ts.txt +70 -0
- package/src/assets/init/src/core/services/CoreService.ts.txt +21 -0
- package/src/assets/init/src/entity/Customer.ts.txt +68 -0
- package/src/assets/init/src/entity/Permission.ts.txt +29 -0
- package/src/assets/init/src/entity/Role.ts.txt +36 -0
- package/src/assets/init/src/entity/Staff.ts.txt +54 -0
- package/src/assets/init/src/entity-request/CustomerInsert.ts.txt +42 -0
- package/src/assets/init/src/entity-request/CustomerUpdate.ts.txt +40 -0
- package/src/assets/init/src/entity-request/PermissionImport.ts.txt +12 -0
- package/src/assets/init/src/entity-request/StaffUpdate.ts.txt +33 -0
- package/src/assets/init/src/index.ts.txt +13 -0
- package/src/assets/init/src/middleware/auth/Verification.ts.txt +16 -0
- package/src/assets/init/src/middleware/auth/VerificationJWT.ts.txt +16 -0
- package/src/assets/init/src/middleware/auth/strategy/AuthStrategy.ts.txt +5 -0
- package/src/assets/init/src/middleware/auth/strategy/JWT.ts.txt +147 -0
- package/src/assets/init/src/middleware/error/handleError.ts.txt +22 -0
- package/src/assets/init/src/middleware/error/handleNotFound.ts.txt +7 -0
- package/src/assets/init/src/middleware/response/CustomSendResponse.ts.txt +35 -0
- package/src/assets/init/src/middleware/response/responseAPI.ts.txt +76 -0
- package/src/assets/init/src/middleware/validator/Validator.ts.txt +103 -0
- package/src/assets/init/src/services/CustomerService.ts.txt +79 -0
- package/src/assets/init/src/services/InitService.ts.txt +11 -0
- package/src/assets/init/src/services/MailService.ts.txt +271 -0
- package/src/assets/init/src/services/RoleService.ts.txt +66 -0
- package/src/assets/init/src/services/StaffService.ts.txt +104 -0
- package/src/assets/init/src/ssl/certificate-ca.crt +0 -0
- package/src/assets/init/src/ssl/certificate.crt +0 -0
- package/src/assets/init/src/ssl/private.key +0 -0
- package/src/assets/init/src/types/express.d.ts.txt +97 -0
- package/src/assets/init/src/util/expo.ts.txt +53 -0
- package/src/assets/init/src/util/helper.ts.txt +321 -0
- package/src/assets/init/src/util/language.ts.txt +8 -0
- package/src/assets/init/src/util/logger.ts.txt +47 -0
- package/src/assets/init/src/util/mailer.ts.txt +32 -0
- package/src/assets/init/src/util/password.ts.txt +13 -0
- package/src/assets/init/tsconfig.json.txt +26 -0
- package/src/assets/service/service.txt +34 -0
- package/src/constant.ts +83 -0
- package/src/extension.ts +459 -0
- package/src/provider/codeAction/controller/addPathParams.ts +65 -0
- package/src/provider/codeAction/controller/addTokenParam.ts +43 -0
- package/src/provider/codeAction/controller/addValidation.ts +47 -0
- package/src/provider/codeAction/controller/codeAction.ts +34 -0
- package/src/provider/codeAction/controller/util.ts +48 -0
- package/src/provider/codeAction/entity/codeAction.ts +48 -0
- package/src/provider/codeAction/entity/handleBuilder.ts +87 -0
- package/src/provider/codeAction/entity/handleFunction.ts +487 -0
- package/src/provider/codeAction/entity/handleProperty.ts +32 -0
- package/src/provider/codeAction/entity/handleRelation.ts +72 -0
- package/src/provider/codeAction/entity/helper.ts +132 -0
- package/src/provider/codeAction/entity-request/codeAction.ts +178 -0
- package/src/provider/codeAction/enum/codeAction.ts +95 -0
- package/src/provider/codeAction/service/codeAction.ts +232 -0
- package/src/provider/completion/CompletionProvider.ts +108 -0
- package/src/provider/errorChecking/checkHeaderToken.ts +60 -0
- package/src/provider/errorChecking/checkPathParam.ts +64 -0
- package/src/provider/errorChecking/checkRequired.ts +56 -0
- package/src/provider/errorChecking/errorChecking.ts +35 -0
- package/src/provider/errorChecking/util.ts +56 -0
- package/src/provider/treeDataProvider/Dependency.ts +26 -0
- package/src/provider/treeDataProvider/TreeProviderCommand.ts +60 -0
- package/src/provider/treeDataProvider/TreeProviderProject.ts +65 -0
- package/src/provider/treeDataProvider/api/createApi.ts +106 -0
- package/src/provider/treeDataProvider/controller/command/createController.ts +99 -0
- package/src/provider/treeDataProvider/controller/command/handleMethod.ts +363 -0
- package/src/provider/treeDataProvider/controller/treeData.ts +81 -0
- package/src/provider/treeDataProvider/deploy/command/handleDeploy.ts +70 -0
- package/src/provider/treeDataProvider/deploy/treeData.ts +21 -0
- package/src/provider/treeDataProvider/entity/command/addProperty.ts +144 -0
- package/src/provider/treeDataProvider/entity/command/addRelation.ts +125 -0
- package/src/provider/treeDataProvider/entity/command/createEntity.ts +53 -0
- package/src/provider/treeDataProvider/entity/command/createEntityRequest.ts +65 -0
- package/src/provider/treeDataProvider/entity/command/exportInterface.ts +130 -0
- package/src/provider/treeDataProvider/entity/treeData.ts +49 -0
- package/src/provider/treeDataProvider/module/command/configuration.ts +34 -0
- package/src/provider/treeDataProvider/module/command/contentDefine.ts +36 -0
- package/src/provider/treeDataProvider/module/command/initProject.ts +155 -0
- package/src/provider/treeDataProvider/module/treeData.ts +28 -0
- package/src/provider/treeDataProvider/project/command/addEnum.ts +0 -0
- package/src/provider/treeDataProvider/project/command/addProjectName.ts +23 -0
- package/src/provider/treeDataProvider/project/command/getProjectDetails.ts +284 -0
- package/src/provider/treeDataProvider/project/treeData.ts +28 -0
- package/src/provider/treeDataProvider/service/command/createService.ts +70 -0
- package/src/provider/treeDataProvider/service/command/handleConstructor.ts +134 -0
- package/src/provider/treeDataProvider/service/treeData.ts +25 -0
- package/src/types/project.d.ts +7 -0
- package/src/util.ts +145 -0
- package/src/utils/Password.ts +19 -0
- package/tsconfig.json +18 -0
- package/tslint.json +15 -0
- package/vsc-extension-quickstart.md +42 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
import * as vscode from 'vscode';
|
2
|
+
import { ItemCommand } from "../TreeProviderCommand";
|
3
|
+
import { BMDCommand, EntityAction } from "../../../constant";
|
4
|
+
import { Dependency } from '../Dependency';
|
5
|
+
|
6
|
+
const entityCommands: ItemCommand[] =
|
7
|
+
[{
|
8
|
+
id: BMDCommand.CreateEntity,
|
9
|
+
title: 'ENTITY',
|
10
|
+
icon: 'add'
|
11
|
+
}, {
|
12
|
+
id: BMDCommand.CreateEntityRequest,
|
13
|
+
title: 'ENTITY REQUEST',
|
14
|
+
icon: 'add'
|
15
|
+
}, {
|
16
|
+
id: EntityAction.AddProperty,
|
17
|
+
title: 'PROPERTIES',
|
18
|
+
icon: 'plus'
|
19
|
+
}, {
|
20
|
+
id: EntityAction.OneToMany,
|
21
|
+
title: 'ONE TO MANY',
|
22
|
+
icon: 'social'
|
23
|
+
}, {
|
24
|
+
id: EntityAction.ManyToOne,
|
25
|
+
title: 'MANY TO ONE',
|
26
|
+
icon: 'social'
|
27
|
+
}, {
|
28
|
+
id: EntityAction.ManyToMany,
|
29
|
+
title: 'MANY TO MANY',
|
30
|
+
icon: 'social'
|
31
|
+
}, {
|
32
|
+
id: EntityAction.OneToOne,
|
33
|
+
title: 'ONE TO ONE',
|
34
|
+
icon: 'social'
|
35
|
+
}, {
|
36
|
+
id: EntityAction.ExportInterface,
|
37
|
+
title: 'EXPORT INTERFACE',
|
38
|
+
icon: 'import'
|
39
|
+
}]
|
40
|
+
|
41
|
+
export const entityDependencies = entityCommands.map(c => {
|
42
|
+
return new Dependency(
|
43
|
+
c.title,
|
44
|
+
vscode.TreeItemCollapsibleState.None,
|
45
|
+
undefined,
|
46
|
+
c.id,
|
47
|
+
c.icon ? c.icon : 'none'
|
48
|
+
);
|
49
|
+
})
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { FSProvider } from "../../../../FsProvider"
|
2
|
+
import * as vscode from 'vscode';
|
3
|
+
import { Confirmation } from "../../../../constant";
|
4
|
+
|
5
|
+
export async function addConfiguration() {
|
6
|
+
if (!FSProvider.isValidStructure()) {
|
7
|
+
return vscode.window.showInformationMessage("Cancel!. Wrong project's structure.");
|
8
|
+
}
|
9
|
+
|
10
|
+
const initFiles = () => {
|
11
|
+
FSProvider.copyFile('configuration/AdminConfigurationController.ts.txt', 'src/controllers/admin/ConfigurationController.ts')
|
12
|
+
FSProvider.copyFile('configuration/Configuration.ts.txt', 'src/entity/Configuration.ts')
|
13
|
+
FSProvider.copyFile('configuration/ConfigurationService.ts.txt', 'src/services/ConfigurationService.ts')
|
14
|
+
|
15
|
+
vscode.window.showInformationMessage("Add module CONFIGURATION successfully!");
|
16
|
+
}
|
17
|
+
|
18
|
+
if (FSProvider.checkExist('src/entity/ContentDefine.ts')) {
|
19
|
+
const confirm = await vscode.window.showQuickPick(
|
20
|
+
[Confirmation.No, Confirmation.Yes],
|
21
|
+
{
|
22
|
+
placeHolder: 'Module CONFIGURATION is already exist. You want to REPLACE?',
|
23
|
+
ignoreFocusOut: true
|
24
|
+
}
|
25
|
+
)
|
26
|
+
if (!confirm || confirm == Confirmation.No) {
|
27
|
+
return vscode.window.showInformationMessage("Cancel: Add module CONFIGURATION.");
|
28
|
+
} else {
|
29
|
+
initFiles()
|
30
|
+
}
|
31
|
+
} else {
|
32
|
+
initFiles()
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import * as vscode from 'vscode';
|
2
|
+
import { FSProvider } from '../../../../FsProvider';
|
3
|
+
import { Confirmation } from '../../../../constant';
|
4
|
+
|
5
|
+
|
6
|
+
export async function addContentDefine() {
|
7
|
+
if (!FSProvider.isValidStructure()) {
|
8
|
+
return vscode.window.showInformationMessage("Cancel!. Wrong project's structure.");
|
9
|
+
}
|
10
|
+
|
11
|
+
const initFiles = () => {
|
12
|
+
FSProvider.copyFile('contentDefine/AdminContentDefineController.ts.txt', 'src/controllers/admin/ContentDefineController.ts')
|
13
|
+
FSProvider.copyFile('contentDefine/CustomerContentDefineController.ts.txt', 'src/controllers/customer/ContentDefineController.ts')
|
14
|
+
FSProvider.copyFile('contentDefine/ContentDefine.ts.txt', 'src/entity/ContentDefine.ts')
|
15
|
+
FSProvider.copyFile('contentDefine/ContentDefineService.ts.txt', 'src/services/ContentDefineService.ts')
|
16
|
+
|
17
|
+
vscode.window.showInformationMessage("Add module CONTENT DEFINE successfully!");
|
18
|
+
}
|
19
|
+
|
20
|
+
if (FSProvider.checkExist('src/entity/ContentDefine.ts')) {
|
21
|
+
const confirm = await vscode.window.showQuickPick(
|
22
|
+
[Confirmation.No, Confirmation.Yes],
|
23
|
+
{
|
24
|
+
placeHolder: 'Module CONTENT DEFINE is already exist. You want to REPLACE?',
|
25
|
+
ignoreFocusOut: true
|
26
|
+
}
|
27
|
+
)
|
28
|
+
if (!confirm || confirm == Confirmation.No) {
|
29
|
+
return vscode.window.showInformationMessage("Cancel: Add module CONTENT DEFINE.");
|
30
|
+
} else {
|
31
|
+
initFiles()
|
32
|
+
}
|
33
|
+
} else {
|
34
|
+
initFiles()
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,155 @@
|
|
1
|
+
import * as vscode from 'vscode';
|
2
|
+
import { FSProvider } from '../../../../FsProvider';
|
3
|
+
import { Confirmation } from '../../../../constant';
|
4
|
+
import { getFullTextType } from '../../../../util';
|
5
|
+
|
6
|
+
|
7
|
+
export async function initProject() {
|
8
|
+
if (FSProvider.checkExist('src')) {
|
9
|
+
const confirm = await vscode.window.showQuickPick(
|
10
|
+
[Confirmation.No, Confirmation.Yes],
|
11
|
+
{
|
12
|
+
placeHolder: 'Already exist project. You want to replace it??? ',
|
13
|
+
ignoreFocusOut: true
|
14
|
+
}
|
15
|
+
)
|
16
|
+
if (!confirm || confirm == Confirmation.No) {
|
17
|
+
return vscode.window.showInformationMessage("Cancel! Init project.");
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
const pass = await vscode.window.showInputBox({
|
22
|
+
placeHolder: "Enter password: ",
|
23
|
+
ignoreFocusOut: true,
|
24
|
+
password: true
|
25
|
+
})
|
26
|
+
if (pass != "bmd1234567890") {
|
27
|
+
return vscode.window.showInformationMessage("Cancel! Wrong password.");
|
28
|
+
}
|
29
|
+
|
30
|
+
const projectName = await vscode.window.showInputBox({
|
31
|
+
placeHolder: "Enter project name: ",
|
32
|
+
ignoreFocusOut: true
|
33
|
+
})
|
34
|
+
if (!projectName) {
|
35
|
+
return vscode.window.showInformationMessage("Cancel! Do not input project name.");
|
36
|
+
}
|
37
|
+
|
38
|
+
const projectCode = await vscode.window.showInputBox({
|
39
|
+
placeHolder: "Enter project code: ",
|
40
|
+
ignoreFocusOut: true
|
41
|
+
})
|
42
|
+
if (!projectCode) {
|
43
|
+
return vscode.window.showInformationMessage("Cancel! Do not input project code.");
|
44
|
+
}
|
45
|
+
|
46
|
+
const projectNameTypes = getFullTextType(projectName)
|
47
|
+
|
48
|
+
let projectPort = await vscode.window.showInputBox({
|
49
|
+
placeHolder: "Use port: (default port 4000)",
|
50
|
+
ignoreFocusOut: true
|
51
|
+
})
|
52
|
+
if (!projectPort) projectPort = "4000"
|
53
|
+
|
54
|
+
FSProvider.copyFile('init/tsconfig.json.txt', 'tsconfig.json')
|
55
|
+
FSProvider.copyFile('init/config.ts.txt', 'config.ts')
|
56
|
+
FSProvider.copyFile('init/.gitignore.txt', '.gitignore')
|
57
|
+
|
58
|
+
FSProvider.copyFile('init/src/controllers/admin/CustomerController.ts.txt', 'src/controllers/admin/CustomerController.ts')
|
59
|
+
FSProvider.copyFile('init/src/controllers/admin/RoleController.ts.txt', 'src/controllers/admin/RoleController.ts')
|
60
|
+
FSProvider.copyFile('init/src/controllers/admin/StaffController.ts.txt', 'src/controllers/admin/StaffController.ts')
|
61
|
+
FSProvider.copyFile('init/src/controllers/admin/AuthController.ts.txt', 'src/controllers/admin/AuthController.ts')
|
62
|
+
FSProvider.copyFile('init/src/controllers/customer/CustomerController.ts.txt', 'src/controllers/customer/CustomerController.ts')
|
63
|
+
FSProvider.copyFile('init/src/controllers/customer/AuthController.ts.txt', 'src/controllers/customer/AuthController.ts')
|
64
|
+
|
65
|
+
FSProvider.copyFile('init/src/core/entity/CoreEntity.ts.txt', 'src/core/entity/CoreEntity.ts')
|
66
|
+
FSProvider.copyFile('init/src/core/services/CoreService.ts.txt', 'src/core/services/CoreService.ts')
|
67
|
+
|
68
|
+
FSProvider.copyFile('init/src/entity/Customer.ts.txt', 'src/entity/Customer.ts')
|
69
|
+
FSProvider.copyFile('init/src/entity/Permission.ts.txt', 'src/entity/Permission.ts')
|
70
|
+
FSProvider.copyFile('init/src/entity/Role.ts.txt', 'src/entity/Role.ts')
|
71
|
+
FSProvider.copyFile('init/src/entity/Staff.ts.txt', 'src/entity/Staff.ts')
|
72
|
+
|
73
|
+
FSProvider.copyFile('init/src/entity-request/CustomerInsert.ts.txt', 'src/entity-request/CustomerInsert.ts')
|
74
|
+
FSProvider.copyFile('init/src/entity-request/CustomerUpdate.ts.txt', 'src/entity-request/CustomerUpdate.ts')
|
75
|
+
FSProvider.copyFile('init/src/entity-request/StaffUpdate.ts.txt', 'src/entity-request/StaffUpdate.ts')
|
76
|
+
FSProvider.copyFile('init/src/entity-request/PermissionImport.ts.txt', 'src/entity-request/PermissionImport.ts')
|
77
|
+
|
78
|
+
FSProvider.copyFile('init/src/middleware/auth/Verification.ts.txt', 'src/middleware/auth/Verification.ts')
|
79
|
+
FSProvider.copyFile('init/src/middleware/auth/VerificationJWT.ts.txt', 'src/middleware/auth/VerificationJWT.ts')
|
80
|
+
FSProvider.copyFile('init/src/middleware/auth/strategy/AuthStrategy.ts.txt', 'src/middleware/auth/strategy/AuthStrategy.ts')
|
81
|
+
FSProvider.copyFile('init/src/middleware/auth/strategy/JWT.ts.txt', 'src/middleware/auth/strategy/JWT.ts')
|
82
|
+
FSProvider.copyFile('init/src/middleware/error/handleError.ts.txt', 'src/middleware/error/handleError.ts')
|
83
|
+
FSProvider.copyFile('init/src/middleware/error/handleNotFound.ts.txt', 'src/middleware/error/handleNotFound.ts')
|
84
|
+
FSProvider.copyFile('init/src/middleware/response/CustomSendResponse.ts.txt', 'src/middleware/response/CustomSendResponse.ts')
|
85
|
+
FSProvider.copyFile('init/src/middleware/response/responseAPI.ts.txt', 'src/middleware/response/responseAPI.ts')
|
86
|
+
FSProvider.copyFile('init/src/middleware/validator/Validator.ts.txt', 'src/middleware/validator/Validator.ts')
|
87
|
+
|
88
|
+
FSProvider.copyFile('init/src/services/CustomerService.ts.txt', 'src/services/CustomerService.ts')
|
89
|
+
FSProvider.copyFile('init/src/services/MailService.ts.txt', 'src/services/MailService.ts')
|
90
|
+
FSProvider.copyFile('init/src/services/StaffService.ts.txt', 'src/services/StaffService.ts')
|
91
|
+
FSProvider.copyFile('init/src/services/RoleService.ts.txt', 'src/services/RoleService.ts')
|
92
|
+
FSProvider.copyFile('init/src/services/InitService.ts.txt', 'src/services/InitService.ts')
|
93
|
+
|
94
|
+
FSProvider.copyFile('init/src/ssl/certificate-ca.crt', 'src/ssl/production/certificate-ca.crt')
|
95
|
+
FSProvider.copyFile('init/src/ssl/certificate.crt', 'src/ssl/production/certificate.crt')
|
96
|
+
FSProvider.copyFile('init/src/ssl/private.key', 'src/ssl/production/private.key')
|
97
|
+
|
98
|
+
FSProvider.copyFile('init/src/ssl/certificate-ca.crt', 'src/ssl/staging/certificate-ca.crt')
|
99
|
+
FSProvider.copyFile('init/src/ssl/certificate.crt', 'src/ssl/staging/certificate.crt')
|
100
|
+
FSProvider.copyFile('init/src/ssl/private.key', 'src/ssl/staging/private.key')
|
101
|
+
|
102
|
+
FSProvider.copyFile('init/src/types/express.d.ts.txt', 'src/types/express.d.ts')
|
103
|
+
|
104
|
+
FSProvider.copyFile('init/src/util/helper.ts.txt', 'src/util/helper.ts')
|
105
|
+
FSProvider.copyFile('init/src/util/mailer.ts.txt', 'src/util/mailer.ts')
|
106
|
+
FSProvider.copyFile('init/src/util/language.ts.txt', 'src/util/language.ts')
|
107
|
+
FSProvider.copyFile('init/src/util/logger.ts.txt', 'src/util/logger.ts')
|
108
|
+
FSProvider.copyFile('init/src/util/expo.ts.txt', 'src/util/expo.ts')
|
109
|
+
FSProvider.copyFile('init/src/util/password.ts.txt', 'src/util/password.ts')
|
110
|
+
|
111
|
+
FSProvider.copyFile('init/src/index.ts.txt', 'src/index.ts')
|
112
|
+
FSProvider.copyFile('init/src/Server.ts.txt', 'src/Server.ts')
|
113
|
+
|
114
|
+
FSProvider.makeFolder('uploads')
|
115
|
+
FSProvider.makeFolder('log/info')
|
116
|
+
FSProvider.makeFolder('log/error')
|
117
|
+
FSProvider.makeFolder('src')
|
118
|
+
|
119
|
+
FSProvider.copyFile('init/package.json.txt', 'package.json')
|
120
|
+
FSProvider.copyFile('init/package-lock.json.txt', 'package-lock.json')
|
121
|
+
|
122
|
+
initEnv('init/.env.production.txt', '.env.production')
|
123
|
+
initEnv('init/.env.production.txt', '.env.staging')
|
124
|
+
initEnv('init/.env.example.txt', '.env.example')
|
125
|
+
initEnv('init/.env.example.txt', '.env')
|
126
|
+
|
127
|
+
function initEnv(from: string, to: string) {
|
128
|
+
FSProvider.copyAndReplaceFile(
|
129
|
+
from,
|
130
|
+
to,
|
131
|
+
[
|
132
|
+
{ regex: /{{snake}}/g, value: projectNameTypes.snakeCase },
|
133
|
+
{ regex: /{{snake_upper}}/g, value: projectNameTypes.snakeUpperCase },
|
134
|
+
{ regex: /{{upper}}/g, value: projectNameTypes.upperCase },
|
135
|
+
{ regex: /{{code}}/g, value: projectCode },
|
136
|
+
{ regex: /{{code_upper}}/g, value: (projectCode as string).toUpperCase() },
|
137
|
+
{ regex: /{{port}}/g, value: projectPort }
|
138
|
+
])
|
139
|
+
}
|
140
|
+
|
141
|
+
initDeploy('init/deploy.sh.txt', 'deploy.production.sh', 'PRODUCTION')
|
142
|
+
initDeploy('init/deploy.sh.txt', 'deploy.staging.sh', 'STAGING')
|
143
|
+
|
144
|
+
function initDeploy(from: string, to: string, env: string) {
|
145
|
+
FSProvider.copyAndReplaceFile(
|
146
|
+
from,
|
147
|
+
to,
|
148
|
+
[
|
149
|
+
{ regex: /{{env}}/g, value: env },
|
150
|
+
{ regex: /{{env_lower}}/g, value: getFullTextType(env).lowerCase },
|
151
|
+
])
|
152
|
+
}
|
153
|
+
|
154
|
+
vscode.window.showInformationMessage("Init project successfully!");
|
155
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { ItemCommand } from "../TreeProviderCommand";
|
2
|
+
import { BMDCommand } from "../../../constant";
|
3
|
+
import { Dependency } from "../Dependency";
|
4
|
+
import * as vscode from 'vscode';
|
5
|
+
|
6
|
+
const moduleCommand: ItemCommand[] = [{
|
7
|
+
id: BMDCommand.Init,
|
8
|
+
title: 'INIT PROJECT',
|
9
|
+
icon: 'earth'
|
10
|
+
}, {
|
11
|
+
id: BMDCommand.AddModuleConfiguration,
|
12
|
+
title: 'CONFIGURATION',
|
13
|
+
icon: 'plus'
|
14
|
+
}, {
|
15
|
+
id: BMDCommand.AddModuleContentDefine,
|
16
|
+
title: 'CONTENT DEFINE ',
|
17
|
+
icon: 'plus'
|
18
|
+
}]
|
19
|
+
|
20
|
+
export const moduleDependencies = moduleCommand.map(c => {
|
21
|
+
return new Dependency(
|
22
|
+
c.title,
|
23
|
+
vscode.TreeItemCollapsibleState.None,
|
24
|
+
undefined,
|
25
|
+
c.id,
|
26
|
+
c.icon ? c.icon : 'none'
|
27
|
+
);
|
28
|
+
})
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { FSProvider, ROOT_PATH } from "../../../../FsProvider"
|
2
|
+
import * as vscode from 'vscode';
|
3
|
+
import { Confirmation } from "../../../../constant";
|
4
|
+
import Axios from "axios";
|
5
|
+
import { API } from "../../../../API";
|
6
|
+
import { Request } from "../../../../Request";
|
7
|
+
import { TreeProviderProject } from "../../TreeProviderProject";
|
8
|
+
|
9
|
+
export async function addProjectName() {
|
10
|
+
const folders = vscode.workspace.workspaceFolders
|
11
|
+
if (!folders?.length) return
|
12
|
+
|
13
|
+
const projectName = folders[0].name
|
14
|
+
|
15
|
+
const data = await Request.post(API.Project.post, { name: projectName })
|
16
|
+
console.log('data:', data)
|
17
|
+
if (data) {
|
18
|
+
vscode.window.showInformationMessage(`Create project success`);
|
19
|
+
const bmdProject = new TreeProviderProject(vscode.workspace.rootPath)
|
20
|
+
bmdProject.refresh()
|
21
|
+
}
|
22
|
+
|
23
|
+
}
|
@@ -0,0 +1,284 @@
|
|
1
|
+
import * as vscode from 'vscode';
|
2
|
+
import { API } from "../../../../API";
|
3
|
+
import { Request } from "../../../../Request";
|
4
|
+
import * as clipboard from "clipboardy"
|
5
|
+
|
6
|
+
interface WebviewContentParams {
|
7
|
+
projectPanel: string
|
8
|
+
}
|
9
|
+
|
10
|
+
interface RenderViewParams {
|
11
|
+
projectName: string
|
12
|
+
panel: any
|
13
|
+
}
|
14
|
+
|
15
|
+
let INTERFACES: any[] = []
|
16
|
+
let ENUMS: any[] = []
|
17
|
+
let FILTER_INTERFACE = ''
|
18
|
+
let FILTER_ENUM = ''
|
19
|
+
let PROJECT_NAME = ''
|
20
|
+
|
21
|
+
enum WebViewCommand {
|
22
|
+
Refresh = 'REFRESH',
|
23
|
+
CopyInterface = 'COPY-INTERFACE',
|
24
|
+
CopyEnum = 'COPY-ENUM',
|
25
|
+
FilterInterfaces = 'FILTER_INTERFACES',
|
26
|
+
FilterEnums = 'FILTER_ENUMS',
|
27
|
+
UpdateInterfacesPart = 'UPDATE_INTERFACES_PART',
|
28
|
+
UpdateEnumsPart = 'UPDATE_ENUMS_PART'
|
29
|
+
}
|
30
|
+
|
31
|
+
|
32
|
+
export async function fetchInterfaces({ projectName, search }: { projectName: string, search?: string }) {
|
33
|
+
const response = await Request.get(API.Interface.get, { project: projectName, search: FILTER_INTERFACE })
|
34
|
+
if (response) INTERFACES = response.data.interfaces
|
35
|
+
|
36
|
+
return INTERFACES;
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
async function fetchEnums({ projectName, search }: { projectName: string, search?: string }) {
|
41
|
+
const response = await Request.get(API.Enum.get, { project: projectName, search: FILTER_ENUM })
|
42
|
+
if (response) ENUMS = response.data.enums
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
export async function getProjectDetails(projectName: string, subscriptions: any) {
|
47
|
+
PROJECT_NAME = projectName
|
48
|
+
|
49
|
+
const projectPanel = `PROJECT: ${projectName.toUpperCase()}`
|
50
|
+
|
51
|
+
const panel = vscode.window.createWebviewPanel(
|
52
|
+
'BMD',
|
53
|
+
'BMD',
|
54
|
+
vscode.ViewColumn.Two,
|
55
|
+
{ enableScripts: true },
|
56
|
+
)
|
57
|
+
|
58
|
+
panel.webview.html = await getWebviewContent({ projectPanel });
|
59
|
+
|
60
|
+
|
61
|
+
// And set its HTML content
|
62
|
+
panel.webview.onDidReceiveMessage(
|
63
|
+
async message => {
|
64
|
+
console.log('message:', JSON.stringify(message))
|
65
|
+
|
66
|
+
if (message.command == WebViewCommand.CopyInterface) {
|
67
|
+
const text = INTERFACES[message.index].body
|
68
|
+
await clipboard.write(text)
|
69
|
+
return vscode.window.showInformationMessage('Copied!')
|
70
|
+
}
|
71
|
+
|
72
|
+
if (message.command == WebViewCommand.CopyEnum) {
|
73
|
+
const text = ENUMS[message.index].body
|
74
|
+
await clipboard.write(text)
|
75
|
+
return vscode.window.showInformationMessage('Copied!')
|
76
|
+
}
|
77
|
+
|
78
|
+
if (message.command == WebViewCommand.FilterInterfaces) {
|
79
|
+
FILTER_INTERFACE = message.text
|
80
|
+
panel.webview.postMessage({
|
81
|
+
command: WebViewCommand.UpdateInterfacesPart,
|
82
|
+
text: await getStringInterfaces()
|
83
|
+
});
|
84
|
+
}
|
85
|
+
|
86
|
+
if (message.command == WebViewCommand.FilterEnums) {
|
87
|
+
FILTER_ENUM = message.text
|
88
|
+
panel.webview.postMessage({
|
89
|
+
command: WebViewCommand.UpdateEnumsPart,
|
90
|
+
text: await getStringEnums()
|
91
|
+
});
|
92
|
+
}
|
93
|
+
|
94
|
+
if (message.command == WebViewCommand.Refresh) {
|
95
|
+
panel.webview.postMessage({
|
96
|
+
command: WebViewCommand.UpdateEnumsPart,
|
97
|
+
text: await getStringEnums()
|
98
|
+
});
|
99
|
+
panel.webview.postMessage({
|
100
|
+
command: WebViewCommand.UpdateInterfacesPart,
|
101
|
+
text: await getStringInterfaces()
|
102
|
+
});
|
103
|
+
}
|
104
|
+
},
|
105
|
+
undefined,
|
106
|
+
subscriptions
|
107
|
+
);
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
|
112
|
+
async function getInterfacesPart({ name, }: { name: string }) {
|
113
|
+
return `
|
114
|
+
<div class="col-sm-6 text-center">
|
115
|
+
<h4>${name.toUpperCase()}</h4>
|
116
|
+
<div class="form-group">
|
117
|
+
<input
|
118
|
+
style="background-color: transparent; color: white;"
|
119
|
+
class="form-control"
|
120
|
+
id="search-interface"
|
121
|
+
placeholder="Search"
|
122
|
+
onkeyup="filterInterfaces()"
|
123
|
+
value="${FILTER_INTERFACE}"
|
124
|
+
>
|
125
|
+
</div>
|
126
|
+
<div class="container text-left" id="interfaces">
|
127
|
+
${await getStringInterfaces()}
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
`
|
131
|
+
}
|
132
|
+
|
133
|
+
async function getStringInterfaces() {
|
134
|
+
await fetchInterfaces({ projectName: PROJECT_NAME })
|
135
|
+
|
136
|
+
function getInterfaceItem(item: any, index: number) {
|
137
|
+
return `
|
138
|
+
<div class="row" onClick="copyInterface(${index})">
|
139
|
+
<pre style="color: #f1f1f1; margin-bottom: -2rem" id="interface-${item.id}">
|
140
|
+
${item.body}
|
141
|
+
</pre>
|
142
|
+
</div>
|
143
|
+
`
|
144
|
+
}
|
145
|
+
|
146
|
+
let string = ``
|
147
|
+
if (INTERFACES.length) {
|
148
|
+
string = INTERFACES.map((item, index) => getInterfaceItem(item, index)).join(`\n`)
|
149
|
+
}
|
150
|
+
|
151
|
+
return string
|
152
|
+
}
|
153
|
+
|
154
|
+
|
155
|
+
async function getEnumsPart({ name }: { name: string }) {
|
156
|
+
return `
|
157
|
+
<div class="col-sm-6 text-center">
|
158
|
+
<h4>${name.toUpperCase()}</h4>
|
159
|
+
<div class="form-group">
|
160
|
+
<input
|
161
|
+
style="background-color: transparent; color: white;"
|
162
|
+
class="form-control"
|
163
|
+
placeholder="Search"
|
164
|
+
id="search-enum"
|
165
|
+
onkeyup="filterEnums()"
|
166
|
+
value="${FILTER_ENUM}"
|
167
|
+
>
|
168
|
+
</div>
|
169
|
+
<div class="container text-left" id="enums">
|
170
|
+
${await getStringEnums()}
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
`
|
174
|
+
}
|
175
|
+
|
176
|
+
async function getStringEnums() {
|
177
|
+
await fetchEnums({ projectName: PROJECT_NAME })
|
178
|
+
|
179
|
+
function getEnumItem(item: any, index: number) {
|
180
|
+
return `
|
181
|
+
<div class="row" onClick="copyEnum(${index})">
|
182
|
+
<pre style="color: #f1f1f1; margin-bottom: -2rem" id="enum-${item.id}">
|
183
|
+
${item.body}
|
184
|
+
</pre>
|
185
|
+
</div>
|
186
|
+
`
|
187
|
+
}
|
188
|
+
|
189
|
+
let string = ``
|
190
|
+
if (ENUMS.length) {
|
191
|
+
string = ENUMS.map((item, index) => getEnumItem(item, index)).join(`\n`)
|
192
|
+
}
|
193
|
+
|
194
|
+
return string
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
async function getWebviewContent({ projectPanel }: WebviewContentParams) {
|
199
|
+
return `
|
200
|
+
<!DOCTYPE html>
|
201
|
+
<html lang="en">
|
202
|
+
<head>
|
203
|
+
<meta charset="UTF-8">
|
204
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
205
|
+
<title>BMD PROJECT</title>
|
206
|
+
<style>
|
207
|
+
* {
|
208
|
+
box-sizing: border-box;
|
209
|
+
}
|
210
|
+
|
211
|
+
</style>
|
212
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
213
|
+
</head>
|
214
|
+
<body style="background-color: transparent; color: #f1f1f1">
|
215
|
+
|
216
|
+
<div class="container-fluid">
|
217
|
+
<h3 class="text-center">${projectPanel}
|
218
|
+
<button onclick="refresh()" type="button" class="btn btn-info">RELOAD</button>
|
219
|
+
</h3>
|
220
|
+
|
221
|
+
<div class="row">
|
222
|
+
${await getEnumsPart({ name: 'enum' })}
|
223
|
+
${await getInterfacesPart({ name: 'interface' })}
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<script>
|
228
|
+
const vscode = acquireVsCodeApi();
|
229
|
+
|
230
|
+
function refresh() {
|
231
|
+
vscode.postMessage({
|
232
|
+
command: '${WebViewCommand.Refresh}',
|
233
|
+
})
|
234
|
+
}
|
235
|
+
|
236
|
+
function copyInterface(index) {
|
237
|
+
vscode.postMessage({
|
238
|
+
command: '${WebViewCommand.CopyInterface}',
|
239
|
+
index
|
240
|
+
})
|
241
|
+
}
|
242
|
+
|
243
|
+
function copyEnum(index) {
|
244
|
+
vscode.postMessage({
|
245
|
+
command: '${WebViewCommand.CopyEnum}',
|
246
|
+
index
|
247
|
+
})
|
248
|
+
}
|
249
|
+
|
250
|
+
function filterInterfaces() {
|
251
|
+
const edValue = document.getElementById("search-interface");
|
252
|
+
const text = edValue.value;
|
253
|
+
vscode.postMessage({
|
254
|
+
command: '${WebViewCommand.FilterInterfaces}',
|
255
|
+
text
|
256
|
+
})
|
257
|
+
}
|
258
|
+
|
259
|
+
function filterEnums() {
|
260
|
+
const edValue = document.getElementById("search-enum");
|
261
|
+
const text = edValue.value;
|
262
|
+
vscode.postMessage({
|
263
|
+
command: '${WebViewCommand.FilterEnums}',
|
264
|
+
text
|
265
|
+
})
|
266
|
+
}
|
267
|
+
|
268
|
+
window.addEventListener('message', event => {
|
269
|
+
|
270
|
+
const message = event.data;
|
271
|
+
|
272
|
+
if (message.command == '${WebViewCommand.UpdateInterfacesPart}') {
|
273
|
+
document.getElementById("interfaces").innerHTML = message.text
|
274
|
+
}
|
275
|
+
|
276
|
+
if (message.command == '${WebViewCommand.UpdateEnumsPart}') {
|
277
|
+
document.getElementById("enums").innerHTML = message.text
|
278
|
+
}
|
279
|
+
});
|
280
|
+
|
281
|
+
</script>
|
282
|
+
</body>
|
283
|
+
</html>`;
|
284
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { ItemCommand } from "../TreeProviderCommand";
|
2
|
+
import { BMDCommand } from "../../../constant";
|
3
|
+
import { Dependency } from "../Dependency";
|
4
|
+
import * as vscode from 'vscode';
|
5
|
+
|
6
|
+
const projectCommand: ItemCommand[] = [{
|
7
|
+
id: BMDCommand.Init,
|
8
|
+
title: 'INIT PROJECT',
|
9
|
+
icon: 'earth'
|
10
|
+
}, {
|
11
|
+
id: BMDCommand.AddModuleConfiguration,
|
12
|
+
title: 'CONFIGURATION',
|
13
|
+
icon: 'plus'
|
14
|
+
}, {
|
15
|
+
id: BMDCommand.AddModuleContentDefine,
|
16
|
+
title: 'CONTENT DEFINE ',
|
17
|
+
icon: 'plus'
|
18
|
+
}]
|
19
|
+
|
20
|
+
export const projectDependencies = projectCommand.map(c => {
|
21
|
+
return new Dependency(
|
22
|
+
c.title,
|
23
|
+
vscode.TreeItemCollapsibleState.None,
|
24
|
+
undefined,
|
25
|
+
c.id,
|
26
|
+
c.icon ? c.icon : 'none'
|
27
|
+
);
|
28
|
+
})
|