From 3f9a0aaf051adb470988509b8ad0df78196f701d Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Fri, 23 Oct 2020 11:51:59 -0700 Subject: [PATCH] Fix npm jank --- .travis.yml | 1 + index.js | 4 ++-- package.json | 4 ++-- postinstall.sh | 9 +++++++-- src/channel/mediarefresher.js | 2 +- src/config.js | 6 +++--- src/database.js | 2 +- src/database/metadata_cache.js | 2 +- src/get-info.js | 12 ++++++------ 9 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc1557de..1f6f1614 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,6 @@ addons: env: - CXX="g++-4.8" node_js: + - "15" - "14" - "12" diff --git a/index.js b/index.js index 4f057612..28f9db50 100755 --- a/index.js +++ b/index.js @@ -2,10 +2,10 @@ const ver = process.version.match(/v(\d+)\.\d+\.\d+/); -if (parseInt(ver[1], 10) < 10) { +if (parseInt(ver[1], 10) < 12) { console.error( `node.js ${process.version} is not supported. ` + - 'CyTube requires node v10 or later.' + 'CyTube requires node v12 or later.' ) process.exit(1); } diff --git a/package.json b/package.json index 0e8ce0af..9913d674 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "dependencies": { "@calzoneman/express-babel-decorators": "^1.0.0", "@calzoneman/jsli": "^2.0.1", + "@cytube/mediaquery": "0.0.24", "bcrypt": "^5.0.0", "bluebird": "^3.5.1", "body-parser": "^1.18.2", @@ -19,8 +20,7 @@ "cookie-parser": "^1.4.0", "create-error": "^0.3.1", "csrf": "^3.0.0", - "cytube-mediaquery": "git://github.com/CyTube/mediaquery", - "cytubefilters": "git://github.com/calzoneman/cytubefilters.git#c6df180eeb226eaffc7909cf047d3667dc58ef67", + "cytubefilters": "github:calzoneman/cytubefilters#b8b515fb749a38a830d3439c59363a62b35a180c", "express": "^4.16.2", "express-minify": "^1.0.0", "graceful-fs": "^4.1.2", diff --git a/postinstall.sh b/postinstall.sh index b42a8f1c..4a0c79c6 100755 --- a/postinstall.sh +++ b/postinstall.sh @@ -2,8 +2,13 @@ set -e +if ! command -v npm >/dev/null; then + echo "Could not find npm in \$PATH" + exit 1 +fi + echo "Building from src/ to lib/" -$npm_package_scripts_build_server +npm run build-server echo "Building from player/ to www/js/player.js" -$npm_package_scripts_build_player +npm run build-player echo "Done" diff --git a/src/channel/mediarefresher.js b/src/channel/mediarefresher.js index 4639f6a6..f8c53f57 100644 --- a/src/channel/mediarefresher.js +++ b/src/channel/mediarefresher.js @@ -1,4 +1,4 @@ -var Vimeo = require("cytube-mediaquery/lib/provider/vimeo"); +var Vimeo = require("@cytube/mediaquery/lib/provider/vimeo"); var ChannelModule = require("./module"); var Config = require("../config"); diff --git a/src/config.js b/src/config.js index bb2e29e5..01e71d51 100644 --- a/src/config.js +++ b/src/config.js @@ -401,7 +401,7 @@ function preprocessConfig(cfg) { } if (cfg["youtube-v3-key"]) { - require("cytube-mediaquery/lib/provider/youtube").setApiKey( + require("@cytube/mediaquery/lib/provider/youtube").setApiKey( cfg["youtube-v3-key"]); } else { LOGGER.warn("No YouTube v3 API key set. YouTube links will " + @@ -411,9 +411,9 @@ function preprocessConfig(cfg) { } if (cfg["twitch-client-id"]) { - require("cytube-mediaquery/lib/provider/twitch-vod").setClientID( + require("@cytube/mediaquery/lib/provider/twitch-vod").setClientID( cfg["twitch-client-id"]); - require("cytube-mediaquery/lib/provider/twitch-clip").setClientID( + require("@cytube/mediaquery/lib/provider/twitch-clip").setClientID( cfg["twitch-client-id"]); } else { LOGGER.warn("No Twitch Client ID set. Twitch VOD links will " + diff --git a/src/database.js b/src/database.js index 76afc9ae..77527c82 100644 --- a/src/database.js +++ b/src/database.js @@ -85,7 +85,7 @@ module.exports.init = function (newDB) { .then(() => { require('./database/update').checkVersion(); module.exports.loadAnnouncement(); - require('cytube-mediaquery/lib/provider/youtube').setCache( + require('@cytube/mediaquery/lib/provider/youtube').setCache( new MetadataCacheDB(db) ); }).catch(error => { diff --git a/src/database/metadata_cache.js b/src/database/metadata_cache.js index a03571d3..d84537e2 100644 --- a/src/database/metadata_cache.js +++ b/src/database/metadata_cache.js @@ -1,7 +1,7 @@ import { Summary } from 'prom-client'; import { createMySQLDuplicateKeyUpdate } from '../util/on-duplicate-key-update'; -const Media = require('cytube-mediaquery/lib/media'); +const Media = require('@cytube/mediaquery/lib/media'); const LOGGER = require('@calzoneman/jsli')('metadata-cache'); // TODO: these fullname-vs-shortcode hacks really need to be abolished diff --git a/src/get-info.js b/src/get-info.js index d19be127..dce6de4a 100644 --- a/src/get-info.js +++ b/src/get-info.js @@ -3,12 +3,12 @@ const Media = require("./media"); const CustomEmbedFilter = require("./customembed").filter; const Config = require("./config"); const ffmpeg = require("./ffmpeg"); -const mediaquery = require("cytube-mediaquery"); -const YouTube = require("cytube-mediaquery/lib/provider/youtube"); -const Vimeo = require("cytube-mediaquery/lib/provider/vimeo"); -const Streamable = require("cytube-mediaquery/lib/provider/streamable"); -const TwitchVOD = require("cytube-mediaquery/lib/provider/twitch-vod"); -const TwitchClip = require("cytube-mediaquery/lib/provider/twitch-clip"); +const mediaquery = require("@cytube/mediaquery"); +const YouTube = require("@cytube/mediaquery/lib/provider/youtube"); +const Vimeo = require("@cytube/mediaquery/lib/provider/vimeo"); +const Streamable = require("@cytube/mediaquery/lib/provider/streamable"); +const TwitchVOD = require("@cytube/mediaquery/lib/provider/twitch-vod"); +const TwitchClip = require("@cytube/mediaquery/lib/provider/twitch-clip"); import { Counter } from 'prom-client'; import { lookup as lookupCustomMetadata } from './custom-media';