fix(deploy): set default version to 1.0.0 and generate key using nanoid; remove confirmation prompt
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
],
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||
"license": "MIT",
|
||||
"packageManager": "pnpm@10.30.2",
|
||||
"packageManager": "pnpm@10.31.0",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -43,18 +43,18 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@inquirer/prompts": "^8.3.0",
|
||||
"@kevisual/ai": "^0.0.24",
|
||||
"@kevisual/api": "^0.0.60",
|
||||
"@kevisual/ai": "^0.0.26",
|
||||
"@kevisual/api": "^0.0.62",
|
||||
"@kevisual/load": "^0.0.6",
|
||||
"@kevisual/local-app-manager": "^0.1.32",
|
||||
"@kevisual/logger": "^0.0.4",
|
||||
"@kevisual/query": "0.0.52",
|
||||
"@kevisual/router": "^0.0.84",
|
||||
"@kevisual/query": "0.0.53",
|
||||
"@kevisual/router": "^0.0.88",
|
||||
"@kevisual/types": "^0.0.12",
|
||||
"@kevisual/use-config": "^1.0.30",
|
||||
"@opencode-ai/plugin": "^1.2.14",
|
||||
"@types/bun": "^1.3.9",
|
||||
"@types/node": "^25.3.0",
|
||||
"@opencode-ai/plugin": "^1.2.21",
|
||||
"@types/bun": "^1.3.10",
|
||||
"@types/node": "^25.3.5",
|
||||
"@types/send": "^1.2.1",
|
||||
"@types/ws": "^8.18.1",
|
||||
"chalk": "^5.6.2",
|
||||
@@ -76,12 +76,12 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.997.0",
|
||||
"@aws-sdk/client-s3": "^3.1004.0",
|
||||
"@kevisual/js-filter": "^0.0.5",
|
||||
"@kevisual/oss": "^0.0.19",
|
||||
"@kevisual/oss": "^0.0.20",
|
||||
"@kevisual/video-tools": "^0.0.13",
|
||||
"@opencode-ai/sdk": "^1.2.14",
|
||||
"es-toolkit": "^1.44.0",
|
||||
"@opencode-ai/sdk": "^1.2.21",
|
||||
"es-toolkit": "^1.45.1",
|
||||
"eventemitter3": "^5.0.4",
|
||||
"lowdb": "^7.0.1",
|
||||
"lru-cache": "^11.2.6",
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"@kevisual/auth": "^2.0.3",
|
||||
"@kevisual/context": "^0.0.8",
|
||||
"@kevisual/use-config": "^1.0.30",
|
||||
"@opencode-ai/sdk": "^1.2.17",
|
||||
"@opencode-ai/sdk": "^1.2.21",
|
||||
"@types/busboy": "^1.5.4",
|
||||
"busboy": "^1.6.0",
|
||||
"eventemitter3": "^5.0.4",
|
||||
@@ -54,22 +54,23 @@
|
||||
"lowdb": "^7.0.1",
|
||||
"lru-cache": "^11.2.6",
|
||||
"micromatch": "^4.0.8",
|
||||
"nanoid": "^5.1.6",
|
||||
"pm2": "latest",
|
||||
"semver": "^7.7.4",
|
||||
"unstorage": "^1.17.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kevisual/api": "^0.0.62",
|
||||
"@kevisual/cnb": "^0.0.33",
|
||||
"@kevisual/cnb": "^0.0.37",
|
||||
"@kevisual/dts": "^0.0.4",
|
||||
"@kevisual/load": "^0.0.6",
|
||||
"@kevisual/logger": "^0.0.4",
|
||||
"@kevisual/query": "0.0.52",
|
||||
"@kevisual/query": "0.0.53",
|
||||
"@types/bun": "^1.3.10",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/jsonwebtoken": "^9.0.10",
|
||||
"@types/micromatch": "^4.0.10",
|
||||
"@types/node": "^25.3.3",
|
||||
"@types/node": "^25.3.5",
|
||||
"@types/semver": "^7.7.1",
|
||||
"chalk": "^5.6.2",
|
||||
"commander": "^14.0.3",
|
||||
|
||||
1632
pnpm-lock.yaml
generated
1632
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -4,13 +4,15 @@ import path from 'path';
|
||||
import fs from 'fs';
|
||||
import FormData from 'form-data';
|
||||
import { getBaseURL, query, storage } from '@/module/query.ts';
|
||||
import { input, confirm } from '@inquirer/prompts';
|
||||
import { confirm } from '@inquirer/prompts';
|
||||
import chalk from 'chalk';
|
||||
import { upload } from '@/module/download/upload.ts';
|
||||
import { getBufferHash, getHash } from '@/uitls/hash.ts';
|
||||
import { getHash } from '@/uitls/hash.ts';
|
||||
import { queryAppVersion } from '@/query/app-manager/query-app.ts';
|
||||
import { logger } from '@/module/logger.ts';
|
||||
import { getUsername } from './login.ts';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz', 8);
|
||||
/**
|
||||
* 获取package.json 中的 basename, version, user, appKey
|
||||
* @returns
|
||||
@@ -23,7 +25,7 @@ export const getPackageJson = (opts?: { version?: string; appKey?: string }) =>
|
||||
try {
|
||||
const packageJson = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
||||
const basename = packageJson.basename || '';
|
||||
const version = packageJson.version || '';
|
||||
const version = packageJson.version || '1.0.0';
|
||||
const app = packageJson.app;
|
||||
const userAppArry = basename.split('/');
|
||||
if (userAppArry.length <= 2 && !opts?.appKey) {
|
||||
@@ -41,7 +43,7 @@ const command = new Command('deploy')
|
||||
.argument('<filePath>', 'Path to the file to be uploaded, filepath or directory') // 定义文件路径参数
|
||||
.option('-v, --version <version>', 'verbose')
|
||||
.option('-k, --key <key>', 'key')
|
||||
.option('-y, --yes <yes>', 'yes')
|
||||
.option('-y, --yes <yes>', 'yes 已经去除')
|
||||
.option('-o, --org <org>', 'org')
|
||||
.option('-u, --update', 'load current app. set current version in product。 redis 缓存更新')
|
||||
.option('-s, --showBackend', 'show backend url, 部署的后端应用,显示执行的cli命令')
|
||||
@@ -49,25 +51,21 @@ const command = new Command('deploy')
|
||||
.option('--dir, --directory <directory>', '上传的prefix路径,默认为空,例如设置为static,则会上传到/${username}/resources/${key}/${version}/static/路径下')
|
||||
.action(async (filePath, options) => {
|
||||
try {
|
||||
let { version, key, yes, update, org, showBackend } = options;
|
||||
let { version, key, update, org, showBackend } = options;
|
||||
const dot = !!options.dot;
|
||||
const pkgInfo = getPackageJson({ version, appKey: key });
|
||||
if (!version && pkgInfo?.version) {
|
||||
version = pkgInfo?.version || '';
|
||||
version = pkgInfo?.version || '1.0.0';
|
||||
}
|
||||
if (!key && pkgInfo?.appKey) {
|
||||
key = pkgInfo?.appKey || '';
|
||||
}
|
||||
logger.debug('start deploy');
|
||||
if (!version) {
|
||||
version = await input({
|
||||
message: 'Enter your version:',
|
||||
});
|
||||
version = '1.0.0';
|
||||
}
|
||||
if (!key) {
|
||||
key = await input({
|
||||
message: 'Enter your key:',
|
||||
});
|
||||
key = nanoid(8);
|
||||
}
|
||||
const pwd = process.cwd();
|
||||
const directory = path.join(pwd, filePath);
|
||||
@@ -99,15 +97,6 @@ const command = new Command('deploy')
|
||||
}
|
||||
logger.debug('upload Files', _relativeFiles);
|
||||
logger.debug('upload Files Key', key, version);
|
||||
if (!yes) {
|
||||
// 确认是否上传
|
||||
const confirmed = await confirm({
|
||||
message: 'Do you want to upload these files?',
|
||||
});
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
let username = '';
|
||||
if (pkgInfo?.user) {
|
||||
username = pkgInfo.user;
|
||||
|
||||
Reference in New Issue
Block a user