diff --git a/README.md b/README.md index e643604..37f53b2 100644 --- a/README.md +++ b/README.md @@ -1,79 +1,20 @@
+ + + - -
- # @renzp/utils 一款零依赖、实用的Javascript/Typescript工具库 -## coverage - -> 由于使用的`bun test`无法生成`coverage`HTML文件,所以在此列一下`coverage` - -| File | % Funcs | % Lines | -| -------------------------------- | ------- | ------- | -| All files | 100.00 | 100.00 | -| src/_base.ts | 100.00 | 100.00 | -| src/array/createArray.ts | 100.00 | 100.00 | -| src/array/difference.ts | 100.00 | 100.00 | -| src/array/first.ts | 100.00 | 100.00 | -| src/array/flatten.ts | 100.00 | 100.00 | -| src/array/index.ts | 100.00 | 100.00 | -| src/array/last.ts | 100.00 | 100.00 | -| src/array/unique.ts | 100.00 | 100.00 | -| src/index.ts | 100.00 | 100.00 | -| src/is/index.ts | 100.00 | 100.00 | -| src/is/isArray.ts | 100.00 | 100.00 | -| src/is/isBigint.ts | 100.00 | 100.00 | -| src/is/isBoolean.ts | 100.00 | 100.00 | -| src/is/isDate.ts | 100.00 | 100.00 | -| src/is/isDef.ts | 100.00 | 100.00 | -| src/is/isFalsy.ts | 100.00 | 100.00 | -| src/is/isFunction.ts | 100.00 | 100.00 | -| src/is/isJson.ts | 100.00 | 100.00 | -| src/is/isMap.ts | 100.00 | 100.00 | -| src/is/isNull.ts | 100.00 | 100.00 | -| src/is/isNumber.ts | 100.00 | 100.00 | -| src/is/isObject.ts | 100.00 | 100.00 | -| src/is/isPrimitive.ts | 100.00 | 100.00 | -| src/is/isRefData.ts | 100.00 | 100.00 | -| src/is/isRegExp.ts | 100.00 | 100.00 | -| src/is/isSet.ts | 100.00 | 100.00 | -| src/is/isString.ts | 100.00 | 100.00 | -| src/is/isSymbol.ts | 100.00 | 100.00 | -| src/is/isTruth.ts | 100.00 | 100.00 | -| src/is/isUnDef.ts | 100.00 | 100.00 | -| src/is/isUndefined.ts | 100.00 | 100.00 | -| src/is/isWeakMap.ts | 100.00 | 100.00 | -| src/is/isWeakSet.ts | 100.00 | 100.00 | -| src/number/index.ts | 100.00 | 100.00 | -| src/number/numberSeparate.ts | 100.00 | 100.00 | -| src/object/index.ts | 100.00 | 100.00 | -| src/object/removeKey.ts | 100.00 | 100.00 | -| src/other/deepClone.ts | 100.00 | 100.00 | -| src/other/index.ts | 100.00 | 100.00 | -| src/other/radom.ts | 100.00 | 100.00 | -| src/other/uuid.ts | 100.00 | 100.00 | -| src/validator/emailValidator.ts | 100.00 | 100.00 | -| src/validator/idCardValidator.ts | 100.00 | 100.00 | -| src/validator/index.ts | 100.00 | 100.00 | -| src/validator/numberValidator.ts | 100.00 | 100.00 | -| src/validator/phoneValidator.ts | 100.00 | 100.00 | -| src/validator/telValidator.ts | 100.00 | 100.00 | -| src/validator/zhValidator.ts | 100.00 | 100.00 | -| src/window/copyText.ts | 100.00 | 100.00 | -| src/window/index.ts | 100.00 | 100.00 | -| test/happydom.ts | 100.00 | 100.00 | - ## 安装 ```sh diff --git a/coverage.md b/coverage.md new file mode 100644 index 0000000..6ba04c3 --- /dev/null +++ b/coverage.md @@ -0,0 +1,56 @@ +# coverage + +File | % Funcs | % Lines | Uncovered Line #s +----------------------------------|---------|---------|------------------- +All files | 100.00 | 100.00 | + src/_base.ts | 100.00 | 100.00 | + src/array/createArray.ts | 100.00 | 100.00 | + src/array/difference.ts | 100.00 | 100.00 | + src/array/first.ts | 100.00 | 100.00 | + src/array/flatten.ts | 100.00 | 100.00 | + src/array/index.ts | 100.00 | 100.00 | + src/array/last.ts | 100.00 | 100.00 | + src/array/unique.ts | 100.00 | 100.00 | + src/index.ts | 100.00 | 100.00 | + src/is/index.ts | 100.00 | 100.00 | + src/is/isArray.ts | 100.00 | 100.00 | + src/is/isBigint.ts | 100.00 | 100.00 | + src/is/isBoolean.ts | 100.00 | 100.00 | + src/is/isDate.ts | 100.00 | 100.00 | + src/is/isDef.ts | 100.00 | 100.00 | + src/is/isFalsy.ts | 100.00 | 100.00 | + src/is/isFunction.ts | 100.00 | 100.00 | + src/is/isJson.ts | 100.00 | 100.00 | + src/is/isMap.ts | 100.00 | 100.00 | + src/is/isNull.ts | 100.00 | 100.00 | + src/is/isNumber.ts | 100.00 | 100.00 | + src/is/isObject.ts | 100.00 | 100.00 | + src/is/isPrimitive.ts | 100.00 | 100.00 | + src/is/isRefData.ts | 100.00 | 100.00 | + src/is/isRegExp.ts | 100.00 | 100.00 | + src/is/isSet.ts | 100.00 | 100.00 | + src/is/isString.ts | 100.00 | 100.00 | + src/is/isSymbol.ts | 100.00 | 100.00 | + src/is/isTruth.ts | 100.00 | 100.00 | + src/is/isUnDef.ts | 100.00 | 100.00 | + src/is/isUndefined.ts | 100.00 | 100.00 | + src/is/isWeakMap.ts | 100.00 | 100.00 | + src/is/isWeakSet.ts | 100.00 | 100.00 | + src/number/index.ts | 100.00 | 100.00 | + src/number/numberSeparate.ts | 100.00 | 100.00 | + src/object/index.ts | 100.00 | 100.00 | + src/object/removeKey.ts | 100.00 | 100.00 | + src/other/deepClone.ts | 100.00 | 100.00 | + src/other/index.ts | 100.00 | 100.00 | + src/other/radom.ts | 100.00 | 100.00 | + src/other/uuid.ts | 100.00 | 100.00 | + src/validator/emailValidator.ts | 100.00 | 100.00 | + src/validator/idCardValidator.ts | 100.00 | 100.00 | + src/validator/index.ts | 100.00 | 100.00 | + src/validator/numberValidator.ts | 100.00 | 100.00 | + src/validator/phoneValidator.ts | 100.00 | 100.00 | + src/validator/telValidator.ts | 100.00 | 100.00 | + src/validator/zhValidator.ts | 100.00 | 100.00 | + src/window/copyText.ts | 100.00 | 100.00 | + src/window/index.ts | 100.00 | 100.00 | + test/happydom.ts | 100.00 | 100.00 | \ No newline at end of file diff --git a/coverage.svg b/coverage.svg new file mode 100644 index 0000000..2df66ab --- /dev/null +++ b/coverage.svg @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 65039d0..f6c407f 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -10,7 +10,7 @@ export default async () => { lastUpdated: true, metaChunk: true, rewrites: { - 'pages/guide/gettingStarted.md': 'index.md', + 'pages/guide/whatIs.md': 'index.md', 'pages/:category/:page.md': ':category/:page.md', }, head: [['link', { rel: 'icon', type: 'image/png', href: '/logo.png' }]], diff --git a/docs/pages/guide/index.ts b/docs/pages/guide/index.ts index aadc228..e97a117 100644 --- a/docs/pages/guide/index.ts +++ b/docs/pages/guide/index.ts @@ -1,8 +1,8 @@ export default { text: '简介', items: [ - { text: '什么是@renzp/utils?', link: '/guide/whatIs' }, - { text: '快速开始', link: '/' }, + { text: '什么是@renzp/utils?', link: '/' }, + { text: '快速开始', link: '/guide/gettingStarted' }, ], sort: 0, } diff --git a/docs/pages/guide/whatIs.md b/docs/pages/guide/whatIs.md index f254f6c..cbe51e7 100644 --- a/docs/pages/guide/whatIs.md +++ b/docs/pages/guide/whatIs.md @@ -1,63 +1,22 @@ -# 什么是@renzp/utils? + ++ + + + + + + + + + + + + + + +
`@renzp/utils`是一款零依赖、强类型、实用、ESM优先的Javascript/Typescript工具库。 - -## coverage - -> 由于使用的`bun test`无法生成`coverage`HTML文件,所以在此列一下`coverage` - - -| File | % Funcs | % Lines | -| -------------------------------- | ------- | ------- | -| All files | 100.00 | 100.00 | -| src/_base.ts | 100.00 | 100.00 | -| src/array/createArray.ts | 100.00 | 100.00 | -| src/array/difference.ts | 100.00 | 100.00 | -| src/array/first.ts | 100.00 | 100.00 | -| src/array/flatten.ts | 100.00 | 100.00 | -| src/array/index.ts | 100.00 | 100.00 | -| src/array/last.ts | 100.00 | 100.00 | -| src/array/unique.ts | 100.00 | 100.00 | -| src/index.ts | 100.00 | 100.00 | -| src/is/index.ts | 100.00 | 100.00 | -| src/is/isArray.ts | 100.00 | 100.00 | -| src/is/isBigint.ts | 100.00 | 100.00 | -| src/is/isBoolean.ts | 100.00 | 100.00 | -| src/is/isDate.ts | 100.00 | 100.00 | -| src/is/isDef.ts | 100.00 | 100.00 | -| src/is/isFalsy.ts | 100.00 | 100.00 | -| src/is/isFunction.ts | 100.00 | 100.00 | -| src/is/isJson.ts | 100.00 | 100.00 | -| src/is/isMap.ts | 100.00 | 100.00 | -| src/is/isNull.ts | 100.00 | 100.00 | -| src/is/isNumber.ts | 100.00 | 100.00 | -| src/is/isObject.ts | 100.00 | 100.00 | -| src/is/isPrimitive.ts | 100.00 | 100.00 | -| src/is/isRefData.ts | 100.00 | 100.00 | -| src/is/isRegExp.ts | 100.00 | 100.00 | -| src/is/isSet.ts | 100.00 | 100.00 | -| src/is/isString.ts | 100.00 | 100.00 | -| src/is/isSymbol.ts | 100.00 | 100.00 | -| src/is/isTruth.ts | 100.00 | 100.00 | -| src/is/isUnDef.ts | 100.00 | 100.00 | -| src/is/isUndefined.ts | 100.00 | 100.00 | -| src/is/isWeakMap.ts | 100.00 | 100.00 | -| src/is/isWeakSet.ts | 100.00 | 100.00 | -| src/number/index.ts | 100.00 | 100.00 | -| src/number/numberSeparate.ts | 100.00 | 100.00 | -| src/object/index.ts | 100.00 | 100.00 | -| src/object/removeKey.ts | 100.00 | 100.00 | -| src/other/deepClone.ts | 100.00 | 100.00 | -| src/other/index.ts | 100.00 | 100.00 | -| src/other/radom.ts | 100.00 | 100.00 | -| src/other/uuid.ts | 100.00 | 100.00 | -| src/validator/emailValidator.ts | 100.00 | 100.00 | -| src/validator/idCardValidator.ts | 100.00 | 100.00 | -| src/validator/index.ts | 100.00 | 100.00 | -| src/validator/numberValidator.ts | 100.00 | 100.00 | -| src/validator/phoneValidator.ts | 100.00 | 100.00 | -| src/validator/telValidator.ts | 100.00 | 100.00 | -| src/validator/zhValidator.ts | 100.00 | 100.00 | -| src/window/copyText.ts | 100.00 | 100.00 | -| src/window/index.ts | 100.00 | 100.00 | -| test/happydom.ts | 100.00 | 100.00 | \ No newline at end of file diff --git a/docs/public/coverage.svg b/docs/public/coverage.svg new file mode 100644 index 0000000..2df66ab --- /dev/null +++ b/docs/public/coverage.svg @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/package.json b/package.json index e93fed7..b35c887 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,7 @@ "description": "一款零依赖、实用的Javascript/Typescript工具库", "type": "module", "main": "dist/index.js", - "files": [ - "dist" - ], + "files": ["dist", "./coverage.svg"], "types": "dist/index.d.ts", "author": "renzp <1074720760.qq.com>", "repository": { @@ -17,9 +15,7 @@ "bugs": { "url": "https://github.com/renzp94/utils/issues" }, - "keywords": [ - "utils" - ], + "keywords": ["utils"], "license": "MIT", "publishConfig": { "registry": "https://registry.npmjs.org", @@ -32,7 +28,8 @@ "pub:all": "bun run scripts/pub-all.ts", "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", - "docs:preview": "vitepress preview docs" + "docs:preview": "vitepress preview docs", + "coverage": "bun run scripts/coverage.ts" }, "devDependencies": { "@biomejs/biome": "^1.7.0", diff --git a/scripts/common.ts b/scripts/common.ts index 253cc7a..e8dc6cf 100644 --- a/scripts/common.ts +++ b/scripts/common.ts @@ -67,3 +67,91 @@ export const jsrPublish = async () => { await Bun.$`git add jsr.json` return Bun.$`git commit -m "chore(jsr:${jsrConfig.version}): published"` } + +import path from 'node:path' + +export interface CoverageOptions { + label?: string + tagConfigs?: Array<{ ratio: number; color: string }> + outDir?: string +} + +export const coverage = async (options?: CoverageOptions): Promise