@flesh-and-blood/types 4.0.0 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -157
- package/dist/helpers/cards.d.ts +1 -1
- package/dist/helpers/cards.js +1 -1
- package/dist/helpers/index.d.ts +2 -2
- package/dist/helpers/index.js +2 -2
- package/dist/helpers/printings.d.ts +1 -1
- package/dist/helpers/printings.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/interfaces.d.ts +1 -0
- package/dist/sets.d.ts +1 -1
- package/dist/sets.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,184 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @flesh-and-blood/types
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- [
|
|
5
|
-
|
|
6
|
-
- [Working with this project](#working-with-this-project)
|
|
3
|
+
TypeScript enums, interfaces, and pure helper functions for **Flesh and Blood** cards. This is the base
|
|
4
|
+
package that [`@flesh-and-blood/cards`](../cards) and [`@flesh-and-blood/search`](../search) depend on.
|
|
5
|
+
It has no runtime dependencies.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Installation
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- `specialImageName` has been renamed `specialImage` for brevity
|
|
13
|
-
|
|
14
|
-
# 7.0 breaking changes
|
|
15
|
-
|
|
16
|
-
- `card.rarity` has been deprecated in favor of `card.rarities`
|
|
17
|
-
|
|
18
|
-
## Overview and installation
|
|
19
|
-
|
|
20
|
-
A library of all Flesh and Blood cards, available as a bundled TypeScript file with matching interfaces. Source data comes from the amazing [the-fab-cube/flesh-and-blood-cards](https://github.com/the-fab-cube/flesh-and-blood-cards) repository maintained by [Tyler Luce](https://github.com/luceleaftea) - all credit goes to him, and all errors are probably added by me in this project 😅.
|
|
21
|
-
|
|
22
|
-
To install run `npm i --save fab-cards`.
|
|
23
|
-
|
|
24
|
-
Access the card data in your project:
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
import { cards } from "fab-cards";
|
|
28
|
-
|
|
29
|
-
cards.forEach((card) => {
|
|
30
|
-
// do stuff with the card data
|
|
31
|
-
});
|
|
9
|
+
```bash
|
|
10
|
+
npm i @flesh-and-blood/types
|
|
32
11
|
```
|
|
33
12
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
**`Card`** contains all of the fields that could show up for any particular card. Required fields can be found on every card, while optional fields may or may not exist on any given card.
|
|
37
|
-
|
|
38
|
-
### Required
|
|
39
|
-
|
|
40
|
-
| Field | Data type | Examples |
|
|
41
|
-
| -------------- | -------------------- | ------------------------------------------ |
|
|
42
|
-
| artists | `string` array | `[ "Riordan Delmiro" ]` |
|
|
43
|
-
| cardIdentifier | `string` | `"snatch-red"`, `"aether-wildfire-red"` |
|
|
44
|
-
| classes | `Class` enum array | `["Generic"]`, `["Warrior","Wizard"]` |
|
|
45
|
-
| defaultImage | `string` | `"1HP001.width-450"` |
|
|
46
|
-
| printings | `Printing` array | see **`Printing`** |
|
|
47
|
-
| name | `string` | `"Rain Razors"`, `"Pummel"` |
|
|
48
|
-
| rarities | `Rarity` enum array | `["Super Rare"]`, `["Token", "Majestic"]` |
|
|
49
|
-
| setIdentifiers | `string` array | `[ "1HP009", "CRU006" ]` |
|
|
50
|
-
| sets | `Release` enum array | `[ "History Pack 1", "Crucible of War" ]` |
|
|
51
|
-
| specialImage | `string` | `"1HP001.width-450"` |
|
|
52
|
-
| subtypes | `Subtype` enum array | `["OneHanded", "Dagger"]`, `["Aura"]` |
|
|
53
|
-
| types | `Type` enum array | `["Action"]`, `["Hero"]` |
|
|
54
|
-
| typeText | `string` | `"Elemental Ranger Action – Arrow Attack"` |
|
|
55
|
-
|
|
56
|
-
### Optional
|
|
57
|
-
|
|
58
|
-
| Field | Data type | Examples |
|
|
59
|
-
| -------------------------- | -------------------- | ------------------------------------ |
|
|
60
|
-
| cost | `number` | `0`, `10` |
|
|
61
|
-
| defense | `number` | `3`, `4` |
|
|
62
|
-
| functionalText | `string` | `"If Snatch hits, draw a card."` |
|
|
63
|
-
| fusions | `Fusion` enum array | `[ "Earth", "Ice" ]` |
|
|
64
|
-
| hero | `Hero` enum | `"Rhinar"`, `"Dori"` |
|
|
65
|
-
| intellect | `number` | `3`, `4` |
|
|
66
|
-
| isCardBack | `boolean` | `true` |
|
|
67
|
-
| keywords | `Keyword` enum array | `[ "Boost" ]` |
|
|
68
|
-
| life | `number` | `18`, `40` |
|
|
69
|
-
| oppositeSideCardIdentifier | `string` | `"invoke-kyloria-red"`, `"tomeltai"` |
|
|
70
|
-
| pitch | `number` | `1`, `2`, `3` |
|
|
71
|
-
| power | `number` | `3`, `14` |
|
|
72
|
-
| restrictedFormats | `Format` enum array | `[ "Blitz" ]` |
|
|
73
|
-
| specialCost | `string` | `"XX"`, `"3X"` |
|
|
74
|
-
| specialDefense | `string` | `"*"` |
|
|
75
|
-
| specialPower | `string` | `"*"` |
|
|
76
|
-
| specializations | `Hero` enum array | `["Dromai","Fai"]` |
|
|
77
|
-
| talents | `Talent` enum array | `[ "Draconic" ]` |
|
|
78
|
-
| young | `boolean` | `true` |
|
|
79
|
-
|
|
80
|
-
**`Printing`** contains information about the different printings a card has had (e.g. different sets, foilings)
|
|
81
|
-
|
|
82
|
-
| Field | Data type | Examples |
|
|
83
|
-
| ---------- | --------------------------------- | ----------------------------------- |
|
|
84
|
-
| edition | `string` of `ReleaseEdition` enum | `"Alpha"`, `"Unlimited"` |
|
|
85
|
-
| foiling | `string` of `Foiling` enum | `"Cold"`, `"Rainbow"` |
|
|
86
|
-
| identifier | `string` | `"1HP001"` |
|
|
87
|
-
| image | `string` | `"1HP001.width-450"` |
|
|
88
|
-
| set | `string` of `Release` enum | `"Dynasty"`, `"Uprising"` |
|
|
89
|
-
| treatment | `string` of `Treatment` enum | `"Alternate Art"`, `"Extended Art"` |
|
|
90
|
-
|
|
91
|
-
## Enums
|
|
92
|
-
|
|
93
|
-
**`Class`**
|
|
13
|
+
Published as **dual ESM + CJS** — works in bundlers, native Node ESM, and CommonJS.
|
|
94
14
|
|
|
95
|
-
|
|
96
|
-
"NotClassed", "Generic", "Adjudicator", "Bard", "Brute", "Guardian", "Illusionist", "Mechanologist", "Merchant", "Ninja", "Ranger", "Runeblade", "Shapeshifter", "Warrior", "Wizard",
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
<br/>
|
|
100
|
-
|
|
101
|
-
**`Format`**
|
|
15
|
+
## Usage
|
|
102
16
|
|
|
103
17
|
```ts
|
|
104
|
-
|
|
18
|
+
import { Hero, Rarity, getDefaultPrinting } from "@flesh-and-blood/types";
|
|
105
19
|
```
|
|
106
20
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
**`Fusion`**
|
|
21
|
+
Data and helper modules are also available as subpath imports, so you can pull in just what you need:
|
|
110
22
|
|
|
111
23
|
```ts
|
|
112
|
-
|
|
24
|
+
import { releases } from "@flesh-and-blood/types/sets";
|
|
25
|
+
import { getDefaultPrinting } from "@flesh-and-blood/types/helpers";
|
|
26
|
+
import type { Card } from "@flesh-and-blood/types/interfaces";
|
|
113
27
|
```
|
|
114
28
|
|
|
115
|
-
|
|
29
|
+
## What's included
|
|
116
30
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
```ts
|
|
120
|
-
"Token", "Common", "Rare", "Super Rare", "Majestic", "Legendary", "Fabled", "Promo",
|
|
121
|
-
```
|
|
31
|
+
The exported TypeScript types are the source of truth for exact values and fields — the lists below are
|
|
32
|
+
an overview.
|
|
122
33
|
|
|
123
|
-
|
|
34
|
+
### Enums
|
|
124
35
|
|
|
125
|
-
|
|
36
|
+
`Bond`, `Class`, `Flow`, `Foiling`, `Format`, `Fusion`, `Hero`, `Keyword`, `Language`, `Meta`,
|
|
37
|
+
`Metatype`, `Rarity`, `Release`, `ReleaseEdition`, `ReleaseType`, `Shorthand`, `Subtype`, `Talent`,
|
|
38
|
+
`Trait`, `Treatment`, `Type`.
|
|
126
39
|
|
|
127
|
-
|
|
128
|
-
// Full sets
|
|
129
|
-
"Arcane Rising", "Crucible of War", "Dynasty", "Everfest", "History Pack 1", "Monarch", "Tales of Aria", "Uprising", "Welcome to Rathe",
|
|
40
|
+
### Interfaces
|
|
130
41
|
|
|
131
|
-
|
|
132
|
-
|
|
42
|
+
`Card` (the main card shape), `DoubleSidedCard`, `Printing`, `LegalOverride`, `ReleaseInfo`,
|
|
43
|
+
`SilverAgeChapter`.
|
|
133
44
|
|
|
134
|
-
|
|
135
|
-
"Promos",
|
|
136
|
-
```
|
|
45
|
+
### Helpers — `@flesh-and-blood/types/helpers`
|
|
137
46
|
|
|
138
|
-
|
|
47
|
+
- **Printing pickers:** `getPrint`, `getDefaultPrinting`, `getSpecialPrinting`, `getBoomerPrinting`,
|
|
48
|
+
`getMaxRarityPrinting`
|
|
49
|
+
- **Card properties:** `getCardIdentifier`, `getFrontAndBackCardIdentifier`,
|
|
50
|
+
`getCardFromGEMCardIdentifier`, `getIsArenaCard`, `getIsDeckCard`, `getIsCardTokenForDeck`,
|
|
51
|
+
`getCanCardBeTokenForDeck`, `getCanAddToDeck`, `getShouldRotateCardImage`
|
|
139
52
|
|
|
140
|
-
|
|
53
|
+
### Set data — `@flesh-and-blood/types/sets`
|
|
141
54
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
<br/>
|
|
147
|
-
|
|
148
|
-
**`Type`**
|
|
149
|
-
|
|
150
|
-
```ts
|
|
151
|
-
"Action", "Attack Action", "Attack Reaction", "Defense Reaction", "Equipment", "Hero", "Instant", "Mentor", "Resource", "Token", "Weapon",
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**`Hero`**
|
|
155
|
-
|
|
156
|
-
```ts
|
|
157
|
-
"Arakni", "Azalea", "Benji", "Boltyn", "Bravo", "Briar", "Chane", "Dash", "Data Doll", "Dorinthea", "Emperor", "Genis Wotchuneed", "Ira", "Iyslander", "Kano", "Kassai", "Katsu", "Kavdaen", "Kayo", "Levia", "Lexi", "Oldhim", "Prism", "Rhinar", "Ruu’di", "Shiyana", "Taylor", "Valda", "Viserai", "Yorick",
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
<br/>
|
|
161
|
-
|
|
162
|
-
**`Keyword`**
|
|
163
|
-
|
|
164
|
-
```ts
|
|
165
|
-
"Arcane Barrier", "Battleworn", "Blade Break", "Blood Debt", "Boost", "Channel", "Charge", "Combo", "Crush", "Dominate", "Essence", "Freeze", "Fusion", "Go Again", "Heave", "Intimidate", "Legendary", "Mentor", "Negate", "Opt", "Phantasm", "Reload", "Reprise", "Specialization", "Spectra", "Spellvoid", "Temper", "Thaw", "Unfreeze",
|
|
166
|
-
```
|
|
55
|
+
`releases`, `fullSetIdentifiers`, `setIdentifierToSetMappings`, `setToSetIdentifierMappings`,
|
|
56
|
+
`silverAgeChapters`, plus `getIsBooster`, `getIsReprint`, `getIsDraftable`, `getIsPreconstructed`.
|
|
167
57
|
|
|
168
58
|
## Working with this project
|
|
169
59
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
- [src/cards.csv](src/cards.csv) is the source of truth for all generated data. The data is managed in Google Sheets and sourced from [the-fab-cube/flesh-and-blood-cards](https://github.com/the-fab-cube/flesh-and-blood-cards).
|
|
60
|
+
Source lives in `src/` (`interfaces.ts`, `sets.ts`, `helpers/`).
|
|
173
61
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
1. [src/parser.ts](src/parser.ts) reads from the `.tsv` file and converts the data into JavaScript objects (performing basic steps like converting comma-delimited lists into arrays)
|
|
179
|
-
1. [src/mapper.ts](src/mapper.ts) takes the parsed card data and transforms it to match the interfaces in [src/interfaces.ts](src/interfaces.ts)
|
|
180
|
-
1. [src/writer.ts](src/writer.ts) creates `.ts` files containing the card information and all types
|
|
181
|
-
|
|
182
|
-
### Bundling the library
|
|
183
|
-
|
|
184
|
-
To generate the distributed package code run `npm run build` after transforming the data.
|
|
62
|
+
```bash
|
|
63
|
+
npm run build # build:esm (per-file ESM, tree-shakeable) + build:cjs (bundled) + tsc declarations
|
|
64
|
+
npm test # jest
|
|
65
|
+
```
|
package/dist/helpers/cards.d.ts
CHANGED
package/dist/helpers/cards.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Type, Keyword, Subtype, Trait } from "../interfaces";
|
|
1
|
+
import { Type, Keyword, Subtype, Trait } from "../interfaces.js";
|
|
2
2
|
const getCardIdentifier = (card, useNumber) => {
|
|
3
3
|
const { name: unformattedName, pitch } = card;
|
|
4
4
|
const name = unformattedName.trim().toLowerCase().replace("//", "-").normalize("NFD").replace(/\p{Diacritic}/gu, "").replace(/ /g, "-").replace("\xF0", "d").replace("\u0111", "d").replace("\xED", "i").replace(/[^a-z0-9 -]/g, "").replace(/--/, "-");
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./cards";
|
|
2
|
-
export * from "./printings";
|
|
1
|
+
export * from "./cards.js";
|
|
2
|
+
export * from "./printings.js";
|
package/dist/helpers/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./cards";
|
|
2
|
-
export * from "./printings";
|
|
1
|
+
export * from "./cards.js";
|
|
2
|
+
export * from "./printings.js";
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
Treatment,
|
|
3
3
|
Foiling,
|
|
4
4
|
ReleaseEdition
|
|
5
|
-
} from "../interfaces";
|
|
6
|
-
import { fullSetIdentifiers } from "../sets";
|
|
5
|
+
} from "../interfaces.js";
|
|
6
|
+
import { fullSetIdentifiers } from "../sets.js";
|
|
7
7
|
const identifierExtensionMapping = {
|
|
8
8
|
// [Release.RhinarBlitzDeck]: "-Blitz",
|
|
9
9
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./helpers/index";
|
|
2
|
-
export * from "./interfaces";
|
|
3
|
-
export * from "./sets";
|
|
1
|
+
export * from "./helpers/index.js";
|
|
2
|
+
export * from "./interfaces.js";
|
|
3
|
+
export * from "./sets.js";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./helpers/index";
|
|
2
|
-
export * from "./interfaces";
|
|
3
|
-
export * from "./sets";
|
|
1
|
+
export * from "./helpers/index.js";
|
|
2
|
+
export * from "./interfaces.js";
|
|
3
|
+
export * from "./sets.js";
|
package/dist/interfaces.d.ts
CHANGED
package/dist/sets.d.ts
CHANGED
package/dist/sets.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flesh-and-blood/types",
|
|
3
3
|
"description": "TypeScript representations of Flesh and Blood card types",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "dist/index.cjs",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"FAB",
|
|
72
72
|
"FABTCG"
|
|
73
73
|
],
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "341ad7b281233911841c004cc8109203375867ec"
|
|
75
75
|
}
|