@lntvow/utils 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +22 -8
- package/src/getRandom.ts +27 -0
- package/src/index.ts +1 -0
- package/.editorconfig +0 -14
- package/.eslintrc.cjs +0 -4
- package/.prettierrc.js +0 -8
- package/1.html +0 -14
- package/src/getRandomColor.js +0 -8
- package/src/index.js +0 -5
package/package.json
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lntvow/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "工具库",
|
|
5
|
-
"
|
|
6
|
-
"author": "lntvow",
|
|
5
|
+
"type": "module",
|
|
7
6
|
"license": "MIT",
|
|
7
|
+
"main": "src/index.ts",
|
|
8
|
+
"author": "lntvow",
|
|
9
|
+
"files": [
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
8
12
|
"devDependencies": {
|
|
9
|
-
"@lntvow/eslint-config": "^
|
|
10
|
-
"
|
|
13
|
+
"@lntvow/eslint-config": "^3.0.5",
|
|
14
|
+
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
15
|
+
"@rollup/plugin-terser": "^0.4.3",
|
|
16
|
+
"bumpp": "^9.1.1",
|
|
11
17
|
"commitizen": "^4.3.0",
|
|
12
|
-
"cz-conventional-changelog": "^3.3.0"
|
|
18
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
19
|
+
"rollup": "^3.25.2",
|
|
20
|
+
"rollup-plugin-dts": "^5.3.0",
|
|
21
|
+
"rollup-plugin-typescript2": "^0.35.0",
|
|
22
|
+
"typescript": "^5.1.3"
|
|
13
23
|
},
|
|
14
24
|
"config": {
|
|
15
25
|
"commitizen": {
|
|
16
26
|
"path": "node_modules/cz-conventional-changelog"
|
|
17
27
|
}
|
|
18
28
|
},
|
|
29
|
+
"eslintTypescript": "true",
|
|
19
30
|
"scripts": {
|
|
31
|
+
"dev": "rollup -cw",
|
|
32
|
+
"build": "pnpm build-dts && rollup -c && pnpm release",
|
|
33
|
+
"build-dts": "pnpm tsc -p tsconfig.build.json && rollup -c rollup.dts.config.js",
|
|
34
|
+
"commit": "git add . && git-cz && git push",
|
|
20
35
|
"rimraf": "rimraf ./node_modules/",
|
|
21
|
-
"commit": "git-cz",
|
|
22
36
|
"preinstall": "npx only-allow pnpm",
|
|
23
|
-
"release": "bumpp package.json
|
|
37
|
+
"release": "git add . && git commit -m 更新 && bumpp package.json --commit --no-tag --push && pnpm publish --access public"
|
|
24
38
|
}
|
|
25
39
|
}
|
package/src/getRandom.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 获取随机颜色
|
|
3
|
+
* @return {String} 颜色
|
|
4
|
+
*
|
|
5
|
+
* @example getRandomColor() => '#f36a38'
|
|
6
|
+
* */
|
|
7
|
+
|
|
8
|
+
export function getRandomColor() {
|
|
9
|
+
return `#${Math.random().toString(16).slice(2, 8).padEnd(6, '0')}`
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description 获取随机颜色
|
|
14
|
+
* @return {String} 颜色
|
|
15
|
+
*
|
|
16
|
+
* @example getRandomColor(10) => '#f36a38'
|
|
17
|
+
* */
|
|
18
|
+
|
|
19
|
+
export function getRandom(number: number) {
|
|
20
|
+
if (number > 11) {
|
|
21
|
+
} else {
|
|
22
|
+
return Math.random()
|
|
23
|
+
.toString()
|
|
24
|
+
.slice(2, number + 2)
|
|
25
|
+
.padEnd(6, '0')
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getRandom'
|
package/.editorconfig
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# https://editorconfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
indent_style = space
|
|
7
|
-
indent_size = 2
|
|
8
|
-
end_of_line = lf
|
|
9
|
-
insert_final_newline = true
|
|
10
|
-
trim_trailing_whitespace = true
|
|
11
|
-
|
|
12
|
-
[*.md]
|
|
13
|
-
insert_final_newline = false
|
|
14
|
-
trim_trailing_whitespace = false
|
package/.eslintrc.cjs
DELETED
package/.prettierrc.js
DELETED
package/1.html
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Document</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body></body>
|
|
10
|
-
<script type="module">
|
|
11
|
-
import a from './src/index.js'
|
|
12
|
-
console.log('a: ', a)
|
|
13
|
-
</script>
|
|
14
|
-
</html>
|
package/src/getRandomColor.js
DELETED