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!: (BREAKING) v2.1.0, attempt to fix waa edge-case, upgrade dependencies #24

Merged
merged 9 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"flutter": "3.24.1"
}
17 changes: 17 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Semantic PRs config file (https://github.com/Ezard/semantic-prs)

enabled: true
titleOnly: true
allowRevertCommits: true
types:
- feat
- fix
- chore
- ci
- docs
- refactor
- style
- test
- revert
- build
- release
16 changes: 8 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ jobs:
kana_kit:
runs-on: ubuntu-latest
container:
image: google/dart:2.12.0
image: dart:3.5.0
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies
run: pub get
run: dart pub get

- name: Format
run: dartfmt --dry-run --set-exit-if-changed .
run: dart format --output none --set-exit-if-changed .

- name: Analyze
run: dartanalyzer --fatal-infos --fatal-warnings lib test
run: dart analyze --fatal-infos --fatal-warnings lib test

- name: Test
run: pub run test_coverage
run: dart run coverage:test_with_coverage

- name: Dry run publish
run: |
echo "Copy credentials"
mkdir -p ~/.pub-cache
echo "$CREDENTIAL_JSON" > ~/.pub-cache/credentials.json
echo "Run pub publish --dry-run"
pub publish --dry-run
dart pub publish --dry-run
env:
CREDENTIAL_JSON: ${{ secrets.CREDENTIAL_JSON }}

Expand All @@ -41,8 +41,8 @@ jobs:
run: bash <(curl -s https://codecov.io/bash)

- name: Check codecov
uses: ChicagoFlutter/[email protected]
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: ./coverage/lcov.info
exclude: "**/*.g.dart lib/src/models/romanization/**"
exclude: '**/*.g.dart lib/src/models/romanization/**'
min_coverage: 99
8 changes: 4 additions & 4 deletions .github/workflows/draft_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ jobs:
update_release_draft:
runs-on: ubuntu-latest
container:
image: google/dart:2.12.0
image: dart:3.5.0
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies
run: pub get
run: dart pub get

- name: Add pub executables to path
run: echo "::add-path::$HOME/.pub-cache/bin"

- name: Set pub version in env
run: |
pub global activate pubspec_version
dart pub global activate pubspec_version
echo "Current version is: $(pubver get)"
echo "::set-env name=RELEASE_VERSION::$(pubver get)"

- name: Create release draft
uses: release-drafter/release-drafter@v5
with:
publish: false
dart publish: false
name: v${{ env.RELEASE_VERSION }}
version: ${{ env.RELEASE_VERSION }}
tag: ${{ env.RELEASE_VERSION }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_to_pub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
publish:
runs-on: ubuntu-latest
container:
image: google/dart:2.12.0
image: dart:3.5.0
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -21,6 +21,6 @@ jobs:
mkdir -p ~/.pub-cache
echo "$CREDENTIAL_JSON" > ~/.pub-cache/credentials.json
echo "Run pub publish --force"
pub publish --force
dart pub publish --force
env:
CREDENTIAL_JSON: ${{ secrets.CREDENTIAL_JSON }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ build/
**/coverage/
**/coverage_badge.svg
**/.test_coverage.dart

# FVM
.fvm/
45 changes: 0 additions & 45 deletions .mergify.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .metadata

This file was deleted.

5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"mkdir",
"toukyou",
"zenkaku"
]
}
],
"dart.flutterSdkPath": ".fvm/versions/3.24.1"
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 2.1.0

- Fix シークヮーサー and シマウヮー conversion edge-cases (thanks to @Moseco and @HighLiuk)
- Change minimum required Dart version to `3.0.0`.
- Add [FVM](https://fvm.app/) config.
- Add CSpell spell checking config.
- Remove `package:equatable` dependency.
- Upgrade dependencies.
- Upgrade all dev dependencies and linter.
- Remove Mergify config.

## 2.0.0

- Add NNBD support.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Jeroen Meijer
Copyright (c) 2024 Jeroen Meijer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ kanaKit

MIT License

Copyright (c) 2020 Jeroen Meijer
Copyright (c) 2024 Jeroen Meijer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 0 additions & 18 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
include: package:very_good_analysis/analysis_options.yaml
# linter:
# rules:
# await_only_futures: true
# prefer_const_constructors: true
# prefer_const_literals_to_create_immutables: true
# prefer_relative_imports: false
# prefer_single_quotes: true
# public_member_api_docs: true
# sort_child_properties_last: true
# sort_constructors_first: true
# unawaited_futures: true
# analyzer:
# strong-mode:
# implicit-casts: false
# errors:
# close_sinks: ignore
# exclude:
# - '**/.test_coverage.dart'
8 changes: 4 additions & 4 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
codecov:
require_ci_to_pass: true

coverage:
precision: 3
range: "99...100"
range: '99...100'

ignore:
- "**/*.g.dart"
- "lib/src/models/romanization/**"
- '**/*.g.dart'
- 'lib/src/models/romanization/**'
20 changes: 20 additions & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ignoreWords:
- transform
words:
- codecov
- hankaku
- hepburn
- HighLiuk
- hira
- initializers
- japanese
- Mergify
- Moseco
- NNBD
- Ōsaka
- pubspec
- romaji
- Tōkyō
- unicode
- zenkaku
- Zenkaku
23 changes: 16 additions & 7 deletions lib/kana_kit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class KanaKit {
/// isRomaji('a!b&cーd'); // false (zenkaku punctuation is not allowed)
/// ```
bool isRomaji(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharRomaji);
}
Expand All @@ -68,7 +68,7 @@ class KanaKit {
/// isJapanese('A泣き虫'); // false
/// ```
bool isJapanese(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharJapanese);
}
Expand All @@ -85,7 +85,7 @@ class KanaKit {
/// isKana('あAア'); // false
/// ```
bool isKana(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharKana);
}
Expand All @@ -100,7 +100,7 @@ class KanaKit {
/// isHiragana('あア'); // false
/// ```
bool isHiragana(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharHiragana);
}
Expand All @@ -116,7 +116,7 @@ class KanaKit {
/// isKatakana('あア'); // false
/// ```
bool isKatakana(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharKatakana);
}
Expand All @@ -133,7 +133,7 @@ class KanaKit {
/// isKanji('🐸'); // false
/// ```
bool isKanji(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharKanji);
}
Expand All @@ -153,12 +153,17 @@ class KanaKit {
/// isMixed('あア'); // false
/// ```
bool isMixed(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

final chars = input.chars;

final hasRomaji = chars.any(_isCharRomaji);
final hasKana = chars.any(_isCharHiragana) || chars.any(_isCharKatakana);

// FIXME: This can be simplified but I can't get my brain
// to do it right now.

// ignore: avoid_bool_literals_in_conditional_expressions
final hasKanji = !(!config.passKanji ? chars.any(_isCharKanji) : false);

return hasKana && hasRomaji && hasKanji;
Expand All @@ -173,6 +178,7 @@ class KanaKit {
/// characters will be converted to uppercase characters.
/// ignored.
///
// cspell: disable
/// ```dart
/// // With KanaKitConfig.upcaseKatakana == false (default)
/// toRomaji('ひらがな カタカナ'); // "hiragana katakana"
Expand All @@ -181,6 +187,7 @@ class KanaKit {
/// toRomaji('ひらがな カタカナ'); // "hiragana KATAKANA"
/// toRomaji('げーむ ゲーム'); // "ge-mu GEEMU"
/// ```
// cspell: enable
String toRomaji(String input) {
if (input.isEmpty) {
return input;
Expand Down Expand Up @@ -218,13 +225,15 @@ class KanaKit {
/// The [input] `String` cannot be null. If an empty `String` is provided,
/// an empty `String` will be returned immediately.
///
// cspell: disable
/// ```dart
/// toKana('onaji BUTTSUUJI'); // "おなじ ブッツウジ"
/// toKana('ONAJI buttsuuji'); // "オナジ ぶっつうじ"
/// toKana('座禅‘zazen’スタイル'); // "座禅「ざぜん」スタイル"
/// toKana('batsuge-mu'); // "ばつげーむ"
/// toKana('!?.:/,~-‘’“”[](){}'); // "!?。:・、〜ー「」『』[](){}"
/// ```
// cspell: enable
String toKana(String input) {
if (input.isEmpty) {
return input;
Expand Down
Loading
Loading