fix: metadata
This commit is contained in:
parent
8b7ecaa9b9
commit
1869164d3d
@ -155,7 +155,7 @@ export class SyncBase {
|
|||||||
let obj: Record<string, any> = {};
|
let obj: Record<string, any> = {};
|
||||||
const keys: string[] = [];
|
const keys: string[] = [];
|
||||||
for (let item of syncDirectory) {
|
for (let item of syncDirectory) {
|
||||||
const { registry, ignore = [], files = [], replace = {}, meta } = item;
|
const { registry, ignore = [], files = [], replace = {}, metadata } = item;
|
||||||
const cwd = this.#dir;
|
const cwd = this.#dir;
|
||||||
const glob_files = await glob(files, {
|
const glob_files = await glob(files, {
|
||||||
ignore: this.getIngore(ignore),
|
ignore: this.getIngore(ignore),
|
||||||
@ -183,8 +183,8 @@ export class SyncBase {
|
|||||||
_registryURL.pathname = pathname;
|
_registryURL.pathname = pathname;
|
||||||
keys.push(key);
|
keys.push(key);
|
||||||
obj[key] = { url: _registryURL.toString() };
|
obj[key] = { url: _registryURL.toString() };
|
||||||
if (meta) {
|
if (metadata) {
|
||||||
obj[key] = { ...obj[key], meta };
|
obj[key] = { ...obj[key], metadata };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ export type SyncConfigType = 'sync' | 'download' | 'upload' | 'none';
|
|||||||
export type SyncConfig = {
|
export type SyncConfig = {
|
||||||
type?: SyncConfigType; // 是否可以同步
|
type?: SyncConfigType; // 是否可以同步
|
||||||
url: string; // 文件具体的 url 的地址
|
url: string; // 文件具体的 url 的地址
|
||||||
meta?: Record<string, any>; // 元数据
|
metadata?: Record<string, any>; // 元数据
|
||||||
};
|
};
|
||||||
export type SyncDirectory = {
|
export type SyncDirectory = {
|
||||||
/**
|
/**
|
||||||
@ -16,7 +16,7 @@ export type SyncDirectory = {
|
|||||||
registry?: string;
|
registry?: string;
|
||||||
files?: string[];
|
files?: string[];
|
||||||
replace?: Record<string, string>;
|
replace?: Record<string, string>;
|
||||||
meta?: Record<string, any>;
|
metadata?: Record<string, any>;
|
||||||
};
|
};
|
||||||
export interface Config {
|
export interface Config {
|
||||||
name?: string; // 项目名称
|
name?: string; // 项目名称
|
||||||
|
@ -50,7 +50,7 @@ const syncUpload = new Command('upload')
|
|||||||
url: item.url,
|
url: item.url,
|
||||||
needHash: true,
|
needHash: true,
|
||||||
hash: item.hash,
|
hash: item.hash,
|
||||||
meta: item.meta ?? meta,
|
meta: item.metadata ?? meta,
|
||||||
});
|
});
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
if (res.data?.isNew) {
|
if (res.data?.isNew) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user