Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
faceleg committed Apr 25, 2024
0 parents commit f965ad0
Show file tree
Hide file tree
Showing 24 changed files with 8,385 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ANKI_DECK='Deutsch'
MAX_CONCURRENCY=4
2 changes: 2 additions & 0 deletions .env.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ANKI_DECK=
MAX_CONCURRENCY=5
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
build
**/*.js
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm ci
- run: npm run ci-build
- run: npm run build
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
coverage

node_modules
dist
build
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "all",
"useTabs": false,
"semi": true,
"singleQuote": true,
"printWidth": 120,
"tabWidth": 4
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Anki Field Transformer - Modify Anki card fields

> _Note: This README has been improved by ChatGPT 😀_
Anki Field Transformer is a tool that lets you (with some fiddling) find fields with wrongly shaped data and correct it.

For example, I had a deck with hundreds of cards with data in the "Simplified" field populated with spaces I didn't want. I made this tool as a modification of https://github.com/mhujer/ankiai aimed at transforming fields only.

# How to fiddle

1. **Identify Target Fields**: Determine which fields in your Anki notes you want to update. Examples could include "Traditional," "Definition," or any custom fields specific to your Anki deck setup.

2. **Modify the Code**:
- Open the `primeProcessNote` function in the `src/utils/process-note.ts` file.
- Adjust the logic within this function to handle the fields you want to modify. Update regex patterns, field names, and any transformations as necessary.
- Replace occurrences of `"Simplified"` with the name of the field you want to update.
- If needed, adjust data structures and types defined in the code (`NotesInfoItemFields`, `UpdateNoteFieldsFields`, etc.) to accommodate new fields, in the `src/anki/api.ts` file.
1,595 changes: 1,595 additions & 0 deletions data/sentences-Mandarin Word Lists - Software Engineering.tsv

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended);
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
};
Loading

0 comments on commit f965ad0

Please sign in to comment.