chore: deploy

pull/21/merge
xiaojunnuo 2023-07-03 09:33:18 +08:00
parent 02a9b0d16c
commit 35632da284
2 changed files with 12 additions and 10 deletions

View File

@ -2,9 +2,10 @@ import http from 'axios'
import fs from 'fs' import fs from 'fs'
//读取 packages/core/pipline/package.json的版本号 //读取 packages/core/pipline/package.json的版本号
import { default as packageJson } from './packages/core/pipeline/package.json' assert { type: "json" }; import {default as packageJson} from './packages/core/pipeline/package.json' assert {type: "json"};
const certdVersion = packageJson.version const certdVersion = packageJson.version
console.log("certdVersion",certdVersion) console.log("certdVersion", certdVersion)
// 同步npmmirror的包 // 同步npmmirror的包
async function getPackages(directoryPath) { async function getPackages(directoryPath) {
@ -29,18 +30,18 @@ async function getPackages(directoryPath) {
} }
async function getAllPackages(){ async function getAllPackages() {
const base = await getPackages("./packages/core") const base = await getPackages("./packages/core")
const plugins =await getPackages("./packages/plugins") const plugins = await getPackages("./packages/plugins")
return base.concat(plugins) return base.concat(plugins)
} }
async function sync(){ async function sync() {
const packages = await getAllPackages() const packages = await getAllPackages()
for(const pkg of packages){ for (const pkg of packages) {
await http({ await http({
url: `https://registry-direct.npmmirror.com/@certd/${pkg}/sync?sync_upstream=true`, url: `http://registry-direct.npmmirror.com/@certd/${pkg}/sync?sync_upstream=true`,
method: 'PUT', method: 'PUT',
headers: { headers: {
"Content-Type": "application/json" "Content-Type": "application/json"
@ -50,7 +51,6 @@ async function sync(){
console.log(`sync success:${pkg}`) console.log(`sync success:${pkg}`)
await sleep(1000) await sleep(1000)
} }
await sleep(60000)
} }
// curl -X PUT https://registry-direct.npmmirror.com/@certd/plugin-cert/sync?sync_upstream=true // curl -X PUT https://registry-direct.npmmirror.com/@certd/plugin-cert/sync?sync_upstream=true
@ -87,6 +87,7 @@ async function start() {
console.log("等待60秒") console.log("等待60秒")
await sleep(60 * 1000) await sleep(60 * 1000)
await sync() await sync()
await sleep(60 * 1000)
await triggerBuild() await triggerBuild()
} }

View File

@ -11,11 +11,12 @@
"scripts": { "scripts": {
"start": "lerna bootstrap --hoist", "start": "lerna bootstrap --hoist",
"i-all": "lerna link && lerna exec npm install ", "i-all": "lerna link && lerna exec npm install ",
"publish": "npm run proxy && npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly", "publish": "npm run proxy && npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly && npm run deploy1",
"afterpublishOnly": "", "afterpublishOnly": "",
"proxy": "npm config set proxy=http://127.0.0.1:10809", "proxy": "npm config set proxy=http://127.0.0.1:10809",
"prepublishOnly1": "npm run before-build && lerna run build ", "prepublishOnly1": "npm run before-build && lerna run build ",
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"" "before-build": "cd ./packages/core/acme-client && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
"deploy1": "node deploy.js"
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {