From cbccf1024b90db264cecee790fdbe149bfa77145 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Wed, 24 May 2023 17:38:24 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=87=86=E5=A4=87=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.js | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 deploy.js diff --git a/deploy.js b/deploy.js new file mode 100644 index 00000000..3fb70ab6 --- /dev/null +++ b/deploy.js @@ -0,0 +1,80 @@ +const http = require("axios") +const exec = require('child_process').exec; + +//builder +function execute(cmd){ + return new Promise((resolve,reject)=>{ + console.log("cmd executing: " + cmd) + exec(cmd, function(error, stdout, stderr) { + if(error){ + console.error(error); + console.info(stderr) + reject(error) + } + else{ + console.info(stdout) + console.log("success"); + resolve(true) + } + }); + }) +} + +async function build(){ + await execute("cd ./packages/fast-admin/fs-admin-antdv/ && npm run build") + await execute("cd ./packages/fast-admin/fs-admin-element/ && npm run build") + await execute("cd ./packages/fast-admin/fs-admin-naive-ui/ && npm run build") + await execute("npm run docs:build") +} + + + +// trigger + +const naive = "http://flow-openapi.aliyun.com/pipeline/webhook/Zm3TJyDtyFZgV4dtJiD1" +const doc = "http://flow-openapi.aliyun.com/pipeline/webhook/soOYdQ5sF3kLjTPJGmIO" +const antdv = "http://flow-openapi.aliyun.com/pipeline/webhook/HiL0uVYxfUnBzIMJZVXB" +const element = "http://flow-openapi.aliyun.com/pipeline/webhook/uFTI0XJ9RgqnofX7jpRD" + +const webhooks = [doc,naive,antdv,element] + +async function sleep(time){ + return new Promise(resolve => { + setTimeout(resolve,time) + }) +} + +async function trigger(){ + for (const webhook of webhooks) { + await http({ + url:webhook, + method:'POST', + headers:{ + "Content-Type": "application/json" + }, + data:{} + }) + console.log(`webhook success:${webhook}`) + await sleep(1000) + } + +} + +async function start(){ + // await build() + console.log("等待60秒") + await sleep(60*1000) + await trigger() +} + +start() + + +/** + * 打包前 修改 lerna + * nodemodules里面搜索如下 + * return childProcess.exec("git", ["add", "--", ...files], execOpts); + * + * ('git', ['add', '--', ...files] + * ('git', ['add', '.'] + */ diff --git a/package.json b/package.json index a293d57a..b45f19ba 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "private": true, "type": "module", "devDependencies": { - "lerna": "^6.3.0" + "@lerna-lite/cli": "^2.4.0", + "@lerna-lite/run": "^2.4.0" }, "scripts": { "start": "lerna bootstrap --hoist",