added certifactions and configurations, util function for constructing image paths

This commit is contained in:
Blake Joynes
2021-05-31 14:48:00 -04:00
parent e390891329
commit b5034bfa9c
11 changed files with 18 additions and 14 deletions

View File

@@ -1,16 +1,15 @@
{ {
"name": "tmdb-ts", "name": "tmdb-ts",
"version": "0.0.3", "version": "0.0.7",
"description": "TMDB v3 library wrapper", "description": "TMDB v3 library wrapper",
"main": "dist/index.ts", "main": "dist/index.js",
"types": "dist/types/index.d.ts", "types": "dist/index.d.ts",
"scripts": { "scripts": {
"compile": "rm -rf dist && tsc -d && npm run copy-types", "compile": "rm -rf dist && tsc -d && npm run copy-types",
"lint": "eslint --ext .ts src/", "lint": "eslint --ext .ts src/",
"lint:fix": "eslint --ext .ts src/ --fix", "lint:fix": "eslint --ext .ts src/ --fix",
"prepublish": "tsc", "prepublish": "tsc",
"copy-types": "mkdir dist/types && cp src/types/*.d.ts dist/types" "copy-types": "mkdir dist/types && cp src/types/*.d.ts dist/types"
}, },
"bugs": { "bugs": {
"url": "https://github.com/blakejoy/tmdb-ts/issues", "url": "https://github.com/blakejoy/tmdb-ts/issues",

View File

@@ -1,3 +1,6 @@
import TMDB from './tmdb'; import TMDB from './tmdb';
export * from './types';
export * from './utils';
export default TMDB; export default TMDB;

View File

@@ -1,3 +1,4 @@
import { Person } from './';
export interface CreditSeason { export interface CreditSeason {
air_date?: string; air_date?: string;

View File

@@ -93,10 +93,3 @@ export interface ExternalIds {
twitter_id: string; twitter_id: string;
id: number; id: number;
} }
export {
certs,
credits,
changes,
};

View File

@@ -6,7 +6,11 @@
* @param {string} baseUrl base image url * @param {string} baseUrl base image url
* @param {string} fileSize file size * @param {string} fileSize file size
* @param {string} imagePath raw image path * @param {string} imagePath raw image path
* @param {boolean} svg get svg version if true
*/ */
export const getFullImagePath = (baseUrl: string, fileSize: string, imagePath: string): string => { export const getFullImagePath = (baseUrl: string, fileSize: string, imagePath: string, svg = false): string => {
return `${baseUrl}${fileSize}${imagePath}`; const imagePathArr = imagePath.split('.');
const imageFormat = svg ? 'svg' : imagePathArr[1];
return `${baseUrl}${fileSize}${imagePathArr[0]}.${imageFormat}`;
}; };

1
src/utils/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from './getImagePath';

View File

@@ -11,7 +11,10 @@
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
"emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
"skipLibCheck": true /* Skip type checking of declaration files. */, "skipLibCheck": true /* Skip type checking of declaration files. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"typeRoots": [
"./src/types"
]
}, },
"types": ["node"], "types": ["node"],
"include": [ "include": [