Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: notifier and reglib #46

Merged
merged 35 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2d97798
refactor: small changes
nikkeyl Apr 28, 2024
531255a
fix: small changes
nikkeyl May 16, 2024
513f006
chore(workflows): bump pnpm/action-setup
nikkeyl May 16, 2024
4288a2e
fix: commitlint workflow
nikkeyl May 16, 2024
8e00376
ci: fix version
nikkeyl May 16, 2024
c01f09b
chore(deps-dev): update
nikkeyl May 16, 2024
3dbb84e
refactor: small changes
nikkeyl May 18, 2024
09c0a42
ci: spec
nikkeyl May 18, 2024
02e9c07
refactor(tests): add `beforeEach` function
nikkeyl Jul 29, 2024
5033356
style(ts): add formatting
nikkeyl Jul 29, 2024
3d484b9
fix: ts and rollup aliases
nikkeyl Jul 29, 2024
a91fb91
refactor: aliases
nikkeyl Jul 29, 2024
24d6b39
refactor: tsconfig
nikkeyl Jul 29, 2024
b0252d6
fix: commitlint
nikkeyl Jul 29, 2024
b18e70f
fix: eslint
nikkeyl Jul 30, 2024
78036f5
refactor: aliases
nikkeyl Jul 30, 2024
ec18afa
refactor: rename pattern to regex
nikkeyl Jul 30, 2024
b3c6f83
feat: add provenance
nikkeyl Jul 30, 2024
a0b06c1
chore: update deps
nikkeyl Jul 30, 2024
f9f1edb
fix: commitlint
nikkeyl Jul 31, 2024
930bcd4
chore(deps-dev): update
nikkeyl Jul 31, 2024
af73414
refactor: add tags
nikkeyl Aug 3, 2024
d4a0078
refactor: small changes
nikkeyl Aug 5, 2024
d2da313
refactor: small changes
nikkeyl Aug 6, 2024
9ac8e8a
refactor: small changes
nikkeyl Aug 7, 2024
5d35b89
refactor: rollup config
nikkeyl Aug 8, 2024
c5801ab
refactor(rollup): sort
nikkeyl Aug 8, 2024
6699b46
refactor: add defineConfig
nikkeyl Aug 9, 2024
9852145
refactor: small changes
nikkeyl Aug 9, 2024
bd8e716
ci: rename `markdown` ro `remark`
nikkeyl Aug 13, 2024
af3bd3d
docs(readme): fix link
nikkeyl Aug 13, 2024
11ab0ba
refactor: small changes
nikkeyl Aug 13, 2024
6d0bea3
docs(readme): rewrite script
nikkeyl Aug 15, 2024
0fea237
spec: rewrite
nikkeyl Aug 15, 2024
6a8127c
refactor: small changes
nikkeyl Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .czrc

This file was deleted.

1 change: 1 addition & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ updates:
schedule:
interval: weekly
day: sunday
versioning-strategy: increase
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
branches:
- main
paths:
- package.json
- src/index.ts
- src/types/*.d.ts
push:
branches:
- main
paths:
- package.json
- src/index.ts
- src/types/*.d.ts

permissions:
actions: read
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Commit Lint

on:
pull_request:
push:

jobs:
Expand All @@ -19,8 +18,6 @@ jobs:

- name: Set Up PNPM
uses: pnpm/action-setup@v4
with:
version: 8

- name: Set Up NodeJS
uses: actions/setup-node@v4
Expand All @@ -31,7 +28,17 @@ jobs:
- name: Install Dependencies
run: pnpm i

- name: Extract Commit Message (Push)
if: ${{ github.event_name }} == 'push'
run: |
git log -1 --pretty=%B > commit_message.txt

- name: Extract Commit Message (Pull Request)
if: ${{ github.event_name }} == 'pull_request'
run: |
git show -s --format=%B > commit_message.txt

- name: Lint
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: echo $COMMIT_MESSAGE | pnpm commitlint
run: |
COMMIT_MESSAGE=$(cat commit_message.txt)
echo "$COMMIT_MESSAGE" | pnpm commitlint
9 changes: 0 additions & 9 deletions .github/workflows/editorconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Editorconfig

on:
workflow_run:
workflows:
- CodeQL
types:
- completed
pull_request:
branches:
- main
Expand All @@ -17,8 +12,6 @@ jobs:
editorconfig:
name: Editorconfig

if: ${{ github.event.workflow_run.conclusion == 'success' }}

runs-on: ubuntu-latest
timeout-minutes: 10

Expand All @@ -28,8 +21,6 @@ jobs:

- name: Set Up PNPM
uses: pnpm/action-setup@v4
with:
version: 8

- name: Set Up NodeJS
uses: actions/setup-node@v4
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/eslint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ jobs:

- name: Set Up PNPM
uses: pnpm/action-setup@v4
with:
version: 8

- name: Set Up NodeJS
uses: actions/setup-node@v4
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Lint
uses: pre-commit/action@v3.0.1
9 changes: 0 additions & 9 deletions .github/workflows/prettier.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Prettier

on:
workflow_run:
workflows:
- CodeQL
types:
- completed
pull_request:
branches:
- main
Expand All @@ -17,8 +12,6 @@ jobs:
prettier:
name: Prettier

if: ${{ github.event.workflow_run.conclusion == 'success' }}

runs-on: ubuntu-latest
timeout-minutes: 10

Expand All @@ -28,8 +21,6 @@ jobs:

- name: Set Up PNPM
uses: pnpm/action-setup@v4
with:
version: 8

- name: Set Up NodeJS
uses: actions/setup-node@v4
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
branches:
- main

permissions:
id-token: write

jobs:
release:
name: Release
Expand All @@ -35,8 +38,6 @@ jobs:

- name: Set Up PNPM
uses: pnpm/action-setup@v4
with:
version: 8

- name: Set Up NodeJS
uses: actions/setup-node@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
name: Markdown
name: Remark

on:
workflow_run:
workflows:
- CodeQL
types:
- completed
pull_request:
branches:
- main
paths:
- '**/*.md'
push:
branches:
- main
paths:
- '**/*.md'

