forked from FooSoft/yomichan
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into debug-translator
- Loading branch information
Showing
18 changed files
with
557 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# npm Scripts | ||
|
||
This file documents the scripts available in the [package.json](../../package.json) file. | ||
Scripts can be executed by running `npm run <name>`. | ||
|
||
- `bench` | ||
Runs performance benchmarks. | ||
|
||
- `build` | ||
Builds packages for all of the primary build targets and outputs them to the builds folder in the root project directory. | ||
|
||
- `build:libs` | ||
Rebuilds all of the third-party dependencies that the extension uses. | ||
|
||
- `test` | ||
Runs all of the tests. | ||
|
||
- `test:fast` | ||
Runs most of the tests that are used more frequently in the typical development process. | ||
|
||
- `test:static-analysis` | ||
Runs all of the static analysis tests. | ||
|
||
- `test:js` | ||
Runs [eslint](https://eslint.org/) on all of the JavaScript and TypeScript files in the project. | ||
|
||
- `test:json` | ||
Runs all JSON tests. | ||
|
||
- `test:json:format` | ||
Runs eslint on all of the JSON files in the project. | ||
|
||
- `test:json:types` | ||
Performs type checking on all of the JSON files in the project. | ||
Running this script often takes a long time since it has to validate a lot of files with complex types. | ||
|
||
- `test:css` | ||
Runs [stylelint](https://stylelint.io/) on all of the CSS files in the project. | ||
|
||
- `test:html` | ||
Runs [html-validate](https://html-validate.org/) on all of the HTML files in the project. | ||
|
||
- `test:md` | ||
Runs [prettier](https://prettier.io/) on all of the Markdown files in the project. | ||
|
||
- `test:md:write` | ||
Uses prettier to fix all issues it encounters with files. | ||
|
||
- `test:ts` | ||
Runs [TypeScript](https://www.typescriptlang.org/) validation on all of the JavaScript and TypeScript files in the project. | ||
|
||
- `test:ts:main` | ||
Runs [TypeScript](https://www.typescriptlang.org/) validation on the files in the [ext](../../ext/) folder. | ||
|
||
- `test:ts:dev` | ||
Runs [TypeScript](https://www.typescriptlang.org/) validation on the files in the [dev](../../dev/) folder. | ||
|
||
- `test:ts:test` | ||
Runs [TypeScript](https://www.typescriptlang.org/) validation on the files in the [test](../../test/) folder. | ||
|
||
- `test:ts:bench` | ||
Runs [TypeScript](https://www.typescriptlang.org/) validation on the files in the [benches](../../benches/) folder. | ||
|
||
- `test:unit` | ||
Runs all of the unit tests in the project using [vitest](https://vitest.dev/). | ||
|
||
- `test:unit:write` | ||
Overwrites the expected test output data for some of the larger tests. | ||
This usually only needs to be run when something modifies the format of dictionary entries or Anki data. | ||
|
||
- `test:unit:options` | ||
Runs unit tests related to the extension's options and their upgrade process. | ||
|
||
- `test:build` | ||
Performs a dry run of the build process without generating any files. | ||
|
||
- `license-report:html` | ||
Generates a file containing license information about the third-party dependencies the extension uses. | ||
The resulting file is located at ext/legal-npm.html. | ||
|
||
- `license-report:markdown` | ||
Generates a Markdown table containing license information about the third-party dependencies the extension uses. | ||
This table is located in the [README.md](../../README.md#third-party-libraries) file | ||
|
||
- `prepare` | ||
Sets up [husky](https://typicode.github.io/husky/) for some git pre-commit tasks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (C) 2024 Yomitan Authors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import {basicTextPreprocessorOptions} from '../text-preprocessors.js'; | ||
|
||
/** @type {import('language').TextPreprocessor<boolean>} */ | ||
export const removeArabicScriptDiacritics = { | ||
name: 'Remove diacritics', | ||
description: 'وَلَدَ ⬅️ ولد', | ||
options: basicTextPreprocessorOptions, | ||
process: (text, setting) => { | ||
return setting ? text.replace(/[\u064E-\u0650]/g, '') : text; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2024 Yomitan Authors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
/** @type {import('language').BidirectionalConversionPreprocessor} */ | ||
export const eszettPreprocessor = { | ||
name: 'Convert "ß" to "ss"', | ||
description: 'ß → ss, ẞ → SS and vice versa', | ||
options: ['off', 'direct', 'inverse'], | ||
process: (str, setting) => { | ||
switch (setting) { | ||
case 'off': | ||
return str; | ||
case 'direct': | ||
return str.replace(/ẞ/g, 'SS').replace(/ß/g, 'ss'); | ||
case 'inverse': | ||
return str.replace(/SS/g, 'ẞ').replace(/ss/g, 'ß'); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.