@flesh-and-blood/cards 4.0.3 → 4.0.5

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.
Files changed (4) hide show
  1. package/README.md +34 -163
  2. package/dist/index.js +2986 -2982
  3. package/dist/index.mjs +2986 -2982
  4. package/package.json +4 -4
package/README.md CHANGED
@@ -1,184 +1,55 @@
1
- # Flesh and Blood cards
1
+ # @flesh-and-blood/cards
2
2
 
3
- - [Overview & installation](#overview-and-installation)
4
- - [Card interfaces](#card-interfaces)
5
- - [Enums](#enums)
6
- - [Working with this project](#working-with-this-project)
3
+ Every **Flesh and Blood** card as a single `cards: Card[]` export, generated from source data. Card
4
+ objects are typed by [`@flesh-and-blood/types`](../types).
7
5
 
8
- # 8.0 breaking changes
6
+ ## Installation
9
7
 
10
- - `card.images` has been deprecated in favor of `card.printings`
11
- - `defaultImageName` has been renamed `defaultImage` for brevity
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 😅.
8
+ ```bash
9
+ npm i @flesh-and-blood/cards @flesh-and-blood/types
10
+ ```
21
11
 
22
- To install run `npm i --save @flesh-and-blood/cards`.
12
+ Published as **dual ESM + CJS**. Note: the dataset is large (~12 MB) — many consumers load it at build
13
+ or server time rather than shipping it to the browser.
23
14
 
24
- Access the card data in your project:
15
+ ## Usage
25
16
 
26
17
  ```ts
27
18
  import { cards } from "@flesh-and-blood/cards";
19
+ import type { Card } from "@flesh-and-blood/types";
28
20
 
29
- cards.forEach((card) => {
21
+ cards.forEach((card: Card) => {
30
22
  // do stuff with the card data
31
23
  });
32
24
  ```
33
25
 
34
- ## Card interfaces
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 | `["1H", "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`**
94
-
95
- ```ts
96
- "NotClassed", "Generic", "Adjudicator", "Bard", "Brute", "Guardian", "Illusionist", "Mechanologist", "Merchant", "Ninja", "Ranger", "Runeblade", "Shapeshifter", "Warrior", "Wizard",
97
- ```
98
-
99
- <br/>
100
-
101
- **`Format`**
102
-
103
- ```ts
104
- "Blitz", "Clash", "Classic Constructed", "Commoner",
105
- ```
106
-
107
- <br/>
108
-
109
- **`Fusion`**
110
-
111
- ```ts
112
- "Earth", "Ice", "Lightning",
113
- ```
114
-
115
- <br/>
116
-
117
- **`Rarity`**
118
-
119
- ```ts
120
- "Token", "Common", "Rare", "Super Rare", "Majestic", "Legendary", "Fabled", "Promo",
121
- ```
122
-
123
- <br/>
124
-
125
- **`Release`**
126
-
127
- ```ts
128
- // Full sets
129
- "Arcane Rising", "Crucible of War", "Dynasty", "Everfest", "History Pack 1", "Monarch", "Tales of Aria", "Uprising", "Welcome to Rathe",
130
-
131
- // Hero/blitz decks
132
- "Boltyn Blitz Deck", "Briar Blitz Deck", "Bravo Blitz Deck", "Chane Blitz Deck", "Classic Battles: Rhinar vs Dorinthea", "Dorinthea Hero Deck", "Ira Welcome Deck", "Katsu Hero Deck", "LeviaBlitzDeck", "Lexi Blitz Deck", "Oldhim Blitz Deck", "Prism Blitz Deck", "Rhinar Hero Deck",
133
-
134
- // One-offs
135
- "Promos",
136
- ```
137
-
138
- <br/>
139
-
140
- **`Talent`**
141
-
142
- ```ts
143
- "Draconic", "Earth", "Elemental", "Ice", "Light", "Lightning", "Royal", "Shadow",
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
- ```
26
+ Card data is sourced from the amazing
27
+ [the-fab-cube/flesh-and-blood-cards](https://github.com/the-fab-cube/flesh-and-blood-cards) project by
28
+ [Tyler Luce](https://github.com/luceleaftea) — all credit to him; any errors are probably mine 😅.
167
29
 
168
- ## Working with this project
30
+ ## The data pipeline
169
31
 
170
- ### Card data
32
+ `src/index.ts` is a **~12 MB generated file that is committed — never hand-edit it.** Regenerate
33
+ everything with `npm run full`, which runs end to end.
171
34
 
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).
35
+ ### transform — `scripts/index.ts`
173
36
 
174
- ### Data transformations
37
+ Reads the source data, computes derived fields, and writes the output:
175
38
 
176
- There are three steps involved in transforming the `.tsv` source data into typed `.ts` code - executed via `npm run transform`.
39
+ 1. **Spoiled** cards from `scripts/Spoiled/*.csv` (Google Sheets exports, one per set), parsed/mapped by `scripts/Spoiled/{parser,mapper}.ts`.
40
+ 2. **Released** cards from `scripts/Released/card.json` + `set.json` (sourced from the-fab-cube/flesh-and-blood-cards), parsed/mapped by `scripts/Released/{parser,mapper}.ts`.
41
+ 3. **Combine & dedupe** — a card re-released in a new set merges its printings, sets, rarities, and legality — then compute derived fields (legality, meta, nicknames, shorthands, short name, TCGplayer info) via `scripts/Shared/*`.
42
+ 4. `scripts/writer.ts` writes `src/index.ts` and `latest-set/index.ts`.
177
43
 
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
44
+ Fix data in the **source**, not the generated output. Overrides and edge cases live in
45
+ `scripts/Spoiled/overrides.csv` and `scripts/Shared/` (artist overrides, excludes, legality, shorthands,
46
+ TCGplayer data, cardvault image maps).
181
47
 
182
- ### Bundling the library
48
+ ### build / new / tts / sitemap
183
49
 
184
- To generate the distributed package code run `npm run build` after transforming the data.
50
+ | Step | Command | What it does |
51
+ | ------- | ----------------- | ------------------------------------------------------------------------------------------ |
52
+ | build | `npm run build` | `build:cjs` (`dist/index.js`) + `build:esm` (`dist/index.mjs`) + `tsc` declarations + jest |
53
+ | new | `npm run new` | Report new/removed cards vs the last published version |
54
+ | tts | `npm run tts` | Generate Tabletop Simulator card data (`tts/tts.txt`) |
55
+ | sitemap | `npm run sitemap` | Generate `sitemap/sitemap-cards.xml` |