save registry
This commit is contained in:
parent
8b2313f817
commit
784aa6380e
@ -3,25 +3,12 @@
|
|||||||
"share": "public"
|
"share": "public"
|
||||||
},
|
},
|
||||||
"syncDirectory": [
|
"syncDirectory": [
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"src/components/a/**/*",
|
|
||||||
"src/lib/**/*",
|
|
||||||
"src/hooks/**/*"
|
|
||||||
],
|
|
||||||
"registry": "https://kevisual.xiongxiao.me/root/ai/code/registry",
|
|
||||||
"replace": {
|
|
||||||
"src/": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
"registry/**/*"
|
"registry/**/*"
|
||||||
],
|
],
|
||||||
"registry": "https://kevisual.xiongxiao.me/root/ai/code/registry",
|
"registry": "https://kevisual.xiongxiao.me/root/ai/code",
|
||||||
"replace": {
|
"replace": {}
|
||||||
"registry/": "components/b/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
21
libs/registry/registry/utils/random.ts
Normal file
21
libs/registry/registry/utils/random.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { customAlphabet } from 'nanoid';
|
||||||
|
|
||||||
|
export const letter = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
export const number = '0123456789';
|
||||||
|
const alphanumeric = `${letter}${number}`;
|
||||||
|
export const alphanumericWithDash = `${alphanumeric}-`;
|
||||||
|
export const uuid = customAlphabet(letter);
|
||||||
|
|
||||||
|
export const nanoid = customAlphabet(alphanumeric, 10);
|
||||||
|
|
||||||
|
export const nanoidWithDash = customAlphabet(alphanumericWithDash, 10);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建一个随机的 id,以字母开头的字符串
|
||||||
|
* @param number
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const randomId = (number: number) => {
|
||||||
|
const _letter = uuid(1);
|
||||||
|
return `${_letter}${nanoid(number)}`;
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user