当前位置: 首页 > news >正文

鼓楼网站seo搜索引擎优化dw网页制作软件官网

鼓楼网站seo搜索引擎优化,dw网页制作软件官网,网站开发一般采用什么框架,四川省建设工程信息网安全监督一、项目背景 一份代码,发布多个小程序。想让技术支持部通过脚本自己获取代码,并通过脚本自动提交到客户的小程序后台。他们自行发布。 现已注册第三方平台,开发人员通过“开发小程序”上传模板。开发人员把代码上传到模板,支持…

一、项目背景

一份代码,发布多个小程序。想让技术支持部通过脚本自己获取代码,并通过脚本自动提交到客户的小程序后台。他们自行发布。

现已注册第三方平台,开发人员通过“开发小程序”上传模板。开发人员把代码上传到模板,支持人员选择模板进行发布小程序。好像git代码管理也不需要了。

二、主要代码

app.js

const express = require('express');
const fs = require('fs');
const simpleGit = require('simple-git');
const cors = require('cors'); // 引入 cors 模块const app = express();const gitUrl = 'xxx'; //配置
const branch = '5.0.1';
const codePath = 'unpackage/dist/build/mp-weixin';// 本地临时文件夹
const tempFolder = 'temp';// 使用 cors 中间件
app.use(cors());//clone项目
app.get('/api/gitClone', (req, res) => {simpleGit().clone(gitUrl, tempFolder, ['-b', branch], (err, data) => {if (err) {console.error('Clone failed:', err);} else {console.log('Clone success');res.json({message: 'clone成功'});// 2. 复制代码到指定路径// 这里可能需要根据你的实际需求使用适当的文件复制方法// 例如使用 fs-extra 库的 copy 方法// 3. 执行特定文件const filePath = `${tempFolder}/${codePath}/your-executable-file.js`;try {// execSync(`node ${filePath}`, {//     stdio: 'inherit'// });console.log('Execution success');} catch (error) {console.error('Execution failed:', error);}}});
});//git 获取所有分支
app.get('/api/gitBranches', (req, res) => {// 获取所有分支simpleGit(tempFolder).branch((err, branchSummary) => {console.log('branchSummary: ', branchSummary);if (err) {console.error('Error:', err);res.status(500).json({error: 'Failed to fetch branches'});} else {// 将分支信息转换为 JSON 格式并返回const branchesJson = {branches: branchSummary.all};// current: '5.0.1',  返回的字段为当前分支//{"branches":["5.0.1","remotes/origin/1.0.0","remotes/origin/2.0.0","remotes/origin/2.0.1","remotes/origin/2.0.2","remotes/origin/3.0.0","remotes/origin/4.0.0","remotes/origin/4.1.0","remotes/origin/4.2.0","remotes/origin/4.2.1","remotes/origin/5.0.1","remotes/origin/6.0.0","remotes/origin/master"]}res.json(branchesJson);}});
});//git 切换分支
app.get('/api/checkoutBranch', (req, res) => {// 获取所有分支simpleGit(tempFolder).checkout('6.0.0', (err) => {if (err) {console.error('Error:', err);} else {console.log('Switched to branch 6.0.0');res.json({message: '切换成功'});}});
});const branchToPull = '6.0.0'; // 要拉取的分支名称//git 拉取指定分支代码
app.get('/api/pull', (req, res) => {// 获取所有分支// 拉取分支代码simpleGit(tempFolder).pull('origin', branchToPull, (err, update) => {if (err) {console.error('Error:', err);res.json({message: '拉取错误'});} else if (update && update.summary.changes) {console.log(`Pulled ${update.summary.changes} changes from branch ${branchToPull}`);res.json({message: '最新成功'});} else {console.log('Already up to date');res.json({message: '已经是最新'});}});
});app.listen(8000, () => {console.log(`Server is running on port 8000`);
});
http://www.yayakq.cn/news/771629/

相关文章:

  • 网站建设初学者必学王建设医生个人网站
  • 网站资源规划怎么写flash如何做网站
  • 榆中建设局网站网站建设加后台
  • 空间建网站网站规划建设与管理维护答案
  • 贵州建设网老网站网站制作全过程
  • 萝岗网站开发wordpress网页内容
  • 建筑网建设通网站作用成功网站案例有哪些
  • 网站建设工具的种类酒店网站设计方案
  • 济宁高端网站建设合肥公司网站设计
  • 道路建设网站平台设计思路
  • 网站如何调用数据库wordpress 音乐网站
  • 长春网站建设建站系统seo关键词排名公司
  • 网站续费申请受欢迎的永州网站建设
  • 七个php源码下载的网站软件开发项目报价模板
  • 点击图片是网站怎么做房地产新闻最新消息今天
  • 注册新公司网上核名网站怎样解除拦截网站设置
  • 典型网站开发的流程图wordpress强制分享代码
  • 企业门户网站的设计与实现网络营销与管理专业
  • 天津 网站设计公司wordpress site-name
  • 河北住房和城乡建设局网站wordpress好看的主题
  • 吉林省建设工程监理检测网站厦门安能建设公司网站
  • 如何做pc网站适配vs网站开发实例
  • 设计和建设企业网站心得和体会wordpress仿qq
  • 怎么查网站icp备案wordpress数据库越来越大
  • 禹州市城乡建设局网站全新wordpress主题
  • 网站建设课程设计实验指导书吐鲁番seo快速排名
  • 如何学做网站优化优化营商环境的意义
  • php网站开发需要多久网站微信分享怎么做
  • 怎样建立自己的网站平台快对作业小程序入口
  • 泰塔科技网站建设微信网站开发设计