mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-07-14 02:45:11 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
0f2ad36e8c | |||
74de8961ef | |||
98c80fcd20 |
30
CHANGELOG.md
30
CHANGELOG.md
@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## 2.5.1 - 2023-07-18
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- ModuleJS exports not working as intended
|
||||||
|
|
||||||
|
## 2.5.0 - 2023-06-28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support for both ModuleJS and CommonJS
|
||||||
|
|
||||||
|
## 2.4.9 - 2022-09-26
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- package not loading on browser
|
||||||
|
|
||||||
|
## 2.4.8 - 2022-09-26
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- fix version number not correctly exposting
|
||||||
|
|
||||||
|
## 2.4.7 - 2022-09-26
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Compatibility with Angular
|
||||||
|
|
||||||
## 2.4.6 - 2022-01-28
|
## 2.4.6 - 2022-01-28
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -82,8 +82,11 @@ _in Browser_
|
|||||||
_in NodeJS (in an async context)_
|
_in NodeJS (in an async context)_
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// Import the SDK in Typescript
|
// Import the SDK in Typescript or moduleJS
|
||||||
import TCGdex from '@tcgdex/sdk';
|
import TCGdex from '@tcgdex/sdk'
|
||||||
|
|
||||||
|
// import the SDK in commonJS
|
||||||
|
const TCGdex = require('@tcgdex/sdk').default
|
||||||
|
|
||||||
// Instantiate the SDK
|
// Instantiate the SDK
|
||||||
const tcgdex = new TCGdex('en');
|
const tcgdex = new TCGdex('en');
|
||||||
|
13
package.json
13
package.json
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@tcgdex/sdk",
|
"name": "@tcgdex/sdk",
|
||||||
"version": "2.5.0",
|
"version": "2.5.1",
|
||||||
"main": "./dist/tcgdex.node.js",
|
"main": "./dist/tcgdex.node.js",
|
||||||
"module": "./dist/tcgdex.node.mjs",
|
"module": "./dist/tcgdex.node.mjs",
|
||||||
"types": "./dist/tcgdex.node.d.ts",
|
"types": "./dist/tcgdex.node.d.ts",
|
||||||
|
"browser": "./dist/tcgdex.browser.global.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"require": {
|
"require": {
|
||||||
@ -11,8 +12,8 @@
|
|||||||
"default": "./dist/tcgdex.node.js"
|
"default": "./dist/tcgdex.node.js"
|
||||||
},
|
},
|
||||||
"import": {
|
"import": {
|
||||||
"default": "./dist/tcgdex.node.mjs",
|
"types": "./dist/tcgdex.node.d.mts",
|
||||||
"types": "./dist/tcgdex.node.d.mts"
|
"default": "./dist/tcgdex.node.mjs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -30,7 +31,9 @@
|
|||||||
"api",
|
"api",
|
||||||
"typescript",
|
"typescript",
|
||||||
"javascript",
|
"javascript",
|
||||||
"typing"
|
"typing",
|
||||||
|
"browser",
|
||||||
|
"node"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -55,7 +58,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "node scripts/export-version-number.js",
|
"prebuild": "node scripts/export-version-number.js",
|
||||||
"build": "tsup ./src/tcgdex.node.ts --format cjs,esm --dts --clean && tsup ./src/tcgdex.browser.ts --format iife --minify --sourcemap",
|
"build": "tsup ./src/tcgdex.node.ts --format cjs,esm --dts --clean && tsup ./src/tcgdex.browser.ts --format iife --global-name TCGdex --sourcemap",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"lint": "eslint",
|
"lint": "eslint",
|
||||||
"test": "jest --coverage"
|
"test": "jest --coverage"
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
import TCGdex from './tcgdex'
|
|
||||||
import unfetch from 'unfetch'
|
import unfetch from 'unfetch'
|
||||||
|
import TCGdex from './tcgdex'
|
||||||
|
|
||||||
TCGdex.fetch = window.fetch ?? unfetch as any
|
TCGdex.fetch = window.fetch ?? unfetch as any
|
||||||
|
|
||||||
if (typeof global !== 'undefined') {
|
export default TCGdex
|
||||||
global.TCGdex = TCGdex
|
|
||||||
}
|
|
||||||
if (typeof window !== 'undefined') {
|
|
||||||
(window as any).TCGdex = TCGdex
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user