youzanyun-devtool-worker
Version:
- web - ws - proxy
198 lines (197 loc) • 7.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
const path_1 = tslib_1.__importDefault(require("path"));
const spring4js_nodejs_1 = require("spring4js-nodejs");
let ProjectService = class ProjectService {
async getProjectById(id) {
let project = await this.projectDao.getDataById(id);
return project;
}
async getProjectList(params = {}) {
const result = await this.projectDao.getDataWithCondition(params);
return result;
}
async getProjectsByProName(params) {
const result = await this.projectDao.getDataWithCondition(params);
return result;
}
async saveProject(params) {
const isDesignPlatform = await fs_extra_1.default.pathExists(path_1.default.resolve(params.proPath, 'ecloud-tpl-version.json'));
const isNodeJs = await fs_extra_1.default.pathExists(path_1.default.resolve(params.proPath, 'package.json'));
const isJava = await fs_extra_1.default.pathExists(path_1.default.resolve(params.proPath, 'pom.xml'));
const isPhp = await fs_extra_1.default.pathExists(path_1.default.resolve(params.proPath, 'composer.json'));
params.isDesignPlatform = isDesignPlatform;
params.isNodeJs = isNodeJs;
params.isJava = isJava;
params.isPhp = isPhp;
return await this.projectDao.save(params);
}
async deleteProject(id) {
return await this.projectDao.delete(id);
}
async checkProjectStatus(proPath) {
const isClean = await this.gitService.checkGitRepoClean(proPath);
return isClean;
}
async getSideBarNavigatorList({ projectId, workbenchId }) {
let project = await this.getProjectById(projectId);
if (project.isDesignPlatform) {
return [{
icon: 'knowledge-o',
title: '设计平台定制',
key: 'design-platform',
actionType: 'openMenuView',
param: {
customType: 'design-platform',
}
}];
}
else {
return [
{
icon: 'apartment',
title: '扩展点调试',
key: 'bep',
actionType: 'openUrl',
param: {
hasNavigator: true,
commands: ["close-all-mock"],
url: `/html/extension-point?projectId=${projectId}&workbenchId=${workbenchId}&type=bep`,
}
},
{
icon: 'mail',
title: '消息推送调试',
key: 'mep',
actionType: 'openUrl',
param: {
hasNavigator: true,
commands: ["close-all-mock"],
url: `/html/extension-point?projectId=${projectId}&workbenchId=${workbenchId}&type=mep`,
}
},
{
icon: 'api',
title: 'API调试',
key: 'api',
actionType: 'openUrl',
param: {
hasNavigator: false,
url: `https://diy.youzanyun.com/custom/dev-tool/page?projectId=${projectId}`,
}
},
{
icon: 'html5',
title: 'H5页面开发',
key: 'h5-extension',
actionType: 'openMenuView',
param: {
customType: 'h5-extension',
}
},
{
icon: 'shopping',
title: '小程序开发',
key: 'mp',
children: [
{
icon: '',
title: '微商城小程序',
key: 'wsc',
actionType: 'openMenuView',
param: {
hasNavigator: false,
customType: 'wsc-mp',
}
},
{
icon: '',
title: '零售小程序',
key: 'retail',
actionType: 'openMenuView',
param: {
customType: 'retail-mp',
}
},
{
icon: '',
title: '美业小程序',
key: 'beauty',
actionType: 'openMenuView',
param: {
customType: 'beauty-mp',
}
}
]
},
{
icon: 'desktop',
title: 'PC页面开发',
key: 'wsc-pc',
actionType: 'openMenuView',
param: {
customType: 'wsc-pc',
}
},
{
icon: 'tool',
title: '常用工具',
key: 'tools',
actionType: 'openUrl',
param: {
hasNavigator: false,
url: `/html/common-tool?projectId=${projectId}`,
}
}
];
}
}
async getCustomTypeList(projectId) {
let project = await this.getProjectById(projectId);
let customTypeList = [];
if (project.isDesignPlatform) {
customTypeList = [{
text: '设计平台定制',
value: 'design-platform'
}];
}
else {
customTypeList = [{
text: 'h5页面定制',
value: 'h5-extension'
}, {
text: '微商城小程序',
value: 'wsc-mp'
}, {
text: 'PC定制',
value: 'wsc-pc'
}, {
text: '零售小程序',
value: 'retail-mp'
}, {
text: '美业小程序',
value: 'beauty-mp'
}, {
text: '功能调试',
value: 'backend-helper'
}];
}
return customTypeList;
}
};
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], ProjectService.prototype, "configService", void 0);
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], ProjectService.prototype, "gitService", void 0);
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], ProjectService.prototype, "projectDao", void 0);
ProjectService = tslib_1.__decorate([
spring4js_nodejs_1.Service()
], ProjectService);
exports.default = ProjectService;
;