mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-04-22 10:42:10 +00:00
Added a version script
It automaticly update the version number without importing package.json Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
f858bd5c79
commit
96bc9149c9
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ coverage
|
||||
|
||||
# Dist files
|
||||
dist
|
||||
src/version.json
|
||||
|
@ -42,7 +42,8 @@
|
||||
"unfetch": "^4.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn build:cjs && yarn build:browser && yarn build:es2015",
|
||||
"prebuild": "node scripts/export-version-number.js",
|
||||
"build": "yarn prebuild && yarn build:cjs && yarn build:browser && yarn build:es2015",
|
||||
"build:cjs": "tsc --project tsconfig.json",
|
||||
"build:es2015": "tsc --project tsconfig.es2015.json",
|
||||
"build:browser": "wp --config webpack.config.js",
|
||||
|
4
scripts/export-version-number.js
Normal file
4
scripts/export-version-number.js
Normal file
@ -0,0 +1,4 @@
|
||||
const { version } = require('../package.json')
|
||||
const fs = require('fs')
|
||||
|
||||
fs.writeFileSync('./src/version.json', JSON.stringify({version}))
|
@ -1,4 +1,5 @@
|
||||
import TCGdex from './tcgdex'
|
||||
import { version } from './version.json'
|
||||
|
||||
export default class Request {
|
||||
|
||||
@ -14,7 +15,7 @@ export default class Request {
|
||||
const unfetch = TCGdex.fetch
|
||||
const resp = await unfetch(url, {
|
||||
headers: {
|
||||
'user-agent': `@tcgdex/javascript-sdk/${TCGdex.VERSION}`
|
||||
'user-agent': `@tcgdex/javascript-sdk/${version}`
|
||||
}
|
||||
})
|
||||
if (resp.status !== 200) {
|
||||
|
@ -8,8 +8,6 @@ export default class TCGdex {
|
||||
|
||||
public static fetch: typeof fetch
|
||||
|
||||
public static readonly VERSION = '2.2.0'
|
||||
|
||||
/**
|
||||
* @deprecated to change the lang use `this.lang`
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user