Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
refactor: ディレクトリ名の変更とファイルの整理
Browse files Browse the repository at this point in the history
  • Loading branch information
laminne committed May 16, 2024
1 parent 1ad011f commit de4ade2
Show file tree
Hide file tree
Showing 42 changed files with 57 additions and 49 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ bun dev

| <img src="https://github.com/laminne.png" width="100px"> | <img src="https://github.com/kiharu3112.png" width="100px"> | <img src="https://github.com/tufusa.png" width="100px"> |
| :------------------------------------------------------: | :---------------------------------------------------------: | :-----------------------------------------------------: |
| **laminne (T. YAMAMOTO)**<br>🔧 🦀 | **kiharu3112**<br>🔧 🦀 | **tufusa**<br>🔧 🦀 |
| **laminne (T. YAMAMOTO)**<br>🔧 🦀 | **kiharu3112**<br>🔧 🦀 | **tufusa**<br>🔧 🦀 |

| <img src="https://github.com/speak-mentaiko.png" width="100px"> | <img src="https://github.com/suzune2741.png" width="100px"> | <img src="https://github.com/C4N4242.png" width="100px"> |
| :------------------------------------------------------: | :---------------------------------------------------------: | :-----------------------------------------------------: |
| **speak-mentaiko**<br>🔧 | **suzune2741**<br>🔧 | **C4N4242**<br>🔧 |
| :-------------------------------------------------------------: | :---------------------------------------------------------: | :------------------------------------------------------: |
| **speak-mentaiko**<br>🔧 | **suzune2741**<br>🔧 | **C4N4242**<br>🔧 |

🔧: KCMS/KCMSFの開発
🦀: 書き込みツール開発
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
"main": "main.js",
"scripts": {
"start": "bun ./build/main.js",
"dev": "bun run --hot ./src/main.ts",
"build": "esbuild ./src/main.ts --bundle --sourcemap --platform=node --target=node16 --format=esm --packages=external --outfile=build/main.js",
"lint": "eslint --cache 'src/**/**.ts'",
"dev": "bun run --hot ./pkg/main.ts",
"build": "esbuild ./pkg/main.ts --bundle --sourcemap --platform=node --target=node16 --format=esm --packages=external --outfile=build/main.js",
"format": "prettier . --write",
"test": "vitest run",
"coverage": "vitest run --coverage",
"check": "prettier --check 'src/**/**.ts' && tsc -p . --noEmit"
"check": "bun run check:lint && bun run check:type && bun run check:format",
"check:lint": "eslint --cache 'pkg/**/**.ts'",
"check:type": "tsc -p . --noEmit",
"check:format": "prettier --check 'pkg/**/**.ts'"
},
"keywords": [],
"author": "Poporon Network (Tatsuto C. YAMAMOTO) & Other Contributors",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntryRepository } from '../repository.js';
import { EntryRepository } from '../model/repository.js';
import { Option, Result } from '@mikuroxina/mini-fn';
import { Entry } from '../entry.js';
import { Entry } from '../model/entry.js';

export class DummyRepository implements EntryRepository {
private data: Array<Entry>;
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/entry/adaptor/json.ts → pkg/entry/adaptor/json.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntryRepository } from '../repository.js';
import { EntryRepository } from '../model/repository.js';
import { Option, Result } from '@mikuroxina/mini-fn';
import { Entry, EntryCategory, EntryID } from '../entry.js';
import { Entry, EntryCategory, EntryID } from '../model/entry.js';
import { readFile, writeFile } from 'node:fs/promises';

interface JSONData {
Expand Down
2 changes: 1 addition & 1 deletion src/entry/controller.ts → pkg/entry/controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EntryRepository } from './repository.js';
import { EntryRepository } from './model/repository.js';
import { EntryService } from './service/entry.js';
import { Result, Option } from '@mikuroxina/mini-fn';
import { FindEntryService } from './service/get.js';
Expand Down
2 changes: 1 addition & 1 deletion src/entry/main.ts → pkg/entry/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Hono } from 'hono';
import { zValidator } from '@hono/zod-validator';
import { entryRequestSchema } from './schema.js';
import { entryRequestSchema } from './model/schema.js';
import { Controller } from './controller.js';
import { Option, Result } from '@mikuroxina/mini-fn';
import { JSONEntryRepository } from './adaptor/json.js';
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/entry/entry.ts → pkg/entry/model/entry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Elementary: 小学生部門 / Open: オープン部門
// ToDo: 部門の定義をファイルから読み込むようにする
import { SnowflakeID } from '../id/main.js';
import { SnowflakeID } from '../../id/main.js';

