diff --git a/package.json b/package.json
index 4fc871e..19aa6bb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@kevisual/cli",
- "version": "0.0.56-beta.4",
+ "version": "0.0.56",
"description": "envision command tools",
"main": "dist/app.mjs",
"type": "module",
diff --git a/src/command/deploy.ts b/src/command/deploy.ts
index a75a992..5098ae0 100644
--- a/src/command/deploy.ts
+++ b/src/command/deploy.ts
@@ -91,7 +91,7 @@ const command = new Command('deploy')
if (stat.isDirectory()) {
isDirectory = true;
const gPath = path.join(directory, '**/*');
- const files = await glob(gPath, { cwd: pwd, ignore: ['node_modules/**/*'], onlyFiles: true, dot });
+ const files = await glob(gPath, { cwd: pwd, ignore: ['node_modules/**/*', '.git/**/*', '.DS_Store'], onlyFiles: true, dot });
_relativeFiles = files.map((file) => path.relative(directory, file));
} else if (stat.isFile()) {
const filename = path.basename(directory);
diff --git a/src/command/publish.ts b/src/command/publish.ts
index cb43fe7..e4b9563 100644
--- a/src/command/publish.ts
+++ b/src/command/publish.ts
@@ -349,11 +349,26 @@ const deployLoadFn = async (id: string, fileKey: string, force = false, install
// devDependencies: [Object],
// dependencies: [Object]
// },
+ let appKey = '';
+ let version = '';
+ if (id && id.includes('/')) {
+ const [a, b] = id.split('/');
+ if (a) {
+ appKey = b || '1.0.0';
+ version = a;
+ id = '';
+ } else {
+ console.error(chalk.red('id format error, please use "version/appKey" format'));
+ return;
+ }
+ }
const res = await query.post({
path: 'micro-app',
key: 'deploy',
data: {
id: id,
+ version: version,
+ appKey: appKey,
key: fileKey,
force: force,
install: !!install,
diff --git a/src/command/sync/sync.ts b/src/command/sync/sync.ts
index e75c94b..89615f6 100644
--- a/src/command/sync/sync.ts
+++ b/src/command/sync/sync.ts
@@ -20,7 +20,7 @@ const syncUpload = new Command('upload')
.option('-d --dir
', '配置目录')
.option('-c --config ', '配置文件的名字', 'kevisual.json')
.option('-f --file ', '操作的对应的文件名')
- .description('上传项目')
+ .description('上传项目, 上传需要和registry的地址同步。')
.action(async (opts) => {
console.log('上传项目');
const sync = new SyncBase({ dir: opts.dir, baseURL: baseURL, configFilename: opts.config });
@@ -32,6 +32,8 @@ const syncUpload = new Command('upload')
...sync.config.metadata,
};
const filepath = sync.getRelativePath(opts.file);
+ const newInfos = [];
+
for (const item of syncList) {
if (!item.auth || !item.exist) {
nodonwArr.push(item);
@@ -54,15 +56,22 @@ const syncUpload = new Command('upload')
});
if (res.code === 200) {
if (res.data?.isNew) {
- logger.info('上传成功', item.key, chalk.green(item.url), chalk.green('文件上传'));
+ newInfos.push(['上传成功', item.key, chalk.green(item.url), chalk.green('文件上传')]);
} else if (res.data?.isNewMeta) {
- logger.info('上传成功', item.key, chalk.green(item.url), chalk.green('元数据更新'));
+ newInfos.push(['上传成功', item.key, chalk.green(item.url), chalk.green('元数据更新')]);
} else {
+ // 文件未更新
logger.info('上传成功', item.key, chalk.green(item.url), chalk.blue('文件未更新'));
}
}
logger.debug(res);
}
+ if (newInfos.length) {
+ logger.info('上传成功的文件\n');
+ newInfos.forEach((item) => {
+ logger.info(...item);
+ });
+ }
if (nodonwArr.length && !filepath) {
logger.warn('以下文件未上传\n', nodonwArr.map((item) => item.key).join(','));
}
diff --git a/src/module/download/install.ts b/src/module/download/install.ts
index 4647745..8223543 100644
--- a/src/module/download/install.ts
+++ b/src/module/download/install.ts
@@ -31,11 +31,12 @@ type Options = {
hash?: string;
[key: string]: any;
};
-export const fetchLink = async (url: string, opts?: Options) => {
+export const fetchLink = async (url: string = '', opts?: Options) => {
const token = process.env.KEVISUAL_TOKEN || storage.getItem('token');
const fetchURL = new URL(url);
const check = opts?.check ?? false;
- const setToken = opts?.setToken ?? true;
+ const isKevisual = !!url.includes('kevisual');
+ const setToken = opts?.setToken ?? isKevisual;
if (check) {
if (!url.startsWith(baseURL)) {
throw new Error('url must start with ' + baseURL);