mirror of
https://github.com/certd/certd.git
synced 2026-04-14 12:30:54 +08:00
Compare commits
110 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b258e92620 | ||
|
|
f6148ef1fb | ||
|
|
457da594be | ||
|
|
891a43ae67 | ||
|
|
bc65c0a786 | ||
|
|
3eeb1f77aa | ||
|
|
91be6826b9 | ||
|
|
f87eee3b9f | ||
|
|
b4e17691c4 | ||
|
|
cce372aeba | ||
|
|
b5a8a9e08a | ||
|
|
35632da284 | ||
|
|
02a9b0d16c | ||
|
|
d1809e0f7d | ||
|
|
abb4a7c0f9 | ||
|
|
cd6fa8b15c | ||
|
|
ecfcada802 | ||
|
|
f8ec5ae253 | ||
|
|
832ba5c8fb | ||
|
|
fa8e91cdcd | ||
|
|
e5d902663b | ||
|
|
042535536e | ||
|
|
6d3063437c | ||
|
|
3db4d04e4c | ||
|
|
96f9eab5cd | ||
|
|
1e641b83c1 | ||
|
|
3791d92d67 | ||
|
|
2bcab76f5a | ||
|
|
f5493c542b | ||
|
|
68eb4198f1 | ||
|
|
ef94607728 | ||
|
|
4ccadbd2be | ||
|
|
0643063b80 | ||
|
|
d6c6ab932a | ||
|
|
46004d2db8 | ||
|
|
620d1d4092 | ||
|
|
f30afac47e | ||
|
|
1779e34773 | ||
|
|
28f535f41c | ||
|
|
e921f58d2f | ||
|
|
301f6cc273 | ||
|
|
f04e497999 | ||
|
|
8db438d76b | ||
|
|
af75e607ec | ||
|
|
cd4b9527c3 | ||
|
|
ea8dc446ae | ||
|
|
ba6270990b | ||
|
|
df55f1066c | ||
|
|
b562d661db | ||
|
|
aede78a0ec | ||
|
|
7e8c3fbab7 | ||
|
|
6621601155 | ||
|
|
1fbd585a46 | ||
|
|
5a51c14de5 | ||
|
|
27a4c81c6d | ||
|
|
fdc25dc0d7 | ||
|
|
99522fb49a | ||
|
|
671d273e2f | ||
|
|
2851a33eb2 | ||
|
|
937e3fac19 | ||
|
|
64afebecd4 | ||
|
|
4c324960e6 | ||
|
|
f516b0931f | ||
|
|
2297121eff | ||
|
|
0c2684d1cf | ||
|
|
4b4c5dba73 | ||
|
|
7b9d70e093 | ||
|
|
71a289b009 | ||
|
|
ddf98ff593 | ||
|
|
db8043ecb6 | ||
|
|
ea756cf0a4 | ||
|
|
8446a6d813 | ||
|
|
a18aaeacf7 | ||
|
|
58a43b3785 | ||
|
|
dd06f12582 | ||
|
|
d7dcc01c9f | ||
|
|
66f56740b7 | ||
|
|
5bd042d9bc | ||
|
|
60921d9adf | ||
|
|
3a668f1f8b | ||
|
|
609fe5f838 | ||
|
|
e29e528aa2 | ||
|
|
e06c9e07fe | ||
|
|
03ee28c380 | ||
|
|
7474235283 | ||
|
|
4eb6ae92d1 | ||
|
|
0eeba2783b | ||
|
|
8498fa75e3 | ||
|
|
5556bc3a4b | ||
|
|
998200e570 | ||
|
|
420b835b09 | ||
|
|
cc3534cf00 | ||
|
|
062a267a6f | ||
|
|
98ee7fcd8c | ||
|
|
e5ec9f4b62 | ||
|
|
b66bb21777 | ||
|
|
f7e026a132 | ||
|
|
c12e56823e | ||
|
|
042f8e9030 | ||
|
|
9308950550 | ||
|
|
a43c5b0824 | ||
|
|
ebdf9f4b5b | ||
|
|
511be1f3ae | ||
|
|
ceb0454277 | ||
|
|
c553b017af | ||
|
|
c553f63127 | ||
|
|
152cb9b23a | ||
|
|
5eff50e8fe | ||
|
|
cddf01ee68 | ||
|
|
d968c4bbb9 |
21
.github/ISSUE_TEMPLATE.md
vendored
Normal file
21
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
> 感谢您支持certd,请按如下规范提交issue
|
||||||
|
> 如果有条件,请尽量在[github上提交](https://github.com/certd/certd/issues)
|
||||||
|
|
||||||
|
|
||||||
|
## 一、问题描述
|
||||||
|
`请在此处简要描述你所遇到的问题,必要时请贴出相关截图辅助理解和定位`
|
||||||
|
|
||||||
|
### 复现步骤
|
||||||
|
`请描述复现问题的详细步骤`
|
||||||
|
`如果非示例页面的问题,最好能提供最小复现示例的代码、或者仓库链接`
|
||||||
|
|
||||||
|
|
||||||
|
### 报错截图
|
||||||
|
`请贴出报错日志截图`
|
||||||
|
|
||||||
|
### 效果截图
|
||||||
|
`请贴出效果截图`
|
||||||
|
#### 1. 期望效果
|
||||||
|
|
||||||
|
#### 2. 实际效果
|
||||||
|
|
||||||
35
.github/workflows/sync-to-gitee.yml
vendored
Normal file
35
.github/workflows/sync-to-gitee.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: sync-to-gitee
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ['v2']
|
||||||
|
pull_request:
|
||||||
|
branches: ['v2']
|
||||||
|
# schedule:
|
||||||
|
# - # 国际时间 19:17 执行,北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
|
||||||
|
# - cron: '17 19 * * *'
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout work repo # 1. 检出当前仓库(certd-sync-work)
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set git user # 2. 给git命令设置用户名和邮箱,↙↙↙ 改成你的name和email
|
||||||
|
run: |
|
||||||
|
git config --global user.name "xiaojunnuo"
|
||||||
|
git config --global user.email "xiaojunnuo@qq.com"
|
||||||
|
|
||||||
|
- name: Set git token # 3. 给git命令设置token,用于push到目标仓库
|
||||||
|
uses: de-vri-es/setup-git-credentials@v2
|
||||||
|
with: # token 格式为: username:password
|
||||||
|
credentials: https://${{secrets.PUSH_TOKEN_GITEE}}@gitee.com
|
||||||
|
|
||||||
|
- name: push to gitee # 4. 执行同步
|
||||||
|
run: |
|
||||||
|
git remote add upstream https://gitee.com/certd/certd
|
||||||
|
git push --set-upstream upstream v2
|
||||||
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -30,3 +30,5 @@ gen
|
|||||||
/packages/test
|
/packages/test
|
||||||
/test/own
|
/test/own
|
||||||
/pnpm-lock.yaml
|
/pnpm-lock.yaml
|
||||||
|
|
||||||
|
docker/image/workspace
|
||||||
|
|||||||
56
CHANGELOG.md
56
CHANGELOG.md
@@ -3,6 +3,62 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* 成功图标转动的问题 ([f87eee3](https://github.com/certd/certd/commit/f87eee3b9ff1ef9874e79a81fe0ed7104cb9ee8c))
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* cancel task ([bc65c0a](https://github.com/certd/certd/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
|
||||||
|
* flush log ([891a43a](https://github.com/certd/certd/commit/891a43ae6716ff98ed06643f7da2e35199ee195c))
|
||||||
|
* flush logger ([91be682](https://github.com/certd/certd/commit/91be6826b902e0f302b1a6cbdb1d24e15914c18d))
|
||||||
|
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package root
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package root
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package root
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* 修复access选择类型trigger ([2851a33](https://github.com/certd/certd/commit/2851a33eb2510f038fadb55da29512597a4ba512))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* 权限控制 ([27a4c81](https://github.com/certd/certd/commit/27a4c81c6d70e70abb3892c3ea58d4719988808a))
|
||||||
|
* 邮件通知 ([937e3fa](https://github.com/certd/certd/commit/937e3fac19cd03b8aa91db8ba03fda7fcfbacea2))
|
||||||
|
* cert download ([5a51c14](https://github.com/certd/certd/commit/5a51c14de521cb8075a80d2ae41a16e6d5281259))
|
||||||
|
* config merge ([fdc25dc](https://github.com/certd/certd/commit/fdc25dc0d795555cffacc4572648ec158988fbbb))
|
||||||
|
* save files ([99522fb](https://github.com/certd/certd/commit/99522fb49adb42c1dfdf7bec3dd52d641158285b))
|
||||||
|
* save files ([671d273](https://github.com/certd/certd/commit/671d273e2f9136d16896536b0ca127cf372f1619))
|
||||||
|
|
||||||
|
## [1.0.6](https://github.com/certd/certd/compare/v1.0.5...v1.0.6) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package root
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/certd/certd/compare/v1.0.4...v1.0.5) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package root
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/certd/certd/compare/v1.0.3...v1.0.4) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package root
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/certd/certd/compare/v1.0.2...v1.0.3) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package root
|
||||||
|
|
||||||
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package root
|
**Note:** Version bump only for package root
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ CertD 是一个帮助你全自动申请和部署SSL证书的工具。
|
|||||||
## 特性
|
## 特性
|
||||||
本项目不仅支持证书申请过程自动化,还可以自动化部署证书,让你的证书永不过期。
|
本项目不仅支持证书申请过程自动化,还可以自动化部署证书,让你的证书永不过期。
|
||||||
|
|
||||||
* 全自动申请证书
|
* 全自动申请证书(支持阿里云、腾讯云、华为云注册的域名)
|
||||||
* 全自动部署证书(目前支持服务器上传部署、阿里云、腾讯云等)
|
* 全自动部署证书(目前支持服务器上传部署、阿里云、腾讯云等)
|
||||||
* 可与CI/DI工具结合使用
|
* 支持通配符域名
|
||||||
|
* 支持多个域名打到一个证书上
|
||||||
|
|
||||||
## 免费证书申请说明
|
## 免费证书申请说明
|
||||||
* 本项目ssl证书提供商为letencrypt
|
* 本项目ssl证书提供商为letencrypt
|
||||||
|
|||||||
102
deploy.js
102
deploy.js
@@ -1,58 +1,80 @@
|
|||||||
const http = require("axios")
|
import http from 'axios'
|
||||||
const exec = require('child_process').exec;
|
import fs from 'fs'
|
||||||
|
|
||||||
//builder
|
//读取 packages/core/pipline/package.json的版本号
|
||||||
function execute(cmd){
|
import {default as packageJson} from './packages/core/pipeline/package.json' assert {type: "json"};
|
||||||
return new Promise((resolve,reject)=>{
|
|
||||||
console.log("cmd executing: " + cmd)
|
const certdVersion = packageJson.version
|
||||||
exec(cmd, function(error, stdout, stderr) {
|
console.log("certdVersion", certdVersion)
|
||||||
if(error){
|
|
||||||
console.error(error);
|
// 同步npmmirror的包
|
||||||
console.info(stderr)
|
async function getPackages(directoryPath) {
|
||||||
reject(error)
|
return new Promise((resolve, reject) => {
|
||||||
}
|
// 读取目录下的文件和目录列表
|
||||||
else{
|
fs.readdir(directoryPath, {withFileTypes: true}, (err, files) => {
|
||||||
console.info(stdout)
|
if (err) {
|
||||||
console.log("success");
|
console.log('无法读取目录:', err);
|
||||||
resolve(true)
|
reject(err)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 过滤仅保留目录
|
||||||
|
const directories = files
|
||||||
|
.filter(file => file.isDirectory())
|
||||||
|
.map(directory => directory.name);
|
||||||
|
|
||||||
|
console.log('目录列表:', directories);
|
||||||
|
resolve(directories)
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function build(){
|
async function getAllPackages() {
|
||||||
await execute("cd ./packages/fast-admin/fs-admin-antdv/ && npm run build")
|
const base = await getPackages("./packages/core")
|
||||||
await execute("cd ./packages/fast-admin/fs-admin-element/ && npm run build")
|
const plugins = await getPackages("./packages/plugins")
|
||||||
await execute("cd ./packages/fast-admin/fs-admin-naive-ui/ && npm run build")
|
|
||||||
await execute("npm run docs:build")
|
return base.concat(plugins)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// curl -X PUT https://registry-direct.npmmirror.com/@certd/plugin-cert/sync?sync_upstream=true
|
||||||
|
|
||||||
// trigger
|
const certdImageBuild = "http://flow-openapi.aliyun.com/pipeline/webhook/4zgFk3i4RZEMGuQzlOcI"
|
||||||
|
const webhooks = [certdImageBuild]
|
||||||
|
|
||||||
const naive = "http://flow-openapi.aliyun.com/pipeline/webhook/Zm3TJyDtyFZgV4dtJiD1"
|
async function sleep(time) {
|
||||||
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 => {
|
return new Promise(resolve => {
|
||||||
setTimeout(resolve,time)
|
setTimeout(resolve, time)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function trigger(){
|
async function triggerBuild() {
|
||||||
for (const webhook of webhooks) {
|
for (const webhook of webhooks) {
|
||||||
await http({
|
await http({
|
||||||
url:webhook,
|
url: webhook,
|
||||||
method:'POST',
|
method: 'POST',
|
||||||
headers:{
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
data:{}
|
data: {
|
||||||
|
'CERTD_VERSION': certdVersion
|
||||||
|
}
|
||||||
})
|
})
|
||||||
console.log(`webhook success:${webhook}`)
|
console.log(`webhook success:${webhook}`)
|
||||||
await sleep(1000)
|
await sleep(1000)
|
||||||
@@ -60,11 +82,13 @@ async function trigger(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function start(){
|
async function start() {
|
||||||
// await build()
|
// await build()
|
||||||
console.log("等待60秒")
|
console.log("等待60秒")
|
||||||
await sleep(60*1000)
|
await sleep(60 * 1000)
|
||||||
await trigger()
|
await sync()
|
||||||
|
await sleep(60 * 1000)
|
||||||
|
await triggerBuild()
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
|
|||||||
18
docker/image/Dockerfile
Normal file
18
docker/image/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
FROM registry.cn-shenzhen.aliyuncs.com/handsfree/node:16-alpine
|
||||||
|
EXPOSE 7001
|
||||||
|
ENV NODE_ENV production
|
||||||
|
ENV MIDWAY_SERVER_ENV production
|
||||||
|
WORKDIR /app/
|
||||||
|
#RUN npm install cross-env -g --registry=https://registry.npmmirror.com
|
||||||
|
#RUN npm install pm2 -g --registry=https://registry.npmmirror.com
|
||||||
|
#RUN pm2 install pm2-logrotate
|
||||||
|
ADD ./workspace/certd-server/ /app/
|
||||||
|
RUN yarn install --production --registry=https://registry.npmmirror.com
|
||||||
|
#RUN yarn install --production
|
||||||
|
RUN npm run build
|
||||||
|
#CMD ["pm2-runtime", "start", "./bootstrap.js","--name", "certd","-i","1"]
|
||||||
|
CMD ["npm", "run","start"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
37
docker/image/build.sh
Executable file
37
docker/image/build.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
echo "请先输入一个版本号:"
|
||||||
|
read version
|
||||||
|
|
||||||
|
echo "您输入的版本号是: $version"
|
||||||
|
echo "登录aliyun镜像仓库"
|
||||||
|
sudo docker login --username=252959493@qq.com registry.cn-shenzhen.aliyuncs.com
|
||||||
|
|
||||||
|
build=$(pwd)
|
||||||
|
cd ../../
|
||||||
|
root=$(pwd)
|
||||||
|
echo "安装依赖"
|
||||||
|
#pnpm install --registry=https://registry.npmmirror.com
|
||||||
|
pnpm install
|
||||||
|
|
||||||
|
echo "client build"
|
||||||
|
cd $root/packages/ui/certd-client
|
||||||
|
pnpm run build
|
||||||
|
echo "client build success"
|
||||||
|
|
||||||
|
echo "server build"
|
||||||
|
cd $root/packages/ui/certd-server
|
||||||
|
pnpm run build
|
||||||
|
echo "server build success"
|
||||||
|
|
||||||
|
echo "rm node_modules"
|
||||||
|
rm ./node_modules -rf
|
||||||
|
|
||||||
|
echo "copy to workspace"
|
||||||
|
mkdir -p $build/workspace/certd-server
|
||||||
|
\cp ./* $build/workspace/certd-server -rf
|
||||||
|
\cp ../certd-client/dist/* $build/workspace/certd-server/public/ -rf
|
||||||
|
|
||||||
|
#export TAG=$version
|
||||||
|
#sudo -E docker compose build
|
||||||
|
#sudo -E docker compose push
|
||||||
14
docker/image/docker-compose.yaml
Normal file
14
docker/image/docker-compose.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
version: '3.3' # 指定docker-compose 版本
|
||||||
|
services: # 要拉起的服务们
|
||||||
|
certd:
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${TAG}
|
||||||
|
container_name: certd # 容器名
|
||||||
|
restart: unless-stopped # 重启
|
||||||
|
ports: # 端口映射
|
||||||
|
- "7001:7001"
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
|
||||||
9
docker/run/Dockerfile
Normal file
9
docker/run/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
|
||||||
|
EXPOSE 7001
|
||||||
|
RUN npm run build
|
||||||
|
#RUN npm install pm2 -g --registry=https://registry.npmmirror.com
|
||||||
|
#CMD ["pm2-runtime", "start", "./bootstrap.js","--name", "certd","-i","1","--", "-p", "7001"]
|
||||||
|
CMD ["npm","run", "start"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
15
docker/run/build.sh
Executable file
15
docker/run/build.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
# 判断$CERTD_VERSION 是否存在
|
||||||
|
if [ -n "$CERTD_VERSION" ]; then
|
||||||
|
echo "CERTD_VERSION is set = $CERTD_VERSION"
|
||||||
|
version=$CERTD_VERSION
|
||||||
|
else
|
||||||
|
echo "CERTD_VERSION is not set"
|
||||||
|
echo "请先输入一个版本号(如 1.0.6):"
|
||||||
|
read version
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "您输入的版本号是: $version"
|
||||||
|
export TAG="$version"
|
||||||
|
sudo -E docker compose up -d
|
||||||
23
docker/run/docker-compose.yaml
Normal file
23
docker/run/docker-compose.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
version: '3.3'
|
||||||
|
services:
|
||||||
|
certd:
|
||||||
|
# 镜像 # ↓↓↓↓↓ --- 1、 修改镜像版本号
|
||||||
|
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${TAG}
|
||||||
|
container_name: certd # 容器名
|
||||||
|
restart: unless-stopped # 重启
|
||||||
|
volumes:
|
||||||
|
# ↓↓↓↓↓ ------------------------------------------------------- 2、 修改数据库以及证书存储路径
|
||||||
|
- /data/certd:/app/data
|
||||||
|
ports: # 端口映射
|
||||||
|
- "7001:7001"
|
||||||
|
environment: # 环境变量
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
- certd_auth_jwt_secret=changeme
|
||||||
|
# ↑↑↑↑↑ ---------------------------------- 3、 修改成你的自定义密钥
|
||||||
|
# 设置环境变量即可自定义certd配置
|
||||||
|
# 服务端配置项见: packages/ui/certd-server/src/config/config.default.ts
|
||||||
|
# 服务端配置规则: certd_ + 配置项, 点号用_代替
|
||||||
|
# 如jwt密钥配置为: auth.jwt.secret,则设置环境变量 certd_auth_jwt_secret=changeme
|
||||||
|
|
||||||
|
# 客户端配置项见: packages/ui/certd-client/.env
|
||||||
|
# 按实际名称配置环境变量即可,如: VITE_APP_API=http://localhost:7001
|
||||||
@@ -9,5 +9,5 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmClient": "pnpm",
|
"npmClient": "pnpm",
|
||||||
"version": "1.0.2"
|
"version": "1.1.4"
|
||||||
}
|
}
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -1,23 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "root",
|
"name": "root",
|
||||||
|
"version": "1.0.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@lerna-lite/cli": "^2.4.0",
|
"@lerna-lite/cli": "^2.4.0",
|
||||||
"@lerna-lite/run": "^2.4.0",
|
"@lerna-lite/publish": "^2.4.0",
|
||||||
"@lerna-lite/publish": "^2.4.0"
|
"@lerna-lite/run": "^2.4.0"
|
||||||
},
|
},
|
||||||
"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": {
|
||||||
|
"axios": "^1.4.0",
|
||||||
"lodash": "^4.17.21"
|
"lodash": "^4.17.21"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
|
|||||||
@@ -3,6 +3,42 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.4](https://github.com/publishlab/node-acme-client/compare/v1.1.3...v1.1.4) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/publishlab/node-acme-client/compare/v1.1.2...v1.1.3) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/publishlab/node-acme-client/compare/v1.1.1...v1.1.2) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/publishlab/node-acme-client/compare/v1.1.0...v1.1.1) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/publishlab/node-acme-client/compare/v1.0.6...v1.1.0) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|
||||||
|
## [1.0.6](https://github.com/publishlab/node-acme-client/compare/v1.0.5...v1.0.6) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/publishlab/node-acme-client/compare/v1.0.4...v1.0.5) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/publishlab/node-acme-client/compare/v1.0.3...v1.0.4) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/publishlab/node-acme-client/compare/v1.0.2...v1.0.3) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|
||||||
## [1.0.2](https://github.com/publishlab/node-acme-client/compare/v1.0.1...v1.0.2) (2023-05-24)
|
## [1.0.2](https://github.com/publishlab/node-acme-client/compare/v1.0.1...v1.0.2) (2023-05-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @certd/acme-client
|
**Note:** Version bump only for package @certd/acme-client
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
18:05
|
12:25
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"description": "Simple and unopinionated ACME client",
|
"description": "Simple and unopinionated ACME client",
|
||||||
"private": false,
|
"private": false,
|
||||||
"author": "nmorsman",
|
"author": "nmorsman",
|
||||||
"version": "1.0.2",
|
"version": "1.1.4",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"types": "types",
|
"types": "types",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -58,5 +58,5 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/publishlab/node-acme-client/issues"
|
"url": "https://github.com/publishlab/node-acme-client/issues"
|
||||||
},
|
},
|
||||||
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
|
"gitHead": "ecfcada8020661b922cbe4f4984d76efb7f2b3e3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/ban-ts-ignore": "off",
|
"@typescript-eslint/ban-ts-ignore": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
|||||||
2
packages/core/pipeline/.npmignore
Normal file
2
packages/core/pipeline/.npmignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
src
|
||||||
@@ -3,6 +3,56 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* cancel task ([bc65c0a](https://github.com/certd/certd/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
|
||||||
|
* flush log ([891a43a](https://github.com/certd/certd/commit/891a43ae6716ff98ed06643f7da2e35199ee195c))
|
||||||
|
* flush logger ([91be682](https://github.com/certd/certd/commit/91be6826b902e0f302b1a6cbdb1d24e15914c18d))
|
||||||
|
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/pipeline
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/pipeline
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/pipeline
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* 修复access选择类型trigger ([2851a33](https://github.com/certd/certd/commit/2851a33eb2510f038fadb55da29512597a4ba512))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* 邮件通知 ([937e3fa](https://github.com/certd/certd/commit/937e3fac19cd03b8aa91db8ba03fda7fcfbacea2))
|
||||||
|
* cert download ([5a51c14](https://github.com/certd/certd/commit/5a51c14de521cb8075a80d2ae41a16e6d5281259))
|
||||||
|
* save files ([99522fb](https://github.com/certd/certd/commit/99522fb49adb42c1dfdf7bec3dd52d641158285b))
|
||||||
|
* save files ([671d273](https://github.com/certd/certd/commit/671d273e2f9136d16896536b0ca127cf372f1619))
|
||||||
|
|
||||||
|
## [1.0.6](https://github.com/certd/certd/compare/v1.0.5...v1.0.6) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/pipeline
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/certd/certd/compare/v1.0.4...v1.0.5) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/pipeline
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/certd/certd/compare/v1.0.3...v1.0.4) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/pipeline
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/certd/certd/compare/v1.0.2...v1.0.3) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/pipeline
|
||||||
|
|
||||||
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @certd/pipeline
|
**Note:** Version bump only for package @certd/pipeline
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./src";
|
|
||||||
@@ -1,61 +1,60 @@
|
|||||||
{
|
{
|
||||||
"name": "@certd/pipeline",
|
"name": "@certd/pipeline",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "1.0.2",
|
"version": "1.1.4",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
"module": "./src/index.ts",
|
"module": "./src/index.ts",
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "./dist/pipeline.umd.js",
|
"main": "./dist/bundle.js",
|
||||||
"module": "./dist/pipeline.mjs",
|
"module": "./dist/bundle.mjs",
|
||||||
"types": "./dist/d/index.d.ts"
|
"types": "./dist/d/index.d.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "rollup -c",
|
||||||
|
"build2": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@certd/acme-client": "^1.0.2",
|
"axios": "^1.4.0",
|
||||||
"axios": "^0.21.1",
|
"node-forge": "^1.3.1",
|
||||||
"dayjs": "^1.11.6",
|
"nodemailer": "^6.9.3",
|
||||||
"lodash": "^4.17.21",
|
"qs": "^6.11.2"
|
||||||
"log4js": "^6.3.0",
|
|
||||||
"node-forge": "^0.10.0",
|
|
||||||
"qs": "^6.9.4",
|
|
||||||
"reflect-metadata": "^0.1.13"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alicloud/cs20151215": "^3.0.3",
|
"@certd/acme-client": "^1.1.4",
|
||||||
"@alicloud/openapi-client": "^0.4.0",
|
"@rollup/plugin-commonjs": "^23.0.4",
|
||||||
"@alicloud/pop-core": "^1.7.10",
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
"@midwayjs/bootstrap": "^3.9.1",
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
"@midwayjs/cache": "^3.9.0",
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
"@midwayjs/cli": "^1.3.21",
|
|
||||||
"@midwayjs/core": "^3.0.0",
|
|
||||||
"@midwayjs/decorator": "^3.0.0",
|
|
||||||
"@midwayjs/koa": "^3.9.0",
|
|
||||||
"@midwayjs/logger": "^2.17.0",
|
|
||||||
"@midwayjs/typeorm": "^3.9.0",
|
|
||||||
"@midwayjs/validate": "^3.9.0",
|
|
||||||
"@rollup/plugin-typescript": "^11.0.0",
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
"@types/chai": "^4.3.3",
|
"@types/chai": "^4.3.5",
|
||||||
"@types/lodash": "^4.14.194",
|
"@types/lodash": "^4.14.194",
|
||||||
"@types/mocha": "^10.0.0",
|
"@types/mocha": "^10.0.1",
|
||||||
"@types/node-forge": "^1.3.0",
|
"@types/node-forge": "^1.3.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
"@types/uuid": "^9.0.2",
|
||||||
"@typescript-eslint/parser": "^5.38.1",
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
||||||
"chai": "^4.3.6",
|
"@typescript-eslint/parser": "^5.59.7",
|
||||||
"eslint": "^8.24.0",
|
"chai": "^4.3.7",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"dayjs": "^1.11.7",
|
||||||
"eslint-plugin-import": "^2.26.0",
|
"eslint": "^8.41.0",
|
||||||
|
"eslint-config-prettier": "^8.8.0",
|
||||||
|
"eslint-plugin-import": "^2.27.5",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"mocha": "^10.1.0",
|
"lodash": "^4.17.21",
|
||||||
|
"log4js": "^6.9.1",
|
||||||
|
"mocha": "^10.2.0",
|
||||||
|
"reflect-metadata": "^0.1.13",
|
||||||
|
"rollup": "^3.7.4",
|
||||||
|
"rollup-plugin-typescript2": "^0.34.1",
|
||||||
|
"rollup-plugin-visualizer": "^5.8.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.8.4",
|
"tslib": "^2.5.2",
|
||||||
"vite": "^3.1.0",
|
"typescript": "^5.0.4",
|
||||||
"vue-tsc": "^0.38.9"
|
"vite": "^4.3.8",
|
||||||
|
"vue-tsc": "^1.6.5"
|
||||||
},
|
},
|
||||||
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
|
"gitHead": "ecfcada8020661b922cbe4f4984d76efb7f2b3e3"
|
||||||
}
|
}
|
||||||
|
|||||||
43
packages/core/pipeline/rollup.config.js
Normal file
43
packages/core/pipeline/rollup.config.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const resolve = require("@rollup/plugin-node-resolve");
|
||||||
|
const commonjs = require("@rollup/plugin-commonjs");
|
||||||
|
//const Typescript = require("rollup-plugin-typescript2");
|
||||||
|
const Typescript = require("@rollup/plugin-typescript");
|
||||||
|
const json = require("@rollup/plugin-json");
|
||||||
|
const terser = require("@rollup/plugin-terser");
|
||||||
|
module.exports = {
|
||||||
|
input: "src/index.ts",
|
||||||
|
output: {
|
||||||
|
file: "dist/bundle.js",
|
||||||
|
format: "cjs",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// 解析第三方依赖
|
||||||
|
resolve(),
|
||||||
|
// 识别 commonjs 模式第三方依赖
|
||||||
|
commonjs(),
|
||||||
|
Typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
terser(),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ConcurrencyStrategy, Pipeline, ResultType, Runnable, RunStrategy, Stage, Step, Task } from "../d.ts";
|
import { ConcurrencyStrategy, NotificationWhen, Pipeline, ResultType, Runnable, RunStrategy, Stage, Step, Task } from "../d.ts";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { RunHistory, RunnableCollection } from "./run-history";
|
import { RunHistory, RunnableCollection } from "./run-history";
|
||||||
import { AbstractTaskPlugin, PluginDefine, pluginRegistry } from "../plugin";
|
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext } from "../plugin";
|
||||||
import { ContextFactory, IContext } from "./context";
|
import { ContextFactory, IContext } from "./context";
|
||||||
import { IStorage } from "./storage";
|
import { IStorage } from "./storage";
|
||||||
import { logger } from "../utils/util.log";
|
import { logger } from "../utils/util.log";
|
||||||
@@ -10,31 +10,37 @@ import { request } from "../utils/util.request";
|
|||||||
import { IAccessService } from "../access";
|
import { IAccessService } from "../access";
|
||||||
import { RegistryItem } from "../registry";
|
import { RegistryItem } from "../registry";
|
||||||
import { Decorator } from "../decorator";
|
import { Decorator } from "../decorator";
|
||||||
|
import { IEmailService } from "../service";
|
||||||
|
import { FileStore } from "./file-store";
|
||||||
|
import { TimeoutPromise } from "../utils/util.promise";
|
||||||
|
|
||||||
export class Executor {
|
export type ExecutorOptions = {
|
||||||
userId: any;
|
userId: any;
|
||||||
pipeline: Pipeline;
|
pipeline: Pipeline;
|
||||||
runtime!: RunHistory;
|
storage: IStorage;
|
||||||
|
onChanged: (history: RunHistory) => Promise<void>;
|
||||||
accessService: IAccessService;
|
accessService: IAccessService;
|
||||||
|
emailService: IEmailService;
|
||||||
|
fileRootDir?: string;
|
||||||
|
};
|
||||||
|
export class Executor {
|
||||||
|
pipeline: Pipeline;
|
||||||
|
runtime!: RunHistory;
|
||||||
contextFactory: ContextFactory;
|
contextFactory: ContextFactory;
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
pipelineContext!: IContext;
|
pipelineContext!: IContext;
|
||||||
lastStatusMap!: RunnableCollection;
|
lastStatusMap!: RunnableCollection;
|
||||||
|
lastRuntime!: RunHistory;
|
||||||
|
options: ExecutorOptions;
|
||||||
|
canceled = false;
|
||||||
onChanged: (history: RunHistory) => void;
|
onChanged: (history: RunHistory) => void;
|
||||||
constructor(options: {
|
constructor(options: ExecutorOptions) {
|
||||||
userId: any;
|
this.options = options;
|
||||||
pipeline: Pipeline;
|
|
||||||
storage: IStorage;
|
|
||||||
onChanged: (history: RunHistory) => Promise<void>;
|
|
||||||
accessService: IAccessService;
|
|
||||||
}) {
|
|
||||||
this.pipeline = _.cloneDeep(options.pipeline);
|
this.pipeline = _.cloneDeep(options.pipeline);
|
||||||
this.onChanged = async (history: RunHistory) => {
|
this.onChanged = async (history: RunHistory) => {
|
||||||
await options.onChanged(history);
|
await options.onChanged(history);
|
||||||
};
|
};
|
||||||
this.accessService = options.accessService;
|
this.pipeline.userId = options.userId;
|
||||||
this.userId = options.userId;
|
|
||||||
this.pipeline.userId = this.userId;
|
|
||||||
this.contextFactory = new ContextFactory(options.storage);
|
this.contextFactory = new ContextFactory(options.storage);
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.pipelineContext = this.contextFactory.getContext("pipeline", this.pipeline.id);
|
this.pipelineContext = this.contextFactory.getContext("pipeline", this.pipeline.id);
|
||||||
@@ -42,9 +48,16 @@ export class Executor {
|
|||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
const lastRuntime = await this.pipelineContext.getObj(`lastRuntime`);
|
const lastRuntime = await this.pipelineContext.getObj(`lastRuntime`);
|
||||||
|
this.lastRuntime = lastRuntime;
|
||||||
this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline);
|
this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async cancel() {
|
||||||
|
this.canceled = true;
|
||||||
|
this.runtime?.cancel(this.pipeline);
|
||||||
|
await this.onChanged(this.runtime);
|
||||||
|
}
|
||||||
|
|
||||||
async run(runtimeId: any = 0, triggerType: string) {
|
async run(runtimeId: any = 0, triggerType: string) {
|
||||||
try {
|
try {
|
||||||
await this.init();
|
await this.init();
|
||||||
@@ -52,10 +65,16 @@ export class Executor {
|
|||||||
// 读取last
|
// 读取last
|
||||||
this.runtime = new RunHistory(runtimeId, trigger, this.pipeline);
|
this.runtime = new RunHistory(runtimeId, trigger, this.pipeline);
|
||||||
this.logger.info(`pipeline.${this.pipeline.id} start`);
|
this.logger.info(`pipeline.${this.pipeline.id} start`);
|
||||||
|
await this.notification("start");
|
||||||
await this.runWithHistory(this.pipeline, "pipeline", async () => {
|
await this.runWithHistory(this.pipeline, "pipeline", async () => {
|
||||||
await this.runStages(this.pipeline);
|
await this.runStages(this.pipeline);
|
||||||
});
|
});
|
||||||
|
if (this.lastRuntime && this.lastRuntime.pipeline.status?.status === ResultType.error) {
|
||||||
|
await this.notification("turnToSuccess");
|
||||||
|
}
|
||||||
|
await this.notification("success");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
await this.notification("error", e);
|
||||||
this.logger.error("pipeline 执行失败", e);
|
this.logger.error("pipeline 执行失败", e);
|
||||||
} finally {
|
} finally {
|
||||||
await this.pipelineContext.setObj("lastRuntime", this.runtime);
|
await this.pipelineContext.setObj("lastRuntime", this.runtime);
|
||||||
@@ -88,17 +107,24 @@ export class Executor {
|
|||||||
return ResultType.skip;
|
return ResultType.skip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
const intervalFlushLogId = setInterval(async () => {
|
||||||
await run();
|
|
||||||
this.runtime.success(runnable);
|
|
||||||
await this.onChanged(this.runtime);
|
await this.onChanged(this.runtime);
|
||||||
|
}, 5000);
|
||||||
|
const timeout = runnable.timeout ?? 20 * 60 * 1000;
|
||||||
|
try {
|
||||||
|
if (this.canceled) {
|
||||||
|
throw new Error("task canceled");
|
||||||
|
}
|
||||||
|
await TimeoutPromise(run, timeout);
|
||||||
|
this.runtime.success(runnable);
|
||||||
return ResultType.success;
|
return ResultType.success;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
this.runtime.error(runnable, e);
|
this.runtime.error(runnable, e);
|
||||||
await this.onChanged(this.runtime);
|
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
this.runtime.finally(runnable);
|
this.runtime.finally(runnable);
|
||||||
|
clearInterval(intervalFlushLogId);
|
||||||
|
await this.onChanged(this.runtime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,27 +207,74 @@ export class Executor {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const context: any = {
|
const taskCtx: TaskInstanceContext = {
|
||||||
logger: this.runtime._loggers[step.id],
|
pipeline: this.pipeline,
|
||||||
accessService: this.accessService,
|
step,
|
||||||
pipelineContext: this.pipelineContext,
|
|
||||||
lastStatus,
|
lastStatus,
|
||||||
userContext: this.contextFactory.getContext("user", this.userId),
|
|
||||||
http: request,
|
http: request,
|
||||||
|
logger: this.runtime._loggers[step.id],
|
||||||
|
accessService: this.options.accessService,
|
||||||
|
emailService: this.options.emailService,
|
||||||
|
pipelineContext: this.pipelineContext,
|
||||||
|
userContext: this.contextFactory.getContext("user", this.options.userId),
|
||||||
|
fileStore: new FileStore({
|
||||||
|
scope: this.pipeline.id,
|
||||||
|
parent: this.runtime.id,
|
||||||
|
rootDir: this.options.fileRootDir,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
Decorator.inject(define.autowire, instance, context);
|
instance.setCtx(taskCtx);
|
||||||
|
|
||||||
await instance.onInstance();
|
await instance.onInstance();
|
||||||
await instance.execute();
|
await instance.execute();
|
||||||
|
|
||||||
if (instance.result.clearLastStatus) {
|
if (instance._result.clearLastStatus) {
|
||||||
this.lastStatusMap.clear();
|
this.lastStatusMap.clear();
|
||||||
}
|
}
|
||||||
//输出到output context
|
//输出到output context
|
||||||
_.forEach(define.output, (item, key) => {
|
_.forEach(define.output, (item, key) => {
|
||||||
step!.status!.output[key] = instance[key];
|
step.status!.output[key] = instance[key];
|
||||||
const stepOutputKey = `step.${step.id}.${key}`;
|
const stepOutputKey = `step.${step.id}.${key}`;
|
||||||
this.runtime.context[stepOutputKey] = instance[key];
|
this.runtime.context[stepOutputKey] = instance[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
step.status!.files = instance.getFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
async notification(when: NotificationWhen, error?: any) {
|
||||||
|
if (!this.pipeline.notifications) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let subject = "";
|
||||||
|
let content = "";
|
||||||
|
if (when === "start") {
|
||||||
|
subject = `【CertD】开始执行,${this.pipeline.title}, buildId:${this.runtime.id}`;
|
||||||
|
content = subject;
|
||||||
|
} else if (when === "success") {
|
||||||
|
subject = `【CertD】执行成功,${this.pipeline.title}, buildId:${this.runtime.id}`;
|
||||||
|
content = subject;
|
||||||
|
} else if (when === "turnToSuccess") {
|
||||||
|
subject = `【CertD】执行成功(错误转成功),${this.pipeline.title}, buildId:${this.runtime.id}`;
|
||||||
|
content = subject;
|
||||||
|
} else if (when === "error") {
|
||||||
|
subject = `【CertD】执行失败,${this.pipeline.title}, buildId:${this.runtime.id}`;
|
||||||
|
content = `<pre>${error.message}</pre>`;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const notification of this.pipeline.notifications) {
|
||||||
|
if (!notification.when.includes(when)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (notification.type === "email") {
|
||||||
|
this.options.emailService?.send({
|
||||||
|
userId: this.pipeline.userId,
|
||||||
|
subject,
|
||||||
|
content,
|
||||||
|
receivers: notification.options.receivers,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
50
packages/core/pipeline/src/core/file-store.ts
Normal file
50
packages/core/pipeline/src/core/file-store.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import { fileUtils } from "../utils/util.file";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import path from "path";
|
||||||
|
import fs from "fs";
|
||||||
|
|
||||||
|
export type FileStoreOptions = {
|
||||||
|
rootDir?: string;
|
||||||
|
scope: string;
|
||||||
|
parent: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class FileStore {
|
||||||
|
rootDir: string;
|
||||||
|
scope: string;
|
||||||
|
parent: string;
|
||||||
|
constructor(options?: FileStoreOptions) {
|
||||||
|
this.rootDir = fileUtils.getFileRootDir(options?.rootDir);
|
||||||
|
this.scope = options?.scope || "0";
|
||||||
|
this.parent = options?.parent || "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
readFile(filePath: string) {
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return fs.readFileSync(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
writeFile(filename: string, file: Buffer) {
|
||||||
|
const localPath = this.buildFilePath(filename);
|
||||||
|
|
||||||
|
fs.writeFileSync(localPath, file);
|
||||||
|
return localPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildFilePath(filename: string) {
|
||||||
|
const parentDir = path.join(this.rootDir, this.scope + "", this.parent + "", dayjs().format("YYYY-MM-DD"));
|
||||||
|
if (!fs.existsSync(parentDir)) {
|
||||||
|
fs.mkdirSync(parentDir, { recursive: true });
|
||||||
|
}
|
||||||
|
return path.join(parentDir, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteByParent(scope: string, parent: string) {
|
||||||
|
const dir = path.join(this.rootDir, scope, parent);
|
||||||
|
if (fs.existsSync(dir)) {
|
||||||
|
fs.unlinkSync(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,3 +2,4 @@ export * from "./executor";
|
|||||||
export * from "./run-history";
|
export * from "./run-history";
|
||||||
export * from "./context";
|
export * from "./context";
|
||||||
export * from "./storage";
|
export * from "./storage";
|
||||||
|
export * from "./file-store";
|
||||||
|
|||||||
@@ -92,6 +92,19 @@ export class RunHistory {
|
|||||||
this.logError(runnable, e);
|
this.logError(runnable, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cancel(runnable: Runnable) {
|
||||||
|
const now = new Date().getTime();
|
||||||
|
const status = runnable.status;
|
||||||
|
_.merge(status, {
|
||||||
|
status: ResultType.canceled,
|
||||||
|
endTime: now,
|
||||||
|
result: ResultType.canceled,
|
||||||
|
message: "用户取消",
|
||||||
|
});
|
||||||
|
|
||||||
|
this.log(runnable, "任务取消");
|
||||||
|
}
|
||||||
|
|
||||||
log(runnable: Runnable, text: string) {
|
log(runnable: Runnable, text: string) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this._loggers[runnable.id].info(`[${runnable.title}]<id:${runnable.id}> [${runnable.runnableType}]`, text);
|
this._loggers[runnable.id].info(`[${runnable.title}]<id:${runnable.id}> [${runnable.runnableType}]`, text);
|
||||||
@@ -119,25 +132,25 @@ export class RunnableCollection {
|
|||||||
this.collection = map;
|
this.collection = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private each<T extends Runnable>(list: T[], exec: (item: Runnable) => void) {
|
static each<T extends Runnable>(list: T[], exec: (item: Runnable) => void) {
|
||||||
list.forEach((item) => {
|
list.forEach((item) => {
|
||||||
exec(item);
|
exec(item);
|
||||||
if (item.runnableType === "pipeline") {
|
if (item.runnableType === "pipeline") {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.each<Stage>(item.stages, exec);
|
RunnableCollection.each<Stage>(item.stages, exec);
|
||||||
} else if (item.runnableType === "stage") {
|
} else if (item.runnableType === "stage") {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.each<Task>(item.tasks, exec);
|
RunnableCollection.each<Task>(item.tasks, exec);
|
||||||
} else if (item.runnableType === "task") {
|
} else if (item.runnableType === "task") {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.each<Step>(item.steps, exec);
|
RunnableCollection.each<Step>(item.steps, exec);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private toMap(pipeline: Pipeline) {
|
public toMap(pipeline: Pipeline) {
|
||||||
const map: RunnableMap = {};
|
const map: RunnableMap = {};
|
||||||
|
|
||||||
this.each(pipeline.stages, (item) => {
|
RunnableCollection.each(pipeline.stages, (item) => {
|
||||||
map[item.id] = item;
|
map[item.id] = item;
|
||||||
});
|
});
|
||||||
return map;
|
return map;
|
||||||
@@ -151,7 +164,7 @@ export class RunnableCollection {
|
|||||||
if (!this.pipeline) {
|
if (!this.pipeline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.each(this.pipeline.stages, (item) => {
|
RunnableCollection.each(this.pipeline.stages, (item) => {
|
||||||
item.status = undefined;
|
item.status = undefined;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { fileUtils } from "../utils/util.file";
|
||||||
|
|
||||||
|
|
||||||
export interface IStorage {
|
export interface IStorage {
|
||||||
get(scope: string, namespace: string, version: string, key: string): Promise<string | null>;
|
get(scope: string, namespace: string, version: string, key: string): Promise<string | null>;
|
||||||
@@ -12,15 +11,7 @@ export interface IStorage {
|
|||||||
export class FileStorage implements IStorage {
|
export class FileStorage implements IStorage {
|
||||||
root: string;
|
root: string;
|
||||||
constructor(rootDir?: string) {
|
constructor(rootDir?: string) {
|
||||||
if (rootDir == null) {
|
this.root = fileUtils.getFileRootDir(rootDir);
|
||||||
const userHome = process.env.HOME || process.env.USERPROFILE;
|
|
||||||
rootDir = userHome + "/.certd/storage/";
|
|
||||||
}
|
|
||||||
this.root = rootDir;
|
|
||||||
|
|
||||||
if (!fs.existsSync(this.root)) {
|
|
||||||
fs.mkdirSync(this.root, { recursive: true });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove(scope: string, namespace: string, version: string, key: string): Promise<void> {
|
async remove(scope: string, namespace: string, version: string, key: string): Promise<void> {
|
||||||
|
|||||||
@@ -55,22 +55,40 @@ export type Trigger = {
|
|||||||
type: string;
|
type: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type FileItem = {
|
||||||
|
id: string;
|
||||||
|
filename: string;
|
||||||
|
path: string;
|
||||||
|
};
|
||||||
export type Runnable = {
|
export type Runnable = {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
strategy?: RunnableStrategy;
|
strategy?: RunnableStrategy;
|
||||||
runnableType?: string; // pipeline, stage, task , step
|
runnableType?: string; // pipeline, stage, task , step
|
||||||
status?: HistoryResult;
|
status?: HistoryResult;
|
||||||
|
timeout?: number;
|
||||||
default?: {
|
default?: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type EmailOptions = {
|
||||||
|
receivers: string[];
|
||||||
|
};
|
||||||
|
export type NotificationWhen = "error" | "success" | "turnToSuccess" | "start";
|
||||||
|
export type NotificationType = "email" | "url";
|
||||||
|
export type Notification = {
|
||||||
|
type: NotificationType;
|
||||||
|
when: NotificationWhen[];
|
||||||
|
options: EmailOptions;
|
||||||
|
};
|
||||||
|
|
||||||
export type Pipeline = Runnable & {
|
export type Pipeline = Runnable & {
|
||||||
version?: number;
|
version?: number;
|
||||||
userId: any;
|
userId: any;
|
||||||
stages: Stage[];
|
stages: Stage[];
|
||||||
triggers: Trigger[];
|
triggers: Trigger[];
|
||||||
|
notifications: Notification[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Context = {
|
export type Context = {
|
||||||
@@ -88,6 +106,7 @@ export enum ResultType {
|
|||||||
start = "start",
|
start = "start",
|
||||||
success = "success",
|
success = "success",
|
||||||
error = "error",
|
error = "error",
|
||||||
|
canceled = "canceled",
|
||||||
skip = "skip",
|
skip = "skip",
|
||||||
none = "none",
|
none = "none",
|
||||||
}
|
}
|
||||||
@@ -101,6 +120,7 @@ export type HistoryResultGroup = {
|
|||||||
export type HistoryResult = {
|
export type HistoryResult = {
|
||||||
input: any;
|
input: any;
|
||||||
output: any;
|
output: any;
|
||||||
|
files?: FileItem[];
|
||||||
/**
|
/**
|
||||||
* 任务状态
|
* 任务状态
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
import "util";
|
||||||
export * from "./core";
|
export * from "./core";
|
||||||
export * from "./d.ts";
|
export * from "./d.ts";
|
||||||
export * from "./access";
|
export * from "./access";
|
||||||
export * from "./registry";
|
export * from "./registry";
|
||||||
export * from "./plugin";
|
export * from "./plugin";
|
||||||
export * from "./utils";
|
export * from "./utils";
|
||||||
export * from "./midway";
|
|
||||||
export * from "./context";
|
export * from "./context";
|
||||||
export * from "./decorator";
|
export * from "./decorator";
|
||||||
|
export * from "./service";
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
import { Config, Configuration, Inject, Logger } from "@midwayjs/decorator";
|
|
||||||
// @ts-ignore
|
|
||||||
import { ILogger } from "@midwayjs/logger";
|
|
||||||
import { IMidwayContainer, MidwayDecoratorService } from "@midwayjs/core";
|
|
||||||
|
|
||||||
// ... (see below) ...
|
|
||||||
@Configuration({
|
|
||||||
namespace: "pipeline",
|
|
||||||
//importConfigs: [join(__dirname, './config')],
|
|
||||||
})
|
|
||||||
export class PipelineConfiguration {
|
|
||||||
@Config()
|
|
||||||
// @ts-ignore
|
|
||||||
config;
|
|
||||||
@Logger()
|
|
||||||
// @ts-ignore
|
|
||||||
logger: ILogger;
|
|
||||||
|
|
||||||
@Inject()
|
|
||||||
// @ts-ignore
|
|
||||||
decoratorService: MidwayDecoratorService;
|
|
||||||
|
|
||||||
async onReady(container: IMidwayContainer) {
|
|
||||||
this.logger.info("pipeline install");
|
|
||||||
|
|
||||||
//this.implPropertyDecorator(container);
|
|
||||||
this.logger.info("pipeline installed");
|
|
||||||
}
|
|
||||||
|
|
||||||
// implPropertyDecorator(container: IMidwayContainer) {
|
|
||||||
// this.logger.info("初始化 property decorator");
|
|
||||||
// // 实现装饰器
|
|
||||||
// this.decoratorService.registerPropertyHandler(CLASS_INPUTS_KEY, (propertyName, meta) => {
|
|
||||||
// return undefined;
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// const autowireWhiteList: any = {
|
|
||||||
// logger: true,
|
|
||||||
// };
|
|
||||||
// this.decoratorService.registerPropertyHandler(CLASS_AUTOWIRE_KEY, (propertyName, meta) => {
|
|
||||||
// // eslint-disable-next-line no-debugger
|
|
||||||
// debugger;
|
|
||||||
// const className = meta.name;
|
|
||||||
// if (autowireWhiteList[className]) {
|
|
||||||
// //在白名单里面,注入
|
|
||||||
// return container.get(className);
|
|
||||||
// }
|
|
||||||
// this.logger.warn(`autowire failed:${className} class is not in white list`);
|
|
||||||
// return undefined;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// src/index.ts
|
|
||||||
export { PipelineConfiguration } from "./configuration";
|
|
||||||
// export * from './controller/user';
|
|
||||||
// export * from './controller/api';
|
|
||||||
// export * from './service/user';
|
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
import { Registrable } from "../registry";
|
import { Registrable } from "../registry";
|
||||||
import { FormItemProps } from "../d.ts";
|
import { FileItem, FormItemProps, Pipeline, Runnable, Step } from "../d.ts";
|
||||||
|
import { FileStore } from "../core/file-store";
|
||||||
|
import { Logger } from "log4js";
|
||||||
|
import { IAccessService } from "../access";
|
||||||
|
import { IEmailService } from "../service";
|
||||||
|
import { IContext } from "../core";
|
||||||
|
import { AxiosInstance } from "axios";
|
||||||
|
|
||||||
export enum ContextScope {
|
export enum ContextScope {
|
||||||
global,
|
global,
|
||||||
@@ -7,16 +13,11 @@ export enum ContextScope {
|
|||||||
runtime,
|
runtime,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Storage = {
|
|
||||||
scope: ContextScope;
|
|
||||||
path: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type TaskOutputDefine = {
|
export type TaskOutputDefine = {
|
||||||
title: string;
|
title: string;
|
||||||
value?: any;
|
value?: any;
|
||||||
storage?: Storage;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TaskInputDefine = FormItemProps;
|
export type TaskInputDefine = FormItemProps;
|
||||||
|
|
||||||
export type PluginDefine = Registrable & {
|
export type PluginDefine = Registrable & {
|
||||||
@@ -31,6 +32,12 @@ export type PluginDefine = Registrable & {
|
|||||||
autowire?: {
|
autowire?: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
reference?: {
|
||||||
|
src: string;
|
||||||
|
dest: string;
|
||||||
|
type: "computed";
|
||||||
|
}[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ITaskPlugin = {
|
export type ITaskPlugin = {
|
||||||
@@ -41,15 +48,66 @@ export type ITaskPlugin = {
|
|||||||
|
|
||||||
export type TaskResult = {
|
export type TaskResult = {
|
||||||
clearLastStatus?: boolean;
|
clearLastStatus?: boolean;
|
||||||
|
files?: FileItem[];
|
||||||
};
|
};
|
||||||
|
export type TaskInstanceContext = {
|
||||||
|
pipeline: Pipeline;
|
||||||
|
step: Step;
|
||||||
|
logger: Logger;
|
||||||
|
accessService: IAccessService;
|
||||||
|
emailService: IEmailService;
|
||||||
|
pipelineContext: IContext;
|
||||||
|
userContext: IContext;
|
||||||
|
http: AxiosInstance;
|
||||||
|
fileStore: FileStore;
|
||||||
|
lastStatus?: Runnable;
|
||||||
|
};
|
||||||
|
|
||||||
export abstract class AbstractTaskPlugin implements ITaskPlugin {
|
export abstract class AbstractTaskPlugin implements ITaskPlugin {
|
||||||
result: TaskResult = {};
|
_result: TaskResult = { clearLastStatus: false, files: [] };
|
||||||
|
ctx!: TaskInstanceContext;
|
||||||
clearLastStatus() {
|
clearLastStatus() {
|
||||||
this.result.clearLastStatus = true;
|
this._result.clearLastStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFiles() {
|
||||||
|
return this._result.files;
|
||||||
|
}
|
||||||
|
|
||||||
|
setCtx(ctx: TaskInstanceContext) {
|
||||||
|
this.ctx = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
randomFileId() {
|
||||||
|
return Math.random().toString(36).substring(2, 9);
|
||||||
|
}
|
||||||
|
linkFile(file: FileItem) {
|
||||||
|
this._result.files!.push({
|
||||||
|
...file,
|
||||||
|
id: this.randomFileId(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
saveFile(filename: string, file: Buffer) {
|
||||||
|
const filePath = this.ctx.fileStore.writeFile(filename, file);
|
||||||
|
this._result.files!.push({
|
||||||
|
id: this.randomFileId(),
|
||||||
|
filename,
|
||||||
|
path: filePath,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get pipeline() {
|
||||||
|
return this.ctx.pipeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
get step() {
|
||||||
|
return this.ctx.step;
|
||||||
|
}
|
||||||
|
|
||||||
async onInstance(): Promise<void> {
|
async onInstance(): Promise<void> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract execute(): Promise<void>;
|
abstract execute(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,11 @@ import { pluginRegistry } from "./registry";
|
|||||||
import { PluginDefine, TaskInputDefine, TaskOutputDefine } from "./api";
|
import { PluginDefine, TaskInputDefine, TaskOutputDefine } from "./api";
|
||||||
import { Decorator } from "../decorator";
|
import { Decorator } from "../decorator";
|
||||||
import { AUTOWIRE_KEY } from "../decorator";
|
import { AUTOWIRE_KEY } from "../decorator";
|
||||||
|
import "reflect-metadata";
|
||||||
// 提供一个唯一 key
|
// 提供一个唯一 key
|
||||||
export const PLUGIN_CLASS_KEY = "pipeline:plugin";
|
export const PLUGIN_CLASS_KEY = "pipeline:plugin";
|
||||||
|
|
||||||
export function IsTaskPlugin(define: PluginDefine): ClassDecorator {
|
export function IsTaskPlugin(define: PluginDefine): ClassDecorator {
|
||||||
console.log("IsTaskPlugin");
|
|
||||||
return (target: any) => {
|
return (target: any) => {
|
||||||
target = Decorator.target(target);
|
target = Decorator.target(target);
|
||||||
|
|
||||||
@@ -61,3 +60,11 @@ export function TaskOutput(output?: TaskOutputDefine): PropertyDecorator {
|
|||||||
Reflect.defineMetadata(PLUGIN_OUTPUT_KEY, output, target, propertyKey);
|
Reflect.defineMetadata(PLUGIN_OUTPUT_KEY, output, target, propertyKey);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const PLUGIN_DOWNLOAD_KEY = "pipeline:plugin:download";
|
||||||
|
export function TaskDownload(output?: TaskOutputDefine): PropertyDecorator {
|
||||||
|
return (target, propertyKey) => {
|
||||||
|
target = Decorator.target(target, propertyKey);
|
||||||
|
Reflect.defineMetadata(PLUGIN_DOWNLOAD_KEY, output, target, propertyKey);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ILogger } from "@midwayjs/logger";
|
|
||||||
import { ITaskPlugin } from "../api";
|
import { ITaskPlugin } from "../api";
|
||||||
import { IsTaskPlugin, TaskInput } from "../decorator";
|
import { IsTaskPlugin, TaskInput } from "../decorator";
|
||||||
import { Autowire } from "../../decorator";
|
import { Autowire } from "../../decorator";
|
||||||
@@ -17,10 +16,6 @@ export class EchoPlugin implements ITaskPlugin {
|
|||||||
})
|
})
|
||||||
test?: string;
|
test?: string;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
// @ts-ignore
|
|
||||||
logger: ILogger;
|
|
||||||
|
|
||||||
onInstance(): Promise<void> {
|
onInstance(): Promise<void> {
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
|
|||||||
10
packages/core/pipeline/src/service/email.ts
Normal file
10
packages/core/pipeline/src/service/email.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
export type EmailSend = {
|
||||||
|
userId: number;
|
||||||
|
subject: string;
|
||||||
|
content: string;
|
||||||
|
receivers: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface IEmailService {
|
||||||
|
send(email: EmailSend): Promise<void>;
|
||||||
|
}
|
||||||
1
packages/core/pipeline/src/service/index.ts
Normal file
1
packages/core/pipeline/src/service/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from "./email";
|
||||||
16
packages/core/pipeline/src/utils/util.file.ts
Normal file
16
packages/core/pipeline/src/utils/util.file.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import fs from "fs";
|
||||||
|
function getFileRootDir(rootDir?: string) {
|
||||||
|
if (rootDir == null) {
|
||||||
|
const userHome = process.env.HOME || process.env.USERPROFILE;
|
||||||
|
rootDir = userHome + "/.certd/storage/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fs.existsSync(rootDir)) {
|
||||||
|
fs.mkdirSync(rootDir, { recursive: true });
|
||||||
|
}
|
||||||
|
return rootDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const fileUtils = {
|
||||||
|
getFileRootDir,
|
||||||
|
};
|
||||||
13
packages/core/pipeline/src/utils/util.promise.ts
Normal file
13
packages/core/pipeline/src/utils/util.promise.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
export function TimeoutPromise(callback: () => Promise<void>, ms = 30 * 1000) {
|
||||||
|
let timeout: any;
|
||||||
|
return Promise.race([
|
||||||
|
callback(),
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
reject(new Error(`Task timeout in ${ms} ms`));
|
||||||
|
}, ms);
|
||||||
|
}),
|
||||||
|
]).finally(() => {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Autowire, ILogger, IsTaskPlugin, ITaskPlugin, TaskInput, TaskOutput } from "../src";
|
import { Autowire, IsTaskPlugin, ITaskPlugin, TaskInput, TaskOutput } from "../src";
|
||||||
|
|
||||||
@IsTaskPlugin({
|
@IsTaskPlugin({
|
||||||
name: "EchoPlugin",
|
name: "EchoPlugin",
|
||||||
@@ -14,9 +14,6 @@ export class EchoPlugin implements ITaskPlugin {
|
|||||||
})
|
})
|
||||||
cert!: any;
|
cert!: any;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
logger!: ILogger;
|
|
||||||
|
|
||||||
@TaskOutput({
|
@TaskOutput({
|
||||||
title: "cert info",
|
title: "cert info",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"importHelpers": false,
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "commonjs",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
@@ -13,8 +14,10 @@
|
|||||||
"lib": ["ESNext", "DOM"],
|
"lib": ["ESNext", "DOM"],
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"emitDecoratorMetadata": true,
|
"paths": {
|
||||||
"outDir": "./dist/ts"
|
"tslib" : ["./node_modules/tslib/tslib.d.ts"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue","test/**/*.ts"],
|
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue","test/**/*.ts","rollup.config.ts"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
import visualizer from "rollup-plugin-visualizer";
|
||||||
import typescript from "@rollup/plugin-typescript";
|
import typescript from "@rollup/plugin-typescript";
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [],
|
plugins: [],
|
||||||
build: {
|
build: {
|
||||||
|
target: "es2015",
|
||||||
lib: {
|
lib: {
|
||||||
entry: "src/index.ts",
|
entry: "src/index.ts",
|
||||||
name: "pipeline",
|
name: "CertdPipeline",
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
visualizer(),
|
||||||
typescript({
|
typescript({
|
||||||
target: "esnext",
|
target: "es2015",
|
||||||
rootDir: "src",
|
rootDir: "src",
|
||||||
declaration: true,
|
declaration: true,
|
||||||
declarationDir: "dist/d",
|
declarationDir: "dist/d",
|
||||||
@@ -19,15 +22,36 @@ export default defineConfig({
|
|||||||
allowSyntheticDefaultImports: true,
|
allowSyntheticDefaultImports: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
external: ["vue", "lodash", "dayjs", "@fast-crud/fast-crud"],
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
"log4js",
|
||||||
|
"@midwayjs/core",
|
||||||
|
"@midwayjs/decorator",
|
||||||
|
],
|
||||||
output: {
|
output: {
|
||||||
// Provide global variables to use in the UMD build
|
|
||||||
// for externalized deps
|
|
||||||
globals: {
|
globals: {
|
||||||
vue: "Vue",
|
vue: "Vue",
|
||||||
lodash: "_",
|
lodash: "_",
|
||||||
dayjs: "dayjs",
|
dayjs: "dayjs",
|
||||||
"@fast-crud/fast-crud": "FastCrud",
|
"@certd/plugin-cert": "CertdPluginCert",
|
||||||
|
"@certd/acme-client": "CertdAcmeClient",
|
||||||
|
"@certd/plugin-aliyun": "CertdPluginAliyun",
|
||||||
|
"@certd/plugin-host": "CertdPluginHost",
|
||||||
|
"@certd/plugin-huawei": "CertdPluginHuawei",
|
||||||
|
"@certd/plugin-util": "CertdPluginUtil",
|
||||||
|
log4js: "log4js",
|
||||||
|
"@midwayjs/core": "MidwayjsCore",
|
||||||
|
"@midwayjs/decorator": "MidwayjsDecorator",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/ban-ts-ignore": "off",
|
"@typescript-eslint/ban-ts-ignore": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
|||||||
2
packages/plugins/plugin-aliyun/.npmignore
Normal file
2
packages/plugins/plugin-aliyun/.npmignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
src
|
||||||
@@ -3,6 +3,46 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-aliyun
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-aliyun
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-aliyun
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* save files ([671d273](https://github.com/certd/certd/commit/671d273e2f9136d16896536b0ca127cf372f1619))
|
||||||
|
|
||||||
|
## [1.0.6](https://github.com/certd/certd/compare/v1.0.5...v1.0.6) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-aliyun
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/certd/certd/compare/v1.0.4...v1.0.5) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-aliyun
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/certd/certd/compare/v1.0.3...v1.0.4) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-aliyun
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/certd/certd/compare/v1.0.2...v1.0.3) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-aliyun
|
||||||
|
|
||||||
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @certd/plugin-aliyun
|
**Note:** Version bump only for package @certd/plugin-aliyun
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./src";
|
|
||||||
@@ -1,38 +1,39 @@
|
|||||||
{
|
{
|
||||||
"name": "@certd/plugin-aliyun",
|
"name": "@certd/plugin-aliyun",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "1.0.2",
|
"version": "1.1.4",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
"module": "./src/index.ts",
|
"module": "./src/index.ts",
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "./dist/plugin-aliyun.umd.js",
|
"main": "./dist/bundle.js",
|
||||||
"module": "./dist/plugin-aliyun.mjs",
|
"module": "./dist/bundle.mjs",
|
||||||
"types": "./dist/es/plugin-aliyun.d.ts"
|
"types": "./dist/d/index.d.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build1": "vue-tsc --noEmit && vite build",
|
||||||
|
"build": "rollup -c",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alicloud/cs20151215": "^3.0.3",
|
"@alicloud/cs20151215": "^3.0.3",
|
||||||
"@alicloud/openapi-client": "^0.4.0",
|
"@alicloud/openapi-client": "^0.4.0",
|
||||||
"@alicloud/pop-core": "^1.7.10",
|
"@alicloud/pop-core": "^1.7.10",
|
||||||
"@certd/acme-client": "^1.0.2",
|
|
||||||
"@certd/pipeline": "^1.0.2",
|
|
||||||
"@certd/plugin-cert": "^1.0.2",
|
|
||||||
"@certd/plugin-util": "^1.0.2",
|
|
||||||
"dayjs": "^1.11.6",
|
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"node-forge": "^0.10.0"
|
"node-forge": "^0.10.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alicloud/cs20151215": "^3.0.3",
|
"@certd/acme-client": "^1.1.4",
|
||||||
"@alicloud/openapi-client": "^0.4.0",
|
"@certd/pipeline": "^1.1.4",
|
||||||
"@alicloud/pop-core": "^1.7.10",
|
"@certd/plugin-cert": "^1.1.4",
|
||||||
|
"@certd/plugin-util": "^1.1.4",
|
||||||
"@midwayjs/core": "^3.0.0",
|
"@midwayjs/core": "^3.0.0",
|
||||||
"@midwayjs/decorator": "^3.0.0",
|
"@midwayjs/decorator": "^3.0.0",
|
||||||
|
"@rollup/plugin-commonjs": "^23.0.4",
|
||||||
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
"@types/chai": "^4.3.3",
|
"@types/chai": "^4.3.3",
|
||||||
"@types/lodash": "^4.14.186",
|
"@types/lodash": "^4.14.186",
|
||||||
"@types/mocha": "^10.0.0",
|
"@types/mocha": "^10.0.0",
|
||||||
@@ -40,17 +41,23 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
||||||
"@typescript-eslint/parser": "^5.38.1",
|
"@typescript-eslint/parser": "^5.38.1",
|
||||||
"chai": "^4.3.6",
|
"chai": "^4.3.6",
|
||||||
|
"dayjs": "^1.11.6",
|
||||||
"eslint": "^8.24.0",
|
"eslint": "^8.24.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-import": "^2.26.0",
|
"eslint-plugin-import": "^2.26.0",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
"log4js": "^6.7.1",
|
"log4js": "^6.7.1",
|
||||||
"mocha": "^10.1.0",
|
"mocha": "^10.1.0",
|
||||||
|
"rollup": "^3.7.4",
|
||||||
|
"rollup-plugin-typescript2": "^0.34.1",
|
||||||
|
"rollup-plugin-visualizer": "^5.8.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
|
"tslib": "^2.5.2",
|
||||||
"typescript": "^4.8.4",
|
"typescript": "^4.8.4",
|
||||||
"vite": "^3.1.0",
|
"vite": "^3.1.0",
|
||||||
"vue-tsc": "^0.38.9"
|
"vue-tsc": "^0.38.9"
|
||||||
},
|
},
|
||||||
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
|
"gitHead": "ecfcada8020661b922cbe4f4984d76efb7f2b3e3"
|
||||||
}
|
}
|
||||||
|
|||||||
43
packages/plugins/plugin-aliyun/rollup.config.js
Normal file
43
packages/plugins/plugin-aliyun/rollup.config.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const resolve = require("@rollup/plugin-node-resolve");
|
||||||
|
const commonjs = require("@rollup/plugin-commonjs");
|
||||||
|
//const Typescript = require("rollup-plugin-typescript2");
|
||||||
|
const Typescript = require("@rollup/plugin-typescript");
|
||||||
|
const json = require("@rollup/plugin-json");
|
||||||
|
const terser = require("@rollup/plugin-terser");
|
||||||
|
module.exports = {
|
||||||
|
input: "src/index.ts",
|
||||||
|
output: {
|
||||||
|
file: "dist/bundle.js",
|
||||||
|
format: "cjs",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// 解析第三方依赖
|
||||||
|
resolve(),
|
||||||
|
// 识别 commonjs 模式第三方依赖
|
||||||
|
commonjs(),
|
||||||
|
Typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
terser(),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export * from "./access";
|
export * from "./access/index";
|
||||||
export * from "./dns-provider";
|
export * from "./dns-provider/index";
|
||||||
export * from "./plugin";
|
export * from "./plugin/index";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { AbstractTaskPlugin, Autowire, IAccessService, ILogger, IsTaskPlugin, RunStrategy, TaskInput, utils } from "@certd/pipeline";
|
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, RunStrategy, TaskInput, utils } from "@certd/pipeline";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { ROAClient } from "@alicloud/pop-core";
|
import { ROAClient } from "@alicloud/pop-core";
|
||||||
import { AliyunAccess } from "../../access";
|
import { AliyunAccess } from "../../access";
|
||||||
import { K8sClient } from "@certd/plugin-util";
|
import { K8sClient } from "@certd/plugin-util";
|
||||||
import { appendTimeSuffix } from "../../utils";
|
import { appendTimeSuffix } from "../../utils/index";
|
||||||
import { CertInfo } from "@certd/plugin-cert";
|
import { CertInfo } from "@certd/plugin-cert";
|
||||||
|
|
||||||
@IsTaskPlugin({
|
@IsTaskPlugin({
|
||||||
@@ -103,11 +103,13 @@ export class DeployCertToAliyunAckIngressPlugin extends AbstractTaskPlugin {
|
|||||||
})
|
})
|
||||||
accessId!: string;
|
accessId!: string;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
accessService!: IAccessService;
|
accessService!: IAccessService;
|
||||||
@Autowire()
|
|
||||||
logger!: ILogger;
|
logger!: ILogger;
|
||||||
|
|
||||||
|
async onInstance(): Promise<void> {
|
||||||
|
this.accessService = this.ctx.accessService;
|
||||||
|
this.logger = this.ctx.logger;
|
||||||
|
}
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
console.log("开始部署证书到阿里云cdn");
|
console.log("开始部署证书到阿里云cdn");
|
||||||
const { regionId, ingressClass, clusterId, isPrivateIpAddress, cert } = this;
|
const { regionId, ingressClass, clusterId, isPrivateIpAddress, cert } = this;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AbstractTaskPlugin, Autowire, IAccessService, ILogger, IsTaskPlugin, RunStrategy, TaskInput } from "@certd/pipeline";
|
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import Core from "@alicloud/pop-core";
|
import Core from "@alicloud/pop-core";
|
||||||
import RPCClient from "@alicloud/pop-core";
|
import RPCClient from "@alicloud/pop-core";
|
||||||
@@ -17,7 +17,7 @@ import { AliyunAccess } from "../../access";
|
|||||||
export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
|
export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
|
||||||
@TaskInput({
|
@TaskInput({
|
||||||
title: "CDN加速域名",
|
title: "CDN加速域名",
|
||||||
helper: "你在阿里云上配置的CDN加速域名,比如certd.docmirror.cn",
|
helper: "你在阿里云上配置的CDN加速域名,比如:certd.docmirror.cn",
|
||||||
required: true,
|
required: true,
|
||||||
})
|
})
|
||||||
domainName!: string;
|
domainName!: string;
|
||||||
@@ -49,13 +49,13 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
|
|||||||
})
|
})
|
||||||
accessId!: string;
|
accessId!: string;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
accessService!: IAccessService;
|
accessService!: IAccessService;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
logger!: ILogger;
|
logger!: ILogger;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
||||||
async onInstance() {}
|
async onInstance() {
|
||||||
|
this.accessService = this.ctx.accessService;
|
||||||
|
this.logger = this.ctx.logger;
|
||||||
|
}
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
console.log("开始部署证书到阿里云cdn");
|
console.log("开始部署证书到阿里云cdn");
|
||||||
const access = (await this.accessService.getById(this.accessId)) as AliyunAccess;
|
const access = (await this.accessService.getById(this.accessId)) as AliyunAccess;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export * from "./deploy-to-cdn";
|
export * from "./deploy-to-cdn/index";
|
||||||
export * from "./deploy-to-ack-ingress";
|
export * from "./deploy-to-ack-ingress/index";
|
||||||
export * from "./upload-to-aliyun";
|
export * from "./upload-to-aliyun/index";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AbstractTaskPlugin, Autowire, IAccessService, IsTaskPlugin, RunStrategy, TaskInput, TaskOutput } from "@certd/pipeline";
|
import { AbstractTaskPlugin, IAccessService, IsTaskPlugin, RunStrategy, TaskInput, TaskOutput } from "@certd/pipeline";
|
||||||
import Core from "@alicloud/pop-core";
|
import Core from "@alicloud/pop-core";
|
||||||
import { AliyunAccess } from "../../access";
|
import { AliyunAccess } from "../../access";
|
||||||
import { appendTimeSuffix, checkRet, ZoneOptions } from "../../utils";
|
import { appendTimeSuffix, checkRet, ZoneOptions } from "../../utils";
|
||||||
@@ -59,14 +59,13 @@ export class UploadCertToAliyun extends AbstractTaskPlugin {
|
|||||||
})
|
})
|
||||||
aliyunCertId!: string;
|
aliyunCertId!: string;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
accessService!: IAccessService;
|
accessService!: IAccessService;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
logger!: Logger;
|
logger!: Logger;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
async onInstance() {
|
||||||
async onInstance() {}
|
this.accessService = this.ctx.accessService;
|
||||||
|
this.logger = this.ctx.logger;
|
||||||
|
}
|
||||||
|
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
console.log("开始部署证书到阿里云cdn");
|
console.log("开始部署证书到阿里云cdn");
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"importHelpers": false,
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "commonjs",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
@@ -12,7 +13,11 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["ESNext", "DOM"],
|
"lib": ["ESNext", "DOM"],
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"experimentalDecorators": true
|
"experimentalDecorators": true,
|
||||||
|
"paths": {
|
||||||
|
"tslib" : ["./node_modules/tslib/tslib.d.ts"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue","test/**/*.ts"],
|
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue","test/**/*.ts","rollup.config.ts"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
import visualizer from "rollup-plugin-visualizer";
|
||||||
|
import typescript from "@rollup/plugin-typescript";
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [],
|
plugins: [],
|
||||||
@@ -8,15 +11,45 @@ export default defineConfig({
|
|||||||
name: "pipeline",
|
name: "pipeline",
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ["vue", "lodash", "dayjs", "@fast-crud/fast-crud"],
|
plugins: [
|
||||||
|
// @ts-ignore
|
||||||
|
visualizer(),
|
||||||
|
// @ts-ignore
|
||||||
|
typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
output: {
|
output: {
|
||||||
// Provide global variables to use in the UMD build
|
|
||||||
// for externalized deps
|
|
||||||
globals: {
|
globals: {
|
||||||
vue: "Vue",
|
vue: "Vue",
|
||||||
"lodash": "_",
|
lodash: "_",
|
||||||
dayjs: "dayjs",
|
dayjs: "dayjs",
|
||||||
"@fast-crud/fast-crud": "FastCrud",
|
"@certd/plugin-cert": "CertdPluginCert",
|
||||||
|
"@certd/acme-client": "CertdAcmeClient",
|
||||||
|
"@certd/pipeline": "CertdPluginPipeline",
|
||||||
|
"@certd/plugin-aliyun": "CertdPluginAliyun",
|
||||||
|
"@certd/plugin-host": "CertdPluginHost",
|
||||||
|
"@certd/plugin-huawei": "CertdPluginHuawei",
|
||||||
|
"@certd/plugin-util": "CertdPluginUtil",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/ban-ts-ignore": "off",
|
"@typescript-eslint/ban-ts-ignore": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
|||||||
2
packages/plugins/plugin-all/.npmignore
Normal file
2
packages/plugins/plugin-all/.npmignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
src
|
||||||
@@ -3,6 +3,44 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-all
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-all
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-all
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-all
|
||||||
|
|
||||||
|
## [1.0.6](https://github.com/certd/certd/compare/v1.0.5...v1.0.6) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-all
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/certd/certd/compare/v1.0.4...v1.0.5) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-all
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/certd/certd/compare/v1.0.3...v1.0.4) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-all
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/certd/certd/compare/v1.0.2...v1.0.3) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-all
|
||||||
|
|
||||||
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @certd/plugin-all
|
**Note:** Version bump only for package @certd/plugin-all
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./src";
|
|
||||||
@@ -1,52 +1,52 @@
|
|||||||
{
|
{
|
||||||
"name": "@certd/plugin-all",
|
"name": "@certd/plugin-all",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "1.0.2",
|
"version": "1.1.4",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
"module": "./src/index.ts",
|
"module": "./src/index.ts",
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "./dist/plugin-all.umd.js",
|
"main": "./dist/bundle.js",
|
||||||
"module": "./dist/plugin-all.mjs",
|
"module": "./dist/bundle.mjs",
|
||||||
"types": "./dist/es/plugin-all.d.ts"
|
"types": "./dist/d/index.d.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build2": " vite build",
|
||||||
|
"build": "rollup -c",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"@certd/plugin-aliyun": "^1.0.2",
|
|
||||||
"@certd/plugin-cert": "^1.0.2",
|
|
||||||
"@certd/plugin-host": "^1.0.2",
|
|
||||||
"@certd/plugin-huawei": "^1.0.2",
|
|
||||||
"@certd/plugin-tencent": "^1.0.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alicloud/cs20151215": "^3.0.3",
|
"@certd/pipeline": "^1.1.4",
|
||||||
"@alicloud/openapi-client": "^0.4.0",
|
"@certd/plugin-aliyun": "^1.1.4",
|
||||||
"@alicloud/pop-core": "^1.7.10",
|
"@certd/plugin-cert": "^1.1.4",
|
||||||
"@certd/pipeline": "^1.0.2",
|
"@certd/plugin-host": "^1.1.4",
|
||||||
"@midwayjs/core": "^3.0.0",
|
"@certd/plugin-huawei": "^1.1.4",
|
||||||
"@midwayjs/decorator": "^3.0.0",
|
"@certd/plugin-tencent": "^1.1.4",
|
||||||
"@types/chai": "^4.3.3",
|
"@rollup/plugin-commonjs": "^23.0.4",
|
||||||
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
|
"@types/chai": "^4.3.5",
|
||||||
|
"@types/jest": "^26.0.24",
|
||||||
"@types/lodash": "^4.14.186",
|
"@types/lodash": "^4.14.186",
|
||||||
"@types/mocha": "^10.0.0",
|
|
||||||
"@types/node-forge": "^1.3.0",
|
"@types/node-forge": "^1.3.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
||||||
"@typescript-eslint/parser": "^5.38.1",
|
"@typescript-eslint/parser": "^5.38.1",
|
||||||
"chai": "^4.3.6",
|
|
||||||
"eslint": "^8.24.0",
|
"eslint": "^8.24.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-import": "^2.26.0",
|
"eslint-plugin-import": "^2.26.0",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"log4js": "^6.7.1",
|
"rollup": "^3.7.4",
|
||||||
"mocha": "^10.1.0",
|
"rollup-plugin-typescript2": "^0.34.1",
|
||||||
|
"rollup-plugin-visualizer": "^5.8.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
|
"tslib": "^2.5.2",
|
||||||
"typescript": "^4.8.4",
|
"typescript": "^4.8.4",
|
||||||
"vite": "^3.1.0",
|
"vite": "^3.1.0",
|
||||||
"vue-tsc": "^0.38.9"
|
"vue-tsc": "^0.38.9"
|
||||||
},
|
},
|
||||||
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
|
"gitHead": "ecfcada8020661b922cbe4f4984d76efb7f2b3e3"
|
||||||
}
|
}
|
||||||
|
|||||||
43
packages/plugins/plugin-all/rollup.config.js
Normal file
43
packages/plugins/plugin-all/rollup.config.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const resolve = require("@rollup/plugin-node-resolve");
|
||||||
|
const commonjs = require("@rollup/plugin-commonjs");
|
||||||
|
//const Typescript = require("rollup-plugin-typescript2");
|
||||||
|
const Typescript = require("@rollup/plugin-typescript");
|
||||||
|
const json = require("@rollup/plugin-json");
|
||||||
|
const terser = require("@rollup/plugin-terser");
|
||||||
|
module.exports = {
|
||||||
|
input: "src/index.ts",
|
||||||
|
output: {
|
||||||
|
file: "dist/bundle.js",
|
||||||
|
format: "cjs",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// 解析第三方依赖
|
||||||
|
resolve(),
|
||||||
|
// 识别 commonjs 模式第三方依赖
|
||||||
|
commonjs(),
|
||||||
|
Typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
terser(),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -7,6 +7,7 @@ import "../../src";
|
|||||||
import "../plugin/echo-plugin";
|
import "../plugin/echo-plugin";
|
||||||
describe("pipeline-hauwei-test", function () {
|
describe("pipeline-hauwei-test", function () {
|
||||||
it("#pipeline", async function () {
|
it("#pipeline", async function () {
|
||||||
|
//@ts-ignore
|
||||||
this.timeout(120000);
|
this.timeout(120000);
|
||||||
async function onChanged(history: RunHistory) {
|
async function onChanged(history: RunHistory) {
|
||||||
console.log("changed:");
|
console.log("changed:");
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import "../plugin/echo-plugin";
|
|||||||
|
|
||||||
describe("pipeline", function () {
|
describe("pipeline", function () {
|
||||||
it("#pipeline", async function () {
|
it("#pipeline", async function () {
|
||||||
|
//@ts-ignore
|
||||||
this.timeout(120000);
|
this.timeout(120000);
|
||||||
async function onChanged(history: RunHistory) {
|
async function onChanged(history: RunHistory) {
|
||||||
console.log("changed:");
|
console.log("changed:");
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "commonjs",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
@@ -12,7 +12,10 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["ESNext", "DOM"],
|
"lib": ["ESNext", "DOM"],
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"experimentalDecorators": true
|
"experimentalDecorators": true,
|
||||||
|
"paths": {
|
||||||
|
"tslib" : ["./node_modules/tslib/tslib.d.ts"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue","test/**/*.ts"],
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue","test/**/*.ts"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,55 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
import visualizer from "rollup-plugin-visualizer";
|
||||||
|
import typescript from "@rollup/plugin-typescript";
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [],
|
plugins: [],
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
lib: {
|
||||||
entry: "src/index.ts",
|
entry: "src/index.ts",
|
||||||
name: "pipeline",
|
name: "CertdPluginAll",
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ["vue", "lodash", "dayjs", "@fast-crud/fast-crud"],
|
plugins: [
|
||||||
|
// @ts-ignore
|
||||||
|
visualizer(),
|
||||||
|
// @ts-ignore
|
||||||
|
typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
output: {
|
output: {
|
||||||
// Provide global variables to use in the UMD build
|
|
||||||
// for externalized deps
|
|
||||||
globals: {
|
globals: {
|
||||||
vue: "Vue",
|
vue: "Vue",
|
||||||
"lodash": "_",
|
lodash: "_",
|
||||||
dayjs: "dayjs",
|
dayjs: "dayjs",
|
||||||
"@fast-crud/fast-crud": "FastCrud",
|
"@certd/plugin-cert": "CertdPluginCert",
|
||||||
|
"@certd/acme-client": "CertdAcmeClient",
|
||||||
|
"@certd/pipeline": "CertdPluginPipeline",
|
||||||
|
"@certd/plugin-aliyun": "CertdPluginAliyun",
|
||||||
|
"@certd/plugin-host": "CertdPluginHost",
|
||||||
|
"@certd/plugin-huawei": "CertdPluginHuawei",
|
||||||
|
"@certd/plugin-util": "CertdPluginUtil",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/ban-ts-ignore": "off",
|
"@typescript-eslint/ban-ts-ignore": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
|||||||
2
packages/plugins/plugin-cert/.npmignore
Normal file
2
packages/plugins/plugin-cert/.npmignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
src
|
||||||
@@ -3,6 +3,51 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-cert
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-cert
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-cert
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* 修复access选择类型trigger ([2851a33](https://github.com/certd/certd/commit/2851a33eb2510f038fadb55da29512597a4ba512))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* save files ([99522fb](https://github.com/certd/certd/commit/99522fb49adb42c1dfdf7bec3dd52d641158285b))
|
||||||
|
* save files ([671d273](https://github.com/certd/certd/commit/671d273e2f9136d16896536b0ca127cf372f1619))
|
||||||
|
|
||||||
|
## [1.0.6](https://github.com/certd/certd/compare/v1.0.5...v1.0.6) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-cert
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/certd/certd/compare/v1.0.4...v1.0.5) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-cert
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/certd/certd/compare/v1.0.3...v1.0.4) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-cert
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/certd/certd/compare/v1.0.2...v1.0.3) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-cert
|
||||||
|
|
||||||
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @certd/plugin-cert
|
**Note:** Version bump only for package @certd/plugin-cert
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./src";
|
|
||||||
@@ -1,23 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "@certd/plugin-cert",
|
"name": "@certd/plugin-cert",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "1.0.2",
|
"version": "1.1.4",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
"module": "./src/index.ts",
|
"module": "./src/index.ts",
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "./dist/plugin-cert.umd.js",
|
"main": "./dist/bundle.js",
|
||||||
"module": "./dist/plugin-cert.mjs",
|
"module": "./dist/bundle.mjs",
|
||||||
"types": "./dist/es/plugin-cert.d.ts"
|
"types": "./dist/d/index.d.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "rollup -c",
|
||||||
|
"build2": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@certd/acme-client": "^1.0.2",
|
"@certd/acme-client": "^1.1.4",
|
||||||
"@certd/pipeline": "^1.0.2",
|
"@certd/pipeline": "^1.1.4",
|
||||||
|
"jszip": "^3.10.1",
|
||||||
"node-forge": "^0.10.0"
|
"node-forge": "^0.10.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -26,6 +28,11 @@
|
|||||||
"@alicloud/pop-core": "^1.7.10",
|
"@alicloud/pop-core": "^1.7.10",
|
||||||
"@midwayjs/core": "^3.0.0",
|
"@midwayjs/core": "^3.0.0",
|
||||||
"@midwayjs/decorator": "^3.0.0",
|
"@midwayjs/decorator": "^3.0.0",
|
||||||
|
"@rollup/plugin-commonjs": "^23.0.4",
|
||||||
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
"@types/chai": "^4.3.3",
|
"@types/chai": "^4.3.3",
|
||||||
"@types/lodash": "^4.14.186",
|
"@types/lodash": "^4.14.186",
|
||||||
"@types/mocha": "^10.0.0",
|
"@types/mocha": "^10.0.0",
|
||||||
@@ -42,10 +49,13 @@
|
|||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"log4js": "^6.7.1",
|
"log4js": "^6.7.1",
|
||||||
"mocha": "^10.1.0",
|
"mocha": "^10.1.0",
|
||||||
|
"rollup": "^3.7.4",
|
||||||
|
"rollup-plugin-visualizer": "^5.8.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
|
"tslib": "^2.5.2",
|
||||||
"typescript": "^4.8.4",
|
"typescript": "^4.8.4",
|
||||||
"vite": "^3.1.0",
|
"vite": "^3.1.0",
|
||||||
"vue-tsc": "^0.38.9"
|
"vue-tsc": "^0.38.9"
|
||||||
},
|
},
|
||||||
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
|
"gitHead": "ecfcada8020661b922cbe4f4984d76efb7f2b3e3"
|
||||||
}
|
}
|
||||||
|
|||||||
43
packages/plugins/plugin-cert/rollup.config.js
Normal file
43
packages/plugins/plugin-cert/rollup.config.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const resolve = require("@rollup/plugin-node-resolve");
|
||||||
|
const commonjs = require("@rollup/plugin-commonjs");
|
||||||
|
//const Typescript = require("rollup-plugin-typescript2");
|
||||||
|
const Typescript = require("@rollup/plugin-typescript");
|
||||||
|
const json = require("@rollup/plugin-json");
|
||||||
|
const terser = require("@rollup/plugin-terser");
|
||||||
|
module.exports = {
|
||||||
|
input: "src/index.ts",
|
||||||
|
output: {
|
||||||
|
file: "dist/bundle.js",
|
||||||
|
format: "cjs",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// 解析第三方依赖
|
||||||
|
resolve(),
|
||||||
|
// 识别 commonjs 模式第三方依赖
|
||||||
|
commonjs(),
|
||||||
|
Typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
terser(),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
import { AbstractTaskPlugin, Autowire, HttpClient, IAccessService, IContext, IsTaskPlugin, RunStrategy, Step, TaskInput, TaskOutput } from "@certd/pipeline";
|
import { AbstractTaskPlugin, Decorator, HttpClient, IAccessService, IContext, IsTaskPlugin, RunStrategy, Step, TaskInput, TaskOutput } from "@certd/pipeline";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { AcmeService, CertInfo } from "./acme";
|
import { AcmeService, CertInfo } from "./acme";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { Logger } from "log4js";
|
import { Logger } from "log4js";
|
||||||
import { Decorator } from "@certd/pipeline/src/decorator";
|
|
||||||
import { DnsProviderDefine, dnsProviderRegistry } from "../../dns-provider";
|
import { DnsProviderDefine, dnsProviderRegistry } from "../../dns-provider";
|
||||||
import { CertReader } from "./cert-reader";
|
import { CertReader } from "./cert-reader";
|
||||||
|
import JSZip from "jszip";
|
||||||
export { CertReader };
|
export { CertReader };
|
||||||
export type { CertInfo };
|
export type { CertInfo };
|
||||||
|
|
||||||
@@ -73,6 +72,13 @@ export class CertApplyPlugin extends AbstractTaskPlugin {
|
|||||||
},
|
},
|
||||||
required: true,
|
required: true,
|
||||||
helper: "请选择dns解析提供商授权",
|
helper: "请选择dns解析提供商授权",
|
||||||
|
reference: [
|
||||||
|
{
|
||||||
|
src: "form.dnsProviderType",
|
||||||
|
dest: "component.type",
|
||||||
|
type: "computed",
|
||||||
|
},
|
||||||
|
],
|
||||||
})
|
})
|
||||||
dnsProviderAccess!: string;
|
dnsProviderAccess!: string;
|
||||||
|
|
||||||
@@ -102,22 +108,11 @@ export class CertApplyPlugin extends AbstractTaskPlugin {
|
|||||||
})
|
})
|
||||||
csrInfo: any;
|
csrInfo: any;
|
||||||
|
|
||||||
// @ts-ignore
|
acme!: AcmeService;
|
||||||
acme: AcmeService;
|
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
logger!: Logger;
|
logger!: Logger;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
userContext!: IContext;
|
userContext!: IContext;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
accessService!: IAccessService;
|
accessService!: IAccessService;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
http!: HttpClient;
|
http!: HttpClient;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
lastStatus!: Step;
|
lastStatus!: Step;
|
||||||
|
|
||||||
@TaskOutput({
|
@TaskOutput({
|
||||||
@@ -126,17 +121,23 @@ export class CertApplyPlugin extends AbstractTaskPlugin {
|
|||||||
cert?: CertInfo;
|
cert?: CertInfo;
|
||||||
|
|
||||||
async onInstance() {
|
async onInstance() {
|
||||||
|
this.accessService = this.ctx.accessService;
|
||||||
|
this.logger = this.ctx.logger;
|
||||||
|
this.userContext = this.ctx.userContext;
|
||||||
|
this.http = this.ctx.http;
|
||||||
|
this.lastStatus = this.ctx.lastStatus as Step;
|
||||||
|
|
||||||
this.acme = new AcmeService({ userContext: this.userContext, logger: this.logger });
|
this.acme = new AcmeService({ userContext: this.userContext, logger: this.logger });
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
const oldCert = await this.condition();
|
const oldCert = await this.condition();
|
||||||
if (oldCert != null) {
|
if (oldCert != null) {
|
||||||
return this.output(oldCert);
|
return await this.output(oldCert.toCertInfo());
|
||||||
}
|
}
|
||||||
const cert = await this.doCertApply();
|
const cert = await this.doCertApply();
|
||||||
if (cert != null) {
|
if (cert != null) {
|
||||||
this.output(cert.toCertInfo());
|
await this.output(cert.toCertInfo());
|
||||||
//清空后续任务的状态,让后续任务能够重新执行
|
//清空后续任务的状态,让后续任务能够重新执行
|
||||||
this.clearLastStatus();
|
this.clearLastStatus();
|
||||||
} else {
|
} else {
|
||||||
@@ -144,8 +145,17 @@ export class CertApplyPlugin extends AbstractTaskPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output(cert: CertInfo) {
|
async output(cert: CertInfo) {
|
||||||
this.cert = cert;
|
this.cert = cert;
|
||||||
|
await this.zipCert(cert);
|
||||||
|
}
|
||||||
|
|
||||||
|
async zipCert(cert: CertInfo) {
|
||||||
|
const zip = new JSZip();
|
||||||
|
zip.file("cert.crt", cert.crt);
|
||||||
|
zip.file("cert.key", cert.key);
|
||||||
|
const content = await zip.generateAsync({ type: "nodebuffer" });
|
||||||
|
this.saveFile("cert.zip", content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
export * from "./cert-plugin";
|
export * from "./cert-plugin";
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noImplicitAny": true,
|
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "commonjs",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
|
|||||||
@@ -1,22 +1,54 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
import visualizer from "rollup-plugin-visualizer";
|
||||||
|
import typescript from "@rollup/plugin-typescript";
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [],
|
plugins: [],
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
lib: {
|
||||||
entry: "src/index.ts",
|
entry: "src/index.ts",
|
||||||
name: "pipeline",
|
name: "CertdPluginCert",
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ["vue", "lodash", "dayjs", "@fast-crud/fast-crud"],
|
plugins: [
|
||||||
|
// @ts-ignore
|
||||||
|
visualizer(),
|
||||||
|
// @ts-ignore
|
||||||
|
typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
output: {
|
output: {
|
||||||
// Provide global variables to use in the UMD build
|
|
||||||
// for externalized deps
|
|
||||||
globals: {
|
globals: {
|
||||||
vue: "Vue",
|
vue: "Vue",
|
||||||
"lodash": "_",
|
lodash: "_",
|
||||||
dayjs: "dayjs",
|
dayjs: "dayjs",
|
||||||
"@fast-crud/fast-crud": "FastCrud",
|
"@certd/plugin-cert": "CertdPluginCert",
|
||||||
|
"@certd/acme-client": "CertdAcmeClient",
|
||||||
|
"@certd/pipeline": "CertdPluginPipeline",
|
||||||
|
"@certd/plugin-aliyun": "CertdPluginAliyun",
|
||||||
|
"@certd/plugin-host": "CertdPluginHost",
|
||||||
|
"@certd/plugin-huawei": "CertdPluginHuawei",
|
||||||
|
"@certd/plugin-util": "CertdPluginUtil",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/ban-ts-ignore": "off",
|
"@typescript-eslint/ban-ts-ignore": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
|||||||
2
packages/plugins/plugin-host/.npmignore
Normal file
2
packages/plugins/plugin-host/.npmignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
src
|
||||||
@@ -3,6 +3,46 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-host
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-host
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-host
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* save files ([671d273](https://github.com/certd/certd/commit/671d273e2f9136d16896536b0ca127cf372f1619))
|
||||||
|
|
||||||
|
## [1.0.6](https://github.com/certd/certd/compare/v1.0.5...v1.0.6) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-host
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/certd/certd/compare/v1.0.4...v1.0.5) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-host
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/certd/certd/compare/v1.0.3...v1.0.4) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-host
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/certd/certd/compare/v1.0.2...v1.0.3) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-host
|
||||||
|
|
||||||
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @certd/plugin-host
|
**Note:** Version bump only for package @certd/plugin-host
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./src";
|
|
||||||
@@ -1,23 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "@certd/plugin-host",
|
"name": "@certd/plugin-host",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "1.0.2",
|
"version": "1.1.4",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
"module": "./src/index.ts",
|
"module": "./src/index.ts",
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "./dist/plugin-host.umd.js",
|
"main": "./dist/bundle.js",
|
||||||
"module": "./dist/plugin-host.mjs",
|
"module": "./dist/bundle.mjs",
|
||||||
"types": "./dist/es/plugin-host.d.ts"
|
"types": "./dist/d/index.d.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "rollup -c",
|
||||||
|
"build2": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@certd/pipeline": "^1.0.2",
|
"@certd/pipeline": "^1.1.4",
|
||||||
"@certd/plugin-cert": "^1.0.2",
|
"@certd/plugin-cert": "^1.1.4",
|
||||||
"ssh2": "^0.8.9"
|
"ssh2": "^0.8.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -26,6 +27,11 @@
|
|||||||
"@alicloud/pop-core": "^1.7.10",
|
"@alicloud/pop-core": "^1.7.10",
|
||||||
"@midwayjs/core": "^3.0.0",
|
"@midwayjs/core": "^3.0.0",
|
||||||
"@midwayjs/decorator": "^3.0.0",
|
"@midwayjs/decorator": "^3.0.0",
|
||||||
|
"@rollup/plugin-commonjs": "^23.0.4",
|
||||||
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
"@types/chai": "^4.3.3",
|
"@types/chai": "^4.3.3",
|
||||||
"@types/lodash": "^4.14.186",
|
"@types/lodash": "^4.14.186",
|
||||||
"@types/mocha": "^10.0.0",
|
"@types/mocha": "^10.0.0",
|
||||||
@@ -43,10 +49,13 @@
|
|||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
"log4js": "^6.3.0",
|
"log4js": "^6.3.0",
|
||||||
"mocha": "^10.1.0",
|
"mocha": "^10.1.0",
|
||||||
|
"rollup": "^3.7.4",
|
||||||
|
"rollup-plugin-visualizer": "^5.8.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
|
"tslib": "^2.5.2",
|
||||||
"typescript": "^4.8.4",
|
"typescript": "^4.8.4",
|
||||||
"vite": "^3.1.0",
|
"vite": "^3.1.0",
|
||||||
"vue-tsc": "^0.38.9"
|
"vue-tsc": "^0.38.9"
|
||||||
},
|
},
|
||||||
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
|
"gitHead": "ecfcada8020661b922cbe4f4984d76efb7f2b3e3"
|
||||||
}
|
}
|
||||||
|
|||||||
43
packages/plugins/plugin-host/rollup.config.js
Normal file
43
packages/plugins/plugin-host/rollup.config.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const resolve = require("@rollup/plugin-node-resolve");
|
||||||
|
const commonjs = require("@rollup/plugin-commonjs");
|
||||||
|
//const Typescript = require("rollup-plugin-typescript2");
|
||||||
|
const Typescript = require("@rollup/plugin-typescript");
|
||||||
|
const json = require("@rollup/plugin-json");
|
||||||
|
const terser = require("@rollup/plugin-terser");
|
||||||
|
module.exports = {
|
||||||
|
input: "src/index.ts",
|
||||||
|
output: {
|
||||||
|
file: "dist/bundle.js",
|
||||||
|
format: "cjs",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// 解析第三方依赖
|
||||||
|
resolve(),
|
||||||
|
// 识别 commonjs 模式第三方依赖
|
||||||
|
commonjs(),
|
||||||
|
Typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
terser(),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -61,6 +61,9 @@ export class SshClient {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.connect({
|
this.connect({
|
||||||
connectConf,
|
connectConf,
|
||||||
|
onError(err: any) {
|
||||||
|
reject(err);
|
||||||
|
},
|
||||||
onReady: (conn: any) => {
|
onReady: (conn: any) => {
|
||||||
conn.exec(script, (err: Error, stream: any) => {
|
conn.exec(script, (err: Error, stream: any) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -98,6 +101,10 @@ export class SshClient {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.connect({
|
this.connect({
|
||||||
connectConf,
|
connectConf,
|
||||||
|
onError: (err: any) => {
|
||||||
|
this.logger.error(err);
|
||||||
|
reject(err);
|
||||||
|
},
|
||||||
onReady: (conn: any) => {
|
onReady: (conn: any) => {
|
||||||
conn.shell((err: Error, stream: any) => {
|
conn.shell((err: Error, stream: any) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -122,10 +129,13 @@ export class SshClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(options: { connectConf: any; onReady: any }) {
|
connect(options: { connectConf: any; onReady: any; onError: any }) {
|
||||||
const { connectConf, onReady } = options;
|
const { connectConf, onReady, onError } = options;
|
||||||
const conn = new ssh2.Client();
|
const conn = new ssh2.Client();
|
||||||
conn
|
conn
|
||||||
|
.on("error", (err: any) => {
|
||||||
|
onError(err);
|
||||||
|
})
|
||||||
.on("ready", () => {
|
.on("ready", () => {
|
||||||
this.logger.info("Client :: ready");
|
this.logger.info("Client :: ready");
|
||||||
onReady(conn);
|
onReady(conn);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AbstractTaskPlugin, Autowire, IAccessService, ILogger, IsTaskPlugin, RunStrategy, TaskInput } from "@certd/pipeline";
|
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||||
import { SshClient } from "../../lib/ssh";
|
import { SshClient } from "../../lib/ssh";
|
||||||
|
|
||||||
@IsTaskPlugin({
|
@IsTaskPlugin({
|
||||||
@@ -32,13 +32,12 @@ export class HostShellExecutePlugin extends AbstractTaskPlugin {
|
|||||||
})
|
})
|
||||||
script!: string;
|
script!: string;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
accessService!: IAccessService;
|
accessService!: IAccessService;
|
||||||
@Autowire()
|
|
||||||
logger!: ILogger;
|
logger!: ILogger;
|
||||||
|
async onInstance() {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
this.accessService = this.ctx.accessService;
|
||||||
async onInstance() {}
|
this.logger = this.ctx.logger;
|
||||||
|
}
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
const { script, accessId } = this;
|
const { script, accessId } = this;
|
||||||
const connectConf = await this.accessService.getById(accessId);
|
const connectConf = await this.accessService.getById(accessId);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AbstractTaskPlugin, Autowire, IAccessService, ILogger, IsTaskPlugin, RunStrategy, TaskInput, TaskOutput } from "@certd/pipeline";
|
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, RunStrategy, TaskInput, TaskOutput } from "@certd/pipeline";
|
||||||
import { SshClient } from "../../lib/ssh";
|
import { SshClient } from "../../lib/ssh";
|
||||||
import { CertInfo, CertReader } from "@certd/plugin-cert";
|
import { CertInfo, CertReader } from "@certd/plugin-cert";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
@@ -49,11 +49,6 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
|||||||
})
|
})
|
||||||
sudo!: boolean;
|
sudo!: boolean;
|
||||||
|
|
||||||
@Autowire()
|
|
||||||
accessService!: IAccessService;
|
|
||||||
@Autowire()
|
|
||||||
logger!: ILogger;
|
|
||||||
|
|
||||||
@TaskOutput({
|
@TaskOutput({
|
||||||
title: "证书保存路径",
|
title: "证书保存路径",
|
||||||
})
|
})
|
||||||
@@ -64,7 +59,13 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
|||||||
})
|
})
|
||||||
hostKeyPath!: string;
|
hostKeyPath!: string;
|
||||||
|
|
||||||
async onInstance() {}
|
accessService!: IAccessService;
|
||||||
|
logger!: ILogger;
|
||||||
|
|
||||||
|
async onInstance() {
|
||||||
|
this.accessService = this.ctx.accessService;
|
||||||
|
this.logger = this.ctx.logger;
|
||||||
|
}
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
const { crtPath, keyPath, cert, accessId, sudo } = this;
|
const { crtPath, keyPath, cert, accessId, sudo } = this;
|
||||||
const certReader = new CertReader(cert);
|
const certReader = new CertReader(cert);
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noImplicitAny": true,
|
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "commonjs",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
import visualizer from "rollup-plugin-visualizer";
|
||||||
|
import typescript from "@rollup/plugin-typescript";
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [],
|
plugins: [],
|
||||||
@@ -8,17 +10,45 @@ export default defineConfig({
|
|||||||
name: "pipeline",
|
name: "pipeline",
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ["vue", "lodash", "dayjs", "@fast-crud/fast-crud", "log4js", "lodash", "@certd/pipeline"],
|
plugins: [
|
||||||
|
// @ts-ignore
|
||||||
|
visualizer(),
|
||||||
|
// @ts-ignore
|
||||||
|
typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
output: {
|
output: {
|
||||||
// Provide global variables to use in the UMD build
|
|
||||||
// for externalized deps
|
|
||||||
globals: {
|
globals: {
|
||||||
vue: "Vue",
|
vue: "Vue",
|
||||||
lodash: "_",
|
lodash: "_",
|
||||||
dayjs: "dayjs",
|
dayjs: "dayjs",
|
||||||
"@fast-crud/fast-crud": "FastCrud",
|
"@certd/plugin-cert": "CertdPluginCert",
|
||||||
log4js: "log4js",
|
"@certd/acme-client": "CertdAcmeClient",
|
||||||
"@certd/pipeline": "pipeline",
|
"@certd/pipeline": "CertdPluginPipeline",
|
||||||
|
"@certd/plugin-aliyun": "CertdPluginAliyun",
|
||||||
|
"@certd/plugin-host": "CertdPluginHost",
|
||||||
|
"@certd/plugin-huawei": "CertdPluginHuawei",
|
||||||
|
"@certd/plugin-util": "CertdPluginUtil",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/ban-ts-ignore": "off",
|
"@typescript-eslint/ban-ts-ignore": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
|||||||
2
packages/plugins/plugin-huawei/.npmignore
Normal file
2
packages/plugins/plugin-huawei/.npmignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
src
|
||||||
@@ -3,6 +3,44 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-huawei
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-huawei
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-huawei
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-huawei
|
||||||
|
|
||||||
|
## [1.0.6](https://github.com/certd/certd/compare/v1.0.5...v1.0.6) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-huawei
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/certd/certd/compare/v1.0.4...v1.0.5) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-huawei
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/certd/certd/compare/v1.0.3...v1.0.4) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-huawei
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/certd/certd/compare/v1.0.2...v1.0.3) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-huawei
|
||||||
|
|
||||||
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @certd/plugin-huawei
|
**Note:** Version bump only for package @certd/plugin-huawei
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./src";
|
|
||||||
@@ -1,25 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "@certd/plugin-huawei",
|
"name": "@certd/plugin-huawei",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "1.0.2",
|
"version": "1.1.4",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
"module": "./src/index.ts",
|
"module": "./src/index.ts",
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "./dist/plugin-huawei.umd.js",
|
"main": "./dist/bundle.js",
|
||||||
"module": "./dist/plugin-huawei.mjs",
|
"module": "./dist/bundle.mjs",
|
||||||
"types": "./dist/es/plugin-huawei.d.ts"
|
"types": "./dist/d/index.d.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "rollup -c",
|
||||||
|
"build2": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@certd/acme-client": "^1.0.2",
|
"@certd/acme-client": "^1.1.4",
|
||||||
"@certd/pipeline": "^1.0.2",
|
"@certd/pipeline": "^1.1.4",
|
||||||
"@certd/plugin-cert": "^1.0.2",
|
"@certd/plugin-cert": "^1.1.4",
|
||||||
"@certd/plugin-util": "^1.0.2",
|
"@certd/plugin-util": "^1.1.4",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"dayjs": "^1.11.6",
|
"dayjs": "^1.11.6",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
@@ -31,6 +32,11 @@
|
|||||||
"@alicloud/pop-core": "^1.7.10",
|
"@alicloud/pop-core": "^1.7.10",
|
||||||
"@midwayjs/core": "^3.0.0",
|
"@midwayjs/core": "^3.0.0",
|
||||||
"@midwayjs/decorator": "^3.0.0",
|
"@midwayjs/decorator": "^3.0.0",
|
||||||
|
"@rollup/plugin-commonjs": "^23.0.4",
|
||||||
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
"@types/chai": "^4.3.3",
|
"@types/chai": "^4.3.3",
|
||||||
"@types/lodash": "^4.14.186",
|
"@types/lodash": "^4.14.186",
|
||||||
"@types/mocha": "^10.0.0",
|
"@types/mocha": "^10.0.0",
|
||||||
@@ -45,10 +51,13 @@
|
|||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"log4js": "^6.7.1",
|
"log4js": "^6.7.1",
|
||||||
"mocha": "^10.1.0",
|
"mocha": "^10.1.0",
|
||||||
|
"rollup": "^3.7.4",
|
||||||
|
"rollup-plugin-visualizer": "^5.8.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
|
"tslib": "^2.5.2",
|
||||||
"typescript": "^4.8.4",
|
"typescript": "^4.8.4",
|
||||||
"vite": "^3.1.0",
|
"vite": "^3.1.0",
|
||||||
"vue-tsc": "^0.38.9"
|
"vue-tsc": "^0.38.9"
|
||||||
},
|
},
|
||||||
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
|
"gitHead": "ecfcada8020661b922cbe4f4984d76efb7f2b3e3"
|
||||||
}
|
}
|
||||||
|
|||||||
43
packages/plugins/plugin-huawei/rollup.config.js
Normal file
43
packages/plugins/plugin-huawei/rollup.config.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const resolve = require("@rollup/plugin-node-resolve");
|
||||||
|
const commonjs = require("@rollup/plugin-commonjs");
|
||||||
|
//const Typescript = require("rollup-plugin-typescript2");
|
||||||
|
const Typescript = require("@rollup/plugin-typescript");
|
||||||
|
const json = require("@rollup/plugin-json");
|
||||||
|
const terser = require("@rollup/plugin-terser");
|
||||||
|
module.exports = {
|
||||||
|
input: "src/index.ts",
|
||||||
|
output: {
|
||||||
|
file: "dist/bundle.js",
|
||||||
|
format: "cjs",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// 解析第三方依赖
|
||||||
|
resolve(),
|
||||||
|
// 识别 commonjs 模式第三方依赖
|
||||||
|
commonjs(),
|
||||||
|
Typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
terser(),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noImplicitAny": true,
|
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "commonjs",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
import visualizer from "rollup-plugin-visualizer";
|
||||||
|
import typescript from "@rollup/plugin-typescript";
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [],
|
plugins: [],
|
||||||
@@ -8,15 +10,45 @@ export default defineConfig({
|
|||||||
name: "pipeline",
|
name: "pipeline",
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ["vue", "lodash", "dayjs", "@fast-crud/fast-crud"],
|
plugins: [
|
||||||
|
// @ts-ignore
|
||||||
|
visualizer(),
|
||||||
|
// @ts-ignore
|
||||||
|
typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
output: {
|
output: {
|
||||||
// Provide global variables to use in the UMD build
|
|
||||||
// for externalized deps
|
|
||||||
globals: {
|
globals: {
|
||||||
vue: "Vue",
|
vue: "Vue",
|
||||||
"lodash": "_",
|
lodash: "_",
|
||||||
dayjs: "dayjs",
|
dayjs: "dayjs",
|
||||||
"@fast-crud/fast-crud": "FastCrud",
|
"@certd/plugin-cert": "CertdPluginCert",
|
||||||
|
"@certd/acme-client": "CertdAcmeClient",
|
||||||
|
"@certd/pipeline": "CertdPluginPipeline",
|
||||||
|
"@certd/plugin-aliyun": "CertdPluginAliyun",
|
||||||
|
"@certd/plugin-host": "CertdPluginHost",
|
||||||
|
"@certd/plugin-huawei": "CertdPluginHuawei",
|
||||||
|
"@certd/plugin-util": "CertdPluginUtil",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/ban-ts-ignore": "off",
|
"@typescript-eslint/ban-ts-ignore": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
|||||||
2
packages/plugins/plugin-tencent/.npmignore
Normal file
2
packages/plugins/plugin-tencent/.npmignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
src
|
||||||
@@ -3,6 +3,46 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-tencent
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-tencent
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-tencent
|
||||||
|
|
||||||
|
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* save files ([671d273](https://github.com/certd/certd/commit/671d273e2f9136d16896536b0ca127cf372f1619))
|
||||||
|
|
||||||
|
## [1.0.6](https://github.com/certd/certd/compare/v1.0.5...v1.0.6) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-tencent
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/certd/certd/compare/v1.0.4...v1.0.5) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-tencent
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/certd/certd/compare/v1.0.3...v1.0.4) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-tencent
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/certd/certd/compare/v1.0.2...v1.0.3) (2023-05-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/plugin-tencent
|
||||||
|
|
||||||
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @certd/plugin-tencent
|
**Note:** Version bump only for package @certd/plugin-tencent
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./src";
|
|
||||||
@@ -1,24 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "@certd/plugin-tencent",
|
"name": "@certd/plugin-tencent",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "1.0.2",
|
"version": "1.1.4",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
"module": "./src/index.ts",
|
"module": "./src/index.ts",
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "./dist/plugin-tencent.umd.js",
|
"main": "./dist/bundle.js",
|
||||||
"module": "./dist/plugin-tencent.mjs",
|
"module": "./dist/bundle.mjs",
|
||||||
"types": "./dist/es/plugin-tencent.d.ts"
|
"types": "./dist/d/index.d.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "rollup -c",
|
||||||
|
"build2": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@certd/pipeline": "^1.0.2",
|
"@certd/pipeline": "^1.1.4",
|
||||||
"@certd/plugin-cert": "^1.0.2",
|
"@certd/plugin-cert": "^1.1.4",
|
||||||
"@certd/plugin-util": "^1.0.2",
|
"@certd/plugin-util": "^1.1.4",
|
||||||
"tencentcloud-sdk-nodejs": "^4.0.44"
|
"tencentcloud-sdk-nodejs": "^4.0.44"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -27,6 +28,11 @@
|
|||||||
"@alicloud/pop-core": "^1.7.10",
|
"@alicloud/pop-core": "^1.7.10",
|
||||||
"@midwayjs/core": "^3.0.0",
|
"@midwayjs/core": "^3.0.0",
|
||||||
"@midwayjs/decorator": "^3.0.0",
|
"@midwayjs/decorator": "^3.0.0",
|
||||||
|
"@rollup/plugin-commonjs": "^23.0.4",
|
||||||
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
"@types/chai": "^4.3.3",
|
"@types/chai": "^4.3.3",
|
||||||
"@types/lodash": "^4.14.186",
|
"@types/lodash": "^4.14.186",
|
||||||
"@types/mocha": "^10.0.0",
|
"@types/mocha": "^10.0.0",
|
||||||
@@ -44,10 +50,13 @@
|
|||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
"log4js": "^6.7.1",
|
"log4js": "^6.7.1",
|
||||||
"mocha": "^10.1.0",
|
"mocha": "^10.1.0",
|
||||||
|
"rollup": "^3.7.4",
|
||||||
|
"rollup-plugin-visualizer": "^5.8.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
|
"tslib": "^2.5.2",
|
||||||
"typescript": "^4.8.4",
|
"typescript": "^4.8.4",
|
||||||
"vite": "^3.1.0",
|
"vite": "^3.1.0",
|
||||||
"vue-tsc": "^0.38.9"
|
"vue-tsc": "^0.38.9"
|
||||||
},
|
},
|
||||||
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
|
"gitHead": "ecfcada8020661b922cbe4f4984d76efb7f2b3e3"
|
||||||
}
|
}
|
||||||
|
|||||||
43
packages/plugins/plugin-tencent/rollup.config.js
Normal file
43
packages/plugins/plugin-tencent/rollup.config.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const resolve = require("@rollup/plugin-node-resolve");
|
||||||
|
const commonjs = require("@rollup/plugin-commonjs");
|
||||||
|
//const Typescript = require("rollup-plugin-typescript2");
|
||||||
|
const Typescript = require("@rollup/plugin-typescript");
|
||||||
|
const json = require("@rollup/plugin-json");
|
||||||
|
const terser = require("@rollup/plugin-terser");
|
||||||
|
module.exports = {
|
||||||
|
input: "src/index.ts",
|
||||||
|
output: {
|
||||||
|
file: "dist/bundle.js",
|
||||||
|
format: "cjs",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// 解析第三方依赖
|
||||||
|
resolve(),
|
||||||
|
// 识别 commonjs 模式第三方依赖
|
||||||
|
commonjs(),
|
||||||
|
Typescript({
|
||||||
|
target: "esnext",
|
||||||
|
rootDir: "src",
|
||||||
|
declaration: true,
|
||||||
|
declarationDir: "dist/d",
|
||||||
|
exclude: ["./node_modules/**", "./src/**/*.vue"],
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
terser(),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
"vue",
|
||||||
|
"lodash",
|
||||||
|
"dayjs",
|
||||||
|
"@certd/acme-client",
|
||||||
|
"@certd/pipeline",
|
||||||
|
"@certd/plugin-cert",
|
||||||
|
"@certd/plugin-aliyun",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-huawei",
|
||||||
|
"@certd/plugin-host",
|
||||||
|
"@certd/plugin-tencent",
|
||||||
|
"@certd/plugin-util",
|
||||||
|
],
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user