unite-lib 1.0.3 → 1.2.0
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/LICENSE +21 -21
- package/README.md +248 -203
- package/dist/i18n/index.cjs +116 -6
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +12 -3
- package/dist/i18n/index.d.ts +12 -3
- package/dist/i18n/index.global.js +114 -6
- package/dist/i18n/index.global.js.map +1 -1
- package/dist/i18n/index.js +114 -6
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +112 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.global.js +109 -17
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +109 -17
- package/dist/index.js.map +1 -1
- package/maps/map-groudon/map-groudon@1x.png +0 -0
- package/maps/map-groudon/map-groudon@2x.png +0 -0
- package/maps/map-groudon/map-groudon@4x.png +0 -0
- package/maps/map-kyogre/map-kyogre@1x.png +0 -0
- package/maps/map-kyogre/map-kyogre@2x.png +0 -0
- package/maps/map-kyogre/map-kyogre@4x.png +0 -0
- package/maps/map-rayquaza/map-rayquaza@1x.png +0 -0
- package/maps/map-rayquaza/map-rayquaza@2x.png +0 -0
- package/maps/map-rayquaza/map-rayquaza@4x.png +0 -0
- package/moves/moltres_s11.png +0 -0
- package/moves/moltres_s21.png +0 -0
- package/package.json +66 -47
- package/pokemons/roster-moltres-2x.png +0 -0
- package/pokemons/roster-moltres.png +0 -0
- package/pokemons/stat-moltres.png +0 -0
- package/maps/groudon.png +0 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 unite-lib contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 unite-lib contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,203 +1,248 @@
|
|
|
1
|
-
# unite-lib
|
|
2
|
-
|
|
3
|
-
Assets and data library for **Pokémon Unite**: roster, names, images, moves, and maps. Use in any project via **npm** or **CDN**.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install unite-lib
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
### Data and helpers
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import {
|
|
17
|
-
pokemons,
|
|
18
|
-
moves,
|
|
19
|
-
maps,
|
|
20
|
-
BattleType,
|
|
21
|
-
Tag,
|
|
22
|
-
getPokemonByName,
|
|
23
|
-
getPokemonByDex,
|
|
24
|
-
getPokemonsByBattleType,
|
|
25
|
-
getImageUrl,
|
|
26
|
-
getPokemonName,
|
|
27
|
-
} from "unite-lib";
|
|
28
|
-
|
|
29
|
-
// All roster entries
|
|
30
|
-
console.log(pokemons.length);
|
|
31
|
-
|
|
32
|
-
// Find by name or dex
|
|
33
|
-
const pikachu = getPokemonByName("Pikachu");
|
|
34
|
-
const dex25 = getPokemonByDex(25);
|
|
35
|
-
|
|
36
|
-
// Filter by role
|
|
37
|
-
const attackers = getPokemonsByBattleType(BattleType.ATTACKER);
|
|
38
|
-
const ranged = getPokemonsByTag(Tag.RANGED);
|
|
39
|
-
|
|
40
|
-
// Image URL (relative or with CDN base)
|
|
41
|
-
const mainImg = getImageUrl(pikachu, "main");
|
|
42
|
-
const cdnImg = getImageUrl(pikachu, "main", {
|
|
43
|
-
baseUrl: "https://cdn.jsdelivr.net/npm/unite-lib@1.0.0",
|
|
44
|
-
});
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### i18n (localized names)
|
|
48
|
-
|
|
49
|
-
```js
|
|
50
|
-
import { getPokemonName } from "unite-lib";
|
|
51
|
-
// or
|
|
52
|
-
import { getPokemonName } from "unite-lib/i18n";
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
getPokemonName("venusaur", "
|
|
56
|
-
getPokemonName("venusaur", "
|
|
57
|
-
getPokemonName("venusaur", "
|
|
58
|
-
getPokemonName("venusaur", "
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
 |  |
|
|
80
|
+
|  |  |
|
|
81
|
+
|  |  |
|
|
82
|
+
|
|
83
|
+
### Moves
|
|
84
|
+
|
|
85
|
+
Move images (slot 1 and 2, variants 1 and 2) per Pokémon.
|
|
86
|
+
|
|
87
|
+
| Slot 1.1 | Slot 1.2 | Slot 2.1 | Slot 2.2 |
|
|
88
|
+
|----------|----------|----------|----------|
|
|
89
|
+
|  |  |  |  |
|
|
90
|
+
|
|
91
|
+
### Maps
|
|
92
|
+
|
|
93
|
+
Game map images (Theia Sky Ruins variants: Groudon, Kyogre, Rayquaza). Each map has multiple resolutions (1x, 2x, 4x); use `getMapImageUrl(map, resolution?, options?)` to pick one. Names and descriptions are available in all supported locales via `getMapName(mapId, locale)` and `getMapDescription(mapId, locale)` (see [i18n](#i18n-localized-names)).
|
|
94
|
+
|
|
95
|
+

|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Local development (testing without publishing to npm)
|
|
100
|
+
|
|
101
|
+
To test the library in another project on your machine without publishing to npm:
|
|
102
|
+
|
|
103
|
+
### 1. Build the library
|
|
104
|
+
|
|
105
|
+
From the **unite-lib** folder:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
cd unite-lib
|
|
109
|
+
npm run build
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 2. Use in your project
|
|
113
|
+
|
|
114
|
+
**Option A — `npm link` (symlink, great for development)**
|
|
115
|
+
|
|
116
|
+
From the library folder:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm link
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
In your other project (e.g. the app that consumes the library):
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
cd /path/to/your/project
|
|
126
|
+
npm link unite-lib
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
From then on, `import { pokemons, getPokemonName } from "unite-lib"` uses the local version. When you change the library, run `npm run build` again; the consuming project already points to the same package.
|
|
130
|
+
|
|
131
|
+
To undo in the consuming project: `npm unlink unite-lib`.
|
|
132
|
+
|
|
133
|
+
**Option B — `file:` dependency (install from path)**
|
|
134
|
+
|
|
135
|
+
In your project's `package.json`, add:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"dependencies": {
|
|
140
|
+
"unite-lib": "file:../unite-lib"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Adjust `../unite-lib` to the relative (or absolute) path to the library folder. Then:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
npm install
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Whenever you change the library, run `npm run build` in it and, to refresh the copy in the consumer, run `npm install` again in the project (or use `npm update unite-lib`).
|
|
152
|
+
|
|
153
|
+
### Images when testing locally
|
|
154
|
+
|
|
155
|
+
Image paths are relative (e.g. `pokemons/roster-venusaur.png`). In the consumer you can:
|
|
156
|
+
|
|
157
|
+
- Use **baseUrl** when calling `getImageUrl(pokemon, "main", { baseUrl: "http://localhost:3000/node_modules/unite-lib" })` if the bundler/server serves `node_modules`, or
|
|
158
|
+
- Point **baseUrl** to where the `pokemons/`, `moves/`, and `maps/` folders are available in your app.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## CDN (browser)
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<script src="https://cdn.jsdelivr.net/npm/unite-lib@latest/dist/index.global.js"></script>
|
|
166
|
+
<script>
|
|
167
|
+
const { pokemons, getPokemonName, BattleType } = window.UniteLib;
|
|
168
|
+
</script>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Asset URLs via jsDelivr (substitua `@latest` por uma versão se quiser):
|
|
172
|
+
|
|
173
|
+
- `https://cdn.jsdelivr.net/npm/unite-lib@latest/pokemons/roster-venusaur.png`
|
|
174
|
+
- `https://cdn.jsdelivr.net/npm/unite-lib@latest/moves/venusaur_s11.png`
|
|
175
|
+
|
|
176
|
+
## API overview
|
|
177
|
+
|
|
178
|
+
| Export | Description |
|
|
179
|
+
|--------|-------------|
|
|
180
|
+
| `pokemons` | Full roster (name, dex, images, battleType, stats, tags, difficulty) |
|
|
181
|
+
| `moves` | Move list (pokemonId, slotId, name, image) |
|
|
182
|
+
| `maps` | Map list (id, name, image, images by resolution, description) |
|
|
183
|
+
| `BattleType` | `attacker`, `defender`, `allrounder`, `speedster`, `supporter` |
|
|
184
|
+
| `Tag` | Role + style: `attacker`, `defender`, `melee`, `ranged`, … |
|
|
185
|
+
| `getImageUrl(pokemon, key, options?)` | Image path or full URL with `baseUrl` |
|
|
186
|
+
| `getMapImageUrl(map, resolution?, options?)` | Map image URL (resolution: `"1"`, `"2"`, `"4"`) |
|
|
187
|
+
| `getPokemonByName(name)` | Find by display name |
|
|
188
|
+
| `getPokemonByDex(dex)` | Find by Pokédex number |
|
|
189
|
+
| `getPokemonBySlug(slug)` | Find by slug (e.g. `venusaur`) |
|
|
190
|
+
| `getPokemonsByBattleType(type)` | Filter by BattleType |
|
|
191
|
+
| `getPokemonsByTag(tag)` | Filter by Tag |
|
|
192
|
+
| `getActivePokemons()` | Only active roster entries |
|
|
193
|
+
| `getPokemonName(slug, locale)` | Localized Pokémon name (from main package or `unite-lib/i18n`) |
|
|
194
|
+
| `getMapName(mapId, locale)` | Localized map name |
|
|
195
|
+
| `getMapDescription(mapId, locale)` | Localized map description |
|
|
196
|
+
|
|
197
|
+
## Project structure
|
|
198
|
+
|
|
199
|
+
- **`dist/`** — Built ESM, CJS, and IIFE; type definitions (`.d.ts`)
|
|
200
|
+
- **`pokemons/`** — Roster and stat images
|
|
201
|
+
- **`moves/`** — Move images
|
|
202
|
+
- **`maps/`** — Map images
|
|
203
|
+
- **`.cursor/skills/`** — [Cursor Agent Skills](https://docs.cursor.com/context/agent-skills) for use with AI agents in this repo (e.g. syncing roster from images in `pokemons/` and `moves/`).
|
|
204
|
+
- **`mcp/`** — [MCP server](mcp/README.md) (Model Context Protocol) para consumir a library em agentes de IA: tools para listar e buscar pokémons, moves, mapas, URLs de imagens e nomes localizados (Cursor, Claude Desktop, etc.).
|
|
205
|
+
|
|
206
|
+
## Releases (publicação no npm)
|
|
207
|
+
|
|
208
|
+
As versões e a publicação no npm são feitas automaticamente com [semantic-release](https://github.com/semantic-release/semantic-release) quando há **push na branch `main`**.
|
|
209
|
+
|
|
210
|
+
### Como a versão é definida
|
|
211
|
+
|
|
212
|
+
Os commits seguem [Conventional Commits](https://www.conventionalcommits.org/). O semantic-release usa isso para decidir o tipo de release:
|
|
213
|
+
|
|
214
|
+
| Tipo de commit | Efeito na versão |
|
|
215
|
+
|------------------|-------------------|
|
|
216
|
+
| `feat:` | **MINOR** (1.**x**.0) — nova funcionalidade |
|
|
217
|
+
| `fix:`, `perf:`, `docs:` (sem escopo de código) | **PATCH** (1.0.**x**) — correção ou melhoria |
|
|
218
|
+
| `BREAKING CHANGE` ou `!` no escopo (ex.: `feat!:`) | **MAJOR** (**x**.0.0) — mudança incompatível |
|
|
219
|
+
|
|
220
|
+
Exemplos:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
git commit -m "feat: add Mega Charizard Y to roster"
|
|
224
|
+
git commit -m "fix: correct Venusaur stat image path"
|
|
225
|
+
git commit -m "feat!: change getImageUrl signature" # breaking → MAJOR
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Commits que não indicam release (ex.: `chore:`, `style:`, `test:`) não geram nova versão; mesmo assim o push na `main` roda o workflow (que pode não publicar nada).
|
|
229
|
+
|
|
230
|
+
### O que você precisa configurar
|
|
231
|
+
|
|
232
|
+
1. **Token do npm (NPM_TOKEN)**
|
|
233
|
+
No repositório no GitHub: **Settings → Secrets and variables → Actions** e crie um secret chamado **`NPM_TOKEN`**.
|
|
234
|
+
- Crie o token em [npmjs.com → Access Tokens](https://www.npmjs.com/settings/~youruser/tokens): “Automation” ou “Publish”.
|
|
235
|
+
- Cole o valor no secret `NPM_TOKEN`.
|
|
236
|
+
|
|
237
|
+
2. **Conventional Commits**
|
|
238
|
+
Para haver release, use pelo menos um commit com `feat:` ou `fix:` (ou breaking) no histórico desde a última tag. Se todos forem `chore:`/`style:`/`test:`, nenhuma versão será publicada.
|
|
239
|
+
|
|
240
|
+
Depois disso, ao dar push na `main`, o workflow **Release** roda, o semantic-release analisa os commits, atualiza a versão no `package.json`, gera/atualiza o `CHANGELOG.md`, cria a release no GitHub e publica o pacote no npm.
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
MIT. See [LICENSE](LICENSE).
|
|
245
|
+
|
|
246
|
+
## Contributing
|
|
247
|
+
|
|
248
|
+
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines and workflow.
|