jobs:
markdown:
name: Markdown

if: ${{ github.event.workflow_run.conclusion == 'success' }}
remark:
name: Remark

runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -28,8 +25,6 @@ jobs:

- name: Set Up PNPM
uses: pnpm/action-setup@v4
with:
version: 8

- name: Set Up NodeJS
uses: actions/setup-node@v4
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Spec
on:
workflow_run:
workflows:
- CodeQL
- ESLint
types:
- completed
pull_request:
Expand All @@ -28,8 +28,6 @@ jobs:

- name: Set Up PNPM
uses: pnpm/action-setup@v4
with:
version: 8

- name: Set Up NodeJS
uses: actions/setup-node@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# directories
# Directories
node_modules
1 change: 1 addition & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm git-pull-run --pattern 'pnpm-lock.yaml' --command 'pnpm i'
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
provenance=true
10 changes: 6 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# directories
# Directories
.husky

# files
# Files
*.md
pnpm-lock.yaml

# *rc
.czrc
.ecrc
.npmrc

# configs
# Configs
.editorconfig
.gitattributes

# ignores
# Ignores
.gitignore
.prettierignore
.remarkignore
2 changes: 2 additions & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Files
CHANGELOG.md
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@

![NPM Version](https://img.shields.io/npm/v/%40archoleat%2Fvalidate-font-file-name)
![NPM Downloads](https://img.shields.io/npm/dm/%40archoleat%2Fvalidate-font-file-name)
![ESM](https://img.shields.io/badge/ESM-fe0)
![Provenance](https://img.shields.io/badge/Provenance-fo0)
![CodeQL](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/codeql.yaml?label=CodeQL)
![Specs](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/spec.yaml?label=Specs)
![Commitlint](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/commitlint.yaml?label=Commitlint)
![Editorconfig](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/editorconfig.yaml?label=Editorconfig)
![Prettier](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/prettier.yaml?label=Prettier)
![ESLint](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/eslint.yaml?label=ESLint)
![Markdown](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/markdown.yaml?label=Markdown)
![ESM Only](https://img.shields.io/badge/ESM-only-gray?labelColor=fe0)
![Remark](https://img.shields.io/github/actions/workflow/status/archoleat/validate-font-file-name/remark.yaml?label=Remark)

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Naming Convention](#naming-convention)
- [Contributing](#contributing)
- [License](#license)
- [Installation](#installation)
- [Usage](#usage)
- [Naming Convention](#naming-convention)
- [Contributing](#contributing)
- [License](#license)

## Installation

```shell
# bun
bun i -D @archoleat/validate-font-file-name
```

```shell
# pnpm
pnpm i -D @archoleat/validate-font-file-name
Expand Down Expand Up @@ -68,22 +74,22 @@ console.log(await validateFontFileName(invalidFontFileName));

### Your Regex

You can also specify your pattern:
You can also specify your regex:

```js
import { validateFontFileName } from '@archoleat/validate-font-file-name';

// You can also specify `new RegExp()` and a regular `string`
const yourPattern = /OpenSans-regular/;
const yourRegex = /OpenSans-regular/;

const validFontFileName = 'OpenSans-regular';
const invalidFontFileName = 'OpenSans.woff2';

// returns: true
console.log(await validateFontFileName(validFontFileName, yourPattern));
console.log(await validateFontFileName(validFontFileName, yourRegex));

// returns: 'OpenSans.woff2' doesn't match with '/OpenSans-regular/'.
console.log(await validateFontFileName(invalidFontFileName, yourPattern));
console.log(await validateFontFileName(invalidFontFileName, yourRegex));
```

## Naming Convention
Expand All @@ -93,7 +99,7 @@ and separated by a **hyphen**.

Extensions that are allowed: `otf`, `ttf`, `woff`, `woff2`.

> `{FontFamily}-{FontWeight}.{ext}`
> `{FontFamily}-{FontWeight}.{extension}`

## Contributing

Expand Down
11 changes: 11 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ export default defineFlatConfig([
'import/no-namespace': 'error',
'import/no-unassigned-import': 'error',
'import/prefer-default-export': 'off',
'unicorn/import-style': [
'error',
{
styles: {
'node:path': {
default: false,
named: true,
},
},
},
],
'unicorn/no-unused-properties': 'error',
'unicorn/string-content': 'error',
},
Expand Down
1 change: 1 addition & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
'**/*.md': 'remark --quiet --frail',
'**/*': 'prettier --write',
'src/index.ts': 'eslint --fix',
};
Loading
Loading