@archoleat/validate-font-file-name 1.1.2 → 1.2.0

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.
Files changed (3) hide show
  1. package/README.md +10 -39
  2. package/index.d.ts +6 -13
  3. package/package.json +15 -13
package/README.md CHANGED
@@ -16,7 +16,6 @@
16
16
 
17
17
  - [Installation](#installation)
18
18
  - [Usage](#usage)
19
- - [Naming Convention](#naming-convention)
20
19
  - [Contributing](#contributing)
21
20
  - [License](#license)
22
21
 
@@ -28,54 +27,26 @@ bun i -D @archoleat/validate-font-file-name
28
27
 
29
28
  ## Usage
30
29
 
31
- ```js
32
- import { validateFontFileName } from '@archoleat/validate-font-file-name';
33
-
34
- const validFontFileName = 'OpenSans-Regular.woff2';
35
- const invalidFontFileName = 'OpenSans.woff2';
30
+ ### Naming Convention
36
31
 
37
- // returns: true
38
- console.log(await validateFontFileName({ file: validFontFileName }));
32
+ The **font family** and **font weight** must be in **Pascal Case**
33
+ and separated by a **hyphen**.
39
34
 
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 }));
42
- ```
35
+ Extensions that are allowed: `otf`, `ttf`, `woff`, `woff2`.
43
36
 
44
- ### Your Regex
37
+ > Example: `OpenSans-SemiBold.woff2`.
45
38
 
46
- You can also specify your regex:
39
+ It's not necessary to specify the `regex` parameter.
47
40
 
48
41
  ```js
49
42
  import { validateFontFileName } from '@archoleat/validate-font-file-name';
50
43
 
51
- // You can also specify `new RegExp()` and a regular `string`
52
- const yourRegex = /OpenSans-regular/;
53
-
54
- const validFontFileName = 'OpenSans-regular';
55
- const invalidFontFileName = 'OpenSans.woff2';
56
-
57
- // returns: true
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
- }));
44
+ await validateFontFileName({
45
+ file: 'path/to/file',
46
+ regex: /regex/ | new RegExp() | '',
47
+ });
68
48
  ```
69
49
 
70
- ## Naming Convention
71
-
72
- The **font family** and **font weight** must be in **Pascal Case**
73
- and separated by a **hyphen**.
74
-
75
- Extensions that are allowed: `otf`, `ttf`, `woff`, `woff2`.
76
-
77
- > `{FontFamily}-{FontWeight}.{extension}`
78
-
79
50
  ## Contributing
80
51
 
81
52
  Please read [**CONTRIBUTING**](https://github.com/archoleat/.github/blob/main/CONTRIBUTING.md)
package/index.d.ts CHANGED
@@ -4,22 +4,15 @@ type Parameters = {
4
4
  };
5
5
 
6
6
  /**
7
- * The asynchronous function `validateFontFileName` validates
8
- * if a given font file name matches a specific regex.
7
+ * Validates the font file name.
9
8
  *
10
- * @param {string} file - The `file` parameter in the `validateFontFileName`
11
- * function is a string that represents the file name of a font file that
12
- * you want to validate.
9
+ * @param {string} file - The file path of the font file.
13
10
  *
14
- * @param {string | RegExp} regex - The `regex` parameter in the
15
- * `validateFontFileName` function is used to provide a custom regular
16
- * expression for validating the font file name. If a custom
17
- * regex is not provided, the function uses a default regex
18
- * to validate the font file name.
11
+ * @param {string} [regex=''] - The regular expression pattern to
12
+ * match the font file name.
19
13
  *
20
- * @returns The function `validateFontFileName` is returning a boolean value.
21
- * It returns `true` if the file name matches the specified regex,
22
- * and `false` if it does not match.
14
+ * @return {boolean} - Return true if the font file name matches the
15
+ * specified regex pattern, false otherwise.
23
16
  */
24
17
  declare const validateFontFileName: (parameters: Parameters) => Promise<boolean>;
25
18
 
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.2",
4
+ "version": "1.2.0",
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": "https://github.com/archoleat/validate-font-file-name.git"
14
+ "url": "git+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"
@@ -37,7 +37,8 @@
37
37
  "type": "module",
38
38
  "types": "index.d.ts",
39
39
  "imports": {
40
- "#app": "./src/app.ts"
40
+ "#index": "./src/index.ts",
41
+ "#types": "./src/types/index.ts"
41
42
  },
42
43
  "exports": {
43
44
  ".": "./index.js"
@@ -51,21 +52,22 @@
51
52
  "build": "rollup -c rollup.config.ts --configPlugin typescript"
52
53
  },
53
54
  "dependencies": {
54
- "@archoleat/notifier": "^1.0.0",
55
+ "@archoleat/notifier": "^1.0.2",
55
56
  "@archoleat/reglib": "^1.1.0"
56
57
  },
57
58
  "devDependencies": {
58
- "@archoleat/commitlint-define-config": "^1.0.10",
59
- "@archoleat/eslint-flat-compatibility": "^1.1.7",
60
- "@archoleat/prettier-define-config": "^1.0.1",
61
- "@archoleat/semantic-release-define-config": "^1.1.15",
62
- "@commitlint/cli": "^19.4.0",
63
- "@commitlint/config-conventional": "^19.2.2",
59
+ "@archoleat/commitlint-define-config": "^1.0.11",
60
+ "@archoleat/eslint-flat-compatibility": "^1.1.8",
61
+ "@archoleat/prettier-define-config": "^1.0.2",
62
+ "@archoleat/semantic-release-define-config": "^1.1.16",
63
+ "@commitlint/cli": "^19.4.1",
64
+ "@commitlint/config-conventional": "^19.4.1",
64
65
  "@commitlint/types": "^19.0.3",
66
+ "@rollup/plugin-alias": "^5.1.1",
65
67
  "@rollup/plugin-typescript": "^11.1.6",
66
68
  "@semantic-release/changelog": "^6.0.3",
67
69
  "@semantic-release/git": "^10.0.1",
68
- "@types/node": "^22.5.0",
70
+ "@types/node": "^22.5.2",
69
71
  "@typescript-eslint/eslint-plugin": "^7.18.0",
70
72
  "@typescript-eslint/parser": "^7.18.0",
71
73
  "@vitest/coverage-v8": "^2.0.5",
@@ -82,14 +84,14 @@
82
84
  "git-pull-run": "^1.4.0",
83
85
  "globals": "^15.9.0",
84
86
  "husky": "^9.1.5",
85
- "lint-staged": "^15.2.9",
87
+ "lint-staged": "^15.2.10",
86
88
  "prettier": "^3.3.3",
87
89
  "remark": "15.0.1",
88
90
  "remark-cli": "^12.0.1",
89
91
  "remark-preset-lint-consistent": "^6.0.0",
90
92
  "remark-preset-lint-markdown-style-guide": "^6.0.0",
91
93
  "remark-preset-lint-recommended": "^7.0.0",
92
- "rollup": "^4.21.1",
94
+ "rollup": "^4.21.2",
93
95
  "rollup-plugin-dts": "^6.1.1",
94
96
  "rollup-plugin-esbuild": "^6.1.1",
95
97
  "semantic-release": "^24.1.0",