diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..2312dc5 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/.markdownlint.json b/.markdownlint.json index 02edc12..68551d6 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -4,4 +4,4 @@ "MD033": false, "MD041": false, "MD047": false -} \ No newline at end of file +} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..7325e23 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,15 @@ +# output +dist/ + +# deps +node_modules/ +vendor/ + +# minified assets +*.min.js +*.min.css +*.bundle.js +*.bundle.css + +# env +.env diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..6a74fad --- /dev/null +++ b/.prettierrc @@ -0,0 +1,14 @@ +{ + "printWidth": 100, + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": true, + "quoteProps": "as-needed", + "trailingComma": "none", + "bracketSpacing": true, + "arrowParens": "always", + "endOfLine": "lf", + "proseWrap": "preserve", + "embeddedLanguageFormatting": "auto" +} diff --git a/cli/bin/index.js b/cli/bin/index.js index abdc9a7..c369871 100755 --- a/cli/bin/index.js +++ b/cli/bin/index.js @@ -12,18 +12,27 @@ import { runTasksMenu } from '../lib/tasks/index.js'; process.on('unhandledRejection', (err) => handleExitError(err, 'Unhandled rejection')); process.on('uncaughtException', (err) => handleExitError(err, 'Uncaught exception')); -program.name('coryd').description('šŸŖ„ Handle tasks, run commands or jobs, download things and have fun.').version('3.2.5'); -program.command('init').description('Initialize CLI and populate required config.').action(async () => { - const { initConfig } = await import('../lib/config.js'); - await initConfig(); -}); +program + .name('coryd') + .description('šŸŖ„ Handle tasks, run commands or jobs, download things and have fun.') + .version('3.2.5'); +program + .command('init') + .description('Initialize CLI and populate required config.') + .action(async () => { + const { initConfig } = await import('../lib/config.js'); + await initConfig(); + }); program.command('run [script]').description('Run site scripts and commands.').action(runRootScript); program.command('tasks').description('Handle repeated tasks.').action(runTasksMenu); program.command('jobs').description('Trigger jobs and scripts.').action(runJobsMenu); -program.command('download').description('Download, name and store image assets.').action(async () => { - const { downloadAsset } = await import('../lib/download.js'); - await downloadAsset(); -}); +program + .command('download') + .description('Download, name and store image assets.') + .action(async () => { + const { downloadAsset } = await import('../lib/download.js'); + await downloadAsset(); + }); if (process.argv.length <= 2) { const ascii = figlet.textSync('coryd.dev', { horizontalLayout: 'default' }); diff --git a/cli/lib/config.js b/cli/lib/config.js index cdd1700..f50ecfc 100644 --- a/cli/lib/config.js +++ b/cli/lib/config.js @@ -14,42 +14,50 @@ const ASSET_TYPES = ['poster', 'backdrop']; dotenv.config({ path: path.resolve(__dirname, '..', '..', '.env') }); export const initConfig = async () => { - const existingConfig = await fs.pathExists(CONFIG_PATH) ? await fs.readJson(CONFIG_PATH) : {}; + const existingConfig = (await fs.pathExists(CONFIG_PATH)) ? await fs.readJson(CONFIG_PATH) : {}; const config = { ...existingConfig }; if (config.storageDir) { - const { updateStorage } = await inquirer.prompt([{ - type: 'confirm', - name: 'updateStorage', - message: `Storage directory is already set to "${config.storageDir}". Do you want to update it?`, - default: false - }]); + const { updateStorage } = await inquirer.prompt([ + { + type: 'confirm', + name: 'updateStorage', + message: `Storage directory is already set to "${config.storageDir}". Do you want to update it?`, + default: false + } + ]); if (updateStorage) { - const { storageDir } = await inquirer.prompt([{ - name: 'storageDir', - message: 'Where is your storage root directory?', - validate: fs.pathExists - }]); + const { storageDir } = await inquirer.prompt([ + { + name: 'storageDir', + message: 'Where is your storage root directory?', + validate: fs.pathExists + } + ]); config.storageDir = storageDir; } } else { - const { storageDir } = await inquirer.prompt([{ - name: 'storageDir', - message: 'Where is your storage root directory?', - validate: fs.pathExists - }]); + const { storageDir } = await inquirer.prompt([ + { + name: 'storageDir', + message: 'Where is your storage root directory?', + validate: fs.pathExists + } + ]); config.storageDir = storageDir; } - const { customize } = await inquirer.prompt([{ - type: 'confirm', - name: 'customize', - message: 'Do you want to customize default media paths?', - default: false - }]); + const { customize } = await inquirer.prompt([ + { + type: 'confirm', + name: 'customize', + message: 'Do you want to customize default media paths?', + default: false + } + ]); config.mediaPaths = {}; @@ -63,11 +71,13 @@ export const initConfig = async () => { let subpath = defaultPath; if (customize) { - const response = await inquirer.prompt([{ - name: 'subpath', - message: `Subpath for ${mediaType}/${assetType} (relative to storage root):`, - default: defaultPath - }]); + const response = await inquirer.prompt([ + { + name: 'subpath', + message: `Subpath for ${mediaType}/${assetType} (relative to storage root):`, + default: defaultPath + } + ]); subpath = response.subpath; } @@ -113,28 +123,34 @@ export const initConfig = async () => { : 'Media assets/books'; if (config.directus?.apiUrl) { - const { updateApiUrl } = await inquirer.prompt([{ - type: 'confirm', - name: 'updateApiUrl', - message: `Directus API URL is already set to "${config.directus.apiUrl}". Do you want to update it?`, - default: false - }]); + const { updateApiUrl } = await inquirer.prompt([ + { + type: 'confirm', + name: 'updateApiUrl', + message: `Directus API URL is already set to "${config.directus.apiUrl}". Do you want to update it?`, + default: false + } + ]); if (updateApiUrl) { - const { apiUrl } = await inquirer.prompt([{ - name: 'apiUrl', - message: 'Enter your Directus instance URL:', - validate: input => input.startsWith('http') || 'Must be a valid URL' - }]); + const { apiUrl } = await inquirer.prompt([ + { + name: 'apiUrl', + message: 'Enter your Directus instance URL:', + validate: (input) => input.startsWith('http') || 'Must be a valid URL' + } + ]); config.directus.apiUrl = apiUrl; } } else { - const { apiUrl } = await inquirer.prompt([{ - name: 'apiUrl', - message: 'Enter your Directus URL:', - validate: input => input.startsWith('http') || 'Must be a valid URL' - }]); + const { apiUrl } = await inquirer.prompt([ + { + name: 'apiUrl', + message: 'Enter your Directus URL:', + validate: (input) => input.startsWith('http') || 'Must be a valid URL' + } + ]); config.directus = { ...(config.directus || {}), apiUrl }; } @@ -150,7 +166,7 @@ export const initConfig = async () => { }; export const loadConfig = async () => { - if (!await fs.pathExists(CONFIG_PATH)) { + if (!(await fs.pathExists(CONFIG_PATH))) { console.error('āŒ Config not found. Run `coryd init` first.'); process.exit(1); } diff --git a/cli/lib/directus/client.js b/cli/lib/directus/client.js index 4d65bd7..1ea16af 100644 --- a/cli/lib/directus/client.js +++ b/cli/lib/directus/client.js @@ -32,9 +32,9 @@ const request = async (method, endpoint, body = null) => { method, headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${API_TOKEN}`, + Authorization: `Bearer ${API_TOKEN}` }, - body: body ? JSON.stringify(body) : null, + body: body ? JSON.stringify(body) : null }); if (!res.ok) { @@ -63,8 +63,8 @@ export const searchItems = async (collection, query = '', filters = {}) => { method: 'GET', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${API_TOKEN}`, - }, + Authorization: `Bearer ${API_TOKEN}` + } }); const data = await res.json(); @@ -76,6 +76,7 @@ export const searchItems = async (collection, query = '', filters = {}) => { } }; -export const updateItem = async (collection, id, values) => await request('PATCH', `${collection}/${id}`, values); +export const updateItem = async (collection, id, values) => + await request('PATCH', `${collection}/${id}`, values); export const createItem = async (collection, values) => await request('POST', collection, values); diff --git a/cli/lib/directus/relationHelpers.js b/cli/lib/directus/relationHelpers.js index a8a9127..baf5ba3 100644 --- a/cli/lib/directus/relationHelpers.js +++ b/cli/lib/directus/relationHelpers.js @@ -25,13 +25,13 @@ export const promptForMultipleRelations = async (collection, label = collection) type: 'checkbox', name: 'selected', message: `āœ” Select ${label} to add:`, - choices: results.map(item => ({ + choices: results.map((item) => ({ name: item.name || item.title || item.id, value: item.id })) }); - selected.forEach(id => selectedIds.add(id)); + selected.forEach((id) => selectedIds.add(id)); const { again } = await inquirer.prompt({ type: 'confirm', diff --git a/cli/lib/download.js b/cli/lib/download.js index 441ae54..bb598fd 100644 --- a/cli/lib/download.js +++ b/cli/lib/download.js @@ -7,17 +7,22 @@ import { loadConfig } from './config.js'; import { sanitizeMediaString } from './sanitize.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const downloadImage = (url, dest) => new Promise((resolve, reject) => { - const file = fs.createWriteStream(dest); +const downloadImage = (url, dest) => + new Promise((resolve, reject) => { + const file = fs.createWriteStream(dest); - https.get(url, response => { - if (response.statusCode !== 200) return reject(new Error(`Failed to download. Status: ${response.statusCode}`)); + https + .get(url, (response) => { + if (response.statusCode !== 200) + return reject(new Error(`Failed to download. Status: ${response.statusCode}`)); - response.pipe(file); - file.on('finish', () => file.close(resolve)); - }).on('error', reject); -}); -const isValidTMDBUrl = (val) => /^https:\/\/image\.tmdb\.org\/t\/p\//.test(val) || 'āŒ Must be a valid TMDB image url'; + response.pipe(file); + file.on('finish', () => file.close(resolve)); + }) + .on('error', reject); + }); +const isValidTMDBUrl = (val) => + /^https:\/\/image\.tmdb\.org\/t\/p\//.test(val) || 'āŒ Must be a valid TMDB image url'; const overwriteImageDownloadPrompt = async (url, finalPath, fileName) => { await fs.ensureDir(path.dirname(finalPath)); @@ -60,25 +65,30 @@ export const downloadWatchingImages = async () => { return; } - const { posterUrl, backdropUrl } = await inquirer.prompt([{ - name: 'posterUrl', - message: 'Enter the poster url:', - validate: (val) => { - if (!val) return true; + const { posterUrl, backdropUrl } = await inquirer.prompt([ + { + name: 'posterUrl', + message: 'Enter the poster url:', + validate: (val) => { + if (!val) return true; - return isValidTMDBUrl(val); - } - }, - { - name: 'backdropUrl', - message: 'Enter the backdrop url:', - validate: (val) => { - if (!val) return true; + return isValidTMDBUrl(val); + } + }, + { + name: 'backdropUrl', + message: 'Enter the backdrop url:', + validate: (val) => { + if (!val) return true; - return isValidTMDBUrl(val); + return isValidTMDBUrl(val); + } } - }]); - const types = [{ type: 'poster', url: posterUrl }, { type: 'backdrop', url: backdropUrl }]; + ]); + const types = [ + { type: 'poster', url: posterUrl }, + { type: 'backdrop', url: backdropUrl } + ]; for (const { type, url } of types) { if (!url) continue; @@ -98,7 +108,7 @@ export const downloadWatchingImages = async () => { await overwriteImageDownloadPrompt(url, finalPath, fileName); } -} +}; export const downloadArtistImage = async () => { const config = await loadConfig(); @@ -134,7 +144,7 @@ export const downloadArtistImage = async () => { const finalPath = path.join(targetDir, fileName); await overwriteImageDownloadPrompt(imageUrl, finalPath, fileName); -} +}; export const downloadAlbumImage = async () => { const config = await loadConfig(); @@ -190,7 +200,8 @@ export const downloadBookImage = async () => { const { isbn } = await inquirer.prompt({ name: 'isbn', message: 'Enter the ISBN (no spaces):', - validate: (val) => /^[a-zA-Z0-9-]+$/.test(val) || 'ISBN must contain only letters, numbers, or hyphens' + validate: (val) => + /^[a-zA-Z0-9-]+$/.test(val) || 'ISBN must contain only letters, numbers, or hyphens' }); const { bookTitle } = await inquirer.prompt({ name: 'bookTitle', @@ -223,8 +234,7 @@ export const downloadBookImage = async () => { const finalPath = path.join(targetDir, fileName); await overwriteImageDownloadPrompt(imageUrl, finalPath, fileName); -} - +}; export const downloadAsset = async () => { const { type } = await inquirer.prompt({ @@ -243,4 +253,4 @@ export const downloadAsset = async () => { } else { await downloadWatchingImages(); } -} +}; diff --git a/cli/lib/handlers.js b/cli/lib/handlers.js index 1744116..5db6543 100644 --- a/cli/lib/handlers.js +++ b/cli/lib/handlers.js @@ -1,5 +1,8 @@ export const handleExitError = (err, type = 'Unhandled error') => { - const isExit = err?.name === 'ExitPromptError' || err?.code === 'ERR_CANCELED' || err?.message?.includes('SIGINT'); + const isExit = + err?.name === 'ExitPromptError' || + err?.code === 'ERR_CANCELED' || + err?.message?.includes('SIGINT'); if (isExit) { console.log('\nšŸ‘‹ Exiting. Cya!\n'); @@ -8,4 +11,4 @@ export const handleExitError = (err, type = 'Unhandled error') => { console.error(`āŒ ${type}:`, err); process.exit(1); -} +}; diff --git a/cli/lib/jobs.js b/cli/lib/jobs.js index 42b760f..aa5c2fc 100644 --- a/cli/lib/jobs.js +++ b/cli/lib/jobs.js @@ -45,12 +45,14 @@ export const runJobsMenu = async () => { apiUrl: `${config.url}/api/artist-import.php`, tokenEnvVar: 'ARTIST_IMPORT_TOKEN', method: 'POST', - paramsPrompt: [{ - type: 'input', - name: 'artistId', - message: 'Enter the Navidrome artist ID:', - validate: input => input ? true : 'Artist ID is required' - }] + paramsPrompt: [ + { + type: 'input', + name: 'artistId', + message: 'Enter the Navidrome artist ID:', + validate: (input) => (input ? true : 'Artist ID is required') + } + ] }, { name: 'šŸ“– Import book', @@ -58,12 +60,14 @@ export const runJobsMenu = async () => { apiUrl: `${config.url}/api/book-import.php`, tokenEnvVar: 'BOOK_IMPORT_TOKEN', method: 'POST', - paramsPrompt: [{ - type: 'input', - name: 'isbn', - message: 'Enter the book\'s ISBN:', - validate: input => input ? true : 'ISBN is required' - }] + paramsPrompt: [ + { + type: 'input', + name: 'isbn', + message: "Enter the book's ISBN:", + validate: (input) => (input ? true : 'ISBN is required') + } + ] }, { name: 'šŸ“½ Import movie or show', @@ -72,19 +76,20 @@ export const runJobsMenu = async () => { tokenEnvVar: 'WATCHING_IMPORT_TOKEN', method: 'POST', tokenIncludeInParams: true, - paramsPrompt: [{ - type: 'input', - name: 'tmdb_id', - message: 'Enter the TMDB ID:', - validate: (input) => - /^\d+$/.test(input) ? true : 'Please enter a valid TMDB ID' - }, - { - type: 'list', - name: 'media_type', - message: 'Is this a movie or a show?', - choices: ['movie', 'show'] - }] + paramsPrompt: [ + { + type: 'input', + name: 'tmdb_id', + message: 'Enter the TMDB ID:', + validate: (input) => (/^\d+$/.test(input) ? true : 'Please enter a valid TMDB ID') + }, + { + type: 'list', + name: 'media_type', + message: 'Is this a movie or a show?', + choices: ['movie', 'show'] + } + ] }, { name: 'šŸ“ŗ Import upcoming TV seasons', @@ -92,17 +97,20 @@ export const runJobsMenu = async () => { apiUrl: `${config.url}/api/seasons-import.php`, tokenEnvVar: 'SEASONS_IMPORT_TOKEN', method: 'POST' - }]; + } + ]; - const { selectedJob } = await inquirer.prompt([{ - type: 'list', - name: 'selectedJob', - message: 'Select a job to run:', - choices: JOBS.map((job, index) => ({ - name: job.name, - value: index - })) - }]); + const { selectedJob } = await inquirer.prompt([ + { + type: 'list', + name: 'selectedJob', + message: 'Select a job to run:', + choices: JOBS.map((job, index) => ({ + name: job.name, + value: index + })) + } + ]); const job = JOBS[selectedJob]; @@ -124,7 +132,7 @@ export const runJobsMenu = async () => { const runCurl = async ({ urlEnvVar, - apiUrl = "", + apiUrl = '', tokenEnvVar, method = 'POST', name, diff --git a/cli/lib/runScript.js b/cli/lib/runScript.js index df2ab68..b61f02c 100644 --- a/cli/lib/runScript.js +++ b/cli/lib/runScript.js @@ -15,12 +15,14 @@ export const runRootScript = async (scriptArg) => { let script = scriptArg; if (!script) { - const { selected } = await inquirer.prompt([{ - type: 'list', - name: 'selected', - message: 'Select a script to run:', - choices: Object.keys(scripts) - }]); + const { selected } = await inquirer.prompt([ + { + type: 'list', + name: 'selected', + message: 'Select a script to run:', + choices: Object.keys(scripts) + } + ]); script = selected; } @@ -39,4 +41,4 @@ export const runRootScript = async (scriptArg) => { console.error(`āŒ Failed to run script "${script}"`); process.exit(1); } -} +}; diff --git a/cli/lib/sanitize.js b/cli/lib/sanitize.js index 340c053..519d46e 100644 --- a/cli/lib/sanitize.js +++ b/cli/lib/sanitize.js @@ -6,6 +6,6 @@ export const sanitizeMediaString = (input) => { const slugified = cleaned.replace(/[\s-]+/g, '-').toLowerCase(); return slugified.replace(/^-+|-+$/g, ''); -} +}; -export const removeUrlProtocol = (url) => url ? url.replace(/^https?:\/\//, '') : ''; +export const removeUrlProtocol = (url) => (url ? url.replace(/^https?:\/\//, '') : ''); diff --git a/cli/lib/tasks/addBlockedRobot.js b/cli/lib/tasks/addBlockedRobot.js index aa780c0..7dd09eb 100644 --- a/cli/lib/tasks/addBlockedRobot.js +++ b/cli/lib/tasks/addBlockedRobot.js @@ -8,7 +8,7 @@ export const addBlockedRobot = async () => { initDirectusClient(config); const robots = await searchItems('robots', '/'); - let rootRobot = robots.find(r => r.path === '/'); + let rootRobot = robots.find((r) => r.path === '/'); if (!rootRobot) { console.log('ā„¹ļø No robots entry for `/` found. Creating one...'); @@ -23,7 +23,7 @@ export const addBlockedRobot = async () => { const { userAgent } = await inquirer.prompt({ name: 'userAgent', message: 'šŸ¤– Enter the user-agent string to block:', - validate: input => !!input || 'User-agent cannot be empty' + validate: (input) => !!input || 'User-agent cannot be empty' }); const createdAgent = await createItem('user_agents', { diff --git a/cli/lib/tasks/addEpisodeToShow.js b/cli/lib/tasks/addEpisodeToShow.js index 4d46e43..2e72c51 100644 --- a/cli/lib/tasks/addEpisodeToShow.js +++ b/cli/lib/tasks/addEpisodeToShow.js @@ -1,6 +1,12 @@ import inquirer from 'inquirer'; import { loadConfig } from '../config.js'; -import { initDirectusClient, getDirectusClient, searchItems, createItem, updateItem } from '../directus/client.js'; +import { + initDirectusClient, + getDirectusClient, + searchItems, + createItem, + updateItem +} from '../directus/client.js'; export const addEpisodeToShow = async () => { const config = await loadConfig(); @@ -10,7 +16,7 @@ export const addEpisodeToShow = async () => { const directus = getDirectusClient(); const showResults = await inquirer.prompt({ name: 'query', - message: 'Search for a show:', + message: 'Search for a show:' }); const matches = await searchItems('shows', showResults.query); @@ -24,34 +30,35 @@ export const addEpisodeToShow = async () => { type: 'list', name: 'showId', message: 'Select a show:', - choices: matches.map(s => ({ + choices: matches.map((s) => ({ name: s.title || s.name || s.id, - value: s.id, - })), + value: s.id + })) }); const { season_number, episode_number, plays } = await inquirer.prompt([ { name: 'season_number', message: 'Season number:', - validate: val => !isNaN(val), + validate: (val) => !isNaN(val) }, { name: 'episode_number', message: 'Episode number:', - validate: val => !isNaN(val), + validate: (val) => !isNaN(val) }, { name: 'plays', message: 'Play count:', default: 0, - validate: val => !isNaN(val), - }, + validate: (val) => !isNaN(val) + } ]); const existing = await searchItems('episodes', `${season_number} ${episode_number}`); - const match = existing.find(e => - Number(e.season_number) === Number(season_number) && - Number(e.episode_number) === Number(episode_number) && - e.show === showId + const match = existing.find( + (e) => + Number(e.season_number) === Number(season_number) && + Number(e.episode_number) === Number(episode_number) && + e.show === showId ); if (match) { @@ -59,7 +66,7 @@ export const addEpisodeToShow = async () => { type: 'confirm', name: 'update', message: `Episode exists. Update play count from ${match.plays ?? 0} to ${plays}?`, - default: true, + default: true }); if (update) { @@ -74,7 +81,7 @@ export const addEpisodeToShow = async () => { season_number: Number(season_number), episode_number: Number(episode_number), plays: Number(plays), - show: showId, + show: showId }); console.log(`šŸ“ŗ Created episode S${season_number}E${episode_number}`); diff --git a/cli/lib/tasks/addLinkToShare.js b/cli/lib/tasks/addLinkToShare.js index efe574e..ad1aa13 100644 --- a/cli/lib/tasks/addLinkToShare.js +++ b/cli/lib/tasks/addLinkToShare.js @@ -12,12 +12,12 @@ export const addLinkToShare = async () => { { name: 'title', message: 'šŸ“ Title for the link:', - validate: input => !!input || 'Title is required' + validate: (input) => !!input || 'Title is required' }, { name: 'link', message: 'šŸ”— URL to share:', - validate: input => input.startsWith('http') || 'Must be a valid URL' + validate: (input) => input.startsWith('http') || 'Must be a valid URL' }, { name: 'description', @@ -26,7 +26,7 @@ export const addLinkToShare = async () => { }, { name: 'authorQuery', - message: 'šŸ‘¤ Search for an author:', + message: 'šŸ‘¤ Search for an author:' } ]); @@ -38,13 +38,17 @@ export const addLinkToShare = async () => { type: 'confirm', name: 'shouldCreate', message: 'āŒ No authors found. Do you want to create a new one?', - default: true, + default: true }); if (!shouldCreate) return; const { name, url, mastodon, rss, json, newsletter, blogroll } = await inquirer.prompt([ - { name: 'name', message: 'šŸ‘¤ Author name:', validate: input => !!input || 'Name is required' }, + { + name: 'name', + message: 'šŸ‘¤ Author name:', + validate: (input) => !!input || 'Name is required' + }, { name: 'url', message: 'šŸ”— URL (optional):', default: '' }, { name: 'mastodon', message: '🐘 Mastodon handle (optional):', default: '' }, { name: 'rss', message: 'šŸ“” RSS feed (optional):', default: '' }, @@ -69,13 +73,13 @@ export const addLinkToShare = async () => { type: 'list', name: 'author', message: 'Select an author:', - choices: authorMatches.map(a => { + choices: authorMatches.map((a) => { const cleanUrl = removeUrlProtocol(a.url); const display = cleanUrl ? `${a.name} (${cleanUrl})` : a.name; return { name: display, - value: a.id, + value: a.id }; }) }); @@ -88,7 +92,7 @@ export const addLinkToShare = async () => { while (true) { const { query } = await inquirer.prompt({ name: 'query', - message: 'šŸ· Search for tags (or leave blank to finish):', + message: 'šŸ· Search for tags (or leave blank to finish):' }); const trimmedQuery = query.trim(); @@ -106,7 +110,7 @@ export const addLinkToShare = async () => { type: 'checkbox', name: 'selected', message: 'āœ” Select tags to add:', - choices: tags.map(tag => ({ name: tag.name, value: tag.id })) + choices: tags.map((tag) => ({ name: tag.name, value: tag.id })) }); tagIds.push(...selected); @@ -115,7 +119,7 @@ export const addLinkToShare = async () => { type: 'confirm', name: 'again', message: 'Search and select more tags?', - default: false, + default: false }); if (!again) break; @@ -126,7 +130,7 @@ export const addLinkToShare = async () => { link, description, author, - link_tags: tagIds.map(tagId => ({ tags_id: tagId })), + link_tags: tagIds.map((tagId) => ({ tags_id: tagId })), date: new Date().toISOString() }); diff --git a/cli/lib/tasks/addPost.js b/cli/lib/tasks/addPost.js index ddf99f0..eafc96f 100644 --- a/cli/lib/tasks/addPost.js +++ b/cli/lib/tasks/addPost.js @@ -18,34 +18,36 @@ export const addPost = async () => { initDirectusClient(config); - const { title, description, content, featured } = await inquirer.prompt([{ - name: 'title', - message: 'šŸ“ Title:', - validate: input => !!input || 'Title is required' - }, - { - name: 'description', - message: 'šŸ—’ Description:', - default: '' - }, - { - name: 'content', - message: 'šŸ“„ Content:', - default: '' - }, - { - type: 'confirm', - name: 'featured', - message: '⭐ Featured?', - default: false - }]); + const { title, description, content, featured } = await inquirer.prompt([ + { + name: 'title', + message: 'šŸ“ Title:', + validate: (input) => !!input || 'Title is required' + }, + { + name: 'description', + message: 'šŸ—’ Description:', + default: '' + }, + { + name: 'content', + message: 'šŸ“„ Content:', + default: '' + }, + { + type: 'confirm', + name: 'featured', + message: '⭐ Featured?', + default: false + } + ]); let tagIds = []; while (true) { const { query } = await inquirer.prompt({ name: 'query', - message: 'šŸ· Search for tags (or leave blank to finish):', + message: 'šŸ· Search for tags (or leave blank to finish):' }); const trimmedQuery = query.trim(); @@ -63,7 +65,7 @@ export const addPost = async () => { type: 'checkbox', name: 'selected', message: 'āœ” Select tags to add:', - choices: tags.map(tag => ({ name: tag.name, value: tag.id })) + choices: tags.map((tag) => ({ name: tag.name, value: tag.id })) }); tagIds.push(...selected); @@ -72,7 +74,7 @@ export const addPost = async () => { type: 'confirm', name: 'again', message: 'Search and select more tags?', - default: false, + default: false }); if (!again) break; @@ -113,7 +115,7 @@ export const addPost = async () => { type: 'list', name: 'itemId', message: `Select an item from ${collection}:`, - choices: results.map(item => ({ + choices: results.map((item) => ({ name: item.title || item.name || item.id, value: item.id })) @@ -161,13 +163,16 @@ export const addPost = async () => { type: 'checkbox', name: 'selected', message: `āœ” Select ${mediaType} to associate:`, - choices: matches.map(m => ({ + choices: matches.map((m) => ({ name: m.name_string || m.title || m.name || m.label || m.id, value: m.id })) }); - if (selected.length) associatedMediaPayload[`${mediaType}`] = selected.map(id => ({ [`${mediaType}_id`]: id })); + if (selected.length) + associatedMediaPayload[`${mediaType}`] = selected.map((id) => ({ + [`${mediaType}_id`]: id + })); } } @@ -178,7 +183,7 @@ export const addPost = async () => { content, featured, date: new Date().toISOString(), - post_tags: tagIds.map(tagId => ({ tags_id: tagId })), + post_tags: tagIds.map((tagId) => ({ tags_id: tagId })), blocks: selectedBlocks, ...associatedMediaPayload }; diff --git a/cli/lib/tasks/index.js b/cli/lib/tasks/index.js index af760d1..c20ad21 100644 --- a/cli/lib/tasks/index.js +++ b/cli/lib/tasks/index.js @@ -10,7 +10,7 @@ const TASKS = [ { name: 'šŸ”— Add link to share', handler: addLinkToShare }, { name: 'āž• Add episode to show', handler: addEpisodeToShow }, { name: 'šŸ“š Update reading progress', handler: updateReadingProgress }, - { name: 'šŸ¤– Block robot', handler: addBlockedRobot }, + { name: 'šŸ¤– Block robot', handler: addBlockedRobot } ]; export const runTasksMenu = async () => { @@ -19,7 +19,7 @@ export const runTasksMenu = async () => { type: 'list', name: 'task', message: 'Select a task to perform:', - choices: TASKS.map(t => ({ name: t.name, value: t.handler })) + choices: TASKS.map((t) => ({ name: t.name, value: t.handler })) } ]); diff --git a/cli/lib/tasks/updateReadingProgress.js b/cli/lib/tasks/updateReadingProgress.js index dcb04b7..0131c79 100644 --- a/cli/lib/tasks/updateReadingProgress.js +++ b/cli/lib/tasks/updateReadingProgress.js @@ -19,7 +19,7 @@ export const updateReadingProgress = async () => { type: 'list', name: 'bookId', message: 'šŸ“š Select a book to update progress:', - choices: readingBooks.map(book => { + choices: readingBooks.map((book) => { const title = book.title || book.name || `Book #${book.id}`; const progress = book.progress ?? 0; @@ -32,10 +32,10 @@ export const updateReadingProgress = async () => { const { progress } = await inquirer.prompt({ name: 'progress', message: 'šŸ“• New progress percentage (0–100):', - validate: input => { + validate: (input) => { const num = Number(input); - return !isNaN(num) && num >= 0 && num <= 100 || 'Enter a number from 0 to 100'; + return (!isNaN(num) && num >= 0 && num <= 100) || 'Enter a number from 0 to 100'; } }); diff --git a/config/collections/index.js b/config/collections/index.js index 49fdb2b..3c7c8de 100644 --- a/config/collections/index.js +++ b/config/collections/index.js @@ -1,11 +1,14 @@ -import ics from "ics"; +import ics from 'ics'; export const albumReleasesCalendar = (collection) => { const collectionData = collection.getAll()[0]; const { data } = collectionData; - const { albumReleases: { all }, globals: { url } } = data; + const { + albumReleases: { all }, + globals: { url } + } = data; - if (!all || all.length === 0) return ""; + if (!all || all.length === 0) return ''; const events = all .map((album) => { @@ -13,27 +16,30 @@ export const albumReleasesCalendar = (collection) => { if (isNaN(date.getTime())) return null; - const albumUrl = album.url?.includes("http") ? album.url : `${url}${album.url}`; - const artistUrl = album.artist.url?.includes("http") ? album.artust.url : `${url}${album.artist.url}`; + const albumUrl = album.url?.includes('http') ? album.url : `${url}${album.url}`; + const artistUrl = album.artist.url?.includes('http') + ? album.artust.url + : `${url}${album.artist.url}`; return { start: [date.getFullYear(), date.getMonth() + 1, date.getDate()], - startInputType: "local", - startOutputType: "local", + startInputType: 'local', + startOutputType: 'local', title: `Release: ${album.artist.name} - ${album.title}`, description: `Check out this new album release: ${albumUrl}. Read more about ${album.artist.name} at ${artistUrl}`, url: albumUrl, - uid: `${album.release_timestamp}-${album.artist.name}-${album.title}`, + uid: `${album.release_timestamp}-${album.artist.name}-${album.title}` }; - }).filter((event) => event !== null); + }) + .filter((event) => event !== null); const { error, value } = ics.createEvents(events, { - calName: "Album releases calendar • coryd.dev", + calName: 'Album releases calendar • coryd.dev' }); if (error) { - console.error("Error creating events: ", error); - return ""; + console.error('Error creating events: ', error); + return ''; } return value; diff --git a/config/events/minify-js.js b/config/events/minify-js.js index 238f473..9cdc9a1 100644 --- a/config/events/minify-js.js +++ b/config/events/minify-js.js @@ -1,9 +1,9 @@ -import fs from "fs"; -import path from "path"; -import { minify } from "terser"; +import fs from 'fs'; +import path from 'path'; +import { minify } from 'terser'; export const minifyJsComponents = async () => { - const scriptsDir = "dist/assets/scripts"; + const scriptsDir = 'dist/assets/scripts'; const minifyJsFilesInDir = async (dir) => { const files = fs.readdirSync(dir); @@ -13,8 +13,8 @@ export const minifyJsComponents = async () => { if (stat.isDirectory()) { await minifyJsFilesInDir(filePath); - } else if (fileName.endsWith(".js")) { - const fileContent = fs.readFileSync(filePath, "utf8"); + } else if (fileName.endsWith('.js')) { + const fileContent = fs.readFileSync(filePath, 'utf8'); const minified = await minify(fileContent); if (minified.error) { diff --git a/config/filters/feeds.js b/config/filters/feeds.js index 58863e0..fffde94 100644 --- a/config/filters/feeds.js +++ b/config/filters/feeds.js @@ -6,32 +6,32 @@ export default { const $ = cheerio.load(htmlContent); - $("a[href]").each((_, link) => { + $('a[href]').each((_, link) => { const $link = $(link); - let href = $link.attr("href"); + let href = $link.attr('href'); - if (href.startsWith("#")) { - $link.replaceWith($("").text($link.text())); - } else if (!href.startsWith("http://") && !href.startsWith("https://")) { + if (href.startsWith('#')) { + $link.replaceWith($('').text($link.text())); + } else if (!href.startsWith('http://') && !href.startsWith('https://')) { const normalizedDomain = domain.replace(/\/$/, ''); const normalizedHref = href.replace(/^\/+/, ''); - $link.attr("href", `${normalizedDomain}/${normalizedHref}`); + $link.attr('href', `${normalizedDomain}/${normalizedHref}`); } }); return $.html(); }, generatePermalink: (url, baseUrl) => { - if (url?.includes("http") || !baseUrl) return url - return `${baseUrl}${url}` + if (url?.includes('http') || !baseUrl) return url; + return `${baseUrl}${url}`; }, getRemoteFileSize: async (url) => { try { - const response = await fetch(url, { method: "HEAD" }); + const response = await fetch(url, { method: 'HEAD' }); if (!response.ok) return 0; - const contentLength = response.headers.get("content-length"); + const contentLength = response.headers.get('content-length'); if (!contentLength) return 0; @@ -40,4 +40,4 @@ export default { return 0; } } -} +}; diff --git a/config/filters/general.js b/config/filters/general.js index 403f11f..8564301 100644 --- a/config/filters/general.js +++ b/config/filters/general.js @@ -1,21 +1,22 @@ -import truncateHtml from "truncate-html"; +import truncateHtml from 'truncate-html'; export default { encodeAmp: (string) => { if (!string) return; const pattern = /&(?!(?:[a-zA-Z]+|#[0-9]+|#x[0-9a-fA-F]+);)/g; - const replacement = "&"; + const replacement = '&'; return string.replace(pattern, replacement); }, replaceQuotes: (string) => { if (!string) return ''; - return string.replace(/"/g, """); + return string.replace(/"/g, '"'); }, - htmlTruncate: (content, limit = 50) => truncateHtml(content, limit, { + htmlTruncate: (content, limit = 50) => + truncateHtml(content, limit, { byWords: true, - ellipsis: "...", + ellipsis: '...' }), shuffleArray: (array) => { const shuffled = [...array]; @@ -29,9 +30,9 @@ export default { return shuffled; }, - mergeArray: (a, b) => Array.isArray(a) && Array.isArray(b) ? [...new Set([...a, ...b])] : [], + mergeArray: (a, b) => (Array.isArray(a) && Array.isArray(b) ? [...new Set([...a, ...b])] : []), pluralize: (count, string, trailing) => { - const countStr = String(count).replace(/,/g, ""); + const countStr = String(count).replace(/,/g, ''); if (parseInt(countStr, 10) === 1) return string; diff --git a/config/filters/index.js b/config/filters/index.js index 974395a..f8c2393 100644 --- a/config/filters/index.js +++ b/config/filters/index.js @@ -1,13 +1,13 @@ -import feeds from "./feeds.js" -import general from "./general.js"; -import media from "./media.js"; -import metadata from "./metadata.js"; -import navigation from "./navigation.js"; +import feeds from './feeds.js'; +import general from './general.js'; +import media from './media.js'; +import metadata from './metadata.js'; +import navigation from './navigation.js'; export default { ...feeds, ...general, ...media, ...metadata, - ...navigation, + ...navigation }; diff --git a/config/filters/media.js b/config/filters/media.js index 8cb1cc3..4034a17 100644 --- a/config/filters/media.js +++ b/config/filters/media.js @@ -1,12 +1,18 @@ export default { filterBooksByStatus: (books, status) => books.filter((book) => book.status === status), findFavoriteBooks: (books) => books.filter((book) => book.favorite === true), - bookYearLinks: (years) => years.sort((a, b) => b.value - a.value).map((year, index) => - `${year.value}${ - index < years.length - 1 ? " • " : "" - }`).join(""), + bookYearLinks: (years) => + years + .sort((a, b) => b.value - a.value) + .map( + (year, index) => + `${year.value}${ + index < years.length - 1 ? ' • ' : '' + }` + ) + .join(''), mediaLinks: (data, type, count = 10) => { - if (!data || !type) return ""; + if (!data || !type) return ''; const dataSlice = data.slice(0, count); @@ -14,23 +20,23 @@ export default { const buildLink = (item) => { switch (type) { - case "genre": + case 'genre': return `${item.genre_name}`; - case "artist": + case 'artist': return `${item.name}`; - case "book": + case 'book': return `${item.title}`; default: - return ""; + return ''; } }; if (dataSlice.length === 1) return buildLink(dataSlice[0]); const links = dataSlice.map(buildLink); - const allButLast = links.slice(0, -1).join(", "); + const allButLast = links.slice(0, -1).join(', '); const last = links[links.length - 1]; return `${allButLast} and ${last}`; - }, + } }; diff --git a/config/filters/metadata.js b/config/filters/metadata.js index 8790aa6..87c0d1b 100644 --- a/config/filters/metadata.js +++ b/config/filters/metadata.js @@ -1,13 +1,16 @@ export default { - getMetadata: (data = {}, globals = {}, page = {}, title = "", description = "", schema = "") => { + getMetadata: (data = {}, globals = {}, page = {}, title = '', description = '', schema = '') => { const metadata = data?.metadata; - const baseUrl = globals.url || ""; - const ogPath = "/og/w800"; - const image = metadata?.open_graph_image || globals.metadata?.open_graph_image || globals.avatar; + const baseUrl = globals.url || ''; + const ogPath = '/og/w800'; + const image = + metadata?.open_graph_image || globals.metadata?.open_graph_image || globals.avatar; const rawTitle = title || page.title || metadata?.title || globals.site_name; - const resolvedTitle = rawTitle === globals.site_name ? globals.site_name : `${rawTitle} • ${globals.site_name}`; - const resolvedDescription = description || metadata?.description || page.description || globals.site_description; - const url = metadata?.url || (page.url ? `${baseUrl}${page.url}` : "#"); + const resolvedTitle = + rawTitle === globals.site_name ? globals.site_name : `${rawTitle} • ${globals.site_name}`; + const resolvedDescription = + description || metadata?.description || page.description || globals.site_description; + const url = metadata?.url || (page.url ? `${baseUrl}${page.url}` : '#'); return { title: resolvedTitle, diff --git a/config/filters/navigation.js b/config/filters/navigation.js index 3157e0a..efff24f 100644 --- a/config/filters/navigation.js +++ b/config/filters/navigation.js @@ -1,3 +1,4 @@ export default { - isLinkActive: (category, page) => page.includes(category) && page.split("/").filter((a) => a !== "").length <= 1, + isLinkActive: (category, page) => + page.includes(category) && page.split('/').filter((a) => a !== '').length <= 1 }; diff --git a/config/plugins/css-config.js b/config/plugins/css-config.js index 86480f7..c18c740 100644 --- a/config/plugins/css-config.js +++ b/config/plugins/css-config.js @@ -1,24 +1,23 @@ -import fs from "node:fs/promises"; -import path from "node:path"; -import postcss from "postcss"; -import postcssImport from "postcss-import"; -import postcssImportExtGlob from "postcss-import-ext-glob"; -import cssnano from "cssnano"; +import fs from 'node:fs/promises'; +import path from 'node:path'; +import postcss from 'postcss'; +import postcssImport from 'postcss-import'; +import postcssImportExtGlob from 'postcss-import-ext-glob'; +import cssnano from 'cssnano'; export const cssConfig = (eleventyConfig) => { - eleventyConfig.addTemplateFormats("css"); - eleventyConfig.addExtension("css", { - outputFileExtension: "css", + eleventyConfig.addTemplateFormats('css'); + eleventyConfig.addExtension('css', { + outputFileExtension: 'css', compile: async (inputContent, inputPath) => { - const outputPath = "dist/assets/css/index.css"; + const outputPath = 'dist/assets/css/index.css'; - if (inputPath.endsWith("index.css")) { + if (inputPath.endsWith('index.css')) { return async () => { - let result = await postcss([ - postcssImportExtGlob, - postcssImport, - cssnano, - ]).process(inputContent, { from: inputPath }); + let result = await postcss([postcssImportExtGlob, postcssImport, cssnano]).process( + inputContent, + { from: inputPath } + ); await fs.mkdir(path.dirname(outputPath), { recursive: true }); await fs.writeFile(outputPath, result.css); @@ -26,6 +25,6 @@ export const cssConfig = (eleventyConfig) => { return result.css; }; } - }, + } }); }; diff --git a/config/plugins/index.js b/config/plugins/index.js index 787e27a..e4a302d 100644 --- a/config/plugins/index.js +++ b/config/plugins/index.js @@ -1,5 +1,5 @@ -import { cssConfig } from "./css-config.js"; -import { htmlConfig } from "./html-config.js"; -import { markdownLib } from "./markdown.js"; +import { cssConfig } from './css-config.js'; +import { htmlConfig } from './html-config.js'; +import { markdownLib } from './markdown.js'; export default { cssConfig, htmlConfig, markdownLib }; diff --git a/config/plugins/markdown.js b/config/plugins/markdown.js index 0fc9fe2..3d93e29 100644 --- a/config/plugins/markdown.js +++ b/config/plugins/markdown.js @@ -1,15 +1,15 @@ -import markdownIt from "markdown-it"; -import markdownItAnchor from "markdown-it-anchor"; -import markdownItFootnote from "markdown-it-footnote"; -import markdownItLinkAttributes from "markdown-it-link-attributes"; -import markdownItPrism from "markdown-it-prism"; +import markdownIt from 'markdown-it'; +import markdownItAnchor from 'markdown-it-anchor'; +import markdownItFootnote from 'markdown-it-footnote'; +import markdownItLinkAttributes from 'markdown-it-link-attributes'; +import markdownItPrism from 'markdown-it-prism'; export const markdownLib = markdownIt({ html: true, linkify: true }) .use(markdownItAnchor, { level: [1, 2], permalink: markdownItAnchor.permalink.headerLink({ - safariReaderFix: true, - }), + safariReaderFix: true + }) }) .use(markdownItLinkAttributes, [ { @@ -17,9 +17,9 @@ export const markdownLib = markdownIt({ html: true, linkify: true }) return href.match(/^https?:\/\//); }, attrs: { - rel: "noopener", - }, - }, + rel: 'noopener' + } + } ]) .use(markdownItFootnote) .use(markdownItPrism); diff --git a/eleventy.config.js b/eleventy.config.js index 00598ce..ded1d9d 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,13 +1,13 @@ -import { createRequire } from "module"; -import "dotenv/config"; -import filters from "./config/filters/index.js"; -import tablerIcons from "@cdransf/eleventy-plugin-tabler-icons"; -import { minifyJsComponents } from "./config/events/minify-js.js"; -import { albumReleasesCalendar } from "./config/collections/index.js"; -import plugins from "./config/plugins/index.js"; +import { createRequire } from 'module'; +import 'dotenv/config'; +import filters from './config/filters/index.js'; +import tablerIcons from '@cdransf/eleventy-plugin-tabler-icons'; +import { minifyJsComponents } from './config/events/minify-js.js'; +import { albumReleasesCalendar } from './config/collections/index.js'; +import plugins from './config/plugins/index.js'; const require = createRequire(import.meta.url); -const appVersion = require("./package.json").version; +const appVersion = require('./package.json').version; export default async function (eleventyConfig) { eleventyConfig.addPlugin(tablerIcons); @@ -18,23 +18,22 @@ export default async function (eleventyConfig) { eleventyConfig.configureErrorReporting({ allowMissingExtensions: true }); eleventyConfig.setLiquidOptions({ jsTruthy: true }); - eleventyConfig.watchIgnores.add("queries/**"); + eleventyConfig.watchIgnores.add('queries/**'); - eleventyConfig.addPassthroughCopy("src/assets"); - eleventyConfig.addPassthroughCopy("api"); - eleventyConfig.addPassthroughCopy("bootstrap.php"); + eleventyConfig.addPassthroughCopy('src/assets'); + eleventyConfig.addPassthroughCopy('api'); + eleventyConfig.addPassthroughCopy('bootstrap.php'); eleventyConfig.addPassthroughCopy({ - "node_modules/minisearch/dist/umd/index.js": - "assets/scripts/components/minisearch.js", - "node_modules/youtube-video-element/dist/youtube-video-element.js": - "assets/scripts/components/youtube-video-element.js", + 'node_modules/minisearch/dist/umd/index.js': 'assets/scripts/components/minisearch.js', + 'node_modules/youtube-video-element/dist/youtube-video-element.js': + 'assets/scripts/components/youtube-video-element.js' }); - eleventyConfig.addCollection("albumReleasesCalendar", albumReleasesCalendar); + eleventyConfig.addCollection('albumReleasesCalendar', albumReleasesCalendar); - eleventyConfig.setLibrary("md", plugins.markdownLib); + eleventyConfig.setLibrary('md', plugins.markdownLib); - eleventyConfig.addLiquidFilter("markdown", (content) => { + eleventyConfig.addLiquidFilter('markdown', (content) => { if (!content) return; return plugins.markdownLib.render(content); }); @@ -43,17 +42,17 @@ export default async function (eleventyConfig) { eleventyConfig.addLiquidFilter(filterName, filters[filterName]); }); - eleventyConfig.addShortcode("appVersion", () => appVersion); + eleventyConfig.addShortcode('appVersion', () => appVersion); - eleventyConfig.on("afterBuild", minifyJsComponents); + eleventyConfig.on('afterBuild', minifyJsComponents); return { dir: { - input: "src", - includes: "includes", - layouts: "layouts", - data: "data", - output: "dist", + input: 'src', + includes: 'includes', + layouts: 'layouts', + data: 'data', + output: 'dist' } }; } diff --git a/package-lock.json b/package-lock.json index 5dd6fc6..8ed54f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "10.0.4", + "version": "10.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "10.0.4", + "version": "10.1.4", "license": "MIT", "dependencies": { "minisearch": "^7.1.2", @@ -21,7 +21,9 @@ "cssnano": "^7.0.7", "dotenv": "16.5.0", "html-minifier-terser": "7.2.0", + "husky": "9.1.7", "ics": "^3.8.1", + "lint-staged": "16.1.1", "markdown-it": "^14.1.0", "markdown-it-anchor": "^9.2.0", "markdown-it-footnote": "^4.0.0", @@ -30,6 +32,7 @@ "postcss": "^8.5.5", "postcss-import": "^16.1.0", "postcss-import-ext-glob": "^2.1.1", + "prettier": "3.5.3", "rimraf": "^6.0.1", "terser": "^5.42.0", "truncate-html": "^1.2.2" @@ -292,6 +295,62 @@ "node": ">=12" } }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", @@ -508,6 +567,22 @@ "node": ">=0.4.0" } }, + "node_modules/ansi-escapes": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.0.0.tgz", + "integrity": "sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ansi-regex": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", @@ -911,6 +986,39 @@ "node": ">= 10.0" } }, + "node_modules/cli-cursor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz", + "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", + "dev": true, + "license": "MIT", + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -943,6 +1051,16 @@ "dev": true, "license": "MIT" }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/cliui/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -1016,6 +1134,13 @@ "dev": true, "license": "MIT" }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true, + "license": "MIT" + }, "node_modules/commander": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", @@ -1415,9 +1540,9 @@ "license": "ISC" }, "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", "dev": true, "license": "MIT" }, @@ -1458,6 +1583,19 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/errno": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/errno/-/errno-1.0.0.tgz", @@ -1546,9 +1684,9 @@ } }, "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", "dev": true, "license": "MIT" }, @@ -1742,6 +1880,19 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-east-asian-width": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz", + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/glob": { "version": "11.0.3", "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", @@ -1940,6 +2091,22 @@ "node": ">= 0.8" } }, + "node_modules/husky": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", + "dev": true, + "license": "MIT", + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -2059,13 +2226,16 @@ } }, "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-glob": { @@ -2197,6 +2367,57 @@ "uc.micro": "^2.0.0" } }, + "node_modules/lint-staged": { + "version": "16.1.1", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-16.1.1.tgz", + "integrity": "sha512-kVZvRAHw9WuufENnwuZLiB1X/8B8YpGszzjMET0bP+uJSjjB7KXeaX2ckYRtQyHfeQdCWMc6tRK34t4geHL9sg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^5.4.1", + "commander": "^14.0.0", + "debug": "^4.4.1", + "lilconfig": "^3.1.3", + "listr2": "^8.3.3", + "micromatch": "^4.0.8", + "nano-spawn": "^1.0.2", + "pidtree": "^0.6.0", + "string-argv": "^0.3.2", + "yaml": "^2.8.0" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": ">=20.17" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/commander": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.0.tgz", + "integrity": "sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, "node_modules/liquidjs": { "version": "10.21.1", "resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-10.21.1.tgz", @@ -2225,6 +2446,24 @@ "dev": true, "license": "MIT" }, + "node_modules/listr2": { + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.3.3.tgz", + "integrity": "sha512-LWzX2KsqcB1wqQ4AHgYb4RsDXauQiqhjLk+6hjbaeHG4zpjjVAB6wC/gz6X0l+Du1cN3pUB5ZlrvTbhGSNnUQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "cli-truncate": "^4.0.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^6.1.0", + "rfdc": "^1.4.1", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -2246,6 +2485,72 @@ "dev": true, "license": "MIT" }, + "node_modules/log-update": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz", + "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-escapes": "^7.0.0", + "cli-cursor": "^5.0.0", + "slice-ansi": "^7.1.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-update/node_modules/is-fullwidth-code-point": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz", + "integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz", + "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, "node_modules/lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", @@ -2448,6 +2753,19 @@ "node": ">= 0.6" } }, + "node_modules/mimic-function": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2508,6 +2826,19 @@ "dev": true, "license": "MIT" }, + "node_modules/nano-spawn": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nano-spawn/-/nano-spawn-1.0.2.tgz", + "integrity": "sha512-21t+ozMQDAL/UGgQVBbZ/xXvNO10++ZPuTmKRO8k9V3AClVRht49ahtDjfY8l1q6nSHOrE5ASfthzH3ol6R/hg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/nano-spawn?sponsor=1" + } + }, "node_modules/nanoid": { "version": "3.3.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", @@ -2629,6 +2960,22 @@ "node": ">= 0.8" } }, + "node_modules/onetime": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-function": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -2656,6 +3003,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-queue/node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true, + "license": "MIT" + }, "node_modules/p-timeout": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", @@ -2809,6 +3163,19 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "license": "MIT", + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -3492,6 +3859,22 @@ "node": ">=12" } }, + "node_modules/prettier": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", + "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/prismjs": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", @@ -3634,6 +4017,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/restore-cursor": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/reusify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", @@ -3645,6 +4045,13 @@ "node": ">=0.10.0" } }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "dev": true, + "license": "MIT" + }, "node_modules/rimraf": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", @@ -3836,6 +4243,36 @@ "node": ">=8" } }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/slugify": { "version": "1.6.6", "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.6.tgz", @@ -3907,19 +4344,29 @@ "node": ">= 0.8" } }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", "dev": true, "license": "MIT", "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3958,6 +4405,16 @@ "dev": true, "license": "MIT" }, + "node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/string-width-cjs/node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -4390,18 +4847,18 @@ } }, "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", "dev": true, "license": "MIT", "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/chalk/wrap-ansi?sponsor=1" @@ -4443,6 +4900,16 @@ "dev": true, "license": "MIT" }, + "node_modules/wrap-ansi-cjs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/wrap-ansi-cjs/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -4516,6 +4983,19 @@ "node": ">=10" } }, + "node_modules/yaml": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz", + "integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + } + }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", @@ -4562,6 +5042,16 @@ "dev": true, "license": "MIT" }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/yargs/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", diff --git a/package.json b/package.json index 0ccd376..a4b6efd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "10.0.4", + "version": "10.1.4", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "engines": { @@ -13,9 +13,14 @@ "php": "export $(grep -v '^#' .env | xargs) && php -d error_reporting=E_ALL^E_DEPRECATED -S localhost:8080 -t dist", "build": "eleventy", "clean": "rimraf dist .cache", + "format": "npx prettier --write '**/*.{js,ts,json,css,md}'", "update": "composer update && npm upgrade && npm --prefix cli upgrade && ncu && ncu --cwd cli", "setup": "sh ./scripts/setup.sh", - "setup:deploy": "sh ./scripts/setup.sh --deploy" + "setup:deploy": "sh ./scripts/setup.sh --deploy", + "prepare": "husky" + }, + "lint-staged": { + "*.{js,json,css,md}": "prettier --write" }, "keywords": [ "11ty", @@ -41,7 +46,9 @@ "cssnano": "^7.0.7", "dotenv": "16.5.0", "html-minifier-terser": "7.2.0", + "husky": "9.1.7", "ics": "^3.8.1", + "lint-staged": "16.1.1", "markdown-it": "^14.1.0", "markdown-it-anchor": "^9.2.0", "markdown-it-footnote": "^4.0.0", @@ -50,6 +57,7 @@ "postcss": "^8.5.5", "postcss-import": "^16.1.0", "postcss-import-ext-glob": "^2.1.1", + "prettier": "3.5.3", "rimraf": "^6.0.1", "terser": "^5.42.0", "truncate-html": "^1.2.2" diff --git a/scripts/setup.sh b/scripts/setup.sh index 69d9ef5..6d59795 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -69,6 +69,9 @@ export $(grep -v '^#' .env | xargs) echo "${COLOR_BLUE}šŸ“¦ Installing root project dependencies...${COLOR_RESET}" npm install +echo "${COLOR_BLUE}🐺 Initializing Husky Git hooks...${COLOR_RESET}" +npm run prepare + echo "${COLOR_BLUE}šŸ“¦ Installing PHP dependencies (composer)...${COLOR_RESET}" composer install diff --git a/src/assets/scripts/components/select-pagination.js b/src/assets/scripts/components/select-pagination.js index 4d6dcdb..ce7e6fd 100644 --- a/src/assets/scripts/components/select-pagination.js +++ b/src/assets/scripts/components/select-pagination.js @@ -1,52 +1,52 @@ class SelectPagination extends HTMLElement { static register(tagName = 'select-pagination') { - if ("customElements" in window) customElements.define(tagName, this) + if ('customElements' in window) customElements.define(tagName, this); } static get observedAttributes() { - return ['data-base-index'] + return ['data-base-index']; } get baseIndex() { - return parseInt(this.getAttribute('data-base-index') || '0', 10) + return parseInt(this.getAttribute('data-base-index') || '0', 10); } connectedCallback() { - if (this.shadowRoot) return + if (this.shadowRoot) return; - this.attachShadow({ mode: 'open' }).appendChild(document.createElement('slot')) + this.attachShadow({ mode: 'open' }).appendChild(document.createElement('slot')); - const uriSegments = window.location.pathname.split('/').filter(Boolean) - let pageNumber = this.extractPageNumber(uriSegments) - if (pageNumber === null) pageNumber = this.baseIndex + const uriSegments = window.location.pathname.split('/').filter(Boolean); + let pageNumber = this.extractPageNumber(uriSegments); + if (pageNumber === null) pageNumber = this.baseIndex; - this.control = this.querySelector('select') - this.control.value = pageNumber.toString() + this.control = this.querySelector('select'); + this.control.value = pageNumber.toString(); this.control.addEventListener('change', (event) => { - pageNumber = parseInt(event.target.value) - const updatedUrlSegments = this.updateUrlSegments(uriSegments, pageNumber) - window.location.href = `${window.location.origin}/${updatedUrlSegments.join('/')}` - }) + pageNumber = parseInt(event.target.value); + const updatedUrlSegments = this.updateUrlSegments(uriSegments, pageNumber); + window.location.href = `${window.location.origin}/${updatedUrlSegments.join('/')}`; + }); } extractPageNumber(segments) { - const lastSegment = segments[segments.length - 1] - return !isNaN(lastSegment) ? parseInt(lastSegment) : null + const lastSegment = segments[segments.length - 1]; + return !isNaN(lastSegment) ? parseInt(lastSegment) : null; } updateUrlSegments(segments, pageNumber) { - const lastIsPage = !isNaN(segments[segments.length - 1]) + const lastIsPage = !isNaN(segments[segments.length - 1]); if (lastIsPage) { - segments[segments.length - 1] = pageNumber.toString() + segments[segments.length - 1] = pageNumber.toString(); } else { - segments.push(pageNumber.toString()) + segments.push(pageNumber.toString()); } - if (pageNumber === this.baseIndex) segments.pop() + if (pageNumber === this.baseIndex) segments.pop(); - return segments + return segments; } } -SelectPagination.register() +SelectPagination.register(); diff --git a/src/assets/scripts/index.js b/src/assets/scripts/index.js index 7fe0880..d4aa020 100644 --- a/src/assets/scripts/index.js +++ b/src/assets/scripts/index.js @@ -21,7 +21,9 @@ window.addEventListener('load', () => { if (isDynamic && !isLoaded) { const markdownFields = dialog.dataset.markdown || ''; try { - const res = await fetch(`/api/query.php?data=${isDynamic}&id=${dialogId}&markdown=${encodeURIComponent(markdownFields)}`); + const res = await fetch( + `/api/query.php?data=${isDynamic}&id=${dialogId}&markdown=${encodeURIComponent(markdownFields)}` + ); const [data] = await res.json(); const firstField = markdownFields.split(',')[0]?.trim(); const html = data?.[`${firstField}_html`] || '

