75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
import { TasksCommand } from 'https://esm.xiongxiao.me/@kevisual/task-command/mod.ts';
|
|
// import { TasksCommand } from '../../task-command/mod.ts';
|
|
const init = {
|
|
description: '安装依赖',
|
|
command: 'npm install -g @kevisual/cli --registry=https://registry.npmmirror.com',
|
|
afterCheck: 'added',
|
|
};
|
|
const init1 = {
|
|
description: '安装 pm2',
|
|
type: 'npm-install',
|
|
command: 'npm install -g pm2 --registry=https://registry.npmmirror.com',
|
|
before: 'pm2 -v',
|
|
};
|
|
const init2 = {
|
|
description: '安装 deno',
|
|
command: 'npm install -g deno --registry=https://registry.npmmirror.com',
|
|
type: 'npm-install',
|
|
before: 'deno -v',
|
|
beforeCheck: 'deno',
|
|
};
|
|
const init3 = {
|
|
description: '安装 bun',
|
|
type: 'npm-install',
|
|
command: 'npm install -g bun --registry=https://registry.npmmirror.com',
|
|
beforeCheck: 'bun -v',
|
|
};
|
|
|
|
// ===========================
|
|
// 安装talkshow的程序到本地
|
|
const talk = {
|
|
description: '设置默认的 base registry 地址 为 https://kevisual.silkyai.cn',
|
|
command: 'ev base -s https://kevisual.silkyai.cn',
|
|
};
|
|
const talkInit = {
|
|
description: '初始化一个助手客户端,生成配置文件。',
|
|
command: 'asst init',
|
|
};
|
|
const task1 = {
|
|
description: '下载前端应用 root/center 应用',
|
|
command: 'ev app download -i root/center -o assistant-app/page',
|
|
};
|
|
|
|
const task2 = {
|
|
description: '下载前端应用 root/talkshow-admin 应用',
|
|
command: 'ev app download -i root/talkshow-admin -o assistant-app/page',
|
|
};
|
|
|
|
const task3 = {
|
|
description: '安装后端应用 root/talkshow-code-center 应用',
|
|
command: 'ev app download -i root/talkshow-code-center -t app -o assistant-app/apps/talkshow-code-center',
|
|
};
|
|
|
|
// ===========================
|
|
|
|
const runTask1 = async () => {
|
|
const tasksCommand = new TasksCommand();
|
|
tasksCommand.addTask(init2);
|
|
const res = tasksCommand.runTask(init2.description);
|
|
console.log(res);
|
|
};
|
|
// runTask1();
|
|
const runTestTask = async () => {
|
|
const tasksCommand = new TasksCommand();
|
|
const task = {
|
|
description: 'test',
|
|
command: 'npm i -g rollup --registry=https://registry.npmmirror.com',
|
|
type: 'npm-install',
|
|
};
|
|
tasksCommand.addTask(task);
|
|
const res = tasksCommand.runTask(task.description);
|
|
console.log(res);
|
|
return res;
|
|
};
|
|
runTestTask();
|