@archoleat/validate-font-file-name 1.1.3 → 1.2.1

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 (4) hide show
  1. package/README.md +14 -13
  2. package/index.d.ts +2 -2
  3. package/index.js +1 -1
  4. package/package.json +30 -30
package/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
  ![NPM Downloads](https://img.shields.io/npm/dm/%40archoleat%2Fvalidate-font-file-name)
5
5
  ![ESM](https://img.shields.io/badge/ESM-fe0)
6
6
  ![Provenance](https://img.shields.io/badge/Provenance-fo0)
7
- ![CodeQL](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/codeql.yaml?label=CodeQL)
8
7
  ![Specs](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/spec.yaml?label=Specs)
9
8
  ![Commitlint](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/commitlint.yaml?label=Commitlint)
10
9
  ![Editorconfig](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/editorconfig.yaml?label=Editorconfig)
@@ -27,25 +26,27 @@ bun i -D @archoleat/validate-font-file-name
27
26
 
28
27
  ## Usage
29
28
 
29
+ ```js
30
+ import { validateFontFileName } from '@archoleat/validate-font-file-name';
31
+
32
+ await validateFontFileName({
33
+ file: string,
34
+ regex?: string | RegExp,
35
+ });
36
+ ```
37
+
30
38
  ### Naming Convention
31
39
 
32
40
  The **font family** and **font weight** must be in **Pascal Case**
33
41
  and separated by a **hyphen**.
34
42
 
35
- Extensions that are allowed: `otf`, `ttf`, `woff`, `woff2`.
43
+ Postfixes that are allowed: `Italic`, `Variable`.
36
44
 
37
- > Example: `OpenSans-SemiBold.woff2`.
45
+ Extensions that are allowed: `woff2`, `woff`, `otf`, `ttf`.
38
46
 
39
- It's not necessary to specify the `regex` parameter.
40
-
41
- ```js
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
- ```
47
+ > Examples: `FontFamily-Bold.woff2`,
48
+ > `FontFamily-SemiBoldItalic.woff`, `FontFamily-MediumVariable.otf`,
49
+ > `FontFamily-RegularItalicVariable.ttf`.
49
50
 
50
51
  ## Contributing
51
52
 
package/index.d.ts CHANGED
@@ -8,11 +8,11 @@ type Parameters = {
8
8
  *
9
9
  * @param {string} file - The file path of the font file.
10
10
  *
11
- * @param {string} [regex=''] - The regular expression pattern to
11
+ * @param {string|RegExp} [regex=''] - The regular expression pattern to
12
12
  * match the font file name.
13
13
  *
14
14
  * @return {boolean} - Return true if the font file name matches the
15
- * specified regex pattern, false otherwise.
15
+ * specified or default regex pattern, false otherwise.
16
16
  */
17
17
  declare const validateFontFileName: (parameters: Parameters) => Promise<boolean>;
18
18
 
package/index.js CHANGED
@@ -1 +1 @@
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};
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": "Checking font file names for standardization",
4
- "version": "1.1.3",
3
+ "description": "Validate font file names",
4
+ "version": "1.2.1",
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"
@@ -19,11 +19,9 @@
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",
@@ -37,7 +35,8 @@
37
35
  "type": "module",
38
36
  "types": "index.d.ts",
39
37
  "imports": {
40
- "#app": "./src/app.ts"
38
+ "#index": "./src/index.ts",
39
+ "#types": "./src/types/index.ts"
41
40
  },
42
41
  "exports": {
43
42
  ".": "./index.js"
@@ -47,41 +46,42 @@
47
46
  "index.js"
48
47
  ],
49
48
  "scripts": {
50
- "init": "pnpm i && husky",
51
- "build": "rollup -c rollup.config.ts --configPlugin typescript"
49
+ "init": "pnpm i && husky"
52
50
  },
53
51
  "dependencies": {
54
- "@archoleat/notifier": "^1.0.0",
55
- "@archoleat/reglib": "^1.1.0"
52
+ "@archoleat/notifier": "^1.0.3",
53
+ "@archoleat/reglib": "^1.2.0"
56
54
  },
57
55
  "devDependencies": {
58
- "@archoleat/commitlint-define-config": "^1.0.11",
59
- "@archoleat/eslint-flat-compatibility": "^1.1.8",
60
- "@archoleat/prettier-define-config": "^1.0.2",
61
- "@archoleat/semantic-release-define-config": "^1.1.16",
62
- "@commitlint/cli": "^19.4.1",
63
- "@commitlint/config-conventional": "^19.4.1",
64
- "@commitlint/types": "^19.0.3",
65
- "@rollup/plugin-typescript": "^11.1.6",
56
+ "@archoleat/commitlint-define-config": "^1.1.0",
57
+ "@archoleat/eslint-flat-compatibility": "^1.2.1",
58
+ "@archoleat/prettier-define-config": "^1.1.0",
59
+ "@archoleat/semantic-release-define-config": "^1.2.0",
60
+ "@commitlint/cli": "^19.5.0",
61
+ "@commitlint/config-conventional": "^19.5.0",
62
+ "@commitlint/types": "^19.5.0",
63
+ "@rollup/plugin-alias": "^5.1.1",
64
+ "@rollup/plugin-typescript": "^12.1.1",
66
65
  "@semantic-release/changelog": "^6.0.3",
67
66
  "@semantic-release/git": "^10.0.1",
68
- "@types/node": "^22.5.2",
67
+ "@types/node": "^22.9.0",
69
68
  "@typescript-eslint/eslint-plugin": "^7.18.0",
70
69
  "@typescript-eslint/parser": "^7.18.0",
71
- "@vitest/coverage-v8": "^2.0.5",
70
+ "@vitest/coverage-v8": "^2.1.4",
72
71
  "conventional-changelog-conventionalcommits": "^8.0.0",
73
- "editorconfig-checker": "^5.1.8",
74
- "eslint": "^8.57.0",
72
+ "editorconfig-checker": "^6.0.0",
73
+ "eslint": "^8.57.1",
75
74
  "eslint-config-airbnb": "^19.0.4",
76
75
  "eslint-config-airbnb-typescript": "^18.0.0",
77
76
  "eslint-config-prettier": "^9.1.0",
78
77
  "eslint-define-config": "^2.1.0",
79
78
  "eslint-import-resolver-typescript": "^3.6.3",
80
- "eslint-plugin-import": "^2.29.1",
81
- "eslint-plugin-unicorn": "^55.0.0",
79
+ "eslint-plugin-import": "^2.31.0",
80
+ "eslint-plugin-simple-import-sort": "^12.1.1",
81
+ "eslint-plugin-unicorn": "^56.0.0",
82
82
  "git-pull-run": "^1.4.0",
83
- "globals": "^15.9.0",
84
- "husky": "^9.1.5",
83
+ "globals": "^15.12.0",
84
+ "husky": "^9.1.6",
85
85
  "lint-staged": "^15.2.10",
86
86
  "prettier": "^3.3.3",
87
87
  "remark": "15.0.1",
@@ -89,11 +89,11 @@
89
89
  "remark-preset-lint-consistent": "^6.0.0",
90
90
  "remark-preset-lint-markdown-style-guide": "^6.0.0",
91
91
  "remark-preset-lint-recommended": "^7.0.0",
92
- "rollup": "^4.21.2",
92
+ "rollup": "^4.25.0",
93
93
  "rollup-plugin-dts": "^6.1.1",
94
94
  "rollup-plugin-esbuild": "^6.1.1",
95
- "semantic-release": "^24.1.0",
96
- "typescript": "^5.5.4",
97
- "vitest": "^2.0.5"
95
+ "semantic-release": "^24.2.0",
96
+ "typescript": "^5.6.3",
97
+ "vitest": "^2.1.4"
98
98
  }
99
99
  }