No notes available.

'; diff --git a/src/assets/scripts/sw.js b/src/assets/scripts/sw.js index a3421dd..de56bb3 100644 --- a/src/assets/scripts/sw.js +++ b/src/assets/scripts/sw.js @@ -7,22 +7,23 @@ const staticAssets = [ '/assets/fonts/dmi.woff2', '/assets/fonts/ml.woff2', '/assets/scripts/index.js', - '/assets/scripts/components/select-pagination.js', + '/assets/scripts/components/select-pagination.js' ]; -self.addEventListener('install', event => { +self.addEventListener('install', (event) => { event.waitUntil( - caches.open(cacheName) - .then(cache => cache.addAll(staticAssets)) + caches + .open(cacheName) + .then((cache) => cache.addAll(staticAssets)) .then(() => self.skipWaiting()) ); }); -self.addEventListener('activate', event => { +self.addEventListener('activate', (event) => { event.waitUntil( (async () => { const keys = await caches.keys(); - await Promise.all(keys.filter(key => key !== cacheName).map(key => caches.delete(key))); + await Promise.all(keys.filter((key) => key !== cacheName).map((key) => caches.delete(key))); if (self.registration.navigationPreload) await self.registration.navigationPreload.enable(); @@ -31,7 +32,7 @@ self.addEventListener('activate', event => { ); }); -self.addEventListener('fetch', event => { +self.addEventListener('fetch', (event) => { const request = event.request; if (request.method !== 'GET') return; @@ -51,6 +52,5 @@ self.addEventListener('fetch', event => { return; } - event.respondWith(caches.match(request).then(response => response || fetch(request)) - ); + event.respondWith(caches.match(request).then((response) => response || fetch(request))); }); diff --git a/src/assets/styles/base/fonts.css b/src/assets/styles/base/fonts.css index d31d229..7c9f4dc 100644 --- a/src/assets/styles/base/fonts.css +++ b/src/assets/styles/base/fonts.css @@ -1,46 +1,46 @@ @font-face { - font-family: "Space Grotesk"; - src: url("/assets/fonts/sg.woff2") format("woff2"); + font-family: 'Space Grotesk'; + src: url('/assets/fonts/sg.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; } @font-face { - font-family: "DM Sans"; - src: url("/assets/fonts/dm-regular.woff2") format("woff2"); + font-family: 'DM Sans'; + src: url('/assets/fonts/dm-regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; } @font-face { - font-family: "DM Sans"; - src: url("/assets/fonts/dm-bold.woff2") format("woff2"); + font-family: 'DM Sans'; + src: url('/assets/fonts/dm-bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; } @font-face { - font-family: "DM Sans"; - src: url("/assets/fonts/dm-regular-italic.woff2") format("woff2"); + font-family: 'DM Sans'; + src: url('/assets/fonts/dm-regular-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: optional; } @font-face { - font-family: "DM Sans"; - src: url("/assets/fonts/dm-bold-italic.woff2") format("woff2"); + font-family: 'DM Sans'; + src: url('/assets/fonts/dm-bold-italic.woff2') format('woff2'); font-weight: 700; font-style: italic; font-display: optional; } @font-face { - font-family: "MonoLisa"; - src: url("/assets/fonts/ml.woff2") format("woff2"); + font-family: 'MonoLisa'; + src: url('/assets/fonts/ml.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; diff --git a/src/assets/styles/base/index.css b/src/assets/styles/base/index.css index 8fa2775..37b7034 100644 --- a/src/assets/styles/base/index.css +++ b/src/assets/styles/base/index.css @@ -82,7 +82,7 @@ img { border-radius: var(--border-radius-slight); &.image-banner { - border: var(--border-gray); + border: var(--border-gray); height: auto; width: var(--sizing-full); margin: var(--margin-vertical-base-horizontal-zero); @@ -302,7 +302,9 @@ a { } /* headers */ -h1, h2, h3 { +h1, +h2, +h3 { font-family: var(--font-heading); font-weight: var(--font-weight-bold); line-height: var(--line-height-md); @@ -440,7 +442,7 @@ td { text-overflow: ellipsis; &::after { - content: ""; + content: ''; position: absolute; inset-block-start: 0; inset-inline-end: 0; @@ -492,7 +494,7 @@ main { main, footer { - width: calc(var(--sizing-full) * .8); + width: calc(var(--sizing-full) * 0.8); @media screen and (min-width: 768px) { max-width: 768px; diff --git a/src/assets/styles/base/vars.css b/src/assets/styles/base/vars.css index 2800c0f..988436b 100644 --- a/src/assets/styles/base/vars.css +++ b/src/assets/styles/base/vars.css @@ -71,9 +71,10 @@ --border-gray: 1px solid var(--gray-light); /* fonts */ - --font-body: "DM Sans", Helvetica Neue, Helvetica, Arial, system-ui, sans-serif; - --font-heading: "Space Grotesk", "Arial Black", "Arial Bold", Gadget, sans-serif; - --font-code: "MonoLisa", SFMono-Regular, Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; + --font-body: 'DM Sans', Helvetica Neue, Helvetica, Arial, system-ui, sans-serif; + --font-heading: 'Space Grotesk', 'Arial Black', 'Arial Bold', Gadget, sans-serif; + --font-code: + 'MonoLisa', SFMono-Regular, Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; /* text */ --font-size-xs: 0.7rem; @@ -152,7 +153,7 @@ } /* transitions */ - --transition-ease-in-out: cubic-bezier(.4, 0, .2, 1); + --transition-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); --transition-duration-default: 300ms; /* transforms */ @@ -165,10 +166,10 @@ --button-offset-hover: 0; } -/* filters */ ---filter-image-default: contrast(1) saturate(1) brightness(1); ---filter-image-light: contrast(1.2) saturate(1.2) brightness(0.9); ---filter-image-dark: contrast(1.1) saturate(1.1) brightness(1.1); + /* filters */ + --filter-image-default: contrast(1) saturate(1) brightness(1); + --filter-image-light: contrast(1.2) saturate(1.2) brightness(0.9); + --filter-image-dark: contrast(1.1) saturate(1.1) brightness(1.1); /* svgs */ --stroke-width-default: 1.3; diff --git a/src/assets/styles/components/buttons.css b/src/assets/styles/components/buttons.css index 2b018ae..14a2145 100644 --- a/src/assets/styles/components/buttons.css +++ b/src/assets/styles/components/buttons.css @@ -1,4 +1,4 @@ -@import url("./text-toggle.css"); +@import url('./text-toggle.css'); button:not([data-dialog-button]), .button { diff --git a/src/assets/styles/components/dialog.css b/src/assets/styles/components/dialog.css index f6fad0f..c56c598 100644 --- a/src/assets/styles/components/dialog.css +++ b/src/assets/styles/components/dialog.css @@ -1,11 +1,23 @@ @keyframes fadeIn { - from { opacity: 0; transform: scale(0.95); } - to { opacity: 1; transform: scale(1); } + from { + opacity: 0; + transform: scale(0.95); + } + to { + opacity: 1; + transform: scale(1); + } } @keyframes fadeOut { - from { opacity: 1; transform: scale(1); } - to { opacity: 0; transform: scale(0.95); } + from { + opacity: 1; + transform: scale(1); + } + to { + opacity: 0; + transform: scale(0.95); + } } .dialog-open, @@ -14,7 +26,8 @@ vertical-align: middle; color: var(--section-color, var(--accent-color)); transform: var(--transform-icon-default); - transition: color var(--transition-duration-default) var(--transition-ease-in-out), + transition: + color var(--transition-duration-default) var(--transition-ease-in-out), transform var(--transition-duration-default) var(--transition-ease-in-out); &:is(:hover, :focus, :active) { @@ -61,9 +74,9 @@ dialog { } @media (min-width: 768px) { - max-width: calc(var(--sizing-full) * .6); - max-height: calc(var(--sizing-full) * .75); - inset: calc(var(--sizing-full) * .125) calc(var(--sizing-full) * .2); + max-width: calc(var(--sizing-full) * 0.6); + max-height: calc(var(--sizing-full) * 0.75); + inset: calc(var(--sizing-full) * 0.125) calc(var(--sizing-full) * 0.2); border: var(--border-gray); } diff --git a/src/assets/styles/components/forms.css b/src/assets/styles/components/forms.css index 240322a..3c893ea 100644 --- a/src/assets/styles/components/forms.css +++ b/src/assets/styles/components/forms.css @@ -1,18 +1,18 @@ ::placeholder { color: var(--text-color); - opacity: .5; + opacity: 0.5; } input { accent-color: var(--section-color, var(--accent-color)); } -input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]), +input:not([type='button']):not([type='submit']):not([type='reset']):not([type='checkbox']), textarea { width: var(--sizing-full); } -input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]), +input:not([type='button']):not([type='submit']):not([type='reset']):not([type='checkbox']), textarea, select { color: var(--text-color); @@ -23,7 +23,7 @@ select { } form, -input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]), +input:not([type='button']):not([type='submit']):not([type='reset']):not([type='checkbox']), textarea { margin-bottom: var(--spacing-base); } @@ -50,7 +50,7 @@ label svg { cursor: pointer; } -detail label:has(input[type="checkbox"]) { +detail label:has(input[type='checkbox']) { display: inline-flex; gap: var(--spacing-xs); } diff --git a/src/assets/styles/components/music-chart.css b/src/assets/styles/components/music-chart.css index 7361737..b7823a8 100644 --- a/src/assets/styles/components/music-chart.css +++ b/src/assets/styles/components/music-chart.css @@ -50,7 +50,7 @@ progress { @media screen and (min-width: 768px) { - max-width: calc(var(--sizing-full) * .8); + max-width: calc(var(--sizing-full) * 0.8); } } } diff --git a/src/assets/styles/components/text-toggle.css b/src/assets/styles/components/text-toggle.css index 936e24d..17819e0 100644 --- a/src/assets/styles/components/text-toggle.css +++ b/src/assets/styles/components/text-toggle.css @@ -11,10 +11,10 @@ &::after { position: absolute; z-index: 1; - content: ""; + content: ''; box-shadow: var(--box-shadow-text-toggle); width: var(--sizing-full); - height: calc(var(--sizing-full) * .2); + height: calc(var(--sizing-full) * 0.2); bottom: 0; left: 0; } diff --git a/src/assets/styles/index.css b/src/assets/styles/index.css index a283ea8..cdbb62a 100644 --- a/src/assets/styles/index.css +++ b/src/assets/styles/index.css @@ -1,36 +1,36 @@ @layer reset, defaults, base, page, components, plugins; /* style resets */ -@import url("./base/reset.css") layer(reset); +@import url('./base/reset.css') layer(reset); /* core defaults */ -@import url("./base/fonts.css") layer(defaults); -@import url("./base/vars.css") layer(defaults); +@import url('./base/fonts.css') layer(defaults); +@import url('./base/vars.css') layer(defaults); /* base styles */ -@import url("./base/index.css") layer(base); +@import url('./base/index.css') layer(base); /* page styles */ -@import url("./pages/contact.css") layer(page); -@import url("./pages/links.css") layer(page); -@import url("./pages/media.css") layer(page); -@import url("./pages/music.css") layer(page); -@import url("./pages/reading.css") layer(page); -@import url("./pages/watching.css") layer(page); -@import url("./pages/webrings.css") layer(page); +@import url('./pages/contact.css') layer(page); +@import url('./pages/links.css') layer(page); +@import url('./pages/media.css') layer(page); +@import url('./pages/music.css') layer(page); +@import url('./pages/reading.css') layer(page); +@import url('./pages/watching.css') layer(page); +@import url('./pages/webrings.css') layer(page); /* plugins */ -@import url("./plugins/prism.css") layer(plugins); +@import url('./plugins/prism.css') layer(plugins); /* component styles */ -@import url("./components/banners.css") layer(components); -@import url("./components/buttons.css") layer(components); -@import url("./components/forms.css") layer(components); -@import url("./components/header.css") layer(components); -@import url("./components/media-grid.css") layer(components); -@import url("./components/nav.css") layer(components); -@import url("./components/dialog.css") layer(components); -@import url("./components/music-chart.css") layer(components); -@import url("./components/paginator.css") layer(components); -@import url("./components/progress-bar.css") layer(components); -@import url("./components/youtube-player.css") layer(components); +@import url('./components/banners.css') layer(components); +@import url('./components/buttons.css') layer(components); +@import url('./components/forms.css') layer(components); +@import url('./components/header.css') layer(components); +@import url('./components/media-grid.css') layer(components); +@import url('./components/nav.css') layer(components); +@import url('./components/dialog.css') layer(components); +@import url('./components/music-chart.css') layer(components); +@import url('./components/paginator.css') layer(components); +@import url('./components/progress-bar.css') layer(components); +@import url('./components/youtube-player.css') layer(components); diff --git a/src/assets/styles/noscript.css b/src/assets/styles/noscript.css index 2f2c941..05de3a4 100644 --- a/src/assets/styles/noscript.css +++ b/src/assets/styles/noscript.css @@ -1,6 +1,6 @@ /* generic helper to hide client side content */ .client-side { - display:none + display: none; } /* unset text toggle implementation on artist + genre pages */ diff --git a/src/data/albumReleases.js b/src/data/albumReleases.js index 506939b..3ee6433 100644 --- a/src/data/albumReleases.js +++ b/src/data/albumReleases.js @@ -1,26 +1,23 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAlbumReleases = async () => { try { - const data = await EleventyFetch( - `${POSTGREST_URL}/optimized_album_releases`, - { - duration: "1d", - type: "json", - fetchOptions: { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, - }, - ); + const data = await EleventyFetch(`${POSTGREST_URL}/optimized_album_releases`, { + duration: '1d', + type: 'json', + fetchOptions: { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } + }); - const pacificNow = new Date().toLocaleString("en-US", { - timeZone: "America/Los_Angeles", + const pacificNow = new Date().toLocaleString('en-US', { + timeZone: 'America/Los_Angeles' }); const pacificDate = new Date(pacificNow); pacificDate.setHours(0, 0, 0, 0); @@ -32,25 +29,23 @@ const fetchAlbumReleases = async () => { return { ...album, - description: album.artist?.description || "No description", - date: releaseDate.toLocaleDateString("en-US", { - year: "numeric", - month: "long", - day: "numeric", - }), + description: album.artist?.description || 'No description', + date: releaseDate.toLocaleDateString('en-US', { + year: 'numeric', + month: 'long', + day: 'numeric' + }) }; }) .sort((a, b) => a.release_timestamp - b.release_timestamp); const upcoming = all.filter( - (album) => - album.release_timestamp > todayTimestamp && - album.total_plays === 0, + (album) => album.release_timestamp > todayTimestamp && album.total_plays === 0 ); return { all, upcoming }; } catch (error) { - console.error("Error fetching and processing album releases:", error); + console.error('Error fetching and processing album releases:', error); return { all: [], upcoming: [] }; } }; diff --git a/src/data/allActivity.js b/src/data/allActivity.js index c2aa946..c89c2c7 100644 --- a/src/data/allActivity.js +++ b/src/data/allActivity.js @@ -1,27 +1,24 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; export default async function fetchAllActivity() { try { - const data = await EleventyFetch( - `${POSTGREST_URL}/optimized_all_activity`, - { - duration: "1h", - type: "json", - fetchOptions: { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + const data = await EleventyFetch(`${POSTGREST_URL}/optimized_all_activity`, { + duration: '1h', + type: 'json', + fetchOptions: { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } } - ); + }); return data?.[0] || []; } catch (error) { - console.error("Error fetching activity:", error); + console.error('Error fetching activity:', error); return []; } } diff --git a/src/data/blogroll.js b/src/data/blogroll.js index f86833d..7bf419f 100644 --- a/src/data/blogroll.js +++ b/src/data/blogroll.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchBlogroll = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_blogroll`, { - duration: "1d", - type: "json", + duration: '1d', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching and processing the blogroll:", error); + console.error('Error fetching and processing the blogroll:', error); return []; } }; diff --git a/src/data/books.js b/src/data/books.js index a58f0bb..7490e3a 100644 --- a/src/data/books.js +++ b/src/data/books.js @@ -1,25 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAllBooks = async () => { try { - return await EleventyFetch( - `${POSTGREST_URL}/optimized_books?order=date_finished.desc`, - { - duration: "1h", - type: "json", - fetchOptions: { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, - }, - ); + return await EleventyFetch(`${POSTGREST_URL}/optimized_books?order=date_finished.desc`, { + duration: '1h', + type: 'json', + fetchOptions: { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } + }); } catch (error) { - console.error("Error fetching books:", error); + console.error('Error fetching books:', error); return []; } }; @@ -45,7 +42,7 @@ export default async function () { const booksForCurrentYear = sortedByYear .find((yearGroup) => yearGroup.value === currentYear) - ?.data.filter((book) => book.status === "finished") || []; + ?.data.filter((book) => book.status === 'finished') || []; return { all: books, diff --git a/src/data/concerts.js b/src/data/concerts.js index 852746d..b143072 100644 --- a/src/data/concerts.js +++ b/src/data/concerts.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAllConcerts = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_concerts`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching concerts:", error); + console.error('Error fetching concerts:', error); return []; } }; @@ -24,7 +24,7 @@ const fetchAllConcerts = async () => { const processConcerts = (concerts) => concerts.map((concert) => ({ ...concert, - artist: concert.artist || { name: concert.artist_name_string, url: null }, + artist: concert.artist || { name: concert.artist_name_string, url: null } })); export default async function () { @@ -32,7 +32,7 @@ export default async function () { const concerts = await fetchAllConcerts(); return processConcerts(concerts); } catch (error) { - console.error("Error fetching and processing concerts data:", error); + console.error('Error fetching and processing concerts data:', error); return []; } } diff --git a/src/data/feeds.js b/src/data/feeds.js index 538f11c..703f9d7 100644 --- a/src/data/feeds.js +++ b/src/data/feeds.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchFeeds = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_feeds?select=*`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching feed metadata:", error); + console.error('Error fetching feed metadata:', error); return []; } }; @@ -24,16 +24,16 @@ const fetchFeeds = async () => { const fetchFeedData = async (feedKey) => { try { return await EleventyFetch(`${POSTGREST_URL}/rpc/get_feed_data`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "POST", + method: 'POST', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` }, - body: JSON.stringify({ feed_key: feedKey }), - }, + body: JSON.stringify({ feed_key: feedKey }) + } }); } catch (error) { console.error(`Error fetching feed data for ${feedKey}:`, error); @@ -48,9 +48,9 @@ export default async function () { for (const feed of feeds) { feedsWithData.push({ ...feed, - entries: await fetchFeedData(feed.data), + entries: await fetchFeedData(feed.data) }); } return feedsWithData; -}; +} diff --git a/src/data/globals.js b/src/data/globals.js index 36bec98..7c19c60 100644 --- a/src/data/globals.js +++ b/src/data/globals.js @@ -1,27 +1,24 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchGlobals = async () => { try { - const data = await EleventyFetch( - `${POSTGREST_URL}/optimized_globals?select=*`, - { - duration: "1d", - type: "json", - fetchOptions: { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, - }, - ); + const data = await EleventyFetch(`${POSTGREST_URL}/optimized_globals?select=*`, { + duration: '1d', + type: 'json', + fetchOptions: { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } + }); return data[0]; } catch (error) { - console.error("Error fetching globals:", error); + console.error('Error fetching globals:', error); return {}; } }; diff --git a/src/data/groupedTags.js b/src/data/groupedTags.js index 5b61a5a..49d34ee 100644 --- a/src/data/groupedTags.js +++ b/src/data/groupedTags.js @@ -1,29 +1,31 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; export default async function () { const res = await EleventyFetch(`${POSTGREST_URL}/optimized_all_tags?order=tag.asc`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); const tags = await res; const groupedMap = new Map(); for (const tag of tags) { - const letter = /^[a-zA-Z]/.test(tag.tag) ? tag.tag[0].toUpperCase() : "#"; + const letter = /^[a-zA-Z]/.test(tag.tag) ? tag.tag[0].toUpperCase() : '#'; if (!groupedMap.has(letter)) groupedMap.set(letter, []); groupedMap.get(letter).push(tag); } - return [...groupedMap.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([letter, tags]) => ({ letter, tags: tags.sort((a, b) => a.tag.localeCompare(b.tag)) })); + return [...groupedMap.entries()] + .sort(([a], [b]) => a.localeCompare(b)) + .map(([letter, tags]) => ({ letter, tags: tags.sort((a, b) => a.tag.localeCompare(b.tag)) })); } diff --git a/src/data/headers.js b/src/data/headers.js index 5844c6b..59735c9 100644 --- a/src/data/headers.js +++ b/src/data/headers.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchHeaders = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_headers?select=*`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching header data:", error); + console.error('Error fetching header data:', error); return []; } }; diff --git a/src/data/links.js b/src/data/links.js index ff394ce..5062d9b 100644 --- a/src/data/links.js +++ b/src/data/links.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAllLinks = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_links?select=*`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching links:", error); + console.error('Error fetching links:', error); return []; } }; @@ -26,6 +26,6 @@ export default async function () { return { all: links, - feed: links.filter((links) => links.feed), - } + feed: links.filter((links) => links.feed) + }; } diff --git a/src/data/movies.js b/src/data/movies.js index b14bb67..53e5dc7 100644 --- a/src/data/movies.js +++ b/src/data/movies.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAllMovies = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_movies?select=*`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching movies:", error); + console.error('Error fetching movies:', error); return []; } }; @@ -44,19 +44,17 @@ export default async function () { movies, watchHistory: movies.filter((movie) => movie.last_watched), recentlyWatched: recentlyWatchedMovies, - favorites: favoriteMovies.sort((a, b) => - a.title.localeCompare(b.title), - ), - feed: movies.filter((movie) => movie.feed), + favorites: favoriteMovies.sort((a, b) => a.title.localeCompare(b.title)), + feed: movies.filter((movie) => movie.feed) }; } catch (error) { - console.error("Error fetching and processing movies data:", error); + console.error('Error fetching and processing movies data:', error); return { movies: [], watchHistory: [], recentlyWatched: [], favorites: [], - feed: [], + feed: [] }; } } diff --git a/src/data/music.js b/src/data/music.js index 1574664..70887e7 100644 --- a/src/data/music.js +++ b/src/data/music.js @@ -1,19 +1,19 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchDataFromView = async (viewName) => { try { return await EleventyFetch(`${POSTGREST_URL}/${viewName}?select=*`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { console.error(`Error fetching data from view ${viewName}:`, error); @@ -32,17 +32,17 @@ export default async function fetchMusicData() { monthTracks, monthArtists, monthAlbums, - monthGenres, + monthGenres ] = await Promise.all([ - fetchDataFromView("recent_tracks"), - fetchDataFromView("week_tracks"), - fetchDataFromView("week_artists"), - fetchDataFromView("week_albums"), - fetchDataFromView("week_genres"), - fetchDataFromView("month_tracks"), - fetchDataFromView("month_artists"), - fetchDataFromView("month_albums"), - fetchDataFromView("month_genres"), + fetchDataFromView('recent_tracks'), + fetchDataFromView('week_tracks'), + fetchDataFromView('week_artists'), + fetchDataFromView('week_albums'), + fetchDataFromView('week_genres'), + fetchDataFromView('month_tracks'), + fetchDataFromView('month_artists'), + fetchDataFromView('month_albums'), + fetchDataFromView('month_genres') ]); return { @@ -52,9 +52,7 @@ export default async function fetchMusicData() { artists: weekArtists, albums: weekAlbums, genres: weekGenres, - totalTracks: weekTracks - .reduce((acc, track) => acc + track.plays, 0) - .toLocaleString("en-US"), + totalTracks: weekTracks.reduce((acc, track) => acc + track.plays, 0).toLocaleString('en-US') }, month: { tracks: monthTracks, @@ -63,11 +61,11 @@ export default async function fetchMusicData() { genres: monthGenres, totalTracks: monthTracks .reduce((acc, track) => acc + track.plays, 0) - .toLocaleString("en-US"), - }, + .toLocaleString('en-US') + } }; } catch (error) { - console.error("Error fetching and processing music data:", error); + console.error('Error fetching and processing music data:', error); return { recent: [], week: { @@ -75,15 +73,15 @@ export default async function fetchMusicData() { artists: [], albums: [], genres: [], - totalTracks: "0", + totalTracks: '0' }, month: { tracks: [], artists: [], albums: [], genres: [], - totalTracks: "0", - }, + totalTracks: '0' + } }; } } diff --git a/src/data/nav.js b/src/data/nav.js index 16a7e91..e4a07eb 100644 --- a/src/data/nav.js +++ b/src/data/nav.js @@ -1,23 +1,20 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAllNavigation = async () => { try { - const data = await EleventyFetch( - `${POSTGREST_URL}/optimized_navigation?select=*`, - { - duration: "1d", - type: "json", - fetchOptions: { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, - }, - ); + const data = await EleventyFetch(`${POSTGREST_URL}/optimized_navigation?select=*`, { + duration: '1d', + type: 'json', + fetchOptions: { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } + }); const nav = data.reduce((acc, item) => { const navItem = { @@ -25,7 +22,7 @@ const fetchAllNavigation = async () => { permalink: item.permalink || item.page_permalink, icon: item.icon, section: item.section, - sort: item.sort, + sort: item.sort }; if (!acc[item.menu_location]) { @@ -43,7 +40,7 @@ const fetchAllNavigation = async () => { return nav; } catch (error) { - console.error("Error fetching navigation data:", error); + console.error('Error fetching navigation data:', error); return {}; } }; diff --git a/src/data/pages.js b/src/data/pages.js index 04b56f6..c2c818a 100644 --- a/src/data/pages.js +++ b/src/data/pages.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAllPages = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_pages?select=*`, { - duration: "1d", - type: "json", + duration: '1d', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching pages:", error); + console.error('Error fetching pages:', error); return []; } }; diff --git a/src/data/posts.js b/src/data/posts.js index 6a981a4..1eadfef 100644 --- a/src/data/posts.js +++ b/src/data/posts.js @@ -1,25 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAllPosts = async () => { try { - return await EleventyFetch( - `${POSTGREST_URL}/optimized_posts?select=*&order=date.desc`, - { - duration: "1d", - type: "json", - fetchOptions: { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, - }, - ); + return await EleventyFetch(`${POSTGREST_URL}/optimized_posts?select=*&order=date.desc`, { + duration: '1d', + type: 'json', + fetchOptions: { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } + }); } catch (error) { - console.error("Error fetching posts:", error); + console.error('Error fetching posts:', error); return []; } }; @@ -29,6 +26,6 @@ export default async function () { return { all: posts, - feed: posts.filter((posts) => posts.feed), + feed: posts.filter((posts) => posts.feed) }; } diff --git a/src/data/recentActivity.js b/src/data/recentActivity.js index da4dd78..2063d78 100644 --- a/src/data/recentActivity.js +++ b/src/data/recentActivity.js @@ -1,29 +1,26 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; export default async function () { try { - const data = await EleventyFetch( - `${POSTGREST_URL}/optimized_recent_activity`, - { - duration: "1h", - type: "json", - fetchOptions: { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + const data = await EleventyFetch(`${POSTGREST_URL}/optimized_recent_activity`, { + duration: '1h', + type: 'json', + fetchOptions: { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } } - ); + }); const feeds = data?.[0]?.feed || []; return feeds.filter((item) => item !== null); } catch (error) { - console.error("Error fetching recent activity:", error); + console.error('Error fetching recent activity:', error); return []; } } diff --git a/src/data/redirects.js b/src/data/redirects.js index d42c0cb..345c708 100644 --- a/src/data/redirects.js +++ b/src/data/redirects.js @@ -1,25 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchRedirects = async () => { try { - return await EleventyFetch( - `${POSTGREST_URL}/optimized_redirects?select=*`, - { - duration: "1h", - type: "json", - fetchOptions: { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, - }, - ); + return await EleventyFetch(`${POSTGREST_URL}/optimized_redirects?select=*`, { + duration: '1h', + type: 'json', + fetchOptions: { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } + }); } catch (error) { - console.error("Error fetching redirect data:", error); + console.error('Error fetching redirect data:', error); return []; } }; diff --git a/src/data/robots.js b/src/data/robots.js index 96a89cb..585c45b 100644 --- a/src/data/robots.js +++ b/src/data/robots.js @@ -1,33 +1,30 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAllRobots = async () => { try { - const data = await EleventyFetch( - `${POSTGREST_URL}/optimized_robots?select=path,user_agents`, - { - duration: "1h", - type: "json", - fetchOptions: { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, - }, - ); + const data = await EleventyFetch(`${POSTGREST_URL}/optimized_robots?select=path,user_agents`, { + duration: '1h', + type: 'json', + fetchOptions: { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } + }); const sortedData = data.sort((a, b) => { - const aHasWildcard = a.user_agents.includes("*") ? 0 : 1; - const bHasWildcard = b.user_agents.includes("*") ? 0 : 1; + const aHasWildcard = a.user_agents.includes('*') ? 0 : 1; + const bHasWildcard = b.user_agents.includes('*') ? 0 : 1; return aHasWildcard - bHasWildcard || a.path.localeCompare(b.path); }); return sortedData; } catch (error) { - console.error("Error fetching robot data:", error); + console.error('Error fetching robot data:', error); return []; } }; diff --git a/src/data/sitemap.js b/src/data/sitemap.js index a63ebbe..614b273 100644 --- a/src/data/sitemap.js +++ b/src/data/sitemap.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchSitemap = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_sitemap?select=*`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching sitemap entries:", error); + console.error('Error fetching sitemap entries:', error); return []; } }; diff --git a/src/data/stats.js b/src/data/stats.js index 2025abf..5d34c92 100644 --- a/src/data/stats.js +++ b/src/data/stats.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchStats = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_stats?select=*`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching stats data:", error); + console.error('Error fetching stats data:', error); return []; } }; diff --git a/src/data/topAlbums.js b/src/data/topAlbums.js index e9be800..c3ed585 100644 --- a/src/data/topAlbums.js +++ b/src/data/topAlbums.js @@ -1,4 +1,4 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; @@ -7,21 +7,21 @@ const fetchTopAlbums = async () => { const data = await EleventyFetch( `${POSTGREST_URL}/optimized_albums?select=table&order=total_plays_raw.desc&limit=8`, { - duration: "1d", - type: "json", + duration: '1d', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } + } ); return data; } catch (error) { - console.error("Error fetching top albums:", error); + console.error('Error fetching top albums:', error); return {}; } }; diff --git a/src/data/topArtists.js b/src/data/topArtists.js index 9b17dea..ea7050a 100644 --- a/src/data/topArtists.js +++ b/src/data/topArtists.js @@ -1,4 +1,4 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; @@ -7,21 +7,21 @@ const fetchTopArtists = async () => { const data = await EleventyFetch( `${POSTGREST_URL}/optimized_artists?select=table&order=total_plays_raw.desc&limit=8`, { - duration: "1d", - type: "json", + duration: '1d', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } + } ); return data; } catch (error) { - console.error("Error fetching top artists:", error); + console.error('Error fetching top artists:', error); return {}; } }; diff --git a/src/data/topTags.js b/src/data/topTags.js index 2348c3b..693fc68 100644 --- a/src/data/topTags.js +++ b/src/data/topTags.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchTopTags = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/rpc/get_top_tag_groups`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "POST", + method: 'POST', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching top tag entries:", error); + console.error('Error fetching top tag entries:', error); return []; } }; diff --git a/src/data/tv.js b/src/data/tv.js index 5a4b615..69770ea 100644 --- a/src/data/tv.js +++ b/src/data/tv.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchAllShows = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_shows?select=*`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching shows:", error); + console.error('Error fetching shows:', error); return []; } }; @@ -25,9 +25,7 @@ export default async function () { try { const shows = await fetchAllShows(); - const watchedShows = shows.filter( - (show) => show.last_watched_at !== null, - ); + const watchedShows = shows.filter((show) => show.last_watched_at !== null); const episodes = watchedShows.map((show) => ({ title: show.episode.title, @@ -37,7 +35,7 @@ export default async function () { image: show.episode.image, backdrop: show.episode.backdrop, last_watched_at: show.episode.last_watched_at, - grid: show.grid, + grid: show.grid })); return { @@ -45,15 +43,15 @@ export default async function () { recentlyWatched: episodes.slice(0, 125), favorites: shows .filter((show) => show.favorite) - .sort((a, b) => a.title.localeCompare(b.title)), + .sort((a, b) => a.title.localeCompare(b.title)) }; } catch (error) { - console.error("Error fetching and processing shows data:", error); + console.error('Error fetching and processing shows data:', error); return { shows: [], recentlyWatched: [], - favorites: [], + favorites: [] }; } } diff --git a/src/data/upcomingShows.js b/src/data/upcomingShows.js index 62c3258..ed7dbf7 100644 --- a/src/data/upcomingShows.js +++ b/src/data/upcomingShows.js @@ -1,22 +1,22 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import EleventyFetch from '@11ty/eleventy-fetch'; const { POSTGREST_URL, POSTGREST_API_KEY } = process.env; const fetchUpcomingShows = async () => { try { return await EleventyFetch(`${POSTGREST_URL}/optimized_scheduled_shows?select=*`, { - duration: "1h", - type: "json", + duration: '1h', + type: 'json', fetchOptions: { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${POSTGREST_API_KEY}`, - }, - }, + 'Content-Type': 'application/json', + Authorization: `Bearer ${POSTGREST_API_KEY}` + } + } }); } catch (error) { - console.error("Error fetching upcoming shows:", error); + console.error('Error fetching upcoming shows:', error); return []; } }; @@ -25,5 +25,5 @@ export default async function () { const data = await fetchUpcomingShows(); const upcomingShows = data?.[0]?.scheduled_shows; - return upcomingShows + return upcomingShows; } diff --git a/src/pages/pages.json b/src/pages/pages.json index 9988fb1..2b9a3f3 100644 --- a/src/pages/pages.json +++ b/src/pages/pages.json @@ -1,3 +1,3 @@ { "layout": "base.liquid" -} \ No newline at end of file +}