export type EntryCategory = 'Elementary' | 'Open';
export type EntryID = SnowflakeID<'Entry'>;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EntryRepository } from '../repository.js';
import { EntryRepository } from '../model/repository.js';
import { Option } from '@mikuroxina/mini-fn';

export class DeleteEntryService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it } from 'vitest';
import { DummyRepository } from '../adaptor/dummyRepository.js';
import { Entry, EntryID } from '../entry.js';
import { Entry, EntryID } from '../model/entry.js';
import { Result } from '@mikuroxina/mini-fn';
import { EntryService } from './entry.js';
import { TestEntryData } from '../../testData/entry.js';
Expand Down
4 changes: 2 additions & 2 deletions src/entry/service/entry.ts → pkg/entry/service/entry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntryRepository } from '../repository.js';
import { Entry, EntryCreateArgs, EntryID } from '../entry.js';
import { EntryRepository } from '../model/repository.js';
import { Entry, EntryCreateArgs, EntryID } from '../model/entry.js';
import { Option, Result } from '@mikuroxina/mini-fn';
import { SnowflakeIDGenerator } from '../../id/main.js';

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/entry/service/get.ts → pkg/entry/service/get.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntryRepository } from '../repository.js';
import { Entry, EntryID } from '../entry.js';
import { EntryRepository } from '../model/repository.js';
import { Entry, EntryID } from '../model/entry.js';
import { Option, Result } from '@mikuroxina/mini-fn';

export class FindEntryService {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Match } from '../match.js';
import { Match } from '../model/match.js';
import { MatchRepository } from '../service/repository.js';
import { Option, Result } from '@mikuroxina/mini-fn';

Expand Down
4 changes: 2 additions & 2 deletions src/match/adaptor/json.ts → pkg/match/adaptor/json.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { MatchID, Match, MatchTeams } from '../match.js';
import { MatchID, Match, MatchTeams } from '../model/match.js';
import { MatchRepository } from '../service/repository.js';
import { Option, Result } from '@mikuroxina/mini-fn';
import { readFile, writeFile } from 'node:fs/promises';
import { EntryJSON } from '../../entry/adaptor/json.js';
import { Entry, EntryID } from '../../entry/entry.js';
import { Entry, EntryID } from '../../entry/model/entry.js';

