@archoleat/validate-font-file-name 1.2.0 → 1.2.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 +14 -15
- package/index.d.ts +0 -11
- package/index.js +1 -1
- package/package.json +30 -36
package/README.md
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
|
-

|
|
6
|
-

|
|
7
|
-

|
|
8
5
|

|
|
9
6
|

|
|
10
7
|

|
|
@@ -27,25 +24,27 @@ bun i -D @archoleat/validate-font-file-name
|
|
|
27
24
|
|
|
28
25
|
## Usage
|
|
29
26
|
|
|
27
|
+
```js
|
|
28
|
+
import { validateFontFileName } from '@archoleat/validate-font-file-name';
|
|
29
|
+
|
|
30
|
+
await validateFontFileName({
|
|
31
|
+
file: string,
|
|
32
|
+
regex?: string | RegExp,
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
30
36
|
### Naming Convention
|
|
31
37
|
|
|
32
38
|
The **font family** and **font weight** must be in **Pascal Case**
|
|
33
39
|
and separated by a **hyphen**.
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
Postfixes that are allowed: `Italic`, `Variable`.
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
Extensions that are allowed: `woff2`, `woff`, `otf`, `ttf`.
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
import { validateFontFileName } from '@archoleat/validate-font-file-name';
|
|
43
|
-
|
|
44
|
-
await validateFontFileName({
|
|
45
|
-
file: 'path/to/file',
|
|
46
|
-
regex: /regex/ | new RegExp() | '',
|
|
47
|
-
});
|
|
48
|
-
```
|
|
45
|
+
> Examples: `FontFamily-Bold.woff2`,
|
|
46
|
+
> `FontFamily-SemiBoldItalic.woff`, `FontFamily-MediumVariable.otf`,
|
|
47
|
+
> `FontFamily-RegularItalicVariable.ttf`.
|
|
49
48
|
|
|
50
49
|
## Contributing
|
|
51
50
|
|
package/index.d.ts
CHANGED
|
@@ -3,17 +3,6 @@ type Parameters = {
|
|
|
3
3
|
regex?: string | RegExp;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Validates the font file name.
|
|
8
|
-
*
|
|
9
|
-
* @param {string} file - The file path of the font file.
|
|
10
|
-
*
|
|
11
|
-
* @param {string} [regex=''] - The regular expression pattern to
|
|
12
|
-
* match the font file name.
|
|
13
|
-
*
|
|
14
|
-
* @return {boolean} - Return true if the font file name matches the
|
|
15
|
-
* specified regex pattern, false otherwise.
|
|
16
|
-
*/
|
|
17
6
|
declare const validateFontFileName: (parameters: Parameters) => Promise<boolean>;
|
|
18
7
|
|
|
19
8
|
export { validateFontFileName };
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parse as
|
|
1
|
+
import{parse as o}from"node:path";import{error as r}from"@archoleat/notifier";import{FONT_FILE_NAME_REGEX as n}from"@archoleat/reglib";const m=async a=>{const{file:t,regex:e=""}=a;if(!t||typeof t!="string")return await r({message:"Invalid file provided. File must be a non-empty string."}),!1;const s=o(t).base,i=typeof e=="string"&&e!==""?new RegExp(e):e||n;return i.test(s)?!0:(await r({message:`(${s}) doesn't match with (${i})`}),!1)};export{m as validateFontFileName};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archoleat/validate-font-file-name",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "1.2.
|
|
3
|
+
"description": "Validate font file names",
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"email": "archoleat@gmail.com",
|
|
@@ -19,26 +19,22 @@
|
|
|
19
19
|
"keywords": [
|
|
20
20
|
"archoleat-font-file-name",
|
|
21
21
|
"archoleat",
|
|
22
|
-
"font-file-name-standard",
|
|
23
22
|
"font-file-name",
|
|
24
23
|
"naming",
|
|
25
24
|
"plugin",
|
|
26
|
-
"standard",
|
|
27
25
|
"validate-font-file-name",
|
|
28
26
|
"validate-name",
|
|
29
27
|
"validate",
|
|
30
28
|
"validator"
|
|
31
29
|
],
|
|
32
|
-
"packageManager": "pnpm@9.7.0",
|
|
33
30
|
"engines": {
|
|
34
|
-
"
|
|
35
|
-
"pnpm": ">=9.0.0"
|
|
31
|
+
"bun": ">=1.0.0"
|
|
36
32
|
},
|
|
37
33
|
"type": "module",
|
|
38
34
|
"types": "index.d.ts",
|
|
39
35
|
"imports": {
|
|
40
|
-
"#
|
|
41
|
-
"#types": "./src/types
|
|
36
|
+
"#src/*": "./src/*",
|
|
37
|
+
"#types/*": "./src/types/*"
|
|
42
38
|
},
|
|
43
39
|
"exports": {
|
|
44
40
|
".": "./index.js"
|
|
@@ -48,54 +44,52 @@
|
|
|
48
44
|
"index.js"
|
|
49
45
|
],
|
|
50
46
|
"scripts": {
|
|
51
|
-
"init": "
|
|
52
|
-
"build": "rollup -c rollup.config.ts --configPlugin typescript"
|
|
47
|
+
"init": "bun i && husky"
|
|
53
48
|
},
|
|
54
49
|
"dependencies": {
|
|
55
|
-
"@archoleat/notifier": "^1.
|
|
56
|
-
"@archoleat/reglib": "^1.1
|
|
50
|
+
"@archoleat/notifier": "^1.1.3",
|
|
51
|
+
"@archoleat/reglib": "^1.2.1"
|
|
57
52
|
},
|
|
58
53
|
"devDependencies": {
|
|
59
|
-
"@archoleat/commitlint-define-config": "^1.0
|
|
60
|
-
"@archoleat/eslint-flat-compatibility": "^1.1
|
|
61
|
-
"@archoleat/prettier-define-config": "^1.0
|
|
62
|
-
"@archoleat/semantic-release-define-config": "^1.
|
|
63
|
-
"@commitlint/cli": "^19.
|
|
64
|
-
"@commitlint/config-conventional": "^19.
|
|
65
|
-
"@commitlint/types": "^19.0
|
|
54
|
+
"@archoleat/commitlint-define-config": "^1.1.0",
|
|
55
|
+
"@archoleat/eslint-flat-compatibility": "^1.2.1",
|
|
56
|
+
"@archoleat/prettier-define-config": "^1.1.0",
|
|
57
|
+
"@archoleat/semantic-release-define-config": "^1.2.0",
|
|
58
|
+
"@commitlint/cli": "^19.6.1",
|
|
59
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
60
|
+
"@commitlint/types": "^19.5.0",
|
|
66
61
|
"@rollup/plugin-alias": "^5.1.1",
|
|
67
|
-
"@rollup/plugin-typescript": "^
|
|
62
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
68
63
|
"@semantic-release/changelog": "^6.0.3",
|
|
69
64
|
"@semantic-release/git": "^10.0.1",
|
|
70
|
-
"@types/
|
|
65
|
+
"@types/bun": "^1.1.16",
|
|
66
|
+
"@types/node": "^22.10.5",
|
|
71
67
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
72
68
|
"@typescript-eslint/parser": "^7.18.0",
|
|
73
|
-
"@vitest/coverage-v8": "^2.0.5",
|
|
74
69
|
"conventional-changelog-conventionalcommits": "^8.0.0",
|
|
75
|
-
"editorconfig-checker": "^
|
|
76
|
-
"eslint": "^8.57.
|
|
70
|
+
"editorconfig-checker": "^6.0.1",
|
|
71
|
+
"eslint": "^8.57.1",
|
|
77
72
|
"eslint-config-airbnb": "^19.0.4",
|
|
78
73
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
79
74
|
"eslint-config-prettier": "^9.1.0",
|
|
80
75
|
"eslint-define-config": "^2.1.0",
|
|
81
|
-
"eslint-import-resolver-typescript": "^3.
|
|
82
|
-
"eslint-plugin-import": "^2.
|
|
83
|
-
"eslint-plugin-
|
|
76
|
+
"eslint-import-resolver-typescript": "^3.7.0",
|
|
77
|
+
"eslint-plugin-import": "^2.31.0",
|
|
78
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
79
|
+
"eslint-plugin-unicorn": "^56.0.1",
|
|
84
80
|
"git-pull-run": "^1.4.0",
|
|
85
|
-
"globals": "^15.
|
|
86
|
-
"husky": "^9.1.
|
|
87
|
-
"lint-staged": "^15.
|
|
88
|
-
"prettier": "^3.
|
|
81
|
+
"globals": "^15.14.0",
|
|
82
|
+
"husky": "^9.1.7",
|
|
83
|
+
"lint-staged": "^15.3.0",
|
|
84
|
+
"prettier": "^3.4.2",
|
|
89
85
|
"remark": "15.0.1",
|
|
90
86
|
"remark-cli": "^12.0.1",
|
|
91
87
|
"remark-preset-lint-consistent": "^6.0.0",
|
|
92
88
|
"remark-preset-lint-markdown-style-guide": "^6.0.0",
|
|
93
89
|
"remark-preset-lint-recommended": "^7.0.0",
|
|
94
|
-
"rollup": "^4.
|
|
90
|
+
"rollup": "^4.30.1",
|
|
95
91
|
"rollup-plugin-dts": "^6.1.1",
|
|
96
92
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
97
|
-
"semantic-release": "^24.1
|
|
98
|
-
"typescript": "^5.5.4",
|
|
99
|
-
"vitest": "^2.0.5"
|
|
93
|
+
"semantic-release": "^24.2.1"
|
|
100
94
|
}
|
|
101
95
|
}
|