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

化工网站建设公司国内装修公司排名

化工网站建设公司,国内装修公司排名,互动平台怎么注册,官网seo是什么意思一、项目背景 一份代码,发布多个小程序。想让技术支持部通过脚本自己获取代码,并通过脚本自动提交到客户的小程序后台。他们自行发布。 现已注册第三方平台,开发人员通过“开发小程序”上传模板。开发人员把代码上传到模板,支持…

一、项目背景

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

现已注册第三方平台,开发人员通过“开发小程序”上传模板。开发人员把代码上传到模板,支持人员选择模板进行发布小程序。好像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/165552/

相关文章:

  • 加强网站信息内容建设网迎客 网站建设
  • app哪个网站开发好百度新站关键词排名
  • 网站怎么做百度认证吗公司想做个网站怎么办
  • 怎么在外管局的网站做延期微信开发者工具代码
  • 建设厅电工证查询网站北京手机网站开发价格
  • 推广型网站制作公司没有网站如何做营销
  • 湖北网站建设的释义附近的代理记账公司有哪些
  • 海城建设网站wordpress编辑页面如何修改
  • 免费建站的网站哪个好泰州市住房和城乡建设局官方网站
  • 郑州便宜网站建设wordpress博客卡
  • 新开传奇网站刚开一秒dw网站模板下载
  • 电商平台网站开发过程是什么初中做网站软件
  • 社交网站wordpress 虚拟空间
  • 网站开发任务jsp 做网站需要什么
  • 网站建设中 倒计时做销售在哪个网站找客户端
  • 新郑做网站优化搜索引擎网站排名
  • 如何在外管局网站上做a合同wordpress 下拉选择
  • 网站收录提交工具南昌如何做百度的网站
  • 微网站模板怎么用计算机网络网站
  • 怎样注册自己网站科讯怎么建设网站
  • 丽江建设局网站网站配置
  • 网站内链seo网站诊断
  • 专业做尼泊尔的旅行网站哪个网站可以学做衣服
  • 在线制作网站免费星巴克已有的网络营销方式
  • 网站开发现在用什么语言淘宝权重查询
  • 手机端网站建设哪家好wordpress显示慢
  • 卫生局网站建设实施方案网页建设推荐
  • 公司建立网站的好处戴尔网站建设的目的
  • 有没有专做于投融资的网站WordPress商品相册
  • 广西工程造价信息网seo建站技巧