interface JSONData {
match: Array<MatchJSON>;
Expand Down
4 changes: 2 additions & 2 deletions src/match/controller.ts → pkg/match/controller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { GenerateFinalMatchService } from './service/generateFinal.js';
import { Result } from '@mikuroxina/mini-fn';
import { Match } from './match.js';
import { Match } from './model/match.js';
import { EditMatchService } from './service/edit.js';
import { Entry, EntryID } from '../entry/entry.js';
import { Entry, EntryID } from '../entry/model/entry.js';
import { GetMatchService } from './service/get.js';
import { GeneratePrimaryMatchService } from './service/generatePrimary.js';

Expand Down
2 changes: 1 addition & 1 deletion src/match/main.ts → pkg/match/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { JSONEntryRepository } from '../entry/adaptor/json.js';
import { MatchController } from './controller.js';
import { Result } from '@mikuroxina/mini-fn';
import { EditMatchService } from './service/edit.js';
import { ReconstructMatchArgs } from './match.js';
import { ReconstructMatchArgs } from './model/match.js';
import { GetMatchService } from './service/get.js';
import { GenerateRankingService } from './service/generateRanking.js';
import { GeneratePrimaryMatchService } from './service/generatePrimary.js';
Expand Down
2 changes: 1 addition & 1 deletion src/match/match.test.ts → pkg/match/model/match.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { MatchID, Match } from './match.js';
import { TestEntryData } from '../testData/entry.js';
import { TestEntryData } from '../../testData/entry.js';

describe('正しくインスタンスを生成できる', () => {
it('試合相手が居るとき', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/match/match.ts → pkg/match/model/match.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Entry, EntryID } from '../entry/entry.js';
import { SnowflakeID } from '../id/main.js';
import { Entry, EntryID } from '../../entry/model/entry.js';
import { SnowflakeID } from '../../id/main.js';

export type MatchID = SnowflakeID<'Match'>;

Expand Down
2 changes: 1 addition & 1 deletion src/match/tournament.ts → pkg/match/model/tournament.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Entry, EntryID } from '../entry/entry.js';
import { Entry, EntryID } from '../../entry/model/entry.js';

type Tournament = [TournamentRank, TournamentRank] | [Tournament, Tournament];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, expect, it } from 'vitest';
import { DummyMatchRepository } from '../adaptor/dummyRepository.js';
import { EditMatchService } from './edit.js';
import { MatchID, Match } from '../match.js';
import { MatchID, Match } from '../model/match.js';
import { Result } from '@mikuroxina/mini-fn';
import { TestEntryData } from '../../testData/entry.js';
import { EntryID } from '../../entry/entry.js';
import { EntryID } from '../../entry/model/entry.js';

describe('EditMatch', () => {
const reporitory = new DummyMatchRepository();
Expand Down
2 changes: 1 addition & 1 deletion src/match/service/edit.ts → pkg/match/service/edit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Option, Result } from '@mikuroxina/mini-fn';
import { MatchRepository } from './repository.js';
import { MatchDTO } from './get.js';
import { ReconstructMatchArgs } from '../match.js';
import { ReconstructMatchArgs } from '../model/match.js';

export class EditMatchService {
private readonly matchRepository: MatchRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { TestEntrySet } from '../../testData/entry.js';
import { GenerateRankingService } from './generateRanking.js';
import { SnowflakeIDGenerator } from '../../id/main.js';
import { Result, Option } from '@mikuroxina/mini-fn';
import { MatchResultFinalPair } from '../match.js';
import { EntryID } from '../../entry/entry.js';
import { MatchResultFinalPair } from '../model/match.js';
import { EntryID } from '../../entry/model/entry.js';

describe('GenerateFinal1st', () => {
const repository = new DummyMatchRepository(TestRankingMatchData);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EntryRepository } from '../../entry/repository.js';
import { EntryRepository } from '../../entry/model/repository.js';
import { Result, Option } from '@mikuroxina/mini-fn';
import { Entry } from '../../entry/entry.js';
import { MatchID, Match, MatchResultFinalPair } from '../match.js';
import { Entry } from '../../entry/model/entry.js';
import { MatchID, Match, MatchResultFinalPair } from '../model/match.js';
import { MatchRepository } from './repository.js';
import { GenerateRankingService } from './generateRanking.js';
import { SnowflakeIDGenerator } from '../../id/main.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Result } from '@mikuroxina/mini-fn';
import { MatchDTO } from './get.js';
import { Entry } from '../../entry/entry.js';
import { MatchID, Match } from '../match.js';
import { EntryRepository } from '../../entry/repository.js';
import { Entry } from '../../entry/model/entry.js';
import { MatchID, Match } from '../model/match.js';
import { EntryRepository } from '../../entry/model/repository.js';
import { MatchRepository } from './repository.js';
import { SnowflakeIDGenerator } from '../../id/main.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TournamentRank } from './generateFinal.js';
import { Result } from '@mikuroxina/mini-fn';
import { isMatchResultPair } from '../match.js';
import { isMatchResultPair } from '../model/match.js';
import { MatchRepository } from './repository.js';

export class GenerateRankingService {
Expand Down
File renamed without changes.
8 changes: 7 additions & 1 deletion src/match/service/get.ts → pkg/match/service/get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { MatchRepository } from './repository.js';
import { Option, Result } from '@mikuroxina/mini-fn';
import { MatchID, Match, MatchResultFinalPair, MatchResultPair, MatchTeams } from '../match.js';
import {
MatchID,
Match,
MatchResultFinalPair,
MatchResultPair,
MatchTeams,
} from '../model/match.js';

export class GetMatchService {
private readonly repository: MatchRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Match } from '../match.js';
import { Match } from '../model/match.js';
import { Option, Result } from '@mikuroxina/mini-fn';

export interface MatchRepository {
Expand Down
2 changes: 1 addition & 1 deletion src/testData/entry.ts → pkg/testData/entry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Entry, EntryID } from '../entry/entry.js';
import { Entry, EntryID } from '../entry/model/entry.js';

export const TestEntryData = {
ElementaryMultiWalk: Entry.new({
Expand Down
4 changes: 2 additions & 2 deletions src/testData/match.ts → pkg/testData/match.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MatchID, Match } from '../match/match.js';
import { MatchID, Match } from '../match/model/match.js';
import { TestEntryData, TestEntrySet } from './entry.js';
import { Entry, EntryID } from '../entry/entry.js';
import { Entry, EntryID } from '../entry/model/entry.js';

// ToDo: もっとデータ数を増やす
export const TestMatchData = {
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"moduleResolution": "Node16",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"pretty": true,
"pretty": true
},
"include": ["**/*.ts"],
"include": ["**/**.ts"],
"exclude": ["node_modules"]
}

0 comments on commit de4ade2

Please sign in to comment.