This action will force synchronization from certd/certd, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
import http from 'axios'import fs from 'fs'//读取 packages/core/pipline/package.json的版本号import {default as packageJson} from './packages/core/pipeline/package.json' assert { type: "json" };const certdVersion = packageJson.versionconsole.log("certdVersion", certdVersion)// 同步npmmirror的包async function getPackages(directoryPath) {return new Promise((resolve, reject) => {// 读取目录下的文件和目录列表fs.readdir(directoryPath, {withFileTypes: true}, (err, files) => {if (err) {console.log('无法读取目录:', err);reject(err)return;}// 过滤仅保留目录const directories = files.filter(file => file.isDirectory()).map(directory => directory.name);console.log('目录列表:', directories);resolve(directories)});})}async function getAllPackages() {const base = await getPackages("./packages/core")const plugins = await getPackages("./packages/plugins")const libs = await getPackages("./packages/libs")return base.concat(plugins).concat(libs)}async function sync() {const packages = await getAllPackages()for (const pkg of packages) {await http({url: `http://registry-direct.npmmirror.com/@certd/${pkg}/sync?sync_upstream=true`,method: 'PUT',headers: {"Content-Type": "application/json"},data: {}})console.log(`sync success:${pkg}`)await sleep(30*1000)}}// curl -X PUT https://registry-direct.npmmirror.com/@certd/plugin-cert/sync?sync_upstream=trueconst certdImageBuild = "http://flow-openapi.aliyun.com/pipeline/webhook/4zgFk3i4RZEMGuQzlOcI"const certdImageRun = "http://flow-openapi.aliyun.com/pipeline/webhook/lzCzlGrLCOHQaTMMt0mG"const webhooks = [certdImageBuild,certdImageRun]async function sleep(time) {return new Promise(resolve => {setTimeout(resolve, time)})}async function triggerBuild() {await sleep(60000)for (const webhook of webhooks) {await http({url: webhook,method: 'POST',headers: {"Content-Type": "application/json"},data: {'CERTD_VERSION': certdVersion}})console.log(`webhook success:${webhook}`)await sleep(30*60*1000)}}async function start() {// await build()console.log("等待60秒")await sleep(100* 1000)await sync()await sleep(100 * 1000)await triggerBuild()}start()/*** 打包前 修改 lerna* nodemodules里面搜索如下* return childProcess.exec("git", ["add", "--", ...files], execOpts);** ('git', ['add', '--', ...files]* ('git', ['add', '.']*/
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。