add install base

This commit is contained in:
2025-05-17 03:32:38 +08:00
parent 717e434ce0
commit 035ddc248c
28 changed files with 667 additions and 260 deletions

View File

@@ -57,7 +57,7 @@ export class AppDownload {
const configDir = this.config.configDir;
this.config?.checkMounted();
const appsDir = this.config.configPath?.appsDir;
const pageDir = this.config.configPath?.pageDir;
const pagesDir = this.config.configPath?.pagesDir;
if (!id) {
throw new Error('应用名称不能为空');
}
@@ -69,7 +69,7 @@ export class AppDownload {
}
const appName = opts?.appName || id.split('/').pop();
if (type === 'web') {
args.push('-o', pageDir);
args.push('-o', pagesDir);
} else if (type === 'app') {
args.push('-o', path.join(appsDir, appName));
} else {
@@ -96,7 +96,7 @@ export class AppDownload {
const appName = opts?.appName || id.split('/').pop();
this.config?.checkMounted();
const appsDir = this.config.configPath?.appsDir;
const pageDir = this.config.configPath?.pageDir;
const pagesDir = this.config.configPath?.pagesDir;
if (!id) {
throw new Error('应用名称不能为空');
}
@@ -104,7 +104,7 @@ export class AppDownload {
let isDelete = false;
if (type === 'web') {
// 直接删除路径就行
const pagePath = path.join(pageDir, id);
const pagePath = path.join(pagesDir, id);
deletePath = pagePath;
} else if (type === 'app') {
const appPath = path.join(appsDir, appName);

View File

@@ -1,8 +1,9 @@
import fs from 'node:fs';
import path from 'node:path';
import { checkFileExists, AssistantConfig, AssistantConfigData } from '@/module/assistant/index.ts';
import { checkFileExists, AssistantConfig, AssistantConfigData, parseHomeArg, parseHelpArg } from '@/module/assistant/index.ts';
import { chalk } from '@/module/chalk.ts';
import { HttpsPem } from '@/module/assistant/https/sign.ts';
export { parseHomeArg, parseHelpArg };
export type AssistantInitOptions = {
path?: string;
init?: boolean;
@@ -30,7 +31,8 @@ export class AssistantInit extends AssistantConfig {
super.init();
} else {
super.init();
console.log(chalk.yellow('助手路径已存在'));
const assistantConfig = this;
console.log(chalk.yellow('助手路径已存在'), chalk.green(assistantConfig.configDir));
}
this.createAssistantConfig();
this.createEnvConfig();

View File

@@ -43,7 +43,7 @@ export class LocalProxy {
}
}
init() {
const frontAppDir = this.assistantConfig.configPath?.pageDir;
const frontAppDir = this.assistantConfig.configPath?.pagesDir;
if (frontAppDir) {
const userList = fs.readdirSync(frontAppDir);
const localProxyProxyList: ProxyType[] = [];

View File

@@ -8,7 +8,7 @@ const localProxy = new LocalProxy({
});
export const proxyRoute = async (req: http.IncomingMessage, res: http.ServerResponse) => {
const _assistantConfig = assistantConfig.getCacheAssistantConfig();
const appDir = assistantConfig.configPath?.pageDir;
const appDir = assistantConfig.configPath?.pagesDir;
const url = new URL(req.url, 'http://localhost');
const pathname = url.pathname;
if (pathname === '/' && _assistantConfig?.home) {