From 88c5e9af48e8bbfa8cfcc63bc820b80b6f5e78e5 Mon Sep 17 00:00:00 2001 From: 0d0 <0d0acre@esiliati.org> Date: Fri, 14 Feb 2025 19:35:55 +0100 Subject: [PATCH] Add configure script --- scripts/configure.sh | 20 ++++++++++++++++++++ scripts/src/pre-commit.sh | 15 +++++++++++++++ src/lib/server/ytdlp.ts | 3 ++- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 scripts/configure.sh create mode 100644 scripts/src/pre-commit.sh diff --git a/scripts/configure.sh b/scripts/configure.sh new file mode 100755 index 0000000..a83e026 --- /dev/null +++ b/scripts/configure.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +set -e + +__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +echo "Install deps..." +npm i > /dev/null 2>&1 +npm run prepare > /dev/null 2>&1 + +echo "Configuring git hooks" +cp "${__dir}/src/pre-commit.sh" .git/hooks/pre-commit +echo "Repo correctly configured" \ No newline at end of file diff --git a/scripts/src/pre-commit.sh b/scripts/src/pre-commit.sh new file mode 100644 index 0000000..6b608c2 --- /dev/null +++ b/scripts/src/pre-commit.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +set -e + +npm run prepare +npm run check +npm run format +npm run lint diff --git a/src/lib/server/ytdlp.ts b/src/lib/server/ytdlp.ts index 99ca02b..48275aa 100644 --- a/src/lib/server/ytdlp.ts +++ b/src/lib/server/ytdlp.ts @@ -1,6 +1,7 @@ import { create } from 'youtube-dl-exec'; -import { YTDLP_PATH } from '$env/static/private'; +import { env } from '$env/dynamic/private'; import { spawn } from 'node:child_process'; +const YTDLP_PATH: string = env.YTDLP_PATH as string export const ytdl = create(YTDLP_PATH);