Compare commits

...

9 Commits

Author SHA1 Message Date
06e6f7639d build: bump esbuild from 0.16.16 to 0.16.17
Bumps [esbuild](https://github.com/evanw/esbuild) from 0.16.16 to 0.16.17.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.16.16...v0.16.17)

---
updated-dependencies:
- dependency-name: esbuild
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 07:03:18 +00:00
09d8b28a66 docs: Include HTML base for browser people :D
Signed-off-by: Avior <github@avior.me>
2023-01-11 20:54:16 +01:00
4507bbd651 misc: Upgraded deps
Signed-off-by: Avior <github@avior.me>
2023-01-11 20:41:55 +01:00
8a89aefe73 2.4.9 2023-01-11 20:33:00 +01:00
8df969c1db fix: Issue regarding browser loading
Signed-off-by: Avior <github@avior.me>
2023-01-11 20:32:51 +01:00
2177e9c088 fix: Updated build versions 2022-12-11 01:38:54 +01:00
a32f42975a 2.4.8 2022-12-09 16:11:29 +01:00
0148979d7d misc: Updated deps
Signed-off-by: Avior <f.bouillon@aptatio.com>
2022-12-09 16:11:24 +01:00
ea357c9080 fix: Version number not being correctly exported
Signed-off-by: Avior <f.bouillon@aptatio.com>
2022-12-09 16:08:10 +01:00
6 changed files with 7863 additions and 4902 deletions

View File

@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
# Follow current releases https://nodejs.org/en/about/releases/
node-version: [12.x, 14.x, 16.x, 17.x, 18.x]
node-version: [14.x, 16.x, 18.x, 19.x]
steps:
- name: Checkout

View File

@ -63,19 +63,40 @@ _Note: a complete documentation is available at [TCGdex.dev](https://www.tcgdex.
**Example: Fetch a Card**
_in Browser_
```html
<script src="https://cdn.jsdelivr.net/npm/@tcgdex/sdk@2.4.9/dist/tcgdex.browser.js"></script>
<script>
// Instantiate the SDK
const tcgdex = new TCGdex('en');
// go into an async context
;(async () => {
// Card will be Furret from the Darkness Ablaze Set
const card = await tcgdex.fetch('cards', 'swsh3-136');
})();
</script>
```
_in NodeJS (in an async context)_
```typescript
// Import the SDK in Typescript
import TCGdex from '@tcgdex/sdk';
// Instantiate the SDK
// note: you can use one of the following lanugages
const tcgdex = new TCGdex('en');
// Card will be Furret from the Darkness Ablaze Set
const card = await tcgdex.fetch('cards', 'swsh3-136');
// go into an async context
(async () => {
// Card will be Furret from the Darkness Ablaze Set
const card = await tcgdex.fetch('cards', 'swsh3-136');
// You can also get the same result using
const card = await tcgdex.fetch('sets', 'Darkness Ablaze', 136);
})();
// You can also get the same result using
const card = await tcgdex.fetch('sets', 'Darkness Ablaze', 136);
```
**Other Examples**

12693
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@tcgdex/sdk",
"version": "2.4.7",
"version": "2.4.9",
"main": "./dist/cjs/tcgdex.node.js",
"module": "./dist/modules/tcgdex.node.js",
"types": "./dist/types/tcgdex.d.ts",
@ -22,28 +22,28 @@
],
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/preset-typescript": "^7.14.5",
"@dzeio/config": "^1.0.0",
"@types/node-fetch": "^2.5.10",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"esbuild": "^0.14.5",
"eslint": "^8.4.1",
"jest": "^27.0.5",
"typescript": "^4.1.3"
"@babel/core": "^7",
"@babel/preset-env": "^7",
"@babel/preset-typescript": "^7",
"@dzeio/config": "^1",
"@types/node-fetch": "^2",
"@typescript-eslint/eslint-plugin": "^5",
"@typescript-eslint/parser": "^5",
"esbuild": "^0.16.3",
"eslint": "^8",
"jest": "^29",
"typescript": "^4"
},
"engines": {
"node": ">=12"
},
"dependencies": {
"isomorphic-unfetch": "^3.1.0",
"unfetch": "^4.2.0"
"isomorphic-unfetch": "^3",
"unfetch": "^4"
},
"scripts": {
"prebuild": "node scripts/export-version-number.js",
"build": "npm run prebuild && npm run build:cjs && npm run build:browser && npm run build:es2015",
"build": "npm run build:cjs && npm run build:browser && npm run build:es2015",
"build:cjs": "tsc --project tsconfig.json",
"build:es2015": "tsc --project tsconfig.es2015.json",
"build:browser": "esbuild ./src/tcgdex.browser.ts --bundle --minify --sourcemap --target=es2016,chrome90,firefox78,safari14,ios13,edge90 --outfile=dist/tcgdex.browser.js",

View File

@ -1,4 +1,4 @@
const { version } = require('../package.json')
const fs = require('fs')
fs.writeFileSync('./src/version.js', `export const version = ${JSON.stringify({version})}`)
fs.writeFileSync('./src/version.js', `export const version = '${version}'`)

View File

@ -3,4 +3,9 @@ import unfetch from 'unfetch'
TCGdex.fetch = window.fetch ?? unfetch as any
(global ?? window).TCGdex = TCGdex
if (typeof global !== 'undefined') {
global.TCGdex = TCGdex
}
if (typeof window !== 'undefined') {
(window as any).TCGdex = TCGdex
}