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

NPM Publish #3

Merged
merged 1 commit into from
Nov 21, 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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# mahjong-kun

```shell
npm install mahjong-kun
```

麻雀の点数計算君

```typescript
Expand Down
31 changes: 1 addition & 30 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1 @@
import type {
Calculate,
Hand,
HuAll,
WinningStyle,
YakuAll,
YakuChitoitsu,
YakuPinhu,
} from "./types";
import type { Position } from "./types/field";

export type MahjongKun<
HAND extends Hand,
WINNING extends HAND[number],
NAKI extends HAND[number][],
STYLE extends WinningStyle,
POSITION extends Position,
> = Calculate<
YakuAll<HAND, WINNING, NAKI>,
HuAll<HAND, WINNING, NAKI, STYLE>,
STYLE,
POSITION,
YakuChitoitsu<HAND, WINNING> extends [1, 1]
? "chitoitsu"
: STYLE extends "tumo"
? YakuPinhu<HAND, WINNING, NAKI> extends [1]
? "pin-tumo"
: null
: null
>;
export * from "./types"
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
{
"name": "mahjong-kun",
"version": "1.0.0",
"main": "index.ts",
"version": "1.5.0",
"author": "[email protected]",
"license": "MIT",
"files": ["dist", "package.json", "README.md"],
"scripts": {
"test": "tsc --noEmit",
"build": "tsc ./index.ts --declaration --outDir ./dist --emitDeclarationOnly"
"build": "tsc ./index.ts --declaration --outDir ./dist --emitDeclarationOnly",
"pub": "yarn build && npm publish --access public"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"esbuild": "^0.24.0",
"typescript": "^5.6.3"
}
},
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts"
}
}
},
"types": "./dist/index.d.ts"
}
27 changes: 27 additions & 0 deletions types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import type {Hand} from "./hand";
import type {WinningStyle} from "./winning";
import type {Position} from "./field";
import type {Calculate} from "./point";
import type {YakuAll, YakuChitoitsu, YakuPinhu} from "./yaku";
import type {HuAll} from "./hu";

export * from "./hand";
export * from "./hu";
export * from "./point";
Expand All @@ -6,3 +13,23 @@ export * from "./tileSet";
export * from "./utilType";
export * from "./winning";
export * from "./yaku";

export type MahjongKun<
HAND extends Hand,
WINNING extends HAND[number],
NAKI extends HAND[number][],
STYLE extends WinningStyle,
POSITION extends Position,
> = Calculate<
YakuAll<HAND, WINNING, NAKI>,
HuAll<HAND, WINNING, NAKI, STYLE>,
STYLE,
POSITION,
YakuChitoitsu<HAND, WINNING> extends [1, 1]
? "chitoitsu"
: STYLE extends "tumo"
? YakuPinhu<HAND, WINNING, NAKI> extends [1]
? "pin-tumo"
: null
: null
>;
Loading