@archoleat/validate-font-file-name 1.1.0 → 1.1.2
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/README.md +13 -38
- package/index.js +1 -1
- package/package.json +15 -26
package/README.md
CHANGED
|
@@ -23,53 +23,22 @@
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
25
25
|
```shell
|
|
26
|
-
# bun
|
|
27
26
|
bun i -D @archoleat/validate-font-file-name
|
|
28
27
|
```
|
|
29
28
|
|
|
30
|
-
```shell
|
|
31
|
-
# pnpm
|
|
32
|
-
pnpm i -D @archoleat/validate-font-file-name
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
```shell
|
|
36
|
-
# npm
|
|
37
|
-
npm i -D @archoleat/validate-font-file-name
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
```shell
|
|
41
|
-
# yarn
|
|
42
|
-
yarn add -D @archoleat/validate-font-file-name
|
|
43
|
-
```
|
|
44
|
-
|
|
45
29
|
## Usage
|
|
46
30
|
|
|
47
31
|
```js
|
|
48
32
|
import { validateFontFileName } from '@archoleat/validate-font-file-name';
|
|
49
33
|
|
|
50
|
-
const validFontFileName = 'src/fonts/OpenSans-Regular.woff2';
|
|
51
|
-
const invalidFontFileName = 'src/fonts/OpenSans.woff2';
|
|
52
|
-
|
|
53
|
-
// returns: true
|
|
54
|
-
console.log(await validateFontFileName(validFontFileName));
|
|
55
|
-
|
|
56
|
-
// returns: 'OpenSans.woff2' doesn't match with '/(^[A-Z][a-z]+([A-Z][a-z]+)?)-(Thin|Hairline|ExtraLight|UltraLight|Light|Regular|Medium|SemiBold|DemiBold|Bold|ExtraBold|UltraBold|Black|Heavy|ExtraBlack|UltraBlack)\.(otf|ttf|woff|woff2)$/'.
|
|
57
|
-
console.log(await validateFontFileName(invalidFontFileName));
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
or
|
|
61
|
-
|
|
62
|
-
```js
|
|
63
|
-
import { validateFontFileName } from '@archoleat/validate-font-file-name';
|
|
64
|
-
|
|
65
34
|
const validFontFileName = 'OpenSans-Regular.woff2';
|
|
66
35
|
const invalidFontFileName = 'OpenSans.woff2';
|
|
67
36
|
|
|
68
37
|
// returns: true
|
|
69
|
-
console.log(await validateFontFileName(validFontFileName));
|
|
38
|
+
console.log(await validateFontFileName({ file: validFontFileName }));
|
|
70
39
|
|
|
71
|
-
// returns: 'OpenSans.woff2' doesn't match with '/(^[A-Z][a-z]+([A-Z][a-z]+)?)-(Thin|Hairline|ExtraLight|UltraLight|Light|Regular|Medium|SemiBold|DemiBold|Bold|ExtraBold|UltraBold|Black|Heavy|ExtraBlack|UltraBlack)\.(otf|ttf|woff|woff2)$/'.
|
|
72
|
-
console.log(await validateFontFileName(invalidFontFileName));
|
|
40
|
+
// returns: {current time} [ERROR] 'OpenSans.woff2' doesn't match with '/(^[A-Z][a-z]+([A-Z][a-z]+)?)-(Thin|Hairline|ExtraLight|UltraLight|Light|Regular|Medium|SemiBold|DemiBold|Bold|ExtraBold|UltraBold|Black|Heavy|ExtraBlack|UltraBlack)\.(otf|ttf|woff|woff2)$/'.
|
|
41
|
+
console.log(await validateFontFileName({ file: invalidFontFileName }));
|
|
73
42
|
```
|
|
74
43
|
|
|
75
44
|
### Your Regex
|
|
@@ -86,10 +55,16 @@ const validFontFileName = 'OpenSans-regular';
|
|
|
86
55
|
const invalidFontFileName = 'OpenSans.woff2';
|
|
87
56
|
|
|
88
57
|
// returns: true
|
|
89
|
-
console.log(await validateFontFileName(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
58
|
+
console.log(await validateFontFileName({
|
|
59
|
+
file: validFontFileName,
|
|
60
|
+
regex: yourRegex,
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
// returns: {current time} [ERROR] 'OpenSans.woff2' doesn't match with '/OpenSans-regular/'.
|
|
64
|
+
console.log(await validateFontFileName({
|
|
65
|
+
file: invalidFontFileName,
|
|
66
|
+
regex: yourRegex,
|
|
67
|
+
}));
|
|
93
68
|
```
|
|
94
69
|
|
|
95
70
|
## Naming Convention
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parse as
|
|
1
|
+
import{parse as a}from"node:path";import{FONT_FILE_NAME_REGEX as n}from"@archoleat/reglib";import{error as m}from"@archoleat/notifier";const c=async o=>{const{file:s,regex:e=""}=o,t=a(s).base,r=typeof e=="string"&&e!==""?new RegExp(e):e||n;return r.test(t)?!0:(await m({message:`(${t}) doesn't match with (${r})`}),!1)};export{c as validateFontFileName};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archoleat/validate-font-file-name",
|
|
3
3
|
"description": "Checking font file names for standardization",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"email": "archoleat@gmail.com",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"homepage": "https://github.com/archoleat/validate-font-file-name#readme",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "
|
|
14
|
+
"url": "https://github.com/archoleat/validate-font-file-name.git"
|
|
15
15
|
},
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/archoleat/validate-font-file-name/issues"
|
|
@@ -29,19 +29,15 @@
|
|
|
29
29
|
"validate",
|
|
30
30
|
"validator"
|
|
31
31
|
],
|
|
32
|
-
"packageManager": "pnpm@9.
|
|
32
|
+
"packageManager": "pnpm@9.7.0",
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=20.0.0",
|
|
35
35
|
"pnpm": ">=9.0.0"
|
|
36
36
|
},
|
|
37
|
-
"volta": {
|
|
38
|
-
"node": "20.16.0",
|
|
39
|
-
"pnpm": "9.4.0"
|
|
40
|
-
},
|
|
41
37
|
"type": "module",
|
|
42
38
|
"types": "index.d.ts",
|
|
43
39
|
"imports": {
|
|
44
|
-
"#
|
|
40
|
+
"#app": "./src/app.ts"
|
|
45
41
|
},
|
|
46
42
|
"exports": {
|
|
47
43
|
".": "./index.js"
|
|
@@ -52,47 +48,40 @@
|
|
|
52
48
|
],
|
|
53
49
|
"scripts": {
|
|
54
50
|
"init": "pnpm i && husky",
|
|
55
|
-
"
|
|
56
|
-
"spec:coverage": "vitest run --coverage",
|
|
57
|
-
"build": "rollup -c rollup.config.ts --configPlugin typescript",
|
|
58
|
-
"release": "semantic-release",
|
|
59
|
-
"lint:editorconfig": "editorconfig-checker",
|
|
60
|
-
"lint:formatting": "prettier . --check",
|
|
61
|
-
"lint:md": "remark . --quiet --frail",
|
|
62
|
-
"lint:ts": "eslint src/index.ts --fix",
|
|
63
|
-
"prettify": "prettier . --write"
|
|
51
|
+
"build": "rollup -c rollup.config.ts --configPlugin typescript"
|
|
64
52
|
},
|
|
65
53
|
"dependencies": {
|
|
66
54
|
"@archoleat/notifier": "^1.0.0",
|
|
67
55
|
"@archoleat/reglib": "^1.1.0"
|
|
68
56
|
},
|
|
69
57
|
"devDependencies": {
|
|
70
|
-
"@archoleat/commitlint-define-config": "^1.0.
|
|
71
|
-
"@archoleat/eslint-flat-compatibility": "^1.1.
|
|
58
|
+
"@archoleat/commitlint-define-config": "^1.0.10",
|
|
59
|
+
"@archoleat/eslint-flat-compatibility": "^1.1.7",
|
|
72
60
|
"@archoleat/prettier-define-config": "^1.0.1",
|
|
73
|
-
"@archoleat/semantic-release-define-config": "^1.1.
|
|
61
|
+
"@archoleat/semantic-release-define-config": "^1.1.15",
|
|
74
62
|
"@commitlint/cli": "^19.4.0",
|
|
75
63
|
"@commitlint/config-conventional": "^19.2.2",
|
|
76
64
|
"@commitlint/types": "^19.0.3",
|
|
77
65
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
78
66
|
"@semantic-release/changelog": "^6.0.3",
|
|
79
67
|
"@semantic-release/git": "^10.0.1",
|
|
80
|
-
"@types/node": "^22.
|
|
68
|
+
"@types/node": "^22.5.0",
|
|
81
69
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
82
70
|
"@typescript-eslint/parser": "^7.18.0",
|
|
83
71
|
"@vitest/coverage-v8": "^2.0.5",
|
|
84
72
|
"conventional-changelog-conventionalcommits": "^8.0.0",
|
|
85
73
|
"editorconfig-checker": "^5.1.8",
|
|
86
74
|
"eslint": "^8.57.0",
|
|
75
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
87
76
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
88
77
|
"eslint-config-prettier": "^9.1.0",
|
|
89
78
|
"eslint-define-config": "^2.1.0",
|
|
90
|
-
"eslint-import-resolver-typescript": "^3.6.
|
|
79
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
91
80
|
"eslint-plugin-import": "^2.29.1",
|
|
92
|
-
"eslint-plugin-unicorn": "^
|
|
81
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
93
82
|
"git-pull-run": "^1.4.0",
|
|
94
83
|
"globals": "^15.9.0",
|
|
95
|
-
"husky": "^9.1.
|
|
84
|
+
"husky": "^9.1.5",
|
|
96
85
|
"lint-staged": "^15.2.9",
|
|
97
86
|
"prettier": "^3.3.3",
|
|
98
87
|
"remark": "15.0.1",
|
|
@@ -100,10 +89,10 @@
|
|
|
100
89
|
"remark-preset-lint-consistent": "^6.0.0",
|
|
101
90
|
"remark-preset-lint-markdown-style-guide": "^6.0.0",
|
|
102
91
|
"remark-preset-lint-recommended": "^7.0.0",
|
|
103
|
-
"rollup": "^4.
|
|
92
|
+
"rollup": "^4.21.1",
|
|
104
93
|
"rollup-plugin-dts": "^6.1.1",
|
|
105
94
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
106
|
-
"semantic-release": "^24.
|
|
95
|
+
"semantic-release": "^24.1.0",
|
|
107
96
|
"typescript": "^5.5.4",
|
|
108
97
|
"vitest": "^2.0.5"
|
|
109
98
|
}
|