Skip to content

Commit

Permalink
fix: commonjs build, downgrade node-fetch, fix types a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
troggy committed Nov 24, 2021
1 parent 0c7461b commit 0a25bbe
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 36 deletions.
6 changes: 3 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fetch from "node-fetch";
import { MovieResponse, MovieResultsResponse } from "./types";
import { ExtractTmdbIdParams, MovieResponse, MovieResultsResponse } from "./types";

const titleMatch = (movieData, needle) =>
movieData.title.toLowerCase() === needle.toLowerCase() ||
Expand Down Expand Up @@ -58,7 +58,7 @@ class TmdbExtractor {
return exactMatch?.id || 0;
}

async extractTmdbId({ imdbId, originalTitle, title, year }): Promise<number> {
async extractTmdbId({ imdbId, originalTitle, title, year }: ExtractTmdbIdParams): Promise<number> {
let id: number = 0;
if (imdbId) {
id = await this.getById(imdbId);
Expand All @@ -69,7 +69,7 @@ class TmdbExtractor {
if (!id && title && year) {
id = await this.getExactByTitleAndMaybeYear(
title,
parseInt(year, 10) + 1
year + 1
);
}
if (!id && originalTitle && year) {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"repository": "WhiteRabbitTheWorldIsYours/extract-tmdb-id",
"author": "Kosta Korenkov <[email protected]>",
"license": "MIT",
"module": "dist/index.js",
"scripts": {
"build": "tsc",
"publish": "clean-publish"
Expand All @@ -15,6 +14,6 @@
"typescript": "^4.5.2"
},
"dependencies": {
"node-fetch": "^3.1.0"
"node-fetch": "^2.6.6"
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es2018",
"module": "esnext",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "dist",
"esModuleInterop": true,
Expand Down
6 changes: 6 additions & 0 deletions types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
export type ExtractTmdbIdParams = {
imdbId?: string
title: string
originalTitle?: string
year?: number
}
export interface Response {}

export interface Genre {
Expand Down
52 changes: 22 additions & 30 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"

data-uri-to-buffer@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b"
integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==

fast-glob@^3.2.7:
version "3.2.7"
resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1"
Expand All @@ -73,27 +68,13 @@ fastq@^1.6.0:
dependencies:
reusify "^1.0.4"

fetch-blob@^3.1.2:
version "3.1.3"
resolved "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.3.tgz#a7dca4855e39d3e3c5a1da62d4ee335c37d26012"
integrity sha512-ax1Y5I9w+9+JiM+wdHkhBoxew+zG4AJ2SvAD1v1szpddUIiPERVGBxrMcB2ZqW0Y3PP8bOWYv2zqQq1Jp2kqUQ==
dependencies:
web-streams-polyfill "^3.0.3"

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
dependencies:
to-regex-range "^5.0.1"

formdata-polyfill@^4.0.10:
version "4.0.10"
resolved "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
dependencies:
fetch-blob "^3.1.2"

fs-extra@^10.0.0:
version "10.0.0"
resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1"
Expand Down Expand Up @@ -178,14 +159,12 @@ micromatch@^4.0.4:
braces "^3.0.1"
picomatch "^2.2.3"

node-fetch@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-3.1.0.tgz#714f4922dc270239487654eaeeab86b8206cb52e"
integrity sha512-QU0WbIfMUjd5+MUzQOYhenAazakV7Irh1SGkWCsRzBwvm4fAhzEUaHMJ6QLP7gWT6WO9/oH2zhKMMGMuIrDyKw==
node-fetch@^2.6.6:
version "2.6.6"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89"
integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==
dependencies:
data-uri-to-buffer "^4.0.0"
fetch-blob "^3.1.2"
formdata-polyfill "^4.0.10"
whatwg-url "^5.0.0"

path-key@^3.1.0:
version "3.1.1"
Expand Down Expand Up @@ -233,6 +212,11 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"

tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=

typescript@^4.5.2:
version "4.5.2"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz#8ac1fba9f52256fdb06fb89e4122fa6a346c2998"
Expand All @@ -243,10 +227,18 @@ universalify@^2.0.0:
resolved "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==

web-streams-polyfill@^3.0.3:
version "3.2.0"
resolved "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz#a6b74026b38e4885869fb5c589e90b95ccfc7965"
integrity sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==
webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=

whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0=
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"

which@^2.0.1:
version "2.0.2"
Expand Down

0 comments on commit 0a25bbe

Please sign in to comment.