Skip to content
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
11 changes: 7 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ yarn lint
# Build production
yarn build

# Run tests
yarn test
# Run tests (add --run to exit after completion)
yarn test --run

# Format code (required before commit)
yarn format
Expand All @@ -36,11 +36,14 @@ yarn format
### Single Test Execution

```bash
# Run specific test file
yarn test KeyModel.test.ts
# Run specific test file (add --run to exit after completion)
yarn test KeyModel.test.ts --run

# Run tests with watch mode
yarn test --watch

# Run all tests once and exit
yarn test --run
```

## Architecture Overview
Expand Down
78 changes: 75 additions & 3 deletions src/actions/workbench.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
IWorkbenchProject,
IWorkbenchProjectFile,
} from '../services/storage/Storage';
import { IFileGenerationConfig } from '../services/workbench/types/FileGenerationTypes';
import { FileGenerator } from '../services/workbench/FileGenerator';
import {
firmwareActionsThunk,
FlashFirmwareDialogActions,
Expand Down Expand Up @@ -202,7 +204,8 @@ export const workbenchActionsThunk = {
(
project: IWorkbenchProject,
path: string,
fileType: IBuildableFirmwareFileType
fileType: IBuildableFirmwareFileType,
code?: string
): ThunkPromiseAction<void> =>
async (
dispatch: ThunkDispatch<RootState, undefined, ActionTypes>,
Expand All @@ -212,16 +215,85 @@ export const workbenchActionsThunk = {
const createResult = await storage.instance!.createWorkbenchProjectFile(
project.id,
fileType,
path
path,
code
);
if (isError(createResult)) {
dispatch(
NotificationActions.addError(createResult.error, createResult.cause)
);
return;
}
const finalFile = createResult.value;
dispatch(WorkbenchAppActions.appendFileToCurrentProject(finalFile));
},
generateWorkbenchProjectFiles:
(
project: IWorkbenchProject,
config: IFileGenerationConfig
): ThunkPromiseAction<void> =>
async (
dispatch: ThunkDispatch<RootState, undefined, ActionTypes>,
_getState: () => RootState
) => {
// Delete existing files if they exist
const keyboardJsonFile = project.keyboardFiles.find(
(file) => file.path === 'keyboard.json'
);
if (keyboardJsonFile !== undefined) {
await dispatch(
workbenchActionsThunk.deleteWorkbenchProjectFile(
project,
keyboardJsonFile,
'keyboard'
)
);
}
const keymapCFile = project.keymapFiles.find(
(file) => file.path === 'keymap.c'
);
if (keymapCFile !== undefined) {
await dispatch(
workbenchActionsThunk.deleteWorkbenchProjectFile(
project,
keymapCFile,
'keymap'
)
);
}

// Generate files using FileGenerator
const generateResult = await FileGenerator.generateFiles(config);
if (generateResult.type === 'error') {
dispatch(
NotificationActions.addError(
generateResult.error,
generateResult.cause
)
);
return;
}

const generatedFiles = generateResult.value;

// Create each generated file in the project with content
for (const generatedFile of generatedFiles) {
await dispatch(
workbenchActionsThunk.createWorkbenchProjectFile(
project,
generatedFile.path,
generatedFile.fileType,
generatedFile.content
)
);
}

// Show success notification
const fileNames = generatedFiles.map((f: any) => f.path).join(', ');
dispatch(
WorkbenchAppActions.appendFileToCurrentProject(createResult.value)
NotificationActions.addSuccess(
`Successfully generated files: ${fileNames}`
)
);
},
updateWorkbenchProjectFile:
Expand Down
23 changes: 22 additions & 1 deletion src/assets/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,18 @@
"Type at least 2 characters to search for a keyboard.": "キーボードを検索するには、2文字以上入力してください。",

"Projects": "プロジェクト",
"File Generation": "ファイル生成",
"Generate": "生成",
"Generate keyboard.json and keymap.c files for QMK Firmware": "QMK Firmware用のkeyboard.jsonとkeymap.cファイルを生成",
"Manufacturer Name": "製造元の名前",
"Maintainer Name": "メンテナーの名前",
"Keyboard Name": "キーボード名",
"MCU Type": "MCUの種別",
"MCU": "MCU",
"Vendor ID": "ベンダーID",
"Product ID": "プロダクトID",
"A separate development board (ex. Pro Micro)": "独立した開発ボード(例:Pro Micro)",
"The microcontroller integrated ont the PCB": "PCBに統合されたマイクロコントローラー",
"Confirm": "確認",
"Are you sure you want to delete the project?": "本当に \"{{name}}\" プロジェクトを削除しますか?",
"Project not found": "プロジェクトが見つかりません",
Expand Down Expand Up @@ -372,5 +384,14 @@
"Date": "日時",
"Amount": "金額",
"Error": "エラー",
"If you have any questions about your purchase, please contact the Remap team.": "購入に関して質問がある場合は、Remapチームにお問い合わせください。"
"If you have any questions about your purchase, please contact the Remap team.": "購入に関して質問がある場合は、Remapチームにお問い合わせください。",
"This field is required": "この項目は必須です",
"Maximum 256 characters allowed": "最大256文字まで入力可能です",
"Only single-byte characters are allowed": "半角文字のみ入力可能です",
"Contains invalid characters for filename": "ファイル名に使用できない文字が含まれています",
"Maximum 4 characters allowed": "最大4文字まで入力可能です",
"Only hexadecimal characters (0-9, A-F) are allowed": "16進数文字(0-9、A-F)のみ入力可能です",
"Confirm File Overwrite": "ファイル上書きの確認",
"The following files already exist: {{files}}. Do you want to overwrite them?": "以下のファイルが既に存在します:{{files}}。上書きしますか?",
"Keyboard Layout": "キーボードレイアウト"
}
Loading
Loading