From 2935475b1175cdf0ff07c3b75f432d837224f846 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 16 Nov 2024 14:44:34 +0530 Subject: [PATCH 001/183] format scripts --- scripts/adopters/index.js | 7 +- scripts/build-docs.js | 113 ++++--- scripts/build-meetings.js | 10 +- scripts/build-newsroom-videos.js | 79 ++--- scripts/build-pages.js | 2 +- scripts/build-post-list.js | 214 ++++++++------ scripts/build-rss.js | 93 +++--- scripts/build-tools.js | 25 +- scripts/casestudies/index.js | 29 +- scripts/compose.js | 57 ++-- scripts/dashboard/build-dashboard.js | 87 ++++-- scripts/finance/index.js | 57 ++-- scripts/index.js | 6 +- scripts/markdown/check-markdown.js | 200 +++++++------ scripts/tools/categorylist.js | 139 +++++---- scripts/tools/combine-tools.js | 258 ++++++++-------- scripts/tools/extract-tools-github.js | 6 +- scripts/tools/tags-color.js | 346 +++++++++++----------- scripts/tools/tools-object.js | 104 ++++--- scripts/tools/tools-schema.json | 411 +++++++++++++------------- scripts/utils.js | 36 +-- scripts/utils/readAndWriteJson.js | 48 +-- 22 files changed, 1277 insertions(+), 1050 deletions(-) diff --git a/scripts/adopters/index.js b/scripts/adopters/index.js index 6a11697ad68f..ef6643802d62 100644 --- a/scripts/adopters/index.js +++ b/scripts/adopters/index.js @@ -1,6 +1,9 @@ const { resolve } = require('path'); -const writeJSON = require('../utils/readAndWriteJson.js') +const writeJSON = require('../utils/readAndWriteJson.js'); module.exports = async function buildAdoptersList() { - writeJSON('config/adopters.yml',resolve(__dirname, '../../config', 'adopters.json')); + writeJSON( + 'config/adopters.yml', + resolve(__dirname, '../../config', 'adopters.json'), + ); }; diff --git a/scripts/build-docs.js b/scripts/build-docs.js index ac47b6751cee..e1aff2f99cd1 100644 --- a/scripts/build-docs.js +++ b/scripts/build-docs.js @@ -1,26 +1,40 @@ -const sortBy = require('lodash/sortBy') +const sortBy = require('lodash/sortBy'); function buildNavTree(navItems) { try { const tree = { - 'welcome': { - item: { title: 'Welcome', weight: 0, isRootSection: true, isSection: true, rootSectionId: 'welcome', sectionWeight: 0, slug: '/docs' }, - children: {} - } - } + welcome: { + item: { + title: 'Welcome', + weight: 0, + isRootSection: true, + isSection: true, + rootSectionId: 'welcome', + sectionWeight: 0, + slug: '/docs', + }, + children: {}, + }, + }; //first we make sure that list of items lists main section items and then sub sections, documents last - const sortedItems = sortBy(navItems, ['isRootSection', 'weight', 'isSection']); + const sortedItems = sortBy(navItems, [ + 'isRootSection', + 'weight', + 'isSection', + ]); - sortedItems.forEach(item => { + sortedItems.forEach((item) => { //identify main sections if (item.isRootSection) { - tree[item.rootSectionId] = { item, children: {} } + tree[item.rootSectionId] = { item, children: {} }; } //identify subsections if (item.parent) { if (!tree[item.parent]) { - throw new Error(`Parent section ${item.parent} not found for item ${item.title}`); + throw new Error( + `Parent section ${item.parent} not found for item ${item.title}`, + ); } tree[item.parent].children[item.sectionId] = { item, children: [] }; } @@ -29,7 +43,10 @@ function buildNavTree(navItems) { if (item.sectionId) { let section = tree[item.rootSectionId]?.children[item.sectionId]; if (!section) { - tree[item.rootSectionId].children[item.sectionId] = { item, children: [] }; + tree[item.rootSectionId].children[item.sectionId] = { + item, + children: [], + }; } tree[item.rootSectionId].children[item.sectionId].children.push(item); } else { @@ -62,40 +79,39 @@ function buildNavTree(navItems) { // point in slug for specification subgroup to the latest specification version if (rootKey === 'reference' && key === 'specification') { - allChildren[key].item.href = allChildren[key].children.find(c => c.isPrerelease === undefined).slug; + allChildren[key].item.href = allChildren[key].children.find( + (c) => c.isPrerelease === undefined, + ).slug; } } } } return tree; - } catch (err) { throw new Error(`Failed to build navigation tree: ${err.message}`); } } -// A recursion function, works on the logic of Depth First Search to traverse all the root and child posts of the +// A recursion function, works on the logic of Depth First Search to traverse all the root and child posts of the // DocTree to get sequential order of the Doc Posts const convertDocPosts = (docObject) => { try { - let docsArray = [] + let docsArray = []; // certain entries in the DocPosts are either a parent to many posts or itself a post. - docsArray.push(docObject?.item || docObject) + docsArray.push(docObject?.item || docObject); if (docObject.children) { - let children = docObject.children + let children = docObject.children; Object.keys(children).forEach((child) => { - let docChildArray = convertDocPosts(children[child]) - docsArray = [...docsArray, ...docChildArray] - }) + let docChildArray = convertDocPosts(children[child]); + docsArray = [...docsArray, ...docChildArray]; + }); } - return docsArray - } - catch (err) { + return docsArray; + } catch (err) { throw new Error('Error in convertDocPosts:', err); } -} - +}; function addDocButtons(docPosts, treePosts) { let structuredPosts = []; @@ -115,56 +131,62 @@ function addDocButtons(docPosts, treePosts) { }); // Appending the content of welcome page of Docs from the posts.json - structuredPosts[0] = docPosts.filter(p => p.slug === '/docs')[0]; + structuredPosts[0] = docPosts.filter((p) => p.slug === '/docs')[0]; // Traversing the structuredPosts in order to add `nextPage` and `prevPage` details for each page let countDocPages = structuredPosts.length; structuredPosts = structuredPosts.map((post, index) => { - // post item specifying the root Section or sub-section in the docs are excluded as - // they doesn't comprise any Doc Page or content to be shown in website. + // post item specifying the root Section or sub-section in the docs are excluded as + // they doesn't comprise any Doc Page or content to be shown in website. if (post?.isRootSection || post?.isSection || index == 0) { - if (post?.isRootSection || index == 0) - rootSections.push(post.title) - return post + if (post?.isRootSection || index == 0) rootSections.push(post.title); + return post; } - let nextPage = {}, prevPage = {} + let nextPage = {}, + prevPage = {}; let docPost = post; // checks whether the next page for the current docPost item exists or not if (index + 1 < countDocPages) { // checks whether the next item inside structuredPosts is a rootElement or a sectionElement // if yes, it goes again to a next to next item in structuredPosts to link the nextPage - if (!structuredPosts[index + 1].isRootElement && !structuredPosts[index + 1].isSection) { + if ( + !structuredPosts[index + 1].isRootElement && + !structuredPosts[index + 1].isSection + ) { nextPage = { title: structuredPosts[index + 1].title, - href: structuredPosts[index + 1].slug - } + href: structuredPosts[index + 1].slug, + }; } else { nextPage = { title: `${structuredPosts[index + 1].title} - ${structuredPosts[index + 2].title}`, - href: structuredPosts[index + 2].slug - } + href: structuredPosts[index + 2].slug, + }; } - docPost = { ...docPost, nextPage } + docPost = { ...docPost, nextPage }; } // checks whether the previous page for the current docPost item exists or not if (index > 0) { // checks whether the previous item inside structuredPosts is a rootElement or a sectionElement // if yes, it goes again to a next previous item in structuredPosts to link the prevPage - if (!structuredPosts[index - 1]?.isRootElement && !structuredPosts[index - 1]?.isSection) { + if ( + !structuredPosts[index - 1]?.isRootElement && + !structuredPosts[index - 1]?.isSection + ) { prevPage = { title: structuredPosts[index - 1].title, - href: structuredPosts[index - 1].slug - } - docPost = { ...docPost, prevPage } + href: structuredPosts[index - 1].slug, + }; + docPost = { ...docPost, prevPage }; } else { // additonal check for the first page of Docs so that it doesn't give any Segementation fault if (index - 2 >= 0) { prevPage = { title: `${structuredPosts[index - 1]?.isRootSection ? rootSections[rootSections.length - 2] : rootSections[rootSections.length - 1]} - ${structuredPosts[index - 2].title}`, - href: structuredPosts[index - 2].slug + href: structuredPosts[index - 2].slug, }; docPost = { ...docPost, prevPage }; } @@ -172,11 +194,10 @@ function addDocButtons(docPosts, treePosts) { } return docPost; }); - } catch (err) { - throw new Error("An error occurred while adding doc buttons:", err); + throw new Error('An error occurred while adding doc buttons:', err); } return structuredPosts; } -module.exports = { buildNavTree, addDocButtons, convertDocPosts } \ No newline at end of file +module.exports = { buildNavTree, addDocButtons, convertDocPosts }; diff --git a/scripts/build-meetings.js b/scripts/build-meetings.js index ee95803d9d44..cc56c0d026b8 100644 --- a/scripts/build-meetings.js +++ b/scripts/build-meetings.js @@ -9,11 +9,12 @@ async function buildMeetings(writePath) { try { auth = new google.auth.GoogleAuth({ scopes: ['https://www.googleapis.com/auth/calendar'], - credentials: process.env.CALENDAR_SERVICE_ACCOUNT ? JSON.parse(process.env.CALENDAR_SERVICE_ACCOUNT) : undefined, + credentials: process.env.CALENDAR_SERVICE_ACCOUNT + ? JSON.parse(process.env.CALENDAR_SERVICE_ACCOUNT) + : undefined, }); calendar = google.calendar({ version: 'v3', auth }); - } catch (err) { throw new Error(`Authentication failed: ${err.message}`); } @@ -24,10 +25,10 @@ async function buildMeetings(writePath) { //cron job runs this always on midnight const currentTime = new Date(Date.now()).toISOString(); const timeMin = new Date( - Date.parse(currentTime) - 100 * 24 * 60 * 60 * 1000 + Date.parse(currentTime) - 100 * 24 * 60 * 60 * 1000, ).toISOString(); const timeMax = new Date( - Date.parse(currentTime) + 30 * 24 * 60 * 60 * 1000 + Date.parse(currentTime) + 30 * 24 * 60 * 60 * 1000, ).toISOString(); const eventsList = await calendar.events.list({ @@ -53,7 +54,6 @@ async function buildMeetings(writePath) { console.log('The following events got fetched', eventsForHuman); writeFileSync(writePath, eventsForHuman); - } catch (err) { throw new Error(`Failed to fetch or process events: ${err.message}`); } diff --git a/scripts/build-newsroom-videos.js b/scripts/build-newsroom-videos.js index 383927765d36..496eba2de769 100644 --- a/scripts/build-newsroom-videos.js +++ b/scripts/build-newsroom-videos.js @@ -3,49 +3,52 @@ const { resolve } = require('path'); const fetch = require('node-fetch-2'); async function buildNewsroomVideos(writePath) { - try { - const response = await fetch('https://youtube.googleapis.com/youtube/v3/search?' + new URLSearchParams({ - key: process.env.YOUTUBE_TOKEN, - part: 'snippet', - channelId: 'UCIz9zGwDLbrYQcDKVXdOstQ', - eventType: 'completed', - type: 'video', - order: 'Date', - maxResults: 5, - })); - - if (!response.ok) { - throw new Error(`HTTP error! with status code: ${response.status}`); - } - - const data = await response.json(); - console.log(data); - - if (!data.items || !Array.isArray(data.items)) { - throw new Error('Invalid data structure received from YouTube API'); - } - - const videoDataItems = data.items.map((video) => ({ - image_url: video.snippet.thumbnails.high.url, - title: video.snippet.title, - description: video.snippet.description, - videoId: video.id.videoId, - })); - - const videoData = JSON.stringify(videoDataItems, null, ' '); - console.log('The following are the Newsroom Youtube videos: ', videoData); - - writeFileSync(writePath, videoData); - - return videoData; - } catch (err) { - throw new Error(`Failed to build newsroom videos: ${err.message}`); + try { + const response = await fetch( + 'https://youtube.googleapis.com/youtube/v3/search?' + + new URLSearchParams({ + key: process.env.YOUTUBE_TOKEN, + part: 'snippet', + channelId: 'UCIz9zGwDLbrYQcDKVXdOstQ', + eventType: 'completed', + type: 'video', + order: 'Date', + maxResults: 5, + }), + ); + + if (!response.ok) { + throw new Error(`HTTP error! with status code: ${response.status}`); } + + const data = await response.json(); + console.log(data); + + if (!data.items || !Array.isArray(data.items)) { + throw new Error('Invalid data structure received from YouTube API'); + } + + const videoDataItems = data.items.map((video) => ({ + image_url: video.snippet.thumbnails.high.url, + title: video.snippet.title, + description: video.snippet.description, + videoId: video.id.videoId, + })); + + const videoData = JSON.stringify(videoDataItems, null, ' '); + console.log('The following are the Newsroom Youtube videos: ', videoData); + + writeFileSync(writePath, videoData); + + return videoData; + } catch (err) { + throw new Error(`Failed to build newsroom videos: ${err.message}`); + } } /* istanbul ignore next */ if (require.main === module) { - buildNewsroomVideos(resolve(__dirname, '../config', 'newsroom_videos.json')) + buildNewsroomVideos(resolve(__dirname, '../config', 'newsroom_videos.json')); } module.exports = { buildNewsroomVideos }; diff --git a/scripts/build-pages.js b/scripts/build-pages.js index 48b3553e96b2..287d44f046b0 100644 --- a/scripts/build-pages.js +++ b/scripts/build-pages.js @@ -57,4 +57,4 @@ function copyAndRenameFiles(srcDir, targetDir) { copyAndRenameFiles(SRC_DIR, TARGET_DIR); -module.exports = {copyAndRenameFiles,capitalizeJsxTags} \ No newline at end of file +module.exports = { copyAndRenameFiles, capitalizeJsxTags }; diff --git a/scripts/build-post-list.js b/scripts/build-post-list.js index 288d7dc0c54e..dc249c6e2a43 100644 --- a/scripts/build-post-list.js +++ b/scripts/build-post-list.js @@ -1,161 +1,201 @@ -const { readdirSync, statSync, existsSync, readFileSync, writeFileSync } = require('fs') -const { resolve, basename } = require('path') -const frontMatter = require('gray-matter') -const toc = require('markdown-toc') -const { slugify } = require('markdown-toc/lib/utils') -const readingTime = require('reading-time') -const { markdownToTxt } = require('markdown-to-txt') -const { buildNavTree, addDocButtons } = require('./build-docs') +const { + readdirSync, + statSync, + existsSync, + readFileSync, + writeFileSync, +} = require('fs'); +const { resolve, basename } = require('path'); +const frontMatter = require('gray-matter'); +const toc = require('markdown-toc'); +const { slugify } = require('markdown-toc/lib/utils'); +const readingTime = require('reading-time'); +const { markdownToTxt } = require('markdown-to-txt'); +const { buildNavTree, addDocButtons } = require('./build-docs'); -let specWeight = 100 +let specWeight = 100; const result = { docs: [], blog: [], about: [], - docsTree: {} -} -const releaseNotes = [] -const basePath = 'pages' + docsTree: {}, +}; +const releaseNotes = []; +const basePath = 'pages'; const postDirectories = [ // order of these directories is important, as the blog should come before docs, to create a list of available release notes, which will later be used to release-note-link for spec docs [`${basePath}/blog`, '/blog'], [`${basePath}/docs`, '/docs'], - [`${basePath}/about`, '/about'] + [`${basePath}/about`, '/about'], ]; const addItem = (details) => { - if(details.slug.startsWith('/docs')) - result["docs"].push(details) - else if(details.slug.startsWith('/blog')) - result["blog"].push(details) - else if(details.slug.startsWith('/about')) - result["about"].push(details) - else {} -} + if (details.slug.startsWith('/docs')) result['docs'].push(details); + else if (details.slug.startsWith('/blog')) result['blog'].push(details); + else if (details.slug.startsWith('/about')) result['about'].push(details); + else { + } +}; module.exports = async function buildPostList() { - walkDirectories(postDirectories, result) - const treePosts = buildNavTree(result["docs"].filter((p) => p.slug.startsWith('/docs/'))) - result["docsTree"] = treePosts - result["docs"] = addDocButtons(result["docs"], treePosts) + walkDirectories(postDirectories, result); + const treePosts = buildNavTree( + result['docs'].filter((p) => p.slug.startsWith('/docs/')), + ); + result['docsTree'] = treePosts; + result['docs'] = addDocButtons(result['docs'], treePosts); if (process.env.NODE_ENV === 'production') { // console.log(inspect(result, { depth: null, colors: true })) } - writeFileSync(resolve(__dirname, '..', 'config', 'posts.json'), JSON.stringify(result, null, ' ')) -} + writeFileSync( + resolve(__dirname, '..', 'config', 'posts.json'), + JSON.stringify(result, null, ' '), + ); +}; -function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, sectionId, rootSectionId) { +function walkDirectories( + directories, + result, + sectionWeight = 0, + sectionTitle, + sectionId, + rootSectionId, +) { for (let dir of directories) { - let directory = dir[0] - let sectionSlug = dir[1] || '' + let directory = dir[0]; + let sectionSlug = dir[1] || ''; let files = readdirSync(directory); for (let file of files) { - let details - const fileName = [directory, file].join('/') - const fileNameWithSection = [fileName, '_section.mdx'].join('/') - const slug = fileName.replace(new RegExp(`^${basePath}`), '') + let details; + const fileName = [directory, file].join('/'); + const fileNameWithSection = [fileName, '_section.mdx'].join('/'); + const slug = fileName.replace(new RegExp(`^${basePath}`), ''); const slugElements = slug.split('/'); if (isDirectory(fileName)) { if (existsSync(fileNameWithSection)) { // Passing a second argument to frontMatter disables cache. See https://github.com/asyncapi/website/issues/1057 - details = frontMatter(readFileSync(fileNameWithSection, 'utf-8'), {}).data - details.title = details.title || capitalize(basename(fileName)) + details = frontMatter( + readFileSync(fileNameWithSection, 'utf-8'), + {}, + ).data; + details.title = details.title || capitalize(basename(fileName)); } else { details = { title: capitalize(basename(fileName)), - } + }; } - details.isSection = true + details.isSection = true; if (slugElements.length > 3) { - details.parent = slugElements[slugElements.length - 2] - details.sectionId = slugElements[slugElements.length - 1] + details.parent = slugElements[slugElements.length - 2]; + details.sectionId = slugElements[slugElements.length - 1]; } if (!details.parent) { - details.isRootSection = true - details.rootSectionId = slugElements[slugElements.length - 1] + details.isRootSection = true; + details.rootSectionId = slugElements[slugElements.length - 1]; } - details.sectionWeight = sectionWeight - details.slug = slug - addItem(details) - const rootId = details.parent || details.rootSectionId - walkDirectories([[fileName, slug]], result, details.weight, details.title, details.sectionId, rootId) + details.sectionWeight = sectionWeight; + details.slug = slug; + addItem(details); + const rootId = details.parent || details.rootSectionId; + walkDirectories( + [[fileName, slug]], + result, + details.weight, + details.title, + details.sectionId, + rootId, + ); } else if (file.endsWith('.mdx') && !fileName.endsWith('/_section.mdx')) { - const fileContent = readFileSync(fileName, 'utf-8') + const fileContent = readFileSync(fileName, 'utf-8'); // Passing a second argument to frontMatter disables cache. See https://github.com/asyncapi/website/issues/1057 - const { data, content } = frontMatter(fileContent, {}) - details = data - details.toc = toc(content, { slugify: slugifyToC }).json - details.readingTime = Math.ceil(readingTime(content).minutes) - details.excerpt = details.excerpt || markdownToTxt(content).substr(0, 200) - details.sectionSlug = sectionSlug || slug.replace(/\.mdx$/, '') - details.sectionWeight = sectionWeight - details.sectionTitle = sectionTitle - details.sectionId = sectionId - details.rootSectionId = rootSectionId - details.id = fileName - details.isIndex = fileName.endsWith('/index.mdx') - details.slug = details.isIndex ? sectionSlug : slug.replace(/\.mdx$/, '') - if(details.slug.includes('/reference/specification/') && !details.title) { - const fileBaseName = basename(data.slug) // ex. v2.0.0 | v2.1.0-next-spec.1 - const fileName = fileBaseName.split('-')[0] // v2.0.0 | v2.1.0 - details.weight = specWeight-- + const { data, content } = frontMatter(fileContent, {}); + details = data; + details.toc = toc(content, { slugify: slugifyToC }).json; + details.readingTime = Math.ceil(readingTime(content).minutes); + details.excerpt = + details.excerpt || markdownToTxt(content).substr(0, 200); + details.sectionSlug = sectionSlug || slug.replace(/\.mdx$/, ''); + details.sectionWeight = sectionWeight; + details.sectionTitle = sectionTitle; + details.sectionId = sectionId; + details.rootSectionId = rootSectionId; + details.id = fileName; + details.isIndex = fileName.endsWith('/index.mdx'); + details.slug = details.isIndex + ? sectionSlug + : slug.replace(/\.mdx$/, ''); + if ( + details.slug.includes('/reference/specification/') && + !details.title + ) { + const fileBaseName = basename(data.slug); // ex. v2.0.0 | v2.1.0-next-spec.1 + const fileName = fileBaseName.split('-')[0]; // v2.0.0 | v2.1.0 + details.weight = specWeight--; if (fileName.startsWith('v')) { - details.title = capitalize(fileName.slice(1)) + details.title = capitalize(fileName.slice(1)); } else { - details.title = capitalize(fileName) + details.title = capitalize(fileName); } - if(releaseNotes.includes(details.title)){ - details.releaseNoteLink = `/blog/release-notes-${details.title}` + if (releaseNotes.includes(details.title)) { + details.releaseNoteLink = `/blog/release-notes-${details.title}`; } - if (fileBaseName.includes('next-spec') || fileBaseName.includes('next-major-spec')) { - details.isPrerelease = true + if ( + fileBaseName.includes('next-spec') || + fileBaseName.includes('next-major-spec') + ) { + details.isPrerelease = true; // this need to be separate because the `-` in "Pre-release" will get removed by `capitalize()` function - details.title += " (Pre-release)" + details.title += ' (Pre-release)'; } if (fileBaseName.includes('explorer')) { - details.title += " - Explorer" + details.title += ' - Explorer'; } } // To create a list of available ReleaseNotes list, which will be used to add details.releaseNoteLink attribute. - if(file.startsWith("release-notes") && dir[1] === "/blog"){ - const fileName_without_extension = file.slice(0,-4) + if (file.startsWith('release-notes') && dir[1] === '/blog') { + const fileName_without_extension = file.slice(0, -4); // removes the file extension. For example, release-notes-2.1.0.md -> release-notes-2.1.0 - const version = fileName_without_extension.slice(fileName_without_extension.lastIndexOf("-")+1) + const version = fileName_without_extension.slice( + fileName_without_extension.lastIndexOf('-') + 1, + ); // gets the version from the name of the releaseNote .md file (from /blog). For example, version = 2.1.0 if fileName_without_extension = release-notes-2.1.0 - releaseNotes.push(version) + releaseNotes.push(version); // releaseNotes is the list of all available releaseNotes } - addItem(details) + addItem(details); } } } } function slugifyToC(str) { - let slug + let slug; // Try to match heading ids like {# myHeadingId} - const headingIdMatch = str.match(/[\s]?\{\#([\w\d\-_]+)\}/) + const headingIdMatch = str.match(/[\s]?\{\#([\w\d\-_]+)\}/); if (headingIdMatch && headingIdMatch.length >= 2) { - slug = headingIdMatch[1] + slug = headingIdMatch[1]; } else { // Try to match heading ids like {} - const anchorTagMatch = str.match(/[\s]*= 2) slug = anchorTagMatch[1] + const anchorTagMatch = str.match(/[\s]*= 2) slug = anchorTagMatch[1]; } - return slug || slugify(str, { firsth1: true, maxdepth: 6 }) + return slug || slugify(str, { firsth1: true, maxdepth: 6 }); } function isDirectory(dir) { - return statSync(dir).isDirectory() + return statSync(dir).isDirectory(); } function capitalize(text) { - return text.split(/[\s\-]/g).map(word => `${word[0].toUpperCase()}${word.substr(1)}`).join(' ') + return text + .split(/[\s\-]/g) + .map((word) => `${word[0].toUpperCase()}${word.substr(1)}`) + .join(' '); } diff --git a/scripts/build-rss.js b/scripts/build-rss.js index 673da1398fe0..46c668119c6a 100644 --- a/scripts/build-rss.js +++ b/scripts/build-rss.js @@ -1,26 +1,25 @@ -const fs = require('fs').promises -const json2xml = require('jgexml/json2xml') +const fs = require('fs').promises; +const json2xml = require('jgexml/json2xml'); function getAllPosts() { return require('../config/posts.json'); } function clean(s) { - s = s.split('<span>').join('') - s = s.split('&').join('&') - s = s.split(''').join("'") - s = s.split('<').join('<') - s = s.split('>').join('>') - s = s.split('"').join('"') - return s + s = s.split('<span>').join(''); + s = s.split('&').join('&'); + s = s.split(''').join("'"); + s = s.split('<').join('<'); + s = s.split('>').join('>'); + s = s.split('"').join('"'); + return s; } module.exports = async function rssFeed(type, title, desc, outputPath) { try { - - let posts = getAllPosts()[`${type}`] - const missingDatePosts = posts.filter(post => !post.date); - posts = posts.filter(post => post.date); + let posts = getAllPosts()[`${type}`]; + const missingDatePosts = posts.filter((post) => !post.date); + posts = posts.filter((post) => post.date); posts.sort((i1, i2) => { const i1Date = new Date(i1.date); const i2Date = new Date(i2.date); @@ -30,37 +29,41 @@ module.exports = async function rssFeed(type, title, desc, outputPath) { }); if (missingDatePosts.length > 0) { - throw new Error(`Missing date in posts: ${missingDatePosts.map(p => p.title || p.slug).join(', ')}`); + throw new Error( + `Missing date in posts: ${missingDatePosts.map((p) => p.title || p.slug).join(', ')}`, + ); } - const base = 'https://www.asyncapi.com' + const base = 'https://www.asyncapi.com'; const tracking = '?utm_source=rss'; - const feed = {} - const rss = {} - rss['@version'] = '2.0' - rss["@xmlns:atom"] = 'http://www.w3.org/2005/Atom' - rss.channel = {} - rss.channel.title = title - rss.channel.link = `${base}/${outputPath}` - rss.channel["atom:link"] = {} - rss.channel["atom:link"]["@rel"] = 'self' - rss.channel["atom:link"]["@href"] = rss.channel.link - rss.channel["atom:link"]["@type"] = 'application/rss+xml' - rss.channel.description = desc + const feed = {}; + const rss = {}; + rss['@version'] = '2.0'; + rss['@xmlns:atom'] = 'http://www.w3.org/2005/Atom'; + rss.channel = {}; + rss.channel.title = title; + rss.channel.link = `${base}/${outputPath}`; + rss.channel['atom:link'] = {}; + rss.channel['atom:link']['@rel'] = 'self'; + rss.channel['atom:link']['@href'] = rss.channel.link; + rss.channel['atom:link']['@type'] = 'application/rss+xml'; + rss.channel.description = desc; rss.channel.language = 'en-gb'; rss.channel.copyright = 'Made with :love: by the AsyncAPI Initiative.'; - rss.channel.webMaster = 'info@asyncapi.io (AsyncAPI Initiative)' - rss.channel.pubDate = new Date().toUTCString() - rss.channel.generator = 'next.js' - rss.channel.item = [] + rss.channel.webMaster = 'info@asyncapi.io (AsyncAPI Initiative)'; + rss.channel.pubDate = new Date().toUTCString(); + rss.channel.generator = 'next.js'; + rss.channel.item = []; - const invalidPosts = posts.filter(post => - !post.title || !post.slug || !post.excerpt || !post.date + const invalidPosts = posts.filter( + (post) => !post.title || !post.slug || !post.excerpt || !post.date, ); if (invalidPosts.length > 0) { - throw new Error(`Missing required fields in posts: ${invalidPosts.map(p => p.title || p.slug).join(', ')}`); + throw new Error( + `Missing required fields in posts: ${invalidPosts.map((p) => p.title || p.slug).join(', ')}`, + ); } for (let post of posts) { @@ -75,25 +78,25 @@ module.exports = async function rssFeed(type, title, desc, outputPath) { link, category: type, guid, - pubDate + pubDate, }; if (post.cover) { const enclosure = {}; - enclosure["@url"] = base + post.cover; - enclosure["@length"] = 15026; // dummy value, anything works - enclosure["@type"] = 'image/jpeg'; - if (typeof enclosure["@url"] === 'string') { - let tmp = enclosure["@url"].toLowerCase(); - if (tmp.indexOf('.png') >= 0) enclosure["@type"] = 'image/png'; - if (tmp.indexOf('.svg') >= 0) enclosure["@type"] = 'image/svg+xml'; - if (tmp.indexOf('.webp') >= 0) enclosure["@type"] = 'image/webp'; + enclosure['@url'] = base + post.cover; + enclosure['@length'] = 15026; // dummy value, anything works + enclosure['@type'] = 'image/jpeg'; + if (typeof enclosure['@url'] === 'string') { + let tmp = enclosure['@url'].toLowerCase(); + if (tmp.indexOf('.png') >= 0) enclosure['@type'] = 'image/png'; + if (tmp.indexOf('.svg') >= 0) enclosure['@type'] = 'image/svg+xml'; + if (tmp.indexOf('.webp') >= 0) enclosure['@type'] = 'image/webp'; } item.enclosure = enclosure; } - rss.channel.item.push(item) + rss.channel.item.push(item); } - feed.rss = rss + feed.rss = rss; const xml = json2xml.getXml(feed, '@', '', 2); await fs.writeFile(`./public/${outputPath}`, xml, 'utf8'); diff --git a/scripts/build-tools.js b/scripts/build-tools.js index c5cce74a7cb1..30404a2d015f 100644 --- a/scripts/build-tools.js +++ b/scripts/build-tools.js @@ -4,14 +4,27 @@ const { combineTools } = require('./tools/combine-tools'); const fs = require('fs-extra'); const { resolve } = require('path'); -const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPath) => { +const buildTools = async ( + automatedToolsPath, + manualToolsPath, + toolsPath, + tagsPath, +) => { try { let githubExtractData = await getData(); let automatedTools = await convertTools(githubExtractData); - await fs.writeFile(automatedToolsPath, JSON.stringify(automatedTools, null, ' ')); + await fs.writeFile( + automatedToolsPath, + JSON.stringify(automatedTools, null, ' '), + ); - await combineTools(automatedTools, require(manualToolsPath), toolsPath, tagsPath); + await combineTools( + automatedTools, + require(manualToolsPath), + toolsPath, + tagsPath, + ); } catch (err) { throw new Error(`An error occurred while building tools: ${err.message}`); } @@ -19,7 +32,11 @@ const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPa /* istanbul ignore next */ if (require.main === module) { - const automatedToolsPath = resolve(__dirname, '../config', 'tools-automated.json'); + const automatedToolsPath = resolve( + __dirname, + '../config', + 'tools-automated.json', + ); const manualToolsPath = resolve(__dirname, '../config', 'tools-manual.json'); const toolsPath = resolve(__dirname, '../config', 'tools.json'); const tagsPath = resolve(__dirname, '../config', 'all-tags.json'); diff --git a/scripts/casestudies/index.js b/scripts/casestudies/index.js index 77695e06fd38..3ff9e415f525 100644 --- a/scripts/casestudies/index.js +++ b/scripts/casestudies/index.js @@ -1,19 +1,22 @@ const { readdir, writeFile, readFile } = require('fs').promises; const { convertToJson } = require('../../scripts/utils'); -module.exports = async function buildCaseStudiesList(dirWithCaseStudy, writeFilePath) { - try { - let files = await readdir(dirWithCaseStudy); - let caseStudiesList = []; - for (let file of files) { - const caseStudyFileName = [dirWithCaseStudy, file].join('/'); - const caseStudyContent = await readFile(caseStudyFileName, 'utf-8'); - const jsonContent = convertToJson(caseStudyContent); +module.exports = async function buildCaseStudiesList( + dirWithCaseStudy, + writeFilePath, +) { + try { + let files = await readdir(dirWithCaseStudy); + let caseStudiesList = []; + for (let file of files) { + const caseStudyFileName = [dirWithCaseStudy, file].join('/'); + const caseStudyContent = await readFile(caseStudyFileName, 'utf-8'); + const jsonContent = convertToJson(caseStudyContent); - caseStudiesList.push(jsonContent); - await writeFile(writeFilePath, JSON.stringify(caseStudiesList)) - } - } catch (err) { - throw new Error(err); + caseStudiesList.push(jsonContent); + await writeFile(writeFilePath, JSON.stringify(caseStudiesList)); } + } catch (err) { + throw new Error(err); + } }; diff --git a/scripts/compose.js b/scripts/compose.js index 8c4f0e3a4a36..00d262019428 100644 --- a/scripts/compose.js +++ b/scripts/compose.js @@ -2,25 +2,25 @@ * Script based on https://github.com/timlrx/tailwind-nextjs-starter-blog/blob/master/scripts/compose.js */ -const fs = require('fs') -const inquirer = require('inquirer') -const dedent = require('dedent') -const moment = require('moment') +const fs = require('fs'); +const inquirer = require('inquirer'); +const dedent = require('dedent'); +const moment = require('moment'); const genFrontMatter = (answers) => { - let d = new Date() + let d = new Date(); const date = [ d.getFullYear(), ('0' + (d.getMonth() + 1)).slice(-2), ('0' + d.getDate()).slice(-2), - ].join('-') - const tagArray = answers.tags.split(',') - tagArray.forEach((tag, index) => (tagArray[index] = tag.trim())) - const tags = "'" + tagArray.join("','") + "'" + ].join('-'); + const tagArray = answers.tags.split(','); + tagArray.forEach((tag, index) => (tagArray[index] = tag.trim())); + const tags = "'" + tagArray.join("','") + "'"; let frontMatter = dedent`--- title: ${answers.title ? answers.title : 'Untitled'} - date: ${moment().format("YYYY-MM-DDTh:mm:ssZ")} + date: ${moment().format('YYYY-MM-DDTh:mm:ssZ')} type: ${answers.type} canonical: ${answers.canonical ? answers.canonical : ''} tags: [${answers.tags ? tags : ''}] @@ -90,12 +90,12 @@ const genFrontMatter = (answers) => {
- ` + `; - frontMatter = frontMatter + '\n---' + frontMatter = frontMatter + '\n---'; - return frontMatter -} + return frontMatter; +}; inquirer .prompt([ @@ -118,7 +118,14 @@ inquirer name: 'type', message: 'Enter the post type:', type: 'list', - choices: ['Communication', 'Community', 'Engineering', 'Marketing', 'Strategy', 'Video'], + choices: [ + 'Communication', + 'Community', + 'Engineering', + 'Marketing', + 'Strategy', + 'Video', + ], }, { name: 'canonical', @@ -132,22 +139,22 @@ inquirer .toLowerCase() .replace(/[^a-zA-Z0-9 ]/g, '') .replace(/ /g, '-') - .replace(/-+/g, '-') - const frontMatter = genFrontMatter(answers) - const filePath = `pages/blog/${fileName ? fileName : 'untitled'}.md` + .replace(/-+/g, '-'); + const frontMatter = genFrontMatter(answers); + const filePath = `pages/blog/${fileName ? fileName : 'untitled'}.md`; fs.writeFile(filePath, frontMatter, { flag: 'wx' }, (err) => { if (err) { - throw err + throw err; } else { - console.log(`Blog post generated successfully at ${filePath}`) + console.log(`Blog post generated successfully at ${filePath}`); } - }) + }); }) .catch((error) => { - console.error(error) + console.error(error); if (error.isTtyError) { - console.log("Prompt couldn't be rendered in the current environment") + console.log("Prompt couldn't be rendered in the current environment"); } else { - console.log('Something went wrong, sorry!') + console.log('Something went wrong, sorry!'); } - }) + }); diff --git a/scripts/dashboard/build-dashboard.js b/scripts/dashboard/build-dashboard.js index c20be204e87b..cb07d85c2f5f 100644 --- a/scripts/dashboard/build-dashboard.js +++ b/scripts/dashboard/build-dashboard.js @@ -20,8 +20,8 @@ async function getDiscussions(query, pageSize, endCursor = null) { first: pageSize, after: endCursor, headers: { - authorization: `token ${process.env.GITHUB_TOKEN}` - } + authorization: `token ${process.env.GITHUB_TOKEN}`, + }, }); if (result.rateLimit.remaining <= 100) { @@ -30,7 +30,7 @@ async function getDiscussions(query, pageSize, endCursor = null) { `cost = ${result.rateLimit.cost}`, `limit = ${result.rateLimit.limit}`, `remaining = ${result.rateLimit.remaining}`, - `resetAt = ${result.rateLimit.resetAt}` + `resetAt = ${result.rateLimit.resetAt}`, ); } @@ -41,7 +41,9 @@ async function getDiscussions(query, pageSize, endCursor = null) { if (!hasNextPage) { return result.search.nodes; } - return result.search.nodes.concat(await getDiscussions(query, pageSize, result.search.pageInfo.endCursor)); + return result.search.nodes.concat( + await getDiscussions(query, pageSize, result.search.pageInfo.endCursor), + ); } catch (e) { console.error(e); return Promise.reject(e); @@ -50,12 +52,15 @@ async function getDiscussions(query, pageSize, endCursor = null) { async function getDiscussionByID(isPR, id) { try { - const result = await graphql(isPR ? Queries.pullRequestById : Queries.issueById, { - id, - headers: { - authorization: `token ${process.env.GITHUB_TOKEN}` - } - }); + const result = await graphql( + isPR ? Queries.pullRequestById : Queries.issueById, + { + id, + headers: { + authorization: `token ${process.env.GITHUB_TOKEN}`, + }, + }, + ); return result; } catch (e) { @@ -70,19 +75,28 @@ async function processHotDiscussions(batch) { try { const isPR = discussion.__typename === 'PullRequest'; if (discussion.comments.pageInfo.hasNextPage) { - const fetchedDiscussion = await getDiscussionByID(isPR, discussion.id); + const fetchedDiscussion = await getDiscussionByID( + isPR, + discussion.id, + ); discussion = fetchedDiscussion.node; } const interactionsCount = discussion.reactions.totalCount + discussion.comments.totalCount + - discussion.comments.nodes.reduce((acc, curr) => acc + curr.reactions.totalCount, 0); + discussion.comments.nodes.reduce( + (acc, curr) => acc + curr.reactions.totalCount, + 0, + ); const finalInteractionsCount = isPR ? interactionsCount + - discussion.reviews.totalCount + - discussion.reviews.nodes.reduce((acc, curr) => acc + curr.comments.totalCount, 0) + discussion.reviews.totalCount + + discussion.reviews.nodes.reduce( + (acc, curr) => acc + curr.comments.totalCount, + 0, + ) : interactionsCount; return { @@ -94,13 +108,17 @@ async function processHotDiscussions(batch) { resourcePath: discussion.resourcePath, repo: `asyncapi/${discussion.repository.name}`, labels: discussion.labels ? discussion.labels.nodes : [], - score: finalInteractionsCount / (monthsSince(discussion.timelineItems.updatedAt) + 2) ** 1.8 + score: + finalInteractionsCount / + (monthsSince(discussion.timelineItems.updatedAt) + 2) ** 1.8, }; } catch (e) { - console.error(`there were some issues while parsing this item: ${JSON.stringify(discussion)}`); + console.error( + `there were some issues while parsing this item: ${JSON.stringify(discussion)}`, + ); throw e; } - }) + }), ); } @@ -116,7 +134,9 @@ async function getHotDiscussions(discussions) { } result.sort((ElemA, ElemB) => ElemB.score - ElemA.score); - const filteredResult = result.filter((issue) => issue.author !== 'asyncapi-bot'); + const filteredResult = result.filter( + (issue) => issue.author !== 'asyncapi-bot', + ); return filteredResult.slice(0, 12); } @@ -126,7 +146,7 @@ async function writeToFile(content, writePath) { } catch (error) { console.error('Failed to write dashboard data:', { error: error.message, - writePath + writePath, }); throw error; } @@ -142,13 +162,17 @@ async function mapGoodFirstIssues(issues) { author: issue.author.login, area: getLabel(issue, 'area/') || 'Unknown', labels: issue.labels.nodes.filter( - (label) => !label.name.startsWith('area/') && !label.name.startsWith('good first issue') - ) + (label) => + !label.name.startsWith('area/') && + !label.name.startsWith('good first issue'), + ), })); } function getLabel(issue, filter) { - const result = issue.labels.nodes.find((label) => label.name.startsWith(filter)); + const result = issue.labels.nodes.find((label) => + label.name.startsWith(filter), + ); return result?.name.split('/')[1]; } @@ -163,11 +187,14 @@ async function start(writePath) { try { const issues = await getDiscussions(Queries.hotDiscussionsIssues, 20); const PRs = await getDiscussions(Queries.hotDiscussionsPullRequests, 20); - const rawGoodFirstIssues = await getDiscussions(Queries.goodFirstIssues, 20); + const rawGoodFirstIssues = await getDiscussions( + Queries.goodFirstIssues, + 20, + ); const discussions = issues.concat(PRs); const [hotDiscussions, goodFirstIssues] = await Promise.all([ getHotDiscussions(discussions), - mapGoodFirstIssues(rawGoodFirstIssues) + mapGoodFirstIssues(rawGoodFirstIssues), ]); return await writeToFile({ hotDiscussions, goodFirstIssues }, writePath); } catch (e) { @@ -181,4 +208,14 @@ if (require.main === module) { start(resolve(__dirname, '..', '..', 'dashboard.json')); } -module.exports = { getLabel, monthsSince, mapGoodFirstIssues, getHotDiscussions, getDiscussionByID, getDiscussions, writeToFile, start, processHotDiscussions }; +module.exports = { + getLabel, + monthsSince, + mapGoodFirstIssues, + getHotDiscussions, + getDiscussionByID, + getDiscussions, + writeToFile, + start, + processHotDiscussions, +}; diff --git a/scripts/finance/index.js b/scripts/finance/index.js index 3f4a5edcfb6e..af3cf0a80f60 100644 --- a/scripts/finance/index.js +++ b/scripts/finance/index.js @@ -1,25 +1,48 @@ const { - promises: { mkdir } + promises: { mkdir }, } = require('fs'); const { resolve } = require('path'); const writeJSON = require('../utils/readAndWriteJson.js'); -module.exports = async function buildFinanceInfoList({ currentDir, configDir, financeDir, year, jsonDataDir }) { - try { - const expensesPath = resolve(currentDir, configDir, financeDir, year, 'Expenses.yml'); - const expensesLinkPath = resolve(currentDir, configDir, financeDir, year, 'ExpensesLink.yml'); +module.exports = async function buildFinanceInfoList({ + currentDir, + configDir, + financeDir, + year, + jsonDataDir, +}) { + try { + const expensesPath = resolve( + currentDir, + configDir, + financeDir, + year, + 'Expenses.yml', + ); + const expensesLinkPath = resolve( + currentDir, + configDir, + financeDir, + year, + 'ExpensesLink.yml', + ); - // Ensure the directory exists before writing the files - const jsonDirectory = resolve(currentDir, configDir, financeDir, jsonDataDir); - await mkdir(jsonDirectory, { recursive: true }); + // Ensure the directory exists before writing the files + const jsonDirectory = resolve( + currentDir, + configDir, + financeDir, + jsonDataDir, + ); + await mkdir(jsonDirectory, { recursive: true }); - // Write Expenses and ExpensesLink to JSON files - const expensesJsonPath = resolve(jsonDirectory, 'Expenses.json'); - await writeJSON(expensesPath, expensesJsonPath); + // Write Expenses and ExpensesLink to JSON files + const expensesJsonPath = resolve(jsonDirectory, 'Expenses.json'); + await writeJSON(expensesPath, expensesJsonPath); - const expensesLinkJsonPath = resolve(jsonDirectory, 'ExpensesLink.json'); - await writeJSON(expensesLinkPath, expensesLinkJsonPath); - } catch (err) { - throw new Error(err); - } -}; \ No newline at end of file + const expensesLinkJsonPath = resolve(jsonDirectory, 'ExpensesLink.json'); + await writeJSON(expensesLinkPath, expensesLinkJsonPath); + } catch (err) { + throw new Error(err); + } +}; diff --git a/scripts/index.js b/scripts/index.js index 33125fe7533b..0ae68666ce24 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -12,11 +12,11 @@ async function start() { 'blog', 'AsyncAPI Initiative Blog RSS Feed', 'AsyncAPI Initiative Blog', - 'rss.xml' + 'rss.xml', ); await buildCaseStudiesList( 'config/casestudies', - resolve(__dirname, '../config', 'case-studies.json') + resolve(__dirname, '../config', 'case-studies.json'), ); await buildAdoptersList(); const financeDir = resolve('.', 'config', 'finance'); @@ -44,7 +44,7 @@ async function start() { configDir: 'config', financeDir: 'finance', year: latestYear, - jsonDataDir: 'json-data' + jsonDataDir: 'json-data', }); } diff --git a/scripts/markdown/check-markdown.js b/scripts/markdown/check-markdown.js index 8979f7e0b4ab..001a210a2a77 100644 --- a/scripts/markdown/check-markdown.js +++ b/scripts/markdown/check-markdown.js @@ -8,12 +8,12 @@ const path = require('path'); * @returns {boolean} True if the string is a valid URL, false otherwise. */ function isValidURL(str) { - try { - new URL(str); - return true; - } catch (err) { - return false; - } + try { + new URL(str); + return true; + } catch (err) { + return false; + } } /** @@ -23,51 +23,60 @@ function isValidURL(str) { * @returns {string[]|null} An array of validation error messages, or null if no errors. */ function validateBlogs(frontmatter) { - const requiredAttributes = ['title', 'date', 'type', 'tags', 'cover', 'authors']; - const errors = []; - - // Check for required attributes - requiredAttributes.forEach(attr => { - if (!frontmatter.hasOwnProperty(attr)) { - errors.push(`${attr} is missing`); - } - }); - - // Validate date format - if (frontmatter.date && Number.isNaN(Date.parse(frontmatter.date))) { - errors.push(`Invalid date format: ${frontmatter.date}`); + const requiredAttributes = [ + 'title', + 'date', + 'type', + 'tags', + 'cover', + 'authors', + ]; + const errors = []; + + // Check for required attributes + requiredAttributes.forEach((attr) => { + if (!frontmatter.hasOwnProperty(attr)) { + errors.push(`${attr} is missing`); } - - // Validate tags format (must be an array) - if (frontmatter.tags && !Array.isArray(frontmatter.tags)) { - errors.push(`Tags should be an array`); - } - - // Validate cover is a string - if (frontmatter.cover && typeof frontmatter.cover !== 'string') { - errors.push(`Cover must be a string`); - } - - // Validate authors (must be an array with valid attributes) - if (frontmatter.authors) { - if (!Array.isArray(frontmatter.authors)) { - errors.push('Authors should be an array'); - } else { - frontmatter.authors.forEach((author, index) => { - if (!author.name) { - errors.push(`Author at index ${index} is missing a name`); - } - if (author.link && !isValidURL(author.link)) { - errors.push(`Invalid URL for author at index ${index}: ${author.link}`); - } - if (!author.photo) { - errors.push(`Author at index ${index} is missing a photo`); - } - }); + }); + + // Validate date format + if (frontmatter.date && Number.isNaN(Date.parse(frontmatter.date))) { + errors.push(`Invalid date format: ${frontmatter.date}`); + } + + // Validate tags format (must be an array) + if (frontmatter.tags && !Array.isArray(frontmatter.tags)) { + errors.push(`Tags should be an array`); + } + + // Validate cover is a string + if (frontmatter.cover && typeof frontmatter.cover !== 'string') { + errors.push(`Cover must be a string`); + } + + // Validate authors (must be an array with valid attributes) + if (frontmatter.authors) { + if (!Array.isArray(frontmatter.authors)) { + errors.push('Authors should be an array'); + } else { + frontmatter.authors.forEach((author, index) => { + if (!author.name) { + errors.push(`Author at index ${index} is missing a name`); + } + if (author.link && !isValidURL(author.link)) { + errors.push( + `Invalid URL for author at index ${index}: ${author.link}`, + ); } + if (!author.photo) { + errors.push(`Author at index ${index} is missing a photo`); + } + }); } + } - return errors.length ? errors : null; + return errors.length ? errors : null; } /** @@ -77,19 +86,22 @@ function validateBlogs(frontmatter) { * @returns {string[]|null} An array of validation error messages, or null if no errors. */ function validateDocs(frontmatter) { - const errors = []; - - // Check if title exists and is a string - if (!frontmatter.title || typeof frontmatter.title !== 'string') { - errors.push('Title is missing or not a string'); - } - - // Check if weight exists and is a number - if (frontmatter.weight === undefined || typeof frontmatter.weight !== 'number') { - errors.push('Weight is missing or not a number'); - } - - return errors.length ? errors : null; + const errors = []; + + // Check if title exists and is a string + if (!frontmatter.title || typeof frontmatter.title !== 'string') { + errors.push('Title is missing or not a string'); + } + + // Check if weight exists and is a number + if ( + frontmatter.weight === undefined || + typeof frontmatter.weight !== 'number' + ) { + errors.push('Weight is missing or not a number'); + } + + return errors.length ? errors : null; } /** @@ -99,44 +111,44 @@ function validateDocs(frontmatter) { * @param {string} [relativePath=''] - The relative path of the folder for logging purposes. */ function checkMarkdownFiles(folderPath, validateFunction, relativePath = '') { - fs.readdir(folderPath, (err, files) => { + fs.readdir(folderPath, (err, files) => { + if (err) { + console.error('Error reading directory:', err); + return; + } + + files.forEach((file) => { + const filePath = path.join(folderPath, file); + const relativeFilePath = path.join(relativePath, file); + + // Skip the folder 'docs/reference/specification' + if (relativeFilePath.includes('reference/specification')) { + return; + } + + fs.stat(filePath, (err, stats) => { if (err) { - console.error('Error reading directory:', err); - return; + console.error('Error reading file stats:', err); + return; } - files.forEach(file => { - const filePath = path.join(folderPath, file); - const relativeFilePath = path.join(relativePath, file); - - // Skip the folder 'docs/reference/specification' - if (relativeFilePath.includes('reference/specification')) { - return; - } - - fs.stat(filePath, (err, stats) => { - if (err) { - console.error('Error reading file stats:', err); - return; - } - - // Recurse if directory, otherwise validate markdown file - if (stats.isDirectory()) { - checkMarkdownFiles(filePath, validateFunction, relativeFilePath); - } else if (path.extname(file) === '.md') { - const fileContent = fs.readFileSync(filePath, 'utf-8'); - const { data: frontmatter } = matter(fileContent); - - const errors = validateFunction(frontmatter); - if (errors) { - console.log(`Errors in file ${relativeFilePath}:`); - errors.forEach(error => console.log(` - ${error}`)); - process.exitCode = 1; - } - } - }); - }); + // Recurse if directory, otherwise validate markdown file + if (stats.isDirectory()) { + checkMarkdownFiles(filePath, validateFunction, relativeFilePath); + } else if (path.extname(file) === '.md') { + const fileContent = fs.readFileSync(filePath, 'utf-8'); + const { data: frontmatter } = matter(fileContent); + + const errors = validateFunction(frontmatter); + if (errors) { + console.log(`Errors in file ${relativeFilePath}:`); + errors.forEach((error) => console.log(` - ${error}`)); + process.exitCode = 1; + } + } + }); }); + }); } const docsFolderPath = path.resolve(__dirname, '../../markdown/docs'); diff --git a/scripts/tools/categorylist.js b/scripts/tools/categorylist.js index 11fcc3790e9e..15323b1606aa 100644 --- a/scripts/tools/categorylist.js +++ b/scripts/tools/categorylist.js @@ -1,100 +1,119 @@ // Various categories to define the category in which a tool has to be listed const categoryList = [ { - name: "APIs", - tag: "api", - description: "The following is a list of APIs that expose functionality related to AsyncAPI." + name: 'APIs', + tag: 'api', + description: + 'The following is a list of APIs that expose functionality related to AsyncAPI.', }, { - name: "Code-first tools", - tag: "code-first", - description: "The following is a list of tools that generate AsyncAPI documents from your code." + name: 'Code-first tools', + tag: 'code-first', + description: + 'The following is a list of tools that generate AsyncAPI documents from your code.', }, { - name: "Code Generators", - tag: "code-generator", - description: "The following is a list of tools that generate code from an AsyncAPI document; not the other way around." + name: 'Code Generators', + tag: 'code-generator', + description: + 'The following is a list of tools that generate code from an AsyncAPI document; not the other way around.', }, { - name: "Converters", - tag: "converter", - description: "The following is a list of tools that do not yet belong to any specific category but are also useful for the community." + name: 'Converters', + tag: 'converter', + description: + 'The following is a list of tools that do not yet belong to any specific category but are also useful for the community.', }, { - name: "Directories", - tag: "directory", - description: "The following is a list of directories that index public AsyncAPI documents." + name: 'Directories', + tag: 'directory', + description: + 'The following is a list of directories that index public AsyncAPI documents.', }, { - name: "Documentation Generators", - tag: "documentation-generator", - description: "The following is a list of tools that generate human-readable documentation from an AsyncAPI document." + name: 'Documentation Generators', + tag: 'documentation-generator', + description: + 'The following is a list of tools that generate human-readable documentation from an AsyncAPI document.', }, { - name: "Editors", - tag: "editor", - description: "The following is a list of editors or related tools that allow editing of AsyncAPI document." + name: 'Editors', + tag: 'editor', + description: + 'The following is a list of editors or related tools that allow editing of AsyncAPI document.', }, { - name: "UI components", - tag: "ui-component", - description: "The following is a list of UI components to view AsyncAPI documents." + name: 'UI components', + tag: 'ui-component', + description: + 'The following is a list of UI components to view AsyncAPI documents.', }, { - name: "DSL", - tag: "dsl", - description: "Writing YAML by hand is no fun, and maybe you don't want a GUI, so use a Domain Specific Language to write AsyncAPI in your language of choice." + name: 'DSL', + tag: 'dsl', + description: + "Writing YAML by hand is no fun, and maybe you don't want a GUI, so use a Domain Specific Language to write AsyncAPI in your language of choice.", }, { - name: "Frameworks", - tag: "framework", - description: "The following is a list of API/application frameworks that make use of AsyncAPI." + name: 'Frameworks', + tag: 'framework', + description: + 'The following is a list of API/application frameworks that make use of AsyncAPI.', }, { - name: "GitHub Actions", - tag: "github-action", - description: "The following is a list of GitHub Actions that you can use in your workflows" + name: 'GitHub Actions', + tag: 'github-action', + description: + 'The following is a list of GitHub Actions that you can use in your workflows', }, { - name: "Mocking and Testing", - tag: "mocking-and-testing", - description: "The tools below take specification documents as input, then publish fake messages to broker destinations for simulation purposes. They may also check that publisher messages are compliant with schemas." + name: 'Mocking and Testing', + tag: 'mocking-and-testing', + description: + 'The tools below take specification documents as input, then publish fake messages to broker destinations for simulation purposes. They may also check that publisher messages are compliant with schemas.', }, { - name: "Validators", - tag: "validator", - description: "The following is a list of tools that validate AsyncAPI documents." + name: 'Validators', + tag: 'validator', + description: + 'The following is a list of tools that validate AsyncAPI documents.', }, { - name: "Compare tools", - tag: "compare-tool", - description: "The following is a list of tools that compare AsyncAPI documents." + name: 'Compare tools', + tag: 'compare-tool', + description: + 'The following is a list of tools that compare AsyncAPI documents.', }, { - name: "CLIs", - tag: "cli", - description: "The following is a list of tools that you can work with in terminal or do some CI/CD automation." + name: 'CLIs', + tag: 'cli', + description: + 'The following is a list of tools that you can work with in terminal or do some CI/CD automation.', }, { - name: "Bundlers", - tag: "bundler", - description: "The following is a list of tools that you can work with to bundle AsyncAPI documents." + name: 'Bundlers', + tag: 'bundler', + description: + 'The following is a list of tools that you can work with to bundle AsyncAPI documents.', }, { - name: "IDE Extensions", - tag: "ide-extension", - description: "The following is a list of extensions for different IDEs like VSCode, IntelliJ IDEA and others" + name: 'IDE Extensions', + tag: 'ide-extension', + description: + 'The following is a list of extensions for different IDEs like VSCode, IntelliJ IDEA and others', }, { - name: "AsyncAPI Generator Templates", - tag: "generator-template", - description: "The following is a list of templates compatible with AsyncAPI Generator. You can use them to generate apps, clients or documentation from your AsyncAPI documents." + name: 'AsyncAPI Generator Templates', + tag: 'generator-template', + description: + 'The following is a list of templates compatible with AsyncAPI Generator. You can use them to generate apps, clients or documentation from your AsyncAPI documents.', }, { - name: "Others", - tag: "other", - description: "The following is a list of tools that comes under Other category." - } -] + name: 'Others', + tag: 'other', + description: + 'The following is a list of tools that comes under Other category.', + }, +]; -module.exports = {categoryList} +module.exports = { categoryList }; diff --git a/scripts/tools/combine-tools.js b/scripts/tools/combine-tools.js index 602262428fa1..34980f1abd61 100644 --- a/scripts/tools/combine-tools.js +++ b/scripts/tools/combine-tools.js @@ -1,142 +1,160 @@ -const { languagesColor, technologiesColor } = require("./tags-color") -const { categoryList } = require("./categorylist.js") -const { createToolObject } = require("./tools-object") -const fs = require('fs') -const schema = require("./tools-schema.json"); -const Ajv = require("ajv") -const addFormats = require("ajv-formats") -const Fuse = require("fuse.js"); -const ajv = new Ajv() -addFormats(ajv, ["uri"]) -const validate = ajv.compile(schema) +const { languagesColor, technologiesColor } = require('./tags-color'); +const { categoryList } = require('./categorylist.js'); +const { createToolObject } = require('./tools-object'); +const fs = require('fs'); +const schema = require('./tools-schema.json'); +const Ajv = require('ajv'); +const addFormats = require('ajv-formats'); +const Fuse = require('fuse.js'); +const ajv = new Ajv(); +addFormats(ajv, ['uri']); +const validate = ajv.compile(schema); let finalTools = {}; for (var category of categoryList) { - finalTools[category.name] = { - description: category.description, - toolsList: [] - }; + finalTools[category.name] = { + description: category.description, + toolsList: [], + }; } // Config options set for the Fuse object const options = { - includeScore: true, - shouldSort: true, - threshold: 0.39, - keys: ['name', 'color', 'borderColor'] -} + includeScore: true, + shouldSort: true, + threshold: 0.39, + keys: ['name', 'color', 'borderColor'], +}; -// Two seperate lists and Fuse objects initialised to search languages and technologies tags +// Two seperate lists and Fuse objects initialised to search languages and technologies tags // from specified list of same. -let languageList = [...languagesColor], technologyList = [...technologiesColor]; -let languageFuse = new Fuse(languageList, options), technologyFuse = new Fuse(technologyList, options) +let languageList = [...languagesColor], + technologyList = [...technologiesColor]; +let languageFuse = new Fuse(languageList, options), + technologyFuse = new Fuse(technologyList, options); -// takes individual tool object and inserts borderColor and backgroundColor of the tags of +// takes individual tool object and inserts borderColor and backgroundColor of the tags of // languages and technologies, for Tool Card in website. const getFinalTool = async (toolObject) => { - let finalObject = toolObject; + let finalObject = toolObject; - //there might be a tool without language - if (toolObject.filters.language) { - let languageArray = [] - if (typeof toolObject.filters.language === 'string') { - const languageSearch = await languageFuse.search(toolObject.filters.language) - if (languageSearch.length) { - languageArray.push(languageSearch[0].item); - } else { - // adds a new language object in the Fuse list as well as in tool object - // so that it isn't missed out in the UI. - let languageObject = { - name: toolObject.filters.language, - color: 'bg-[#57f281]', - borderColor: 'border-[#37f069]' - } - languageList.push(languageObject); - languageArray.push(languageObject) - languageFuse = new Fuse(languageList, options) - } + //there might be a tool without language + if (toolObject.filters.language) { + let languageArray = []; + if (typeof toolObject.filters.language === 'string') { + const languageSearch = await languageFuse.search( + toolObject.filters.language, + ); + if (languageSearch.length) { + languageArray.push(languageSearch[0].item); + } else { + // adds a new language object in the Fuse list as well as in tool object + // so that it isn't missed out in the UI. + let languageObject = { + name: toolObject.filters.language, + color: 'bg-[#57f281]', + borderColor: 'border-[#37f069]', + }; + languageList.push(languageObject); + languageArray.push(languageObject); + languageFuse = new Fuse(languageList, options); + } + } else { + for (const language of toolObject?.filters?.language) { + const languageSearch = await languageFuse.search(language); + if (languageSearch.length > 0) { + languageArray.push(languageSearch[0].item); } else { - for (const language of toolObject?.filters?.language) { - const languageSearch = await languageFuse.search(language) - if (languageSearch.length > 0) { - languageArray.push(languageSearch[0].item); - } - else { - // adds a new language object in the Fuse list as well as in tool object - // so that it isn't missed out in the UI. - let languageObject = { - name: language, - color: 'bg-[#57f281]', - borderColor: 'border-[#37f069]' - } - languageList.push(languageObject); - languageArray.push(languageObject) - languageFuse = new Fuse(languageList, options) - } - } + // adds a new language object in the Fuse list as well as in tool object + // so that it isn't missed out in the UI. + let languageObject = { + name: language, + color: 'bg-[#57f281]', + borderColor: 'border-[#37f069]', + }; + languageList.push(languageObject); + languageArray.push(languageObject); + languageFuse = new Fuse(languageList, options); } - finalObject.filters.language = languageArray + } } - let technologyArray = []; - if (toolObject.filters.technology) { - for (const technology of toolObject?.filters?.technology) { - const technologySearch = await technologyFuse.search(technology) - if (technologySearch.length > 0) { - technologyArray.push(technologySearch[0].item); - } - else { - // adds a new technology object in the Fuse list as well as in tool object - // so that it isn't missed out in the UI. - let technologyObject = { - name: technology, - color: 'bg-[#61d0f2]', - borderColor: 'border-[#40ccf7]' - } - technologyList.push(technologyObject); - technologyArray.push(technologyObject); - technologyFuse = new Fuse(technologyList, options) - } - } + finalObject.filters.language = languageArray; + } + let technologyArray = []; + if (toolObject.filters.technology) { + for (const technology of toolObject?.filters?.technology) { + const technologySearch = await technologyFuse.search(technology); + if (technologySearch.length > 0) { + technologyArray.push(technologySearch[0].item); + } else { + // adds a new technology object in the Fuse list as well as in tool object + // so that it isn't missed out in the UI. + let technologyObject = { + name: technology, + color: 'bg-[#61d0f2]', + borderColor: 'border-[#40ccf7]', + }; + technologyList.push(technologyObject); + technologyArray.push(technologyObject); + technologyFuse = new Fuse(technologyList, options); + } } - finalObject.filters.technology = technologyArray; - return finalObject; -} - + } + finalObject.filters.technology = technologyArray; + return finalObject; +}; -// Combine the automated tools and manual tools list into single JSON object file, and +// Combine the automated tools and manual tools list into single JSON object file, and // lists down all the language and technology tags in one JSON file. -const combineTools = async (automatedTools, manualTools, toolsPath, tagsPath) => { - for (const key in automatedTools) { - let finalToolsList = []; - if (automatedTools[key].toolsList.length) { - for (const tool of automatedTools[key].toolsList) { - finalToolsList.push(await getFinalTool(tool)) - } - } - if (manualTools[key] && manualTools[key].toolsList.length) { - for (const tool of manualTools[key].toolsList) { - let isAsyncAPIrepo; - const isValid = await validate(tool) - if (isValid) { - if (tool?.links?.repoUrl) { - const url = new URL(tool.links.repoUrl) - isAsyncAPIrepo = url.href.startsWith("https://github.com/asyncapi/") - } else isAsyncAPIrepo = false - let toolObject = await createToolObject(tool, "", "", isAsyncAPIrepo) - finalToolsList.push(await getFinalTool(toolObject)) - } else { - console.error('Script is not failing, it is just dropping errors for further investigation'); - console.error(`Invalid ${tool.title} .asyncapi-tool file.`); - console.error(`Located in manual-tools.json file`); - console.error('Validation errors:', JSON.stringify(validate.errors, null, 2)); - } - } +const combineTools = async ( + automatedTools, + manualTools, + toolsPath, + tagsPath, +) => { + for (const key in automatedTools) { + let finalToolsList = []; + if (automatedTools[key].toolsList.length) { + for (const tool of automatedTools[key].toolsList) { + finalToolsList.push(await getFinalTool(tool)); + } + } + if (manualTools[key] && manualTools[key].toolsList.length) { + for (const tool of manualTools[key].toolsList) { + let isAsyncAPIrepo; + const isValid = await validate(tool); + if (isValid) { + if (tool?.links?.repoUrl) { + const url = new URL(tool.links.repoUrl); + isAsyncAPIrepo = url.href.startsWith( + 'https://github.com/asyncapi/', + ); + } else isAsyncAPIrepo = false; + let toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); + finalToolsList.push(await getFinalTool(toolObject)); + } else { + console.error( + 'Script is not failing, it is just dropping errors for further investigation', + ); + console.error(`Invalid ${tool.title} .asyncapi-tool file.`); + console.error(`Located in manual-tools.json file`); + console.error( + 'Validation errors:', + JSON.stringify(validate.errors, null, 2), + ); } - finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); - finalTools[key].toolsList = finalToolsList + } } - fs.writeFileSync(toolsPath,JSON.stringify(finalTools)); - fs.writeFileSync(tagsPath,JSON.stringify({ languages: languageList, technologies: technologyList }),) -} + finalToolsList.sort((tool, anotherTool) => + tool.title.localeCompare(anotherTool.title), + ); + finalTools[key].toolsList = finalToolsList; + } + fs.writeFileSync(toolsPath, JSON.stringify(finalTools)); + fs.writeFileSync( + tagsPath, + JSON.stringify({ languages: languageList, technologies: technologyList }), + ); +}; -module.exports = { combineTools } \ No newline at end of file +module.exports = { combineTools }; diff --git a/scripts/tools/extract-tools-github.js b/scripts/tools/extract-tools-github.js index 55e96124b752..567a8077be4b 100644 --- a/scripts/tools/extract-tools-github.js +++ b/scripts/tools/extract-tools-github.js @@ -1,5 +1,5 @@ const axios = require('axios'); -require('dotenv').config() +require('dotenv').config(); const getData = async () => { try { @@ -10,7 +10,7 @@ const getData = async () => { accept: 'application/vnd.github.text-match+json', authorization: `token ${process.env.GITHUB_TOKEN}`, }, - } + }, ); return result.data; @@ -19,4 +19,4 @@ const getData = async () => { } }; -module.exports = { getData }; \ No newline at end of file +module.exports = { getData }; diff --git a/scripts/tools/tags-color.js b/scripts/tools/tags-color.js index 9a18ca2058d5..5897fcab5837 100644 --- a/scripts/tools/tags-color.js +++ b/scripts/tools/tags-color.js @@ -1,178 +1,178 @@ // Language and Technology tags along with their colors in UI are defined here. const languagesColor = [ - { - name: "Go/Golang", - color: "bg-[#8ECFDF]", - borderColor: "border-[#00AFD9]" - }, - { - name: "Java", - color: "bg-[#ECA2A4]", - borderColor: "border-[#EC2125]" - }, - { - name: "JavaScript", - color: "bg-[#F2F1C7]", - borderColor: "border-[#BFBE86]" - }, - { - name: "HTML", - color: "bg-[#E2A291]", - borderColor: "border-[#E44D26]" - }, - { - name: "C/C++", - color: "bg-[#93CDEF]", - borderColor: "border-[#0080CC]" - }, - { - name: "C#", - color: "bg-[#E3AFE0]", - borderColor: "border-[#9B4F96]" - }, - { - name: "Python", - color: "bg-[#A8D0EF]", - borderColor: "border-[#3878AB]" - }, - { - name: "TypeScript", - color: "bg-[#7DBCFE]", - borderColor: "border-[#2C78C7]" - }, - { - name: "Kotlin", - color: "bg-[#B1ACDF]", - borderColor: "border-[#756BD9]" - }, - { - name: "Scala", - color: "bg-[#FFA299]", - borderColor: "border-[#DF301F]" - }, - { - name: "Markdown", - color: "bg-[#BABEBF]", - borderColor: "border-[#445B64]" - }, - { - name: "YAML", - color: "bg-[#FFB764]", - borderColor: "border-[#F1901F]" - }, - { - name: "R", - color: "bg-[#84B5ED]", - borderColor: "border-[#246BBE]" - }, - { - name: "Ruby", - color: "bg-[#FF8289]", - borderColor: "border-[#FF000F]" - }, - { - name: "Rust", - color: "bg-[#FFB8AA]", - borderColor: "border-[#E43716]" - }, - { - name: "Shell", - color: "bg-[#87D4FF]", - borderColor: "border-[#389ED7]" - }, - { - name: "Groovy", - color: "bg-[#B6D5E5]", - borderColor: "border-[#609DBC]" - } -] + { + name: 'Go/Golang', + color: 'bg-[#8ECFDF]', + borderColor: 'border-[#00AFD9]', + }, + { + name: 'Java', + color: 'bg-[#ECA2A4]', + borderColor: 'border-[#EC2125]', + }, + { + name: 'JavaScript', + color: 'bg-[#F2F1C7]', + borderColor: 'border-[#BFBE86]', + }, + { + name: 'HTML', + color: 'bg-[#E2A291]', + borderColor: 'border-[#E44D26]', + }, + { + name: 'C/C++', + color: 'bg-[#93CDEF]', + borderColor: 'border-[#0080CC]', + }, + { + name: 'C#', + color: 'bg-[#E3AFE0]', + borderColor: 'border-[#9B4F96]', + }, + { + name: 'Python', + color: 'bg-[#A8D0EF]', + borderColor: 'border-[#3878AB]', + }, + { + name: 'TypeScript', + color: 'bg-[#7DBCFE]', + borderColor: 'border-[#2C78C7]', + }, + { + name: 'Kotlin', + color: 'bg-[#B1ACDF]', + borderColor: 'border-[#756BD9]', + }, + { + name: 'Scala', + color: 'bg-[#FFA299]', + borderColor: 'border-[#DF301F]', + }, + { + name: 'Markdown', + color: 'bg-[#BABEBF]', + borderColor: 'border-[#445B64]', + }, + { + name: 'YAML', + color: 'bg-[#FFB764]', + borderColor: 'border-[#F1901F]', + }, + { + name: 'R', + color: 'bg-[#84B5ED]', + borderColor: 'border-[#246BBE]', + }, + { + name: 'Ruby', + color: 'bg-[#FF8289]', + borderColor: 'border-[#FF000F]', + }, + { + name: 'Rust', + color: 'bg-[#FFB8AA]', + borderColor: 'border-[#E43716]', + }, + { + name: 'Shell', + color: 'bg-[#87D4FF]', + borderColor: 'border-[#389ED7]', + }, + { + name: 'Groovy', + color: 'bg-[#B6D5E5]', + borderColor: 'border-[#609DBC]', + }, +]; const technologiesColor = [ - { - name: "Node.js", - color: "bg-[#BDFF67]", - borderColor: "border-[#84CE24]" - }, - { - name: "Hermes", - color: "bg-[#8AEEBD]", - borderColor: "border-[#2AB672]" - }, - { - name: "React JS", - color: "bg-[#9FECFA]", - borderColor: "border-[#08D8FE]" - }, - { - name: ".NET", - color: "bg-[#A184FF]", - borderColor: "border-[#5026D4]" - }, - { - name: "ASP.NET", - color: "bg-[#71C2FB]", - borderColor: "border-[#1577BC]" - }, - { - name: "Springboot", - color: "bg-[#98E279]", - borderColor: "border-[#68BC44]" - }, - { - name: "AWS", - color: "bg-[#FF9F59]", - borderColor: "border-[#EF6703]" - }, - { - name: "Docker", - color: "bg-[#B8E0FF]", - borderColor: "border-[#2596ED]" - }, - { - name: "Node-RED", - color: "bg-[#FF7474]", - borderColor: "border-[#8F0101]" - }, - { - name: "Maven", - color: "bg-[#FF6B80]", - borderColor: "border-[#CA1A33]" - }, - { - name: "Saas", - color: "bg-[#6AB8EC]", - borderColor: "border-[#2275AD]" - }, - { - name: "Kubernetes-native", - color: "bg-[#D7C7F2]", - borderColor: "border-[#A387D2]" - }, - { - name: "Scala", - color: "bg-[#D7C7F2]", - borderColor: "border-[#A387D2]" - }, - { - name: "Azure", - color: "bg-[#4B93FF]", - borderColor: "border-[#015ADF]" - }, - { - name: "Jenkins", - color: "bg-[#D7C7F2]", - borderColor: "border-[#A387D2]" - }, - { - name: "Flask", - color: "bg-[#D7C7F2]", - borderColor: "border-[#A387D2]" - }, - { - name: "Nest Js", - color: "bg-[#E1224E]", - borderColor: "border-[#B9012b]" - } -] + { + name: 'Node.js', + color: 'bg-[#BDFF67]', + borderColor: 'border-[#84CE24]', + }, + { + name: 'Hermes', + color: 'bg-[#8AEEBD]', + borderColor: 'border-[#2AB672]', + }, + { + name: 'React JS', + color: 'bg-[#9FECFA]', + borderColor: 'border-[#08D8FE]', + }, + { + name: '.NET', + color: 'bg-[#A184FF]', + borderColor: 'border-[#5026D4]', + }, + { + name: 'ASP.NET', + color: 'bg-[#71C2FB]', + borderColor: 'border-[#1577BC]', + }, + { + name: 'Springboot', + color: 'bg-[#98E279]', + borderColor: 'border-[#68BC44]', + }, + { + name: 'AWS', + color: 'bg-[#FF9F59]', + borderColor: 'border-[#EF6703]', + }, + { + name: 'Docker', + color: 'bg-[#B8E0FF]', + borderColor: 'border-[#2596ED]', + }, + { + name: 'Node-RED', + color: 'bg-[#FF7474]', + borderColor: 'border-[#8F0101]', + }, + { + name: 'Maven', + color: 'bg-[#FF6B80]', + borderColor: 'border-[#CA1A33]', + }, + { + name: 'Saas', + color: 'bg-[#6AB8EC]', + borderColor: 'border-[#2275AD]', + }, + { + name: 'Kubernetes-native', + color: 'bg-[#D7C7F2]', + borderColor: 'border-[#A387D2]', + }, + { + name: 'Scala', + color: 'bg-[#D7C7F2]', + borderColor: 'border-[#A387D2]', + }, + { + name: 'Azure', + color: 'bg-[#4B93FF]', + borderColor: 'border-[#015ADF]', + }, + { + name: 'Jenkins', + color: 'bg-[#D7C7F2]', + borderColor: 'border-[#A387D2]', + }, + { + name: 'Flask', + color: 'bg-[#D7C7F2]', + borderColor: 'border-[#A387D2]', + }, + { + name: 'Nest Js', + color: 'bg-[#E1224E]', + borderColor: 'border-[#B9012b]', + }, +]; -module.exports = {languagesColor, technologiesColor} \ No newline at end of file +module.exports = { languagesColor, technologiesColor }; diff --git a/scripts/tools/tools-object.js b/scripts/tools/tools-object.js index e5a30334f7d3..9ef57e5cab31 100644 --- a/scripts/tools/tools-object.js +++ b/scripts/tools/tools-object.js @@ -1,50 +1,58 @@ -const schema = require("./tools-schema.json"); -const axios = require('axios') -const Ajv = require("ajv") -const addFormats = require("ajv-formats") -const Fuse = require("fuse.js") -const { categoryList } = require("./categorylist") -const ajv = new Ajv() -addFormats(ajv, ["uri"]) -const validate = ajv.compile(schema) +const schema = require('./tools-schema.json'); +const axios = require('axios'); +const Ajv = require('ajv'); +const addFormats = require('ajv-formats'); +const Fuse = require('fuse.js'); +const { categoryList } = require('./categorylist'); +const ajv = new Ajv(); +addFormats(ajv, ['uri']); +const validate = ajv.compile(schema); const { convertToJson } = require('../utils'); - // Config options set for the Fuse object const options = { includeScore: true, shouldSort: true, threshold: 0.4, - keys: ["tag"] -} + keys: ['tag'], +}; -const fuse = new Fuse(categoryList, options) +const fuse = new Fuse(categoryList, options); -// using the contents of each toolFile (extracted from Github), along with Github URL -// (repositoryUrl) of the tool, it's repository description (repoDescription) and -// isAsyncAPIrepo boolean variable to define whether the tool repository is under -// AsyncAPI organization or not, to create a JSON tool object as required in the frontend +// using the contents of each toolFile (extracted from Github), along with Github URL +// (repositoryUrl) of the tool, it's repository description (repoDescription) and +// isAsyncAPIrepo boolean variable to define whether the tool repository is under +// AsyncAPI organization or not, to create a JSON tool object as required in the frontend // side to show ToolCard. -const createToolObject = async (toolFile, repositoryUrl='', repoDescription='', isAsyncAPIrepo='') => { +const createToolObject = async ( + toolFile, + repositoryUrl = '', + repoDescription = '', + isAsyncAPIrepo = '', +) => { let resultantObject = { title: toolFile.title, description: toolFile?.description ? toolFile.description : repoDescription, links: { ...toolFile.links, - repoUrl: toolFile?.links?.repoUrl ? toolFile.links.repoUrl : repositoryUrl + repoUrl: toolFile?.links?.repoUrl + ? toolFile.links.repoUrl + : repositoryUrl, }, filters: { ...toolFile.filters, - hasCommercial: toolFile?.filters?.hasCommercial ? toolFile.filters.hasCommercial : false, - isAsyncAPIOwner: isAsyncAPIrepo - } + hasCommercial: toolFile?.filters?.hasCommercial + ? toolFile.filters.hasCommercial + : false, + isAsyncAPIOwner: isAsyncAPIrepo, + }, }; return resultantObject; }; -// Each result obtained from the Github API call will be tested and verified +// Each result obtained from the Github API call will be tested and verified // using the defined JSON schema, categorising each tool inside their defined categories -// and creating a JSON tool object in which all the tools are listed in defined +// and creating a JSON tool object in which all the tools are listed in defined // categories order, which is then updated in `automated-tools.json` file. async function convertTools(data) { let finalToolsObject = {}; @@ -54,7 +62,7 @@ async function convertTools(data) { for (var index in categoryList) { finalToolsObject[categoryList[index].name] = { description: categoryList[index].description, - toolsList: [] + toolsList: [], }; } @@ -64,50 +72,70 @@ async function convertTools(data) { // extracting the reference id of the repository which will be used to extract the path of the .asyncapi-tool file in the Tools repository // ex: for a url = "https://api.github.com/repositories/351453552/contents/.asyncapi-tool?ref=61855e7365a881e98c2fe667a658a0005753d873" // the text (id) present after '=' gives us a reference id for the repo - let reference_id = tool.url.split("=")[1]; + let reference_id = tool.url.split('=')[1]; let download_url = `https://raw.githubusercontent.com/${tool.repository.full_name}/${reference_id}/${tool.path}`; const { data: toolFileContent } = await axios.get(download_url); //some stuff can be YAML - const jsonToolFileContent = await convertToJson(toolFileContent) + const jsonToolFileContent = await convertToJson(toolFileContent); //validating against JSON Schema for tools file - const isValid = await validate(jsonToolFileContent) + const isValid = await validate(jsonToolFileContent); if (isValid) { let repositoryUrl = tool.repository.html_url; let repoDescription = tool.repository.description; - let isAsyncAPIrepo = tool.repository.owner.login === "asyncapi"; - let toolObject = await createToolObject(jsonToolFileContent, repositoryUrl, repoDescription, isAsyncAPIrepo); + let isAsyncAPIrepo = tool.repository.owner.login === 'asyncapi'; + let toolObject = await createToolObject( + jsonToolFileContent, + repositoryUrl, + repoDescription, + isAsyncAPIrepo, + ); // Tool Object is appended to each category array according to Fuse search for categories inside Tool Object jsonToolFileContent.filters.categories.forEach(async (category) => { const categorySearch = await fuse.search(category); if (categorySearch.length) { - let searchedCategoryName = categorySearch[0].item.name - if (!finalToolsObject[searchedCategoryName].toolsList.find((element => element === toolObject))) - finalToolsObject[searchedCategoryName].toolsList.push(toolObject); + let searchedCategoryName = categorySearch[0].item.name; + if ( + !finalToolsObject[searchedCategoryName].toolsList.find( + (element) => element === toolObject, + ) + ) + finalToolsObject[searchedCategoryName].toolsList.push( + toolObject, + ); } else { // if Tool object has a category, not defined in our categorylist, then this provides a `other` category to the tool. - if (!finalToolsObject['Others'].toolsList.find((element => element === toolObject))) + if ( + !finalToolsObject['Others'].toolsList.find( + (element) => element === toolObject, + ) + ) finalToolsObject['Others'].toolsList.push(toolObject); } }); } else { - console.error('Script is not failing, it is just dropping errors for further investigation'); + console.error( + 'Script is not failing, it is just dropping errors for further investigation', + ); console.error('Invalid .asyncapi-tool file.'); console.error(`Located in: ${tool.html_url}`); - console.error('Validation errors:', JSON.stringify(validate.errors, null, 2)); + console.error( + 'Validation errors:', + JSON.stringify(validate.errors, null, 2), + ); } } } catch (err) { - console.error(err) + console.error(err); throw err; } } return finalToolsObject; } -module.exports = {convertTools, createToolObject} \ No newline at end of file +module.exports = { convertTools, createToolObject }; diff --git a/scripts/tools/tools-schema.json b/scripts/tools/tools-schema.json index e11968a1b2e1..74bcb3d783b4 100644 --- a/scripts/tools/tools-schema.json +++ b/scripts/tools/tools-schema.json @@ -1,220 +1,209 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "JSON Schema for AsyncAPI tool discovery file.", - "type": "object", - "additionalProperties": false, - "required": [ - "title", - "filters" - ], - "properties": { - "title": { - "type": "string", - "description": "Human-readable name of the tool that will be visible to people in the list of tools.", - "examples": [ - "AsyncAPI Generator", - "Cupid" - ] + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "JSON Schema for AsyncAPI tool discovery file.", + "type": "object", + "additionalProperties": false, + "required": ["title", "filters"], + "properties": { + "title": { + "type": "string", + "description": "Human-readable name of the tool that will be visible to people in the list of tools.", + "examples": ["AsyncAPI Generator", "Cupid"] + }, + "description": { + "type": "string", + "description": "By default scripts read description of repository there project is stored. You can override this behaviour by providing custom description." + }, + "links": { + "type": "object", + "additionalProperties": false, + "properties": { + "websiteUrl": { + "type": "string", + "description": "You can provide URL to the website where your project hosts some demo or project landing page.", + "format": "uri" }, - "description": { - "type": "string", - "description": "By default scripts read description of repository there project is stored. You can override this behaviour by providing custom description." + "docsUrl": { + "type": "string", + "description": "You can provide URL to project documentation in case you have more than just a readme file.", + "format": "uri" }, - "links": { - "type": "object", - "additionalProperties": false, - "properties": { - "websiteUrl": { - "type": "string", - "description": "You can provide URL to the website where your project hosts some demo or project landing page.", - "format": "uri" - }, - "docsUrl": { - "type": "string", - "description": "You can provide URL to project documentation in case you have more than just a readme file.", - "format": "uri" + "repoUrl": { + "type": "string", + "description": "You can provide URL to project codebase in case you have more than one tool present inside single repository.", + "format": "uri" + } + } + }, + "filters": { + "type": "object", + "additionalProperties": false, + "required": ["categories"], + "properties": { + "language": { + "description": "The language referred to is the runtime language selected by the user, not the generator or library language. For example, the Generator written in JavaScript generates Python code from the JavaScript template and the result of generation is a Python app, so the language for Generator is specified as Python. But for the Bundler library, users need to know if it can be integrated into their TypeScript codebase, so its language is specified as TypeScript. If some language in the schema's enum is omitted, it can be added through a pull request to the AsyncAPI website repository.", + "anyOf": [ + { + "type": "string", + "anyOf": [ + { + "type": "string", + "enum": [ + "Go", + "Java", + "JavaScript", + "HTML", + "C/C++", + "C#", + "Python", + "TypeScript", + "Kotlin", + "Scala", + "Markdown", + "YAML", + "R", + "Ruby", + "Rust", + "Shell", + "Groovy" + ] }, - "repoUrl": { - "type": "string", - "description": "You can provide URL to project codebase in case you have more than one tool present inside single repository.", - "format": "uri" + { + "type": "string" } - } - }, - "filters": { - "type": "object", - "additionalProperties": false, - "required": [ - "categories" - ], - "properties": { - "language": { - "description": "The language referred to is the runtime language selected by the user, not the generator or library language. For example, the Generator written in JavaScript generates Python code from the JavaScript template and the result of generation is a Python app, so the language for Generator is specified as Python. But for the Bundler library, users need to know if it can be integrated into their TypeScript codebase, so its language is specified as TypeScript. If some language in the schema's enum is omitted, it can be added through a pull request to the AsyncAPI website repository.", - "anyOf": [ - { - "type": "string", - "anyOf": [ - { - "type": "string", - "enum": [ - "Go", - "Java", - "JavaScript", - "HTML", - "C/C++", - "C#", - "Python", - "TypeScript", - "Kotlin", - "Scala", - "Markdown", - "YAML", - "R", - "Ruby", - "Rust", - "Shell", - "Groovy" - ] - }, - { - "type": "string" - } - ] - }, - { - "type": "array", - "items": { - "type": "string", - "anyOf": [ - { - "type": "string", - "enum": [ - "Go", - "Java", - "JavaScript", - "HTML", - "C/C++", - "C#", - "Python", - "TypeScript", - "Kotlin", - "Scala", - "Markdown", - "YAML", - "R", - "Ruby", - "Rust", - "Shell", - "Groovy" - ] - }, - { - "type": "string" - } - ] - } - } - ] - }, - "technology": { - "type": "array", - "description": "Provide a list of different technologies used in the tool. Put details useful for tool user and tool contributor.", - "items": { - "type": "string", - "anyOf": [ - { - "type": "string", - "enum": [ - "Node js", - "Hermes", - "React JS", - ".NET", - "ASP.NET", - "Springboot", - "AWS", - "Docker", - "Node-red", - "Maven", - "Saas", - "Kubernetes-native", - "Scala", - "Azure", - "Jenkins", - "Flask" - ] - }, - { - "type": "string" - } - ] - }, - "examples": [ - "Express.js", - "Kafka" - ] - }, - "categories": { - "type": "array", - "description": "Categories are used to group tools by different use case, like documentation or code generation. If have a list of fixed categories. If you use different one that your tool lands under \"other\" category. Feel free to add your category through a pull request to AsyncAPI website repository.", - "items": { - "type": "string", - "anyOf": [ - { - "type": "string", - "enum": [ - "api", - "code-first", - "code-generator", - "converter", - "directory", - "documentation-generator", - "editor", - "ui-component", - "dsl", - "framework", - "github-action", - "mocking-and-testing", - "validator", - "compare-tool", - "other", - "cli", - "bundler", - "ide-extension" - ] - }, - { - "type": "string" - } - ] - }, - "minItems": 1, - "examples": [ - "api", - "code-first", - "code-generator", - "converter", - "directory", - "documentation-generator", - "editor", - "ui-component", - "dsl", - "framework", - "github-action", - "mocking-and-testing", - "validator", - "compare-tool", - "other", - "cli", - "bundler", - "ide-extension" + ] + }, + { + "type": "array", + "items": { + "type": "string", + "anyOf": [ + { + "type": "string", + "enum": [ + "Go", + "Java", + "JavaScript", + "HTML", + "C/C++", + "C#", + "Python", + "TypeScript", + "Kotlin", + "Scala", + "Markdown", + "YAML", + "R", + "Ruby", + "Rust", + "Shell", + "Groovy" ] - }, - "hasCommercial": { - "type": "boolean", - "description": "Indicate if your tool is open source or commercial offering, like SAAS for example", - "default": false - } + }, + { + "type": "string" + } + ] + } } + ] + }, + "technology": { + "type": "array", + "description": "Provide a list of different technologies used in the tool. Put details useful for tool user and tool contributor.", + "items": { + "type": "string", + "anyOf": [ + { + "type": "string", + "enum": [ + "Node js", + "Hermes", + "React JS", + ".NET", + "ASP.NET", + "Springboot", + "AWS", + "Docker", + "Node-red", + "Maven", + "Saas", + "Kubernetes-native", + "Scala", + "Azure", + "Jenkins", + "Flask" + ] + }, + { + "type": "string" + } + ] + }, + "examples": ["Express.js", "Kafka"] + }, + "categories": { + "type": "array", + "description": "Categories are used to group tools by different use case, like documentation or code generation. If have a list of fixed categories. If you use different one that your tool lands under \"other\" category. Feel free to add your category through a pull request to AsyncAPI website repository.", + "items": { + "type": "string", + "anyOf": [ + { + "type": "string", + "enum": [ + "api", + "code-first", + "code-generator", + "converter", + "directory", + "documentation-generator", + "editor", + "ui-component", + "dsl", + "framework", + "github-action", + "mocking-and-testing", + "validator", + "compare-tool", + "other", + "cli", + "bundler", + "ide-extension" + ] + }, + { + "type": "string" + } + ] + }, + "minItems": 1, + "examples": [ + "api", + "code-first", + "code-generator", + "converter", + "directory", + "documentation-generator", + "editor", + "ui-component", + "dsl", + "framework", + "github-action", + "mocking-and-testing", + "validator", + "compare-tool", + "other", + "cli", + "bundler", + "ide-extension" + ] + }, + "hasCommercial": { + "type": "boolean", + "description": "Indicate if your tool is open source or commercial offering, like SAAS for example", + "default": false } + } } -} \ No newline at end of file + } +} diff --git a/scripts/utils.js b/scripts/utils.js index c740ae91eaef..66d01b75afc7 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -1,26 +1,28 @@ const yaml = require('yaml'); function convertToJson(contentYAMLorJSON) { - // Axios handles conversion to JSON by default, if data returned from the server allows it - // So if returned content is not a string (not YAML), we just return JSON back - if (typeof contentYAMLorJSON !== "string") { - return contentYAMLorJSON; - } + // Axios handles conversion to JSON by default, if data returned from the server allows it + // So if returned content is not a string (not YAML), we just return JSON back + if (typeof contentYAMLorJSON !== 'string') { + return contentYAMLorJSON; + } - // Check if the content is valid JSON before attempting to parse as YAML + // Check if the content is valid JSON before attempting to parse as YAML + try { + const jsonContent = JSON.parse(contentYAMLorJSON); + return jsonContent; + } catch (jsonError) { + // If it's not valid JSON, try parsing it as YAML try { - const jsonContent = JSON.parse(contentYAMLorJSON); - return jsonContent; - } catch (jsonError) { - // If it's not valid JSON, try parsing it as YAML - try { - const yamlContent = yaml.parse(contentYAMLorJSON); - return yamlContent; - } catch (yamlError) { - // If parsing as YAML also fails, throw an error - throw new Error(`Invalid content format:\nJSON Parse Error: ${jsonError}\nYAML Parse Error: ${yamlError}`); - } + const yamlContent = yaml.parse(contentYAMLorJSON); + return yamlContent; + } catch (yamlError) { + // If parsing as YAML also fails, throw an error + throw new Error( + `Invalid content format:\nJSON Parse Error: ${jsonError}\nYAML Parse Error: ${yamlError}`, + ); } + } } module.exports = { convertToJson }; diff --git a/scripts/utils/readAndWriteJson.js b/scripts/utils/readAndWriteJson.js index 3c7f05d2308b..d1ed2dd43a12 100644 --- a/scripts/utils/readAndWriteJson.js +++ b/scripts/utils/readAndWriteJson.js @@ -1,28 +1,30 @@ -const { promises: { readFile, writeFile } } = require('fs'); -const { convertToJson } = require("../utils"); +const { + promises: { readFile, writeFile }, +} = require('fs'); +const { convertToJson } = require('../utils'); module.exports = async function writeJSON(readPath, writePath) { - let readContent; - let jsonContent; + let readContent; + let jsonContent; - // Attempt to read the file - try { - readContent = await readFile(readPath, 'utf-8'); - } catch (err) { - throw new Error(`Error while reading file\nError: ${err}`); - } + // Attempt to read the file + try { + readContent = await readFile(readPath, 'utf-8'); + } catch (err) { + throw new Error(`Error while reading file\nError: ${err}`); + } - // Attempt to convert content to JSON - try { - jsonContent = convertToJson(readContent); - } catch (err) { - throw new Error(`Error while conversion\nError: ${err}`); - } + // Attempt to convert content to JSON + try { + jsonContent = convertToJson(readContent); + } catch (err) { + throw new Error(`Error while conversion\nError: ${err}`); + } - // Attempt to write the JSON content to file - try { - await writeFile(writePath, JSON.stringify(jsonContent)); - } catch (err) { - throw new Error(`Error while writing file\nError: ${err}`); - } -}; \ No newline at end of file + // Attempt to write the JSON content to file + try { + await writeFile(writePath, JSON.stringify(jsonContent)); + } catch (err) { + throw new Error(`Error while writing file\nError: ${err}`); + } +}; From 2badba708c2dc63498e9ea71bae30e84b748ae7a Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 16 Nov 2024 15:04:44 +0530 Subject: [PATCH 002/183] format using prettier --- scripts/adopters/index.js | 5 +- scripts/build-docs.js | 67 +++++++++------------ scripts/build-meetings.js | 23 +++---- scripts/build-newsroom-videos.js | 21 +++---- scripts/build-post-list.js | 87 ++++++++------------------- scripts/build-rss.js | 18 ++---- scripts/build-tools.js | 33 +++------- scripts/casestudies/index.js | 13 ++-- scripts/compose.js | 33 ++++------ scripts/dashboard/build-dashboard.js | 75 ++++++++--------------- scripts/dashboard/issue-queries.js | 2 +- scripts/finance/index.js | 33 ++-------- scripts/index.js | 14 +---- scripts/markdown/check-markdown.js | 18 +----- scripts/tools/categorylist.js | 53 ++++++---------- scripts/tools/combine-tools.js | 82 ++++++++++--------------- scripts/tools/extract-tools-github.js | 15 ++--- scripts/tools/tags-color.js | 72 +++++++++++----------- scripts/tools/tools-object.js | 81 +++++++++---------------- scripts/utils.js | 4 +- scripts/utils/readAndWriteJson.js | 2 +- 21 files changed, 261 insertions(+), 490 deletions(-) diff --git a/scripts/adopters/index.js b/scripts/adopters/index.js index ef6643802d62..a8c8363d25ab 100644 --- a/scripts/adopters/index.js +++ b/scripts/adopters/index.js @@ -2,8 +2,5 @@ const { resolve } = require('path'); const writeJSON = require('../utils/readAndWriteJson.js'); module.exports = async function buildAdoptersList() { - writeJSON( - 'config/adopters.yml', - resolve(__dirname, '../../config', 'adopters.json'), - ); + writeJSON('config/adopters.yml', resolve(__dirname, '../../config', 'adopters.json')); }; diff --git a/scripts/build-docs.js b/scripts/build-docs.js index e1aff2f99cd1..48693f176ba8 100644 --- a/scripts/build-docs.js +++ b/scripts/build-docs.js @@ -1,4 +1,5 @@ const sortBy = require('lodash/sortBy'); + function buildNavTree(navItems) { try { const tree = { @@ -10,42 +11,36 @@ function buildNavTree(navItems) { isSection: true, rootSectionId: 'welcome', sectionWeight: 0, - slug: '/docs', + slug: '/docs' }, - children: {}, - }, + children: {} + } }; - //first we make sure that list of items lists main section items and then sub sections, documents last - const sortedItems = sortBy(navItems, [ - 'isRootSection', - 'weight', - 'isSection', - ]); + // first we make sure that list of items lists main section items and then sub sections, documents last + const sortedItems = sortBy(navItems, ['isRootSection', 'weight', 'isSection']); sortedItems.forEach((item) => { - //identify main sections + // identify main sections if (item.isRootSection) { tree[item.rootSectionId] = { item, children: {} }; } - //identify subsections + // identify subsections if (item.parent) { if (!tree[item.parent]) { - throw new Error( - `Parent section ${item.parent} not found for item ${item.title}`, - ); + throw new Error(`Parent section ${item.parent} not found for item ${item.title}`); } tree[item.parent].children[item.sectionId] = { item, children: [] }; } if (!item.isSection) { if (item.sectionId) { - let section = tree[item.rootSectionId]?.children[item.sectionId]; + const section = tree[item.rootSectionId]?.children[item.sectionId]; if (!section) { tree[item.rootSectionId].children[item.sectionId] = { item, - children: [], + children: [] }; } tree[item.rootSectionId].children[item.sectionId].children.push(item); @@ -68,7 +63,7 @@ function buildNavTree(navItems) { return obj; }, {}); - //handling subsections + // handling subsections if (allChildrenKeys.length > 1) { for (const key of allChildrenKeys) { if (allChildren[key].children) { @@ -79,9 +74,7 @@ function buildNavTree(navItems) { // point in slug for specification subgroup to the latest specification version if (rootKey === 'reference' && key === 'specification') { - allChildren[key].item.href = allChildren[key].children.find( - (c) => c.isPrerelease === undefined, - ).slug; + allChildren[key].item.href = allChildren[key].children.find((c) => c.isPrerelease === undefined).slug; } } } @@ -101,9 +94,9 @@ const convertDocPosts = (docObject) => { // certain entries in the DocPosts are either a parent to many posts or itself a post. docsArray.push(docObject?.item || docObject); if (docObject.children) { - let children = docObject.children; + const { children } = docObject; Object.keys(children).forEach((child) => { - let docChildArray = convertDocPosts(children[child]); + const docChildArray = convertDocPosts(children[child]); docsArray = [...docsArray, ...docChildArray]; }); } @@ -115,16 +108,16 @@ const convertDocPosts = (docObject) => { function addDocButtons(docPosts, treePosts) { let structuredPosts = []; - let rootSections = []; + const rootSections = []; try { // Traversing the whole DocTree and storing each post inside them in sequential order Object.keys(treePosts).forEach((rootElement) => { structuredPosts.push(treePosts[rootElement].item); if (treePosts[rootElement].children) { - let children = treePosts[rootElement].children; + const { children } = treePosts[rootElement]; Object.keys(children).forEach((child) => { - let docChildArray = convertDocPosts(children[child]); + const docChildArray = convertDocPosts(children[child]); structuredPosts = [...structuredPosts, ...docChildArray]; }); } @@ -134,7 +127,7 @@ function addDocButtons(docPosts, treePosts) { structuredPosts[0] = docPosts.filter((p) => p.slug === '/docs')[0]; // Traversing the structuredPosts in order to add `nextPage` and `prevPage` details for each page - let countDocPages = structuredPosts.length; + const countDocPages = structuredPosts.length; structuredPosts = structuredPosts.map((post, index) => { // post item specifying the root Section or sub-section in the docs are excluded as // they doesn't comprise any Doc Page or content to be shown in website. @@ -143,26 +136,23 @@ function addDocButtons(docPosts, treePosts) { return post; } - let nextPage = {}, - prevPage = {}; + let nextPage = {}; + let prevPage = {}; let docPost = post; // checks whether the next page for the current docPost item exists or not if (index + 1 < countDocPages) { // checks whether the next item inside structuredPosts is a rootElement or a sectionElement // if yes, it goes again to a next to next item in structuredPosts to link the nextPage - if ( - !structuredPosts[index + 1].isRootElement && - !structuredPosts[index + 1].isSection - ) { + if (!structuredPosts[index + 1].isRootElement && !structuredPosts[index + 1].isSection) { nextPage = { title: structuredPosts[index + 1].title, - href: structuredPosts[index + 1].slug, + href: structuredPosts[index + 1].slug }; } else { nextPage = { title: `${structuredPosts[index + 1].title} - ${structuredPosts[index + 2].title}`, - href: structuredPosts[index + 2].slug, + href: structuredPosts[index + 2].slug }; } docPost = { ...docPost, nextPage }; @@ -172,13 +162,10 @@ function addDocButtons(docPosts, treePosts) { if (index > 0) { // checks whether the previous item inside structuredPosts is a rootElement or a sectionElement // if yes, it goes again to a next previous item in structuredPosts to link the prevPage - if ( - !structuredPosts[index - 1]?.isRootElement && - !structuredPosts[index - 1]?.isSection - ) { + if (!structuredPosts[index - 1]?.isRootElement && !structuredPosts[index - 1]?.isSection) { prevPage = { title: structuredPosts[index - 1].title, - href: structuredPosts[index - 1].slug, + href: structuredPosts[index - 1].slug }; docPost = { ...docPost, prevPage }; } else { @@ -186,7 +173,7 @@ function addDocButtons(docPosts, treePosts) { if (index - 2 >= 0) { prevPage = { title: `${structuredPosts[index - 1]?.isRootSection ? rootSections[rootSections.length - 2] : rootSections[rootSections.length - 1]} - ${structuredPosts[index - 2].title}`, - href: structuredPosts[index - 2].slug, + href: structuredPosts[index - 2].slug }; docPost = { ...docPost, prevPage }; } diff --git a/scripts/build-meetings.js b/scripts/build-meetings.js index cc56c0d026b8..ac556b7578d4 100644 --- a/scripts/build-meetings.js +++ b/scripts/build-meetings.js @@ -9,9 +9,7 @@ async function buildMeetings(writePath) { try { auth = new google.auth.GoogleAuth({ scopes: ['https://www.googleapis.com/auth/calendar'], - credentials: process.env.CALENDAR_SERVICE_ACCOUNT - ? JSON.parse(process.env.CALENDAR_SERVICE_ACCOUNT) - : undefined, + credentials: process.env.CALENDAR_SERVICE_ACCOUNT ? JSON.parse(process.env.CALENDAR_SERVICE_ACCOUNT) : undefined }); calendar = google.calendar({ version: 'v3', auth }); @@ -22,19 +20,15 @@ async function buildMeetings(writePath) { let eventsItems; try { - //cron job runs this always on midnight + // cron job runs this always on midnight const currentTime = new Date(Date.now()).toISOString(); - const timeMin = new Date( - Date.parse(currentTime) - 100 * 24 * 60 * 60 * 1000, - ).toISOString(); - const timeMax = new Date( - Date.parse(currentTime) + 30 * 24 * 60 * 60 * 1000, - ).toISOString(); + const timeMin = new Date(Date.parse(currentTime) - 100 * 24 * 60 * 60 * 1000).toISOString(); + const timeMax = new Date(Date.parse(currentTime) + 30 * 24 * 60 * 60 * 1000).toISOString(); const eventsList = await calendar.events.list({ calendarId: process.env.CALENDAR_ID, - timeMax: timeMax, - timeMin: timeMin, + timeMax, + timeMin }); eventsItems = eventsList.data.items.map((e) => { @@ -44,9 +38,8 @@ async function buildMeetings(writePath) { url: e.extendedProperties?.private && `https://github.com/asyncapi/community/issues/${e.extendedProperties.private.ISSUE_ID}`, - banner: - e.extendedProperties?.private && e.extendedProperties.private.BANNER, - date: new Date(e.start.dateTime), + banner: e.extendedProperties?.private && e.extendedProperties.private.BANNER, + date: new Date(e.start.dateTime) }; }); diff --git a/scripts/build-newsroom-videos.js b/scripts/build-newsroom-videos.js index 496eba2de769..40ad1617362e 100644 --- a/scripts/build-newsroom-videos.js +++ b/scripts/build-newsroom-videos.js @@ -5,16 +5,15 @@ const fetch = require('node-fetch-2'); async function buildNewsroomVideos(writePath) { try { const response = await fetch( - 'https://youtube.googleapis.com/youtube/v3/search?' + - new URLSearchParams({ - key: process.env.YOUTUBE_TOKEN, - part: 'snippet', - channelId: 'UCIz9zGwDLbrYQcDKVXdOstQ', - eventType: 'completed', - type: 'video', - order: 'Date', - maxResults: 5, - }), + `https://youtube.googleapis.com/youtube/v3/search?${new URLSearchParams({ + key: process.env.YOUTUBE_TOKEN, + part: 'snippet', + channelId: 'UCIz9zGwDLbrYQcDKVXdOstQ', + eventType: 'completed', + type: 'video', + order: 'Date', + maxResults: 5 + })}` ); if (!response.ok) { @@ -32,7 +31,7 @@ async function buildNewsroomVideos(writePath) { image_url: video.snippet.thumbnails.high.url, title: video.snippet.title, description: video.snippet.description, - videoId: video.id.videoId, + videoId: video.id.videoId })); const videoData = JSON.stringify(videoDataItems, null, ' '); diff --git a/scripts/build-post-list.js b/scripts/build-post-list.js index dc249c6e2a43..3cfee35032ec 100644 --- a/scripts/build-post-list.js +++ b/scripts/build-post-list.js @@ -1,10 +1,4 @@ -const { - readdirSync, - statSync, - existsSync, - readFileSync, - writeFileSync, -} = require('fs'); +const { readdirSync, statSync, existsSync, readFileSync, writeFileSync } = require('fs'); const { resolve, basename } = require('path'); const frontMatter = require('gray-matter'); const toc = require('markdown-toc'); @@ -18,7 +12,7 @@ const result = { docs: [], blog: [], about: [], - docsTree: {}, + docsTree: {} }; const releaseNotes = []; const basePath = 'pages'; @@ -26,47 +20,35 @@ const postDirectories = [ // order of these directories is important, as the blog should come before docs, to create a list of available release notes, which will later be used to release-note-link for spec docs [`${basePath}/blog`, '/blog'], [`${basePath}/docs`, '/docs'], - [`${basePath}/about`, '/about'], + [`${basePath}/about`, '/about'] ]; const addItem = (details) => { - if (details.slug.startsWith('/docs')) result['docs'].push(details); - else if (details.slug.startsWith('/blog')) result['blog'].push(details); - else if (details.slug.startsWith('/about')) result['about'].push(details); + if (details.slug.startsWith('/docs')) result.docs.push(details); + else if (details.slug.startsWith('/blog')) result.blog.push(details); + else if (details.slug.startsWith('/about')) result.about.push(details); else { } }; module.exports = async function buildPostList() { walkDirectories(postDirectories, result); - const treePosts = buildNavTree( - result['docs'].filter((p) => p.slug.startsWith('/docs/')), - ); - result['docsTree'] = treePosts; - result['docs'] = addDocButtons(result['docs'], treePosts); + const treePosts = buildNavTree(result.docs.filter((p) => p.slug.startsWith('/docs/'))); + result.docsTree = treePosts; + result.docs = addDocButtons(result.docs, treePosts); if (process.env.NODE_ENV === 'production') { // console.log(inspect(result, { depth: null, colors: true })) } - writeFileSync( - resolve(__dirname, '..', 'config', 'posts.json'), - JSON.stringify(result, null, ' '), - ); + writeFileSync(resolve(__dirname, '..', 'config', 'posts.json'), JSON.stringify(result, null, ' ')); }; -function walkDirectories( - directories, - result, - sectionWeight = 0, - sectionTitle, - sectionId, - rootSectionId, -) { - for (let dir of directories) { - let directory = dir[0]; - let sectionSlug = dir[1] || ''; - let files = readdirSync(directory); +function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, sectionId, rootSectionId) { + for (const dir of directories) { + const directory = dir[0]; + const sectionSlug = dir[1] || ''; + const files = readdirSync(directory); - for (let file of files) { + for (const file of files) { let details; const fileName = [directory, file].join('/'); const fileNameWithSection = [fileName, '_section.mdx'].join('/'); @@ -75,14 +57,11 @@ function walkDirectories( if (isDirectory(fileName)) { if (existsSync(fileNameWithSection)) { // Passing a second argument to frontMatter disables cache. See https://github.com/asyncapi/website/issues/1057 - details = frontMatter( - readFileSync(fileNameWithSection, 'utf-8'), - {}, - ).data; + details = frontMatter(readFileSync(fileNameWithSection, 'utf-8'), {}).data; details.title = details.title || capitalize(basename(fileName)); } else { details = { - title: capitalize(basename(fileName)), + title: capitalize(basename(fileName)) }; } details.isSection = true; @@ -98,14 +77,7 @@ function walkDirectories( details.slug = slug; addItem(details); const rootId = details.parent || details.rootSectionId; - walkDirectories( - [[fileName, slug]], - result, - details.weight, - details.title, - details.sectionId, - rootId, - ); + walkDirectories([[fileName, slug]], result, details.weight, details.title, details.sectionId, rootId); } else if (file.endsWith('.mdx') && !fileName.endsWith('/_section.mdx')) { const fileContent = readFileSync(fileName, 'utf-8'); // Passing a second argument to frontMatter disables cache. See https://github.com/asyncapi/website/issues/1057 @@ -113,8 +85,7 @@ function walkDirectories( details = data; details.toc = toc(content, { slugify: slugifyToC }).json; details.readingTime = Math.ceil(readingTime(content).minutes); - details.excerpt = - details.excerpt || markdownToTxt(content).substr(0, 200); + details.excerpt = details.excerpt || markdownToTxt(content).substr(0, 200); details.sectionSlug = sectionSlug || slug.replace(/\.mdx$/, ''); details.sectionWeight = sectionWeight; details.sectionTitle = sectionTitle; @@ -122,13 +93,8 @@ function walkDirectories( details.rootSectionId = rootSectionId; details.id = fileName; details.isIndex = fileName.endsWith('/index.mdx'); - details.slug = details.isIndex - ? sectionSlug - : slug.replace(/\.mdx$/, ''); - if ( - details.slug.includes('/reference/specification/') && - !details.title - ) { + details.slug = details.isIndex ? sectionSlug : slug.replace(/\.mdx$/, ''); + if (details.slug.includes('/reference/specification/') && !details.title) { const fileBaseName = basename(data.slug); // ex. v2.0.0 | v2.1.0-next-spec.1 const fileName = fileBaseName.split('-')[0]; // v2.0.0 | v2.1.0 details.weight = specWeight--; @@ -143,10 +109,7 @@ function walkDirectories( details.releaseNoteLink = `/blog/release-notes-${details.title}`; } - if ( - fileBaseName.includes('next-spec') || - fileBaseName.includes('next-major-spec') - ) { + if (fileBaseName.includes('next-spec') || fileBaseName.includes('next-major-spec')) { details.isPrerelease = true; // this need to be separate because the `-` in "Pre-release" will get removed by `capitalize()` function details.title += ' (Pre-release)'; @@ -160,9 +123,7 @@ function walkDirectories( if (file.startsWith('release-notes') && dir[1] === '/blog') { const fileName_without_extension = file.slice(0, -4); // removes the file extension. For example, release-notes-2.1.0.md -> release-notes-2.1.0 - const version = fileName_without_extension.slice( - fileName_without_extension.lastIndexOf('-') + 1, - ); + const version = fileName_without_extension.slice(fileName_without_extension.lastIndexOf('-') + 1); // gets the version from the name of the releaseNote .md file (from /blog). For example, version = 2.1.0 if fileName_without_extension = release-notes-2.1.0 releaseNotes.push(version); diff --git a/scripts/build-rss.js b/scripts/build-rss.js index 46c668119c6a..75195ea53ccf 100644 --- a/scripts/build-rss.js +++ b/scripts/build-rss.js @@ -29,9 +29,7 @@ module.exports = async function rssFeed(type, title, desc, outputPath) { }); if (missingDatePosts.length > 0) { - throw new Error( - `Missing date in posts: ${missingDatePosts.map((p) => p.title || p.slug).join(', ')}`, - ); + throw new Error(`Missing date in posts: ${missingDatePosts.map((p) => p.title || p.slug).join(', ')}`); } const base = 'https://www.asyncapi.com'; @@ -56,17 +54,13 @@ module.exports = async function rssFeed(type, title, desc, outputPath) { rss.channel.generator = 'next.js'; rss.channel.item = []; - const invalidPosts = posts.filter( - (post) => !post.title || !post.slug || !post.excerpt || !post.date, - ); + const invalidPosts = posts.filter((post) => !post.title || !post.slug || !post.excerpt || !post.date); if (invalidPosts.length > 0) { - throw new Error( - `Missing required fields in posts: ${invalidPosts.map((p) => p.title || p.slug).join(', ')}`, - ); + throw new Error(`Missing required fields in posts: ${invalidPosts.map((p) => p.title || p.slug).join(', ')}`); } - for (let post of posts) { + for (const post of posts) { const link = `${base}${post.slug}${tracking}`; const { title, excerpt, date } = post; const pubDate = new Date(date).toUTCString(); @@ -78,7 +72,7 @@ module.exports = async function rssFeed(type, title, desc, outputPath) { link, category: type, guid, - pubDate, + pubDate }; if (post.cover) { const enclosure = {}; @@ -86,7 +80,7 @@ module.exports = async function rssFeed(type, title, desc, outputPath) { enclosure['@length'] = 15026; // dummy value, anything works enclosure['@type'] = 'image/jpeg'; if (typeof enclosure['@url'] === 'string') { - let tmp = enclosure['@url'].toLowerCase(); + const tmp = enclosure['@url'].toLowerCase(); if (tmp.indexOf('.png') >= 0) enclosure['@type'] = 'image/png'; if (tmp.indexOf('.svg') >= 0) enclosure['@type'] = 'image/svg+xml'; if (tmp.indexOf('.webp') >= 0) enclosure['@type'] = 'image/webp'; diff --git a/scripts/build-tools.js b/scripts/build-tools.js index 30404a2d015f..83db76534f11 100644 --- a/scripts/build-tools.js +++ b/scripts/build-tools.js @@ -1,30 +1,17 @@ +const fs = require('fs-extra'); +const { resolve } = require('path'); const { getData } = require('./tools/extract-tools-github'); const { convertTools } = require('./tools/tools-object'); const { combineTools } = require('./tools/combine-tools'); -const fs = require('fs-extra'); -const { resolve } = require('path'); -const buildTools = async ( - automatedToolsPath, - manualToolsPath, - toolsPath, - tagsPath, -) => { +const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPath) => { try { - let githubExtractData = await getData(); - let automatedTools = await convertTools(githubExtractData); + const githubExtractData = await getData(); + const automatedTools = await convertTools(githubExtractData); - await fs.writeFile( - automatedToolsPath, - JSON.stringify(automatedTools, null, ' '), - ); + await fs.writeFile(automatedToolsPath, JSON.stringify(automatedTools, null, ' ')); - await combineTools( - automatedTools, - require(manualToolsPath), - toolsPath, - tagsPath, - ); + await combineTools(automatedTools, require(manualToolsPath), toolsPath, tagsPath); } catch (err) { throw new Error(`An error occurred while building tools: ${err.message}`); } @@ -32,11 +19,7 @@ const buildTools = async ( /* istanbul ignore next */ if (require.main === module) { - const automatedToolsPath = resolve( - __dirname, - '../config', - 'tools-automated.json', - ); + const automatedToolsPath = resolve(__dirname, '../config', 'tools-automated.json'); const manualToolsPath = resolve(__dirname, '../config', 'tools-manual.json'); const toolsPath = resolve(__dirname, '../config', 'tools.json'); const tagsPath = resolve(__dirname, '../config', 'all-tags.json'); diff --git a/scripts/casestudies/index.js b/scripts/casestudies/index.js index 3ff9e415f525..22011781f1be 100644 --- a/scripts/casestudies/index.js +++ b/scripts/casestudies/index.js @@ -1,14 +1,11 @@ const { readdir, writeFile, readFile } = require('fs').promises; -const { convertToJson } = require('../../scripts/utils'); +const { convertToJson } = require('../utils'); -module.exports = async function buildCaseStudiesList( - dirWithCaseStudy, - writeFilePath, -) { +module.exports = async function buildCaseStudiesList(dirWithCaseStudy, writeFilePath) { try { - let files = await readdir(dirWithCaseStudy); - let caseStudiesList = []; - for (let file of files) { + const files = await readdir(dirWithCaseStudy); + const caseStudiesList = []; + for (const file of files) { const caseStudyFileName = [dirWithCaseStudy, file].join('/'); const caseStudyContent = await readFile(caseStudyFileName, 'utf-8'); const jsonContent = convertToJson(caseStudyContent); diff --git a/scripts/compose.js b/scripts/compose.js index 00d262019428..18d8d724420d 100644 --- a/scripts/compose.js +++ b/scripts/compose.js @@ -8,15 +8,11 @@ const dedent = require('dedent'); const moment = require('moment'); const genFrontMatter = (answers) => { - let d = new Date(); - const date = [ - d.getFullYear(), - ('0' + (d.getMonth() + 1)).slice(-2), - ('0' + d.getDate()).slice(-2), - ].join('-'); + const d = new Date(); + const date = [d.getFullYear(), `0${d.getMonth() + 1}`.slice(-2), `0${d.getDate()}`.slice(-2)].join('-'); const tagArray = answers.tags.split(','); tagArray.forEach((tag, index) => (tagArray[index] = tag.trim())); - const tags = "'" + tagArray.join("','") + "'"; + const tags = `'${tagArray.join("','")}'`; let frontMatter = dedent`--- title: ${answers.title ? answers.title : 'Untitled'} @@ -92,7 +88,7 @@ const genFrontMatter = (answers) => { `; - frontMatter = frontMatter + '\n---'; + frontMatter += '\n---'; return frontMatter; }; @@ -102,36 +98,29 @@ inquirer { name: 'title', message: 'Enter post title:', - type: 'input', + type: 'input' }, { name: 'excerpt', message: 'Enter post excerpt:', - type: 'input', + type: 'input' }, { name: 'tags', message: 'Any Tags? Separate them with , or leave empty if no tags.', - type: 'input', + type: 'input' }, { name: 'type', message: 'Enter the post type:', type: 'list', - choices: [ - 'Communication', - 'Community', - 'Engineering', - 'Marketing', - 'Strategy', - 'Video', - ], + choices: ['Communication', 'Community', 'Engineering', 'Marketing', 'Strategy', 'Video'] }, { name: 'canonical', message: 'Enter the canonical URL if any:', - type: 'input', - }, + type: 'input' + } ]) .then((answers) => { // Remove special characters and replace space with - @@ -141,7 +130,7 @@ inquirer .replace(/ /g, '-') .replace(/-+/g, '-'); const frontMatter = genFrontMatter(answers); - const filePath = `pages/blog/${fileName ? fileName : 'untitled'}.md`; + const filePath = `pages/blog/${fileName || 'untitled'}.md`; fs.writeFile(filePath, frontMatter, { flag: 'wx' }, (err) => { if (err) { throw err; diff --git a/scripts/dashboard/build-dashboard.js b/scripts/dashboard/build-dashboard.js index cb07d85c2f5f..00e2049a6338 100644 --- a/scripts/dashboard/build-dashboard.js +++ b/scripts/dashboard/build-dashboard.js @@ -20,8 +20,8 @@ async function getDiscussions(query, pageSize, endCursor = null) { first: pageSize, after: endCursor, headers: { - authorization: `token ${process.env.GITHUB_TOKEN}`, - }, + authorization: `token ${process.env.GITHUB_TOKEN}` + } }); if (result.rateLimit.remaining <= 100) { @@ -30,7 +30,7 @@ async function getDiscussions(query, pageSize, endCursor = null) { `cost = ${result.rateLimit.cost}`, `limit = ${result.rateLimit.limit}`, `remaining = ${result.rateLimit.remaining}`, - `resetAt = ${result.rateLimit.resetAt}`, + `resetAt = ${result.rateLimit.resetAt}` ); } @@ -41,9 +41,7 @@ async function getDiscussions(query, pageSize, endCursor = null) { if (!hasNextPage) { return result.search.nodes; } - return result.search.nodes.concat( - await getDiscussions(query, pageSize, result.search.pageInfo.endCursor), - ); + return result.search.nodes.concat(await getDiscussions(query, pageSize, result.search.pageInfo.endCursor)); } catch (e) { console.error(e); return Promise.reject(e); @@ -52,15 +50,12 @@ async function getDiscussions(query, pageSize, endCursor = null) { async function getDiscussionByID(isPR, id) { try { - const result = await graphql( - isPR ? Queries.pullRequestById : Queries.issueById, - { - id, - headers: { - authorization: `token ${process.env.GITHUB_TOKEN}`, - }, - }, - ); + const result = await graphql(isPR ? Queries.pullRequestById : Queries.issueById, { + id, + headers: { + authorization: `token ${process.env.GITHUB_TOKEN}` + } + }); return result; } catch (e) { @@ -75,28 +70,19 @@ async function processHotDiscussions(batch) { try { const isPR = discussion.__typename === 'PullRequest'; if (discussion.comments.pageInfo.hasNextPage) { - const fetchedDiscussion = await getDiscussionByID( - isPR, - discussion.id, - ); + const fetchedDiscussion = await getDiscussionByID(isPR, discussion.id); discussion = fetchedDiscussion.node; } const interactionsCount = discussion.reactions.totalCount + discussion.comments.totalCount + - discussion.comments.nodes.reduce( - (acc, curr) => acc + curr.reactions.totalCount, - 0, - ); + discussion.comments.nodes.reduce((acc, curr) => acc + curr.reactions.totalCount, 0); const finalInteractionsCount = isPR ? interactionsCount + discussion.reviews.totalCount + - discussion.reviews.nodes.reduce( - (acc, curr) => acc + curr.comments.totalCount, - 0, - ) + discussion.reviews.nodes.reduce((acc, curr) => acc + curr.comments.totalCount, 0) : interactionsCount; return { @@ -108,17 +94,13 @@ async function processHotDiscussions(batch) { resourcePath: discussion.resourcePath, repo: `asyncapi/${discussion.repository.name}`, labels: discussion.labels ? discussion.labels.nodes : [], - score: - finalInteractionsCount / - (monthsSince(discussion.timelineItems.updatedAt) + 2) ** 1.8, + score: finalInteractionsCount / (monthsSince(discussion.timelineItems.updatedAt) + 2) ** 1.8 }; } catch (e) { - console.error( - `there were some issues while parsing this item: ${JSON.stringify(discussion)}`, - ); + console.error(`there were some issues while parsing this item: ${JSON.stringify(discussion)}`); throw e; } - }), + }) ); } @@ -134,9 +116,7 @@ async function getHotDiscussions(discussions) { } result.sort((ElemA, ElemB) => ElemB.score - ElemA.score); - const filteredResult = result.filter( - (issue) => issue.author !== 'asyncapi-bot', - ); + const filteredResult = result.filter((issue) => issue.author !== 'asyncapi-bot'); return filteredResult.slice(0, 12); } @@ -146,7 +126,7 @@ async function writeToFile(content, writePath) { } catch (error) { console.error('Failed to write dashboard data:', { error: error.message, - writePath, + writePath }); throw error; } @@ -162,17 +142,13 @@ async function mapGoodFirstIssues(issues) { author: issue.author.login, area: getLabel(issue, 'area/') || 'Unknown', labels: issue.labels.nodes.filter( - (label) => - !label.name.startsWith('area/') && - !label.name.startsWith('good first issue'), - ), + (label) => !label.name.startsWith('area/') && !label.name.startsWith('good first issue') + ) })); } function getLabel(issue, filter) { - const result = issue.labels.nodes.find((label) => - label.name.startsWith(filter), - ); + const result = issue.labels.nodes.find((label) => label.name.startsWith(filter)); return result?.name.split('/')[1]; } @@ -187,14 +163,11 @@ async function start(writePath) { try { const issues = await getDiscussions(Queries.hotDiscussionsIssues, 20); const PRs = await getDiscussions(Queries.hotDiscussionsPullRequests, 20); - const rawGoodFirstIssues = await getDiscussions( - Queries.goodFirstIssues, - 20, - ); + const rawGoodFirstIssues = await getDiscussions(Queries.goodFirstIssues, 20); const discussions = issues.concat(PRs); const [hotDiscussions, goodFirstIssues] = await Promise.all([ getHotDiscussions(discussions), - mapGoodFirstIssues(rawGoodFirstIssues), + mapGoodFirstIssues(rawGoodFirstIssues) ]); return await writeToFile({ hotDiscussions, goodFirstIssues }, writePath); } catch (e) { @@ -217,5 +190,5 @@ module.exports = { getDiscussions, writeToFile, start, - processHotDiscussions, + processHotDiscussions }; diff --git a/scripts/dashboard/issue-queries.js b/scripts/dashboard/issue-queries.js index 629214a9ea90..4b2e5a87853c 100644 --- a/scripts/dashboard/issue-queries.js +++ b/scripts/dashboard/issue-queries.js @@ -274,5 +274,5 @@ query($first: Int!, $after: String) { resetAt } } -`, +` }); diff --git a/scripts/finance/index.js b/scripts/finance/index.js index af3cf0a80f60..c5ab35346c0d 100644 --- a/scripts/finance/index.js +++ b/scripts/finance/index.js @@ -1,39 +1,16 @@ const { - promises: { mkdir }, + promises: { mkdir } } = require('fs'); const { resolve } = require('path'); const writeJSON = require('../utils/readAndWriteJson.js'); -module.exports = async function buildFinanceInfoList({ - currentDir, - configDir, - financeDir, - year, - jsonDataDir, -}) { +module.exports = async function buildFinanceInfoList({ currentDir, configDir, financeDir, year, jsonDataDir }) { try { - const expensesPath = resolve( - currentDir, - configDir, - financeDir, - year, - 'Expenses.yml', - ); - const expensesLinkPath = resolve( - currentDir, - configDir, - financeDir, - year, - 'ExpensesLink.yml', - ); + const expensesPath = resolve(currentDir, configDir, financeDir, year, 'Expenses.yml'); + const expensesLinkPath = resolve(currentDir, configDir, financeDir, year, 'ExpensesLink.yml'); // Ensure the directory exists before writing the files - const jsonDirectory = resolve( - currentDir, - configDir, - financeDir, - jsonDataDir, - ); + const jsonDirectory = resolve(currentDir, configDir, financeDir, jsonDataDir); await mkdir(jsonDirectory, { recursive: true }); // Write Expenses and ExpensesLink to JSON files diff --git a/scripts/index.js b/scripts/index.js index 0ae68666ce24..afe99ff7ca11 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -8,16 +8,8 @@ const buildFinanceInfoList = require('./finance'); async function start() { await buildPostList(); - rssFeed( - 'blog', - 'AsyncAPI Initiative Blog RSS Feed', - 'AsyncAPI Initiative Blog', - 'rss.xml', - ); - await buildCaseStudiesList( - 'config/casestudies', - resolve(__dirname, '../config', 'case-studies.json'), - ); + rssFeed('blog', 'AsyncAPI Initiative Blog RSS Feed', 'AsyncAPI Initiative Blog', 'rss.xml'); + await buildCaseStudiesList('config/casestudies', resolve(__dirname, '../config', 'case-studies.json')); await buildAdoptersList(); const financeDir = resolve('.', 'config', 'finance'); @@ -44,7 +36,7 @@ async function start() { configDir: 'config', financeDir: 'finance', year: latestYear, - jsonDataDir: 'json-data', + jsonDataDir: 'json-data' }); } diff --git a/scripts/markdown/check-markdown.js b/scripts/markdown/check-markdown.js index 001a210a2a77..7088a1c4d0fc 100644 --- a/scripts/markdown/check-markdown.js +++ b/scripts/markdown/check-markdown.js @@ -23,14 +23,7 @@ function isValidURL(str) { * @returns {string[]|null} An array of validation error messages, or null if no errors. */ function validateBlogs(frontmatter) { - const requiredAttributes = [ - 'title', - 'date', - 'type', - 'tags', - 'cover', - 'authors', - ]; + const requiredAttributes = ['title', 'date', 'type', 'tags', 'cover', 'authors']; const errors = []; // Check for required attributes @@ -65,9 +58,7 @@ function validateBlogs(frontmatter) { errors.push(`Author at index ${index} is missing a name`); } if (author.link && !isValidURL(author.link)) { - errors.push( - `Invalid URL for author at index ${index}: ${author.link}`, - ); + errors.push(`Invalid URL for author at index ${index}: ${author.link}`); } if (!author.photo) { errors.push(`Author at index ${index} is missing a photo`); @@ -94,10 +85,7 @@ function validateDocs(frontmatter) { } // Check if weight exists and is a number - if ( - frontmatter.weight === undefined || - typeof frontmatter.weight !== 'number' - ) { + if (frontmatter.weight === undefined || typeof frontmatter.weight !== 'number') { errors.push('Weight is missing or not a number'); } diff --git a/scripts/tools/categorylist.js b/scripts/tools/categorylist.js index 15323b1606aa..dc81be15a320 100644 --- a/scripts/tools/categorylist.js +++ b/scripts/tools/categorylist.js @@ -3,117 +3,104 @@ const categoryList = [ { name: 'APIs', tag: 'api', - description: - 'The following is a list of APIs that expose functionality related to AsyncAPI.', + description: 'The following is a list of APIs that expose functionality related to AsyncAPI.' }, { name: 'Code-first tools', tag: 'code-first', - description: - 'The following is a list of tools that generate AsyncAPI documents from your code.', + description: 'The following is a list of tools that generate AsyncAPI documents from your code.' }, { name: 'Code Generators', tag: 'code-generator', description: - 'The following is a list of tools that generate code from an AsyncAPI document; not the other way around.', + 'The following is a list of tools that generate code from an AsyncAPI document; not the other way around.' }, { name: 'Converters', tag: 'converter', description: - 'The following is a list of tools that do not yet belong to any specific category but are also useful for the community.', + 'The following is a list of tools that do not yet belong to any specific category but are also useful for the community.' }, { name: 'Directories', tag: 'directory', - description: - 'The following is a list of directories that index public AsyncAPI documents.', + description: 'The following is a list of directories that index public AsyncAPI documents.' }, { name: 'Documentation Generators', tag: 'documentation-generator', description: - 'The following is a list of tools that generate human-readable documentation from an AsyncAPI document.', + 'The following is a list of tools that generate human-readable documentation from an AsyncAPI document.' }, { name: 'Editors', tag: 'editor', - description: - 'The following is a list of editors or related tools that allow editing of AsyncAPI document.', + description: 'The following is a list of editors or related tools that allow editing of AsyncAPI document.' }, { name: 'UI components', tag: 'ui-component', - description: - 'The following is a list of UI components to view AsyncAPI documents.', + description: 'The following is a list of UI components to view AsyncAPI documents.' }, { name: 'DSL', tag: 'dsl', description: - "Writing YAML by hand is no fun, and maybe you don't want a GUI, so use a Domain Specific Language to write AsyncAPI in your language of choice.", + "Writing YAML by hand is no fun, and maybe you don't want a GUI, so use a Domain Specific Language to write AsyncAPI in your language of choice." }, { name: 'Frameworks', tag: 'framework', - description: - 'The following is a list of API/application frameworks that make use of AsyncAPI.', + description: 'The following is a list of API/application frameworks that make use of AsyncAPI.' }, { name: 'GitHub Actions', tag: 'github-action', - description: - 'The following is a list of GitHub Actions that you can use in your workflows', + description: 'The following is a list of GitHub Actions that you can use in your workflows' }, { name: 'Mocking and Testing', tag: 'mocking-and-testing', description: - 'The tools below take specification documents as input, then publish fake messages to broker destinations for simulation purposes. They may also check that publisher messages are compliant with schemas.', + 'The tools below take specification documents as input, then publish fake messages to broker destinations for simulation purposes. They may also check that publisher messages are compliant with schemas.' }, { name: 'Validators', tag: 'validator', - description: - 'The following is a list of tools that validate AsyncAPI documents.', + description: 'The following is a list of tools that validate AsyncAPI documents.' }, { name: 'Compare tools', tag: 'compare-tool', - description: - 'The following is a list of tools that compare AsyncAPI documents.', + description: 'The following is a list of tools that compare AsyncAPI documents.' }, { name: 'CLIs', tag: 'cli', - description: - 'The following is a list of tools that you can work with in terminal or do some CI/CD automation.', + description: 'The following is a list of tools that you can work with in terminal or do some CI/CD automation.' }, { name: 'Bundlers', tag: 'bundler', - description: - 'The following is a list of tools that you can work with to bundle AsyncAPI documents.', + description: 'The following is a list of tools that you can work with to bundle AsyncAPI documents.' }, { name: 'IDE Extensions', tag: 'ide-extension', - description: - 'The following is a list of extensions for different IDEs like VSCode, IntelliJ IDEA and others', + description: 'The following is a list of extensions for different IDEs like VSCode, IntelliJ IDEA and others' }, { name: 'AsyncAPI Generator Templates', tag: 'generator-template', description: - 'The following is a list of templates compatible with AsyncAPI Generator. You can use them to generate apps, clients or documentation from your AsyncAPI documents.', + 'The following is a list of templates compatible with AsyncAPI Generator. You can use them to generate apps, clients or documentation from your AsyncAPI documents.' }, { name: 'Others', tag: 'other', - description: - 'The following is a list of tools that comes under Other category.', - }, + description: 'The following is a list of tools that comes under Other category.' + } ]; module.exports = { categoryList }; diff --git a/scripts/tools/combine-tools.js b/scripts/tools/combine-tools.js index 34980f1abd61..01be1ec876dc 100644 --- a/scripts/tools/combine-tools.js +++ b/scripts/tools/combine-tools.js @@ -1,20 +1,21 @@ -const { languagesColor, technologiesColor } = require('./tags-color'); -const { categoryList } = require('./categorylist.js'); -const { createToolObject } = require('./tools-object'); const fs = require('fs'); -const schema = require('./tools-schema.json'); const Ajv = require('ajv'); const addFormats = require('ajv-formats'); const Fuse = require('fuse.js'); +const { languagesColor, technologiesColor } = require('./tags-color'); +const { categoryList } = require('./categorylist.js'); +const { createToolObject } = require('./tools-object'); +const schema = require('./tools-schema.json'); + const ajv = new Ajv(); addFormats(ajv, ['uri']); const validate = ajv.compile(schema); -let finalTools = {}; -for (var category of categoryList) { +const finalTools = {}; +for (const category of categoryList) { finalTools[category.name] = { description: category.description, - toolsList: [], + toolsList: [] }; } @@ -23,37 +24,35 @@ const options = { includeScore: true, shouldSort: true, threshold: 0.39, - keys: ['name', 'color', 'borderColor'], + keys: ['name', 'color', 'borderColor'] }; // Two seperate lists and Fuse objects initialised to search languages and technologies tags // from specified list of same. -let languageList = [...languagesColor], - technologyList = [...technologiesColor]; -let languageFuse = new Fuse(languageList, options), - technologyFuse = new Fuse(technologyList, options); +const languageList = [...languagesColor]; +const technologyList = [...technologiesColor]; +let languageFuse = new Fuse(languageList, options); +let technologyFuse = new Fuse(technologyList, options); // takes individual tool object and inserts borderColor and backgroundColor of the tags of // languages and technologies, for Tool Card in website. const getFinalTool = async (toolObject) => { - let finalObject = toolObject; + const finalObject = toolObject; - //there might be a tool without language + // there might be a tool without language if (toolObject.filters.language) { - let languageArray = []; + const languageArray = []; if (typeof toolObject.filters.language === 'string') { - const languageSearch = await languageFuse.search( - toolObject.filters.language, - ); + const languageSearch = await languageFuse.search(toolObject.filters.language); if (languageSearch.length) { languageArray.push(languageSearch[0].item); } else { // adds a new language object in the Fuse list as well as in tool object // so that it isn't missed out in the UI. - let languageObject = { + const languageObject = { name: toolObject.filters.language, color: 'bg-[#57f281]', - borderColor: 'border-[#37f069]', + borderColor: 'border-[#37f069]' }; languageList.push(languageObject); languageArray.push(languageObject); @@ -67,10 +66,10 @@ const getFinalTool = async (toolObject) => { } else { // adds a new language object in the Fuse list as well as in tool object // so that it isn't missed out in the UI. - let languageObject = { + const languageObject = { name: language, color: 'bg-[#57f281]', - borderColor: 'border-[#37f069]', + borderColor: 'border-[#37f069]' }; languageList.push(languageObject); languageArray.push(languageObject); @@ -80,7 +79,7 @@ const getFinalTool = async (toolObject) => { } finalObject.filters.language = languageArray; } - let technologyArray = []; + const technologyArray = []; if (toolObject.filters.technology) { for (const technology of toolObject?.filters?.technology) { const technologySearch = await technologyFuse.search(technology); @@ -89,10 +88,10 @@ const getFinalTool = async (toolObject) => { } else { // adds a new technology object in the Fuse list as well as in tool object // so that it isn't missed out in the UI. - let technologyObject = { + const technologyObject = { name: technology, color: 'bg-[#61d0f2]', - borderColor: 'border-[#40ccf7]', + borderColor: 'border-[#40ccf7]' }; technologyList.push(technologyObject); technologyArray.push(technologyObject); @@ -106,14 +105,9 @@ const getFinalTool = async (toolObject) => { // Combine the automated tools and manual tools list into single JSON object file, and // lists down all the language and technology tags in one JSON file. -const combineTools = async ( - automatedTools, - manualTools, - toolsPath, - tagsPath, -) => { +const combineTools = async (automatedTools, manualTools, toolsPath, tagsPath) => { for (const key in automatedTools) { - let finalToolsList = []; + const finalToolsList = []; if (automatedTools[key].toolsList.length) { for (const tool of automatedTools[key].toolsList) { finalToolsList.push(await getFinalTool(tool)); @@ -126,35 +120,23 @@ const combineTools = async ( if (isValid) { if (tool?.links?.repoUrl) { const url = new URL(tool.links.repoUrl); - isAsyncAPIrepo = url.href.startsWith( - 'https://github.com/asyncapi/', - ); + isAsyncAPIrepo = url.href.startsWith('https://github.com/asyncapi/'); } else isAsyncAPIrepo = false; - let toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); + const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); finalToolsList.push(await getFinalTool(toolObject)); } else { - console.error( - 'Script is not failing, it is just dropping errors for further investigation', - ); + console.error('Script is not failing, it is just dropping errors for further investigation'); console.error(`Invalid ${tool.title} .asyncapi-tool file.`); console.error(`Located in manual-tools.json file`); - console.error( - 'Validation errors:', - JSON.stringify(validate.errors, null, 2), - ); + console.error('Validation errors:', JSON.stringify(validate.errors, null, 2)); } } } - finalToolsList.sort((tool, anotherTool) => - tool.title.localeCompare(anotherTool.title), - ); + finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); finalTools[key].toolsList = finalToolsList; } fs.writeFileSync(toolsPath, JSON.stringify(finalTools)); - fs.writeFileSync( - tagsPath, - JSON.stringify({ languages: languageList, technologies: technologyList }), - ); + fs.writeFileSync(tagsPath, JSON.stringify({ languages: languageList, technologies: technologyList })); }; module.exports = { combineTools }; diff --git a/scripts/tools/extract-tools-github.js b/scripts/tools/extract-tools-github.js index 567a8077be4b..1db138a95add 100644 --- a/scripts/tools/extract-tools-github.js +++ b/scripts/tools/extract-tools-github.js @@ -3,15 +3,12 @@ require('dotenv').config(); const getData = async () => { try { - const result = await axios.get( - 'https://api.github.com/search/code?q=filename:.asyncapi-tool', - { - headers: { - accept: 'application/vnd.github.text-match+json', - authorization: `token ${process.env.GITHUB_TOKEN}`, - }, - }, - ); + const result = await axios.get('https://api.github.com/search/code?q=filename:.asyncapi-tool', { + headers: { + accept: 'application/vnd.github.text-match+json', + authorization: `token ${process.env.GITHUB_TOKEN}` + } + }); return result.data; } catch (err) { diff --git a/scripts/tools/tags-color.js b/scripts/tools/tags-color.js index 5897fcab5837..3483de2b0b08 100644 --- a/scripts/tools/tags-color.js +++ b/scripts/tools/tags-color.js @@ -3,176 +3,176 @@ const languagesColor = [ { name: 'Go/Golang', color: 'bg-[#8ECFDF]', - borderColor: 'border-[#00AFD9]', + borderColor: 'border-[#00AFD9]' }, { name: 'Java', color: 'bg-[#ECA2A4]', - borderColor: 'border-[#EC2125]', + borderColor: 'border-[#EC2125]' }, { name: 'JavaScript', color: 'bg-[#F2F1C7]', - borderColor: 'border-[#BFBE86]', + borderColor: 'border-[#BFBE86]' }, { name: 'HTML', color: 'bg-[#E2A291]', - borderColor: 'border-[#E44D26]', + borderColor: 'border-[#E44D26]' }, { name: 'C/C++', color: 'bg-[#93CDEF]', - borderColor: 'border-[#0080CC]', + borderColor: 'border-[#0080CC]' }, { name: 'C#', color: 'bg-[#E3AFE0]', - borderColor: 'border-[#9B4F96]', + borderColor: 'border-[#9B4F96]' }, { name: 'Python', color: 'bg-[#A8D0EF]', - borderColor: 'border-[#3878AB]', + borderColor: 'border-[#3878AB]' }, { name: 'TypeScript', color: 'bg-[#7DBCFE]', - borderColor: 'border-[#2C78C7]', + borderColor: 'border-[#2C78C7]' }, { name: 'Kotlin', color: 'bg-[#B1ACDF]', - borderColor: 'border-[#756BD9]', + borderColor: 'border-[#756BD9]' }, { name: 'Scala', color: 'bg-[#FFA299]', - borderColor: 'border-[#DF301F]', + borderColor: 'border-[#DF301F]' }, { name: 'Markdown', color: 'bg-[#BABEBF]', - borderColor: 'border-[#445B64]', + borderColor: 'border-[#445B64]' }, { name: 'YAML', color: 'bg-[#FFB764]', - borderColor: 'border-[#F1901F]', + borderColor: 'border-[#F1901F]' }, { name: 'R', color: 'bg-[#84B5ED]', - borderColor: 'border-[#246BBE]', + borderColor: 'border-[#246BBE]' }, { name: 'Ruby', color: 'bg-[#FF8289]', - borderColor: 'border-[#FF000F]', + borderColor: 'border-[#FF000F]' }, { name: 'Rust', color: 'bg-[#FFB8AA]', - borderColor: 'border-[#E43716]', + borderColor: 'border-[#E43716]' }, { name: 'Shell', color: 'bg-[#87D4FF]', - borderColor: 'border-[#389ED7]', + borderColor: 'border-[#389ED7]' }, { name: 'Groovy', color: 'bg-[#B6D5E5]', - borderColor: 'border-[#609DBC]', - }, + borderColor: 'border-[#609DBC]' + } ]; const technologiesColor = [ { name: 'Node.js', color: 'bg-[#BDFF67]', - borderColor: 'border-[#84CE24]', + borderColor: 'border-[#84CE24]' }, { name: 'Hermes', color: 'bg-[#8AEEBD]', - borderColor: 'border-[#2AB672]', + borderColor: 'border-[#2AB672]' }, { name: 'React JS', color: 'bg-[#9FECFA]', - borderColor: 'border-[#08D8FE]', + borderColor: 'border-[#08D8FE]' }, { name: '.NET', color: 'bg-[#A184FF]', - borderColor: 'border-[#5026D4]', + borderColor: 'border-[#5026D4]' }, { name: 'ASP.NET', color: 'bg-[#71C2FB]', - borderColor: 'border-[#1577BC]', + borderColor: 'border-[#1577BC]' }, { name: 'Springboot', color: 'bg-[#98E279]', - borderColor: 'border-[#68BC44]', + borderColor: 'border-[#68BC44]' }, { name: 'AWS', color: 'bg-[#FF9F59]', - borderColor: 'border-[#EF6703]', + borderColor: 'border-[#EF6703]' }, { name: 'Docker', color: 'bg-[#B8E0FF]', - borderColor: 'border-[#2596ED]', + borderColor: 'border-[#2596ED]' }, { name: 'Node-RED', color: 'bg-[#FF7474]', - borderColor: 'border-[#8F0101]', + borderColor: 'border-[#8F0101]' }, { name: 'Maven', color: 'bg-[#FF6B80]', - borderColor: 'border-[#CA1A33]', + borderColor: 'border-[#CA1A33]' }, { name: 'Saas', color: 'bg-[#6AB8EC]', - borderColor: 'border-[#2275AD]', + borderColor: 'border-[#2275AD]' }, { name: 'Kubernetes-native', color: 'bg-[#D7C7F2]', - borderColor: 'border-[#A387D2]', + borderColor: 'border-[#A387D2]' }, { name: 'Scala', color: 'bg-[#D7C7F2]', - borderColor: 'border-[#A387D2]', + borderColor: 'border-[#A387D2]' }, { name: 'Azure', color: 'bg-[#4B93FF]', - borderColor: 'border-[#015ADF]', + borderColor: 'border-[#015ADF]' }, { name: 'Jenkins', color: 'bg-[#D7C7F2]', - borderColor: 'border-[#A387D2]', + borderColor: 'border-[#A387D2]' }, { name: 'Flask', color: 'bg-[#D7C7F2]', - borderColor: 'border-[#A387D2]', + borderColor: 'border-[#A387D2]' }, { name: 'Nest Js', color: 'bg-[#E1224E]', - borderColor: 'border-[#B9012b]', - }, + borderColor: 'border-[#B9012b]' + } ]; module.exports = { languagesColor, technologiesColor }; diff --git a/scripts/tools/tools-object.js b/scripts/tools/tools-object.js index 9ef57e5cab31..57b152e49570 100644 --- a/scripts/tools/tools-object.js +++ b/scripts/tools/tools-object.js @@ -1,9 +1,10 @@ -const schema = require('./tools-schema.json'); const axios = require('axios'); const Ajv = require('ajv'); const addFormats = require('ajv-formats'); const Fuse = require('fuse.js'); +const schema = require('./tools-schema.json'); const { categoryList } = require('./categorylist'); + const ajv = new Ajv(); addFormats(ajv, ['uri']); const validate = ajv.compile(schema); @@ -14,7 +15,7 @@ const options = { includeScore: true, shouldSort: true, threshold: 0.4, - keys: ['tag'], + keys: ['tag'] }; const fuse = new Fuse(categoryList, options); @@ -24,28 +25,19 @@ const fuse = new Fuse(categoryList, options); // isAsyncAPIrepo boolean variable to define whether the tool repository is under // AsyncAPI organization or not, to create a JSON tool object as required in the frontend // side to show ToolCard. -const createToolObject = async ( - toolFile, - repositoryUrl = '', - repoDescription = '', - isAsyncAPIrepo = '', -) => { - let resultantObject = { +const createToolObject = async (toolFile, repositoryUrl = '', repoDescription = '', isAsyncAPIrepo = '') => { + const resultantObject = { title: toolFile.title, description: toolFile?.description ? toolFile.description : repoDescription, links: { ...toolFile.links, - repoUrl: toolFile?.links?.repoUrl - ? toolFile.links.repoUrl - : repositoryUrl, + repoUrl: toolFile?.links?.repoUrl ? toolFile.links.repoUrl : repositoryUrl }, filters: { ...toolFile.filters, - hasCommercial: toolFile?.filters?.hasCommercial - ? toolFile.filters.hasCommercial - : false, - isAsyncAPIOwner: isAsyncAPIrepo, - }, + hasCommercial: toolFile?.filters?.hasCommercial ? toolFile.filters.hasCommercial : false, + isAsyncAPIOwner: isAsyncAPIrepo + } }; return resultantObject; }; @@ -55,43 +47,43 @@ const createToolObject = async ( // and creating a JSON tool object in which all the tools are listed in defined // categories order, which is then updated in `automated-tools.json` file. async function convertTools(data) { - let finalToolsObject = {}; + const finalToolsObject = {}; const dataArray = data.items; // initialising finalToolsObject with all categories inside it with proper elements in each category - for (var index in categoryList) { + for (const index in categoryList) { finalToolsObject[categoryList[index].name] = { description: categoryList[index].description, - toolsList: [], + toolsList: [] }; } - for (let tool of dataArray) { + for (const tool of dataArray) { try { if (tool.name.startsWith('.asyncapi-tool')) { // extracting the reference id of the repository which will be used to extract the path of the .asyncapi-tool file in the Tools repository // ex: for a url = "https://api.github.com/repositories/351453552/contents/.asyncapi-tool?ref=61855e7365a881e98c2fe667a658a0005753d873" // the text (id) present after '=' gives us a reference id for the repo - let reference_id = tool.url.split('=')[1]; - let download_url = `https://raw.githubusercontent.com/${tool.repository.full_name}/${reference_id}/${tool.path}`; + const reference_id = tool.url.split('=')[1]; + const download_url = `https://raw.githubusercontent.com/${tool.repository.full_name}/${reference_id}/${tool.path}`; const { data: toolFileContent } = await axios.get(download_url); - //some stuff can be YAML + // some stuff can be YAML const jsonToolFileContent = await convertToJson(toolFileContent); - //validating against JSON Schema for tools file + // validating against JSON Schema for tools file const isValid = await validate(jsonToolFileContent); if (isValid) { - let repositoryUrl = tool.repository.html_url; - let repoDescription = tool.repository.description; - let isAsyncAPIrepo = tool.repository.owner.login === 'asyncapi'; - let toolObject = await createToolObject( + const repositoryUrl = tool.repository.html_url; + const repoDescription = tool.repository.description; + const isAsyncAPIrepo = tool.repository.owner.login === 'asyncapi'; + const toolObject = await createToolObject( jsonToolFileContent, repositoryUrl, repoDescription, - isAsyncAPIrepo, + isAsyncAPIrepo ); // Tool Object is appended to each category array according to Fuse search for categories inside Tool Object @@ -99,35 +91,20 @@ async function convertTools(data) { const categorySearch = await fuse.search(category); if (categorySearch.length) { - let searchedCategoryName = categorySearch[0].item.name; - if ( - !finalToolsObject[searchedCategoryName].toolsList.find( - (element) => element === toolObject, - ) - ) - finalToolsObject[searchedCategoryName].toolsList.push( - toolObject, - ); + const searchedCategoryName = categorySearch[0].item.name; + if (!finalToolsObject[searchedCategoryName].toolsList.find((element) => element === toolObject)) + finalToolsObject[searchedCategoryName].toolsList.push(toolObject); } else { // if Tool object has a category, not defined in our categorylist, then this provides a `other` category to the tool. - if ( - !finalToolsObject['Others'].toolsList.find( - (element) => element === toolObject, - ) - ) - finalToolsObject['Others'].toolsList.push(toolObject); + if (!finalToolsObject.Others.toolsList.find((element) => element === toolObject)) + finalToolsObject.Others.toolsList.push(toolObject); } }); } else { - console.error( - 'Script is not failing, it is just dropping errors for further investigation', - ); + console.error('Script is not failing, it is just dropping errors for further investigation'); console.error('Invalid .asyncapi-tool file.'); console.error(`Located in: ${tool.html_url}`); - console.error( - 'Validation errors:', - JSON.stringify(validate.errors, null, 2), - ); + console.error('Validation errors:', JSON.stringify(validate.errors, null, 2)); } } } catch (err) { diff --git a/scripts/utils.js b/scripts/utils.js index 66d01b75afc7..fa893a6de22e 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -18,9 +18,7 @@ function convertToJson(contentYAMLorJSON) { return yamlContent; } catch (yamlError) { // If parsing as YAML also fails, throw an error - throw new Error( - `Invalid content format:\nJSON Parse Error: ${jsonError}\nYAML Parse Error: ${yamlError}`, - ); + throw new Error(`Invalid content format:\nJSON Parse Error: ${jsonError}\nYAML Parse Error: ${yamlError}`); } } } diff --git a/scripts/utils/readAndWriteJson.js b/scripts/utils/readAndWriteJson.js index d1ed2dd43a12..e3e2a6f2b6e3 100644 --- a/scripts/utils/readAndWriteJson.js +++ b/scripts/utils/readAndWriteJson.js @@ -1,5 +1,5 @@ const { - promises: { readFile, writeFile }, + promises: { readFile, writeFile } } = require('fs'); const { convertToJson } = require('../utils'); From ad8c426af27358a639ace24bf8090e653559027c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Mon, 18 Nov 2024 11:20:49 +0530 Subject: [PATCH 003/183] migrate build-pages --- scripts/{build-pages.js => build-pages.ts} | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) rename scripts/{build-pages.js => build-pages.ts} (88%) diff --git a/scripts/build-pages.js b/scripts/build-pages.ts similarity index 88% rename from scripts/build-pages.js rename to scripts/build-pages.ts index 287d44f046b0..ed6eda670f98 100644 --- a/scripts/build-pages.js +++ b/scripts/build-pages.ts @@ -1,5 +1,5 @@ -const fs = require('fs'); -const path = require('path'); +import fs from 'fs'; +import path from 'path'; const SRC_DIR = 'markdown'; const TARGET_DIR = 'pages'; @@ -11,7 +11,7 @@ if (!fs.existsSync(TARGET_DIR)) { fs.mkdirSync(TARGET_DIR, { recursive: true }); } -function capitalizeJsxTags(content) { +export function capitalizeJsxTags(content: string) { return content.replace(/<\/?(\w+)/g, function (match, letter) { if (capitalizeTags.includes(letter.toLowerCase())) { return `<${match[1] === '/' ? '/' : ''}${letter[0].toUpperCase()}${letter.slice(1)}`; @@ -20,7 +20,7 @@ function capitalizeJsxTags(content) { }); } -function copyAndRenameFiles(srcDir, targetDir) { +export function copyAndRenameFiles(srcDir: string, targetDir: string) { // Read all files and directories from source directory const entries = fs.readdirSync(srcDir, { withFileTypes: true }); @@ -56,5 +56,3 @@ function copyAndRenameFiles(srcDir, targetDir) { } copyAndRenameFiles(SRC_DIR, TARGET_DIR); - -module.exports = { copyAndRenameFiles, capitalizeJsxTags }; From eedff42e93e4d1254b71f02106bdeccf8a35d939 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Mon, 18 Nov 2024 11:21:38 +0530 Subject: [PATCH 004/183] add ts-node configuration --- package-lock.json | 158 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 6 +- 2 files changed, 161 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0749d409a5fc..82a8b0119b9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -122,7 +122,8 @@ "remark-cli": "^12.0.1", "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", - "storybook": "^8.2.4" + "storybook": "^8.2.4", + "ts-node": "^10.9.2" } }, "node_modules/@adobe/css-tools": { @@ -2413,6 +2414,28 @@ "yarn": ">=1.22.18" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "devOptional": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "devOptional": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@docsearch/css": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.6.0.tgz", @@ -7172,6 +7195,30 @@ "node": ">=10.13.0" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "devOptional": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "devOptional": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "devOptional": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "devOptional": true + }, "node_modules/@types/acorn": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz", @@ -10726,6 +10773,12 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "devOptional": true + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -18242,6 +18295,12 @@ "semver": "bin/semver.js" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "devOptional": true + }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -28606,6 +28665,88 @@ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "devOptional": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "devOptional": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ts-node/node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "devOptional": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ts-node/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "devOptional": true + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "devOptional": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/ts-pnp": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", @@ -29708,6 +29849,12 @@ "node": ">=6" } }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "devOptional": true + }, "node_modules/v8-to-istanbul": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", @@ -30450,6 +30597,15 @@ "node": ">=12" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "devOptional": true, + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 84f538697d4d..13ce5e81207a 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,12 @@ "version": "0.1.0", "description": "AsyncAPI website", "private": true, + "type": "module", "scripts": { "dev": "npm run build-scripts && next dev", "build": "npm run build-scripts && next build", "test": "jest --passWithNoTests", - "build:pages": "node scripts/build-pages.js && npm run format:mdx", + "build:pages": "node --loader ts-node/esm scripts/build-pages.ts && npm run format:mdx", "build:posts": "node scripts/index.js", "build-scripts": "npm run build:pages && npm run lint:mdx && npm run build:posts", "write:blog": "node ./scripts/compose.js", @@ -151,6 +152,7 @@ "eslint-plugin-storybook": "^0.8.0", "eslint-plugin-tailwindcss": "^3.14.2", "eslint-plugin-unused-imports": "^3.1.0", + "fast-xml-parser": "^4.5.0", "inquirer": "^9.2.14", "jest": "^29.7.0", "postcss-import": "^16.0.1", @@ -158,6 +160,6 @@ "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", "storybook": "^8.2.4", - "fast-xml-parser": "^4.5.0" + "ts-node": "^10.9.2" } } From df75c79b377679c3c41f0e23a41b750ca897723f Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Mon, 18 Nov 2024 11:21:53 +0530 Subject: [PATCH 005/183] setup eslint rule to ignore js-doc in script files --- .eslintrc | 178 +++++++++++++++++++++--------------------------------- 1 file changed, 70 insertions(+), 108 deletions(-) diff --git a/.eslintrc b/.eslintrc index f77da8144e9c..69b1b9e34900 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,18 +4,15 @@ "next/core-web-vitals", "eslint:recommended", "plugin:prettier/recommended", - "plugin:storybook/recommended" + "plugin:storybook/recommended", ], "env": { "browser": true, "es2021": true, "node": true, - "jest": true + "jest": true, }, - "plugins": [ - "react", - "jsx-a11y" - ], + "plugins": ["react", "jsx-a11y"], "rules": { "prettier/prettier": [ "error", @@ -33,47 +30,43 @@ "insertPragma": false, "requirePragma": false, "jsxSingleQuote": true, - "printWidth": 120 - } + "printWidth": 120, + }, ], "max-len": [ "error", { "code": 120, "ignoreUrls": true, - "ignorePattern": "(className=\\{[\\s\\S]*\\}|.*\\}|'.*'|className='.*')" // Ignore classnames - } - ] + "ignorePattern": "(className=\\{[\\s\\S]*\\}|.*\\}|'.*'|className='.*')", // Ignore classnames + }, + ], }, "globals": { "React": true, "expect": true, "jsdom": true, - "JSX": true + "JSX": true, }, "overrides": [ // Configuration for TypeScript files { - "files": [ - "**/*.ts", - "**/*.tsx", - "netlify/*.ts" - ], + "files": ["**/*.ts", "**/*.tsx", "netlify/*.ts"], "plugins": [ "@typescript-eslint", "tailwindcss", "unused-imports", - "simple-import-sort" + "simple-import-sort", ], "extends": [ "plugin:tailwindcss/recommended", "airbnb-typescript", "next/core-web-vitals", "plugin:prettier/recommended", - "plugin:storybook/recommended" + "plugin:storybook/recommended", ], "parserOptions": { - "project": "./tsconfig.json" + "project": "./tsconfig.json", }, "rules": { "react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable @@ -89,7 +82,7 @@ "error", "ForInStatement", "LabeledStatement", - "WithStatement" + "WithStatement", ], // Overrides Airbnb configuration and enable no-restricted-syntax "import/prefer-default-export": "off", // Named export is easier to refactor automatically "tailwindcss/no-custom-classname": "off", // Disabled otherwise nightmare to allow each custom tailwind classes @@ -101,8 +94,8 @@ "unused-imports/no-unused-vars": [ "error", { - "argsIgnorePattern": "^_" - } + "argsIgnorePattern": "^_", + }, ], // Variables "init-declarations": "off", @@ -126,42 +119,30 @@ "off", "stroustrup", { - "allowSingleLine": true - } + "allowSingleLine": true, + }, ], "camelcase": "off", "capitalized-comments": "off", - "comma-dangle": [ - "error", - "never" - ], + "comma-dangle": ["error", "never"], "comma-spacing": [ 2, { "before": false, - "after": true - } - ], - "comma-style": [ - "error", - "last" + "after": true, + }, ], + "comma-style": ["error", "last"], "eol-last": "error", "func-call-spacing": "error", "func-name-matching": "error", "func-names": "off", "func-style": "off", - "jsx-quotes": [ - "error", - "prefer-single" - ], + "jsx-quotes": ["error", "prefer-single"], "key-spacing": "error", "keyword-spacing": "error", "line-comment-position": "off", - "linebreak-style": [ - "error", - "unix" - ], + "linebreak-style": ["error", "unix"], "lines-around-comment": [ "error", { @@ -174,22 +155,22 @@ "allowObjectStart": true, "allowObjectEnd": false, "allowArrayStart": true, - "allowArrayEnd": false - } + "allowArrayEnd": false, + }, ], "max-depth": "error", "max-lines": [ "error", { - "max": 2000 - } + "max": 2000, + }, ], "max-nested-callbacks": "error", "max-statements-per-line": [ "error", { - "max": 2 - } + "max": 2, + }, ], "multiline-comment-style": "off", "multiline-ternary": "off", @@ -198,13 +179,10 @@ "newline-per-chained-call": [ "error", { - "ignoreChainWithDepth": 4 - } - ], - "newline-after-var": [ - "error", - "always" + "ignoreChainWithDepth": 4, + }, ], + "newline-after-var": ["error", "always"], "no-array-constructor": "error", "no-lonely-if": "error", "no-mixed-operators": "off", @@ -213,8 +191,8 @@ "no-multiple-empty-lines": [ "error", { - "max": 1 - } + "max": 1, + }, ], "no-negated-condition": "error", "no-nested-ternary": "error", @@ -227,63 +205,51 @@ "no-whitespace-before-property": "error", "nonblock-statement-body-position": "error", "object-curly-newline": "off", - "object-curly-spacing": [ - "error", - "always" - ], + "object-curly-spacing": ["error", "always"], "object-property-newline": "off", - "padded-blocks": [ - "error", - "never" - ], + "padded-blocks": ["error", "never"], "padding-line-between-statements": [ "error", { "blankLine": "always", "prev": "*", - "next": "return" + "next": "return", }, { "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" + "prev": ["const", "let", "var"], + "next": "*", }, { "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "quote-props": [ - "error", - "as-needed" + "prev": ["const", "let", "var"], + "next": ["const", "let", "var"], + }, ], + "quote-props": ["error", "as-needed"], "quotes": [ "error", "single", { - "avoidEscape": true - } + "avoidEscape": true, + }, + ], + "require-jsdoc": [ + "warn", + { + "overrides": [ + { + "files": ["path/to/your/folder/**"], + "rules": { + "require-jsdoc": "off", + }, + }, + ], + }, ], - "require-jsdoc": "warn", "semi": "error", "semi-spacing": "error", - "semi-style": [ - "error", - "last" - ], + "semi-style": ["error", "last"], "sort-keys": "off", "sort-vars": "off", "space-before-blocks": "error", @@ -296,22 +262,18 @@ "always", { "block": { - "exceptions": [ - "!" - ] - } - } + "exceptions": ["!"], + }, + }, ], - "switch-colon-spacing": "error" - } + "switch-colon-spacing": "error", + }, }, { - "files": [ - "components/logos/*" - ], + "files": ["components/logos/*"], "rules": { - "max-len": "off" - } - } - ] + "max-len": "off", + }, + }, + ], } From 7bf568a00840f54350e023b6b7e7bc376e7f72ce Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Mon, 18 Nov 2024 11:23:24 +0530 Subject: [PATCH 006/183] Revert "setup eslint rule to ignore js-doc in script files" This reverts commit df75c79b377679c3c41f0e23a41b750ca897723f. --- .eslintrc | 178 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 108 insertions(+), 70 deletions(-) diff --git a/.eslintrc b/.eslintrc index 69b1b9e34900..f77da8144e9c 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,15 +4,18 @@ "next/core-web-vitals", "eslint:recommended", "plugin:prettier/recommended", - "plugin:storybook/recommended", + "plugin:storybook/recommended" ], "env": { "browser": true, "es2021": true, "node": true, - "jest": true, + "jest": true }, - "plugins": ["react", "jsx-a11y"], + "plugins": [ + "react", + "jsx-a11y" + ], "rules": { "prettier/prettier": [ "error", @@ -30,43 +33,47 @@ "insertPragma": false, "requirePragma": false, "jsxSingleQuote": true, - "printWidth": 120, - }, + "printWidth": 120 + } ], "max-len": [ "error", { "code": 120, "ignoreUrls": true, - "ignorePattern": "(className=\\{[\\s\\S]*\\}|.*\\}|'.*'|className='.*')", // Ignore classnames - }, - ], + "ignorePattern": "(className=\\{[\\s\\S]*\\}|.*\\}|'.*'|className='.*')" // Ignore classnames + } + ] }, "globals": { "React": true, "expect": true, "jsdom": true, - "JSX": true, + "JSX": true }, "overrides": [ // Configuration for TypeScript files { - "files": ["**/*.ts", "**/*.tsx", "netlify/*.ts"], + "files": [ + "**/*.ts", + "**/*.tsx", + "netlify/*.ts" + ], "plugins": [ "@typescript-eslint", "tailwindcss", "unused-imports", - "simple-import-sort", + "simple-import-sort" ], "extends": [ "plugin:tailwindcss/recommended", "airbnb-typescript", "next/core-web-vitals", "plugin:prettier/recommended", - "plugin:storybook/recommended", + "plugin:storybook/recommended" ], "parserOptions": { - "project": "./tsconfig.json", + "project": "./tsconfig.json" }, "rules": { "react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable @@ -82,7 +89,7 @@ "error", "ForInStatement", "LabeledStatement", - "WithStatement", + "WithStatement" ], // Overrides Airbnb configuration and enable no-restricted-syntax "import/prefer-default-export": "off", // Named export is easier to refactor automatically "tailwindcss/no-custom-classname": "off", // Disabled otherwise nightmare to allow each custom tailwind classes @@ -94,8 +101,8 @@ "unused-imports/no-unused-vars": [ "error", { - "argsIgnorePattern": "^_", - }, + "argsIgnorePattern": "^_" + } ], // Variables "init-declarations": "off", @@ -119,30 +126,42 @@ "off", "stroustrup", { - "allowSingleLine": true, - }, + "allowSingleLine": true + } ], "camelcase": "off", "capitalized-comments": "off", - "comma-dangle": ["error", "never"], + "comma-dangle": [ + "error", + "never" + ], "comma-spacing": [ 2, { "before": false, - "after": true, - }, + "after": true + } + ], + "comma-style": [ + "error", + "last" ], - "comma-style": ["error", "last"], "eol-last": "error", "func-call-spacing": "error", "func-name-matching": "error", "func-names": "off", "func-style": "off", - "jsx-quotes": ["error", "prefer-single"], + "jsx-quotes": [ + "error", + "prefer-single" + ], "key-spacing": "error", "keyword-spacing": "error", "line-comment-position": "off", - "linebreak-style": ["error", "unix"], + "linebreak-style": [ + "error", + "unix" + ], "lines-around-comment": [ "error", { @@ -155,22 +174,22 @@ "allowObjectStart": true, "allowObjectEnd": false, "allowArrayStart": true, - "allowArrayEnd": false, - }, + "allowArrayEnd": false + } ], "max-depth": "error", "max-lines": [ "error", { - "max": 2000, - }, + "max": 2000 + } ], "max-nested-callbacks": "error", "max-statements-per-line": [ "error", { - "max": 2, - }, + "max": 2 + } ], "multiline-comment-style": "off", "multiline-ternary": "off", @@ -179,10 +198,13 @@ "newline-per-chained-call": [ "error", { - "ignoreChainWithDepth": 4, - }, + "ignoreChainWithDepth": 4 + } + ], + "newline-after-var": [ + "error", + "always" ], - "newline-after-var": ["error", "always"], "no-array-constructor": "error", "no-lonely-if": "error", "no-mixed-operators": "off", @@ -191,8 +213,8 @@ "no-multiple-empty-lines": [ "error", { - "max": 1, - }, + "max": 1 + } ], "no-negated-condition": "error", "no-nested-ternary": "error", @@ -205,51 +227,63 @@ "no-whitespace-before-property": "error", "nonblock-statement-body-position": "error", "object-curly-newline": "off", - "object-curly-spacing": ["error", "always"], + "object-curly-spacing": [ + "error", + "always" + ], "object-property-newline": "off", - "padded-blocks": ["error", "never"], + "padded-blocks": [ + "error", + "never" + ], "padding-line-between-statements": [ "error", { "blankLine": "always", "prev": "*", - "next": "return", + "next": "return" }, { "blankLine": "always", - "prev": ["const", "let", "var"], - "next": "*", + "prev": [ + "const", + "let", + "var" + ], + "next": "*" }, { "blankLine": "any", - "prev": ["const", "let", "var"], - "next": ["const", "let", "var"], - }, + "prev": [ + "const", + "let", + "var" + ], + "next": [ + "const", + "let", + "var" + ] + } + ], + "quote-props": [ + "error", + "as-needed" ], - "quote-props": ["error", "as-needed"], "quotes": [ "error", "single", { - "avoidEscape": true, - }, - ], - "require-jsdoc": [ - "warn", - { - "overrides": [ - { - "files": ["path/to/your/folder/**"], - "rules": { - "require-jsdoc": "off", - }, - }, - ], - }, + "avoidEscape": true + } ], + "require-jsdoc": "warn", "semi": "error", "semi-spacing": "error", - "semi-style": ["error", "last"], + "semi-style": [ + "error", + "last" + ], "sort-keys": "off", "sort-vars": "off", "space-before-blocks": "error", @@ -262,18 +296,22 @@ "always", { "block": { - "exceptions": ["!"], - }, - }, + "exceptions": [ + "!" + ] + } + } ], - "switch-colon-spacing": "error", - }, + "switch-colon-spacing": "error" + } }, { - "files": ["components/logos/*"], + "files": [ + "components/logos/*" + ], "rules": { - "max-len": "off", - }, - }, - ], + "max-len": "off" + } + } + ] } From 4c51a800a41ad4ae45d95d79c2c24a7557c25106 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 00:29:57 +0530 Subject: [PATCH 007/183] move to imports --- next-i18next.config.js | 20 +++++------ pages/_document.tsx | 46 +++++++++++++++++++------ postcss.config.js => postcss.config.cjs | 0 scripts/adopters/index.js | 11 +++--- scripts/build-docs.js | 6 ++-- scripts/build-meetings.js | 8 ++--- scripts/build-newsroom-videos.js | 8 ++--- scripts/build-post-list.js | 26 ++++++++------ scripts/build-rss.js | 11 +++--- scripts/build-tools.js | 12 +++---- scripts/casestudies/index.js | 8 ++--- scripts/compose.js | 8 ++--- scripts/dashboard/build-dashboard.js | 10 +++--- scripts/dashboard/issue-queries.js | 2 +- scripts/finance/index.js | 12 +++---- scripts/index.js | 19 +++++----- scripts/markdown/check-markdown.js | 6 ++-- scripts/tools/categorylist.js | 2 +- scripts/tools/combine-tools.js | 18 +++++----- scripts/tools/extract-tools-github.js | 5 +-- scripts/tools/tags-color.js | 2 +- scripts/tools/tools-object.js | 16 ++++----- scripts/utils.js | 4 +-- scripts/utils/readAndWriteJson.js | 10 +++--- utils/getStatic.ts | 12 +++---- utils/languageDetector.ts | 4 +-- 26 files changed, 161 insertions(+), 125 deletions(-) rename postcss.config.js => postcss.config.cjs (100%) diff --git a/next-i18next.config.js b/next-i18next.config.js index 2848266d6554..854dbe88c0ac 100644 --- a/next-i18next.config.js +++ b/next-i18next.config.js @@ -1,10 +1,10 @@ -module.exports = { - i18n: { - locales: ['en', 'de'], - defaultLocale : 'en', - namespaces: ['landing-page', 'common', 'tools'], - defaultNamespace: 'landing-page', - react: { useSuspense: false },// this line - }, - - }; +const config = { + i18n: { + locales: ['en', 'de'], + defaultLocale: 'en', + namespaces: ['landing-page', 'common', 'tools'], + defaultNamespace: 'landing-page', + react: { useSuspense: false } // this line + } +}; +export default config; diff --git a/pages/_document.tsx b/pages/_document.tsx index b220a1b44841..b71582a10850 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -1,7 +1,7 @@ import Document, { Head, Html, Main, NextScript } from 'next/document'; import React from 'react'; -import i18nextConfig from '../next-i18next.config'; +import i18nextConfig from '../next-i18next.config.js'; class MyDocument extends Document { static async getInitialProps(ctx: any) { @@ -12,27 +12,51 @@ class MyDocument extends Document { render() { // eslint-disable-next-line no-underscore-dangle - const currentLocale = this.props.__NEXT_DATA__.query.locale || i18nextConfig.i18n.defaultLocale; + const currentLocale = + this.props.__NEXT_DATA__.query.locale || i18nextConfig.i18n.defaultLocale; return ( {/* Load Work Sans font */} - - + + {/* eslint-disable-next-line max-len */} {/* Icons */} - - - - + + + + - +
diff --git a/postcss.config.js b/postcss.config.cjs similarity index 100% rename from postcss.config.js rename to postcss.config.cjs diff --git a/scripts/adopters/index.js b/scripts/adopters/index.js index a8c8363d25ab..9018b80054ac 100644 --- a/scripts/adopters/index.js +++ b/scripts/adopters/index.js @@ -1,6 +1,9 @@ -const { resolve } = require('path'); -const writeJSON = require('../utils/readAndWriteJson.js'); +import { resolve, dirname } from 'path'; +import { fileURLToPath } from 'url'; +import { writeJSON } from '../utils/readAndWriteJson.js'; -module.exports = async function buildAdoptersList() { +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +export async function buildAdoptersList() { writeJSON('config/adopters.yml', resolve(__dirname, '../../config', 'adopters.json')); -}; +} diff --git a/scripts/build-docs.js b/scripts/build-docs.js index 48693f176ba8..b0183e13cf7b 100644 --- a/scripts/build-docs.js +++ b/scripts/build-docs.js @@ -1,4 +1,6 @@ -const sortBy = require('lodash/sortBy'); +import lodash from 'lodash'; + +const { sortBy } = lodash; function buildNavTree(navItems) { try { @@ -187,4 +189,4 @@ function addDocButtons(docPosts, treePosts) { return structuredPosts; } -module.exports = { buildNavTree, addDocButtons, convertDocPosts }; +export { buildNavTree, addDocButtons, convertDocPosts }; diff --git a/scripts/build-meetings.js b/scripts/build-meetings.js index ac556b7578d4..4a76d021e853 100644 --- a/scripts/build-meetings.js +++ b/scripts/build-meetings.js @@ -1,6 +1,6 @@ -const { writeFileSync } = require('fs'); -const { resolve } = require('path'); -const { google } = require('googleapis'); +import { writeFileSync } from 'fs'; +import { resolve } from 'path'; +import { google } from 'googleapis'; async function buildMeetings(writePath) { let auth; @@ -57,4 +57,4 @@ if (require.main === module) { buildMeetings(resolve(__dirname, '../config', 'meetings.json')); } -module.exports = { buildMeetings }; +export { buildMeetings }; diff --git a/scripts/build-newsroom-videos.js b/scripts/build-newsroom-videos.js index 40ad1617362e..7cd4917c7199 100644 --- a/scripts/build-newsroom-videos.js +++ b/scripts/build-newsroom-videos.js @@ -1,6 +1,6 @@ -const { writeFileSync } = require('fs-extra'); -const { resolve } = require('path'); -const fetch = require('node-fetch-2'); +import { writeFileSync } from 'fs'; +import { resolve } from 'path'; +import fetch from 'node-fetch'; async function buildNewsroomVideos(writePath) { try { @@ -50,4 +50,4 @@ if (require.main === module) { buildNewsroomVideos(resolve(__dirname, '../config', 'newsroom_videos.json')); } -module.exports = { buildNewsroomVideos }; +export { buildNewsroomVideos }; diff --git a/scripts/build-post-list.js b/scripts/build-post-list.js index 3cfee35032ec..946cc6456166 100644 --- a/scripts/build-post-list.js +++ b/scripts/build-post-list.js @@ -1,11 +1,17 @@ -const { readdirSync, statSync, existsSync, readFileSync, writeFileSync } = require('fs'); -const { resolve, basename } = require('path'); -const frontMatter = require('gray-matter'); -const toc = require('markdown-toc'); -const { slugify } = require('markdown-toc/lib/utils'); -const readingTime = require('reading-time'); -const { markdownToTxt } = require('markdown-to-txt'); -const { buildNavTree, addDocButtons } = require('./build-docs'); +import { readFileSync, writeFileSync, readdirSync, statSync, existsSync } from 'fs'; +import { resolve, basename, dirname } from 'path'; +import frontMatter from 'gray-matter'; +import toc from 'markdown-toc'; +import markdownTocUtils from 'markdown-toc/lib/utils.js'; +import readingTime from 'reading-time'; +import { markdownToTxt } from 'markdown-to-txt'; +import { fileURLToPath } from 'url'; +import { buildNavTree, addDocButtons } from './build-docs.js'; + +const { slugify } = markdownTocUtils; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); let specWeight = 100; const result = { @@ -31,7 +37,7 @@ const addItem = (details) => { } }; -module.exports = async function buildPostList() { +export async function buildPostList() { walkDirectories(postDirectories, result); const treePosts = buildNavTree(result.docs.filter((p) => p.slug.startsWith('/docs/'))); result.docsTree = treePosts; @@ -40,7 +46,7 @@ module.exports = async function buildPostList() { // console.log(inspect(result, { depth: null, colors: true })) } writeFileSync(resolve(__dirname, '..', 'config', 'posts.json'), JSON.stringify(result, null, ' ')); -}; +} function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, sectionId, rootSectionId) { for (const dir of directories) { diff --git a/scripts/build-rss.js b/scripts/build-rss.js index 75195ea53ccf..bda4c61664cc 100644 --- a/scripts/build-rss.js +++ b/scripts/build-rss.js @@ -1,8 +1,9 @@ -const fs = require('fs').promises; -const json2xml = require('jgexml/json2xml'); +import fs from 'fs/promises'; +import json2xml from 'jgexml/json2xml.js'; +import posts from '../config/posts.json' assert { type: 'json' }; function getAllPosts() { - return require('../config/posts.json'); + return posts; } function clean(s) { @@ -15,7 +16,7 @@ function clean(s) { return s; } -module.exports = async function rssFeed(type, title, desc, outputPath) { +export async function rssFeed(type, title, desc, outputPath) { try { let posts = getAllPosts()[`${type}`]; const missingDatePosts = posts.filter((post) => !post.date); @@ -97,4 +98,4 @@ module.exports = async function rssFeed(type, title, desc, outputPath) { } catch (err) { throw new Error(`Failed to generate RSS feed: ${err.message}`); } -}; +} diff --git a/scripts/build-tools.js b/scripts/build-tools.js index 83db76534f11..47e0d806faa7 100644 --- a/scripts/build-tools.js +++ b/scripts/build-tools.js @@ -1,8 +1,8 @@ -const fs = require('fs-extra'); -const { resolve } = require('path'); -const { getData } = require('./tools/extract-tools-github'); -const { convertTools } = require('./tools/tools-object'); -const { combineTools } = require('./tools/combine-tools'); +import fs from 'fs-extra'; +import { resolve } from 'path'; +import { getData } from './tools/extract-tools-github.js'; +import { convertTools } from './tools/tools-object.js'; +import { combineTools } from './tools/combine-tools.js'; const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPath) => { try { @@ -27,4 +27,4 @@ if (require.main === module) { buildTools(automatedToolsPath, manualToolsPath, toolsPath, tagsPath); } -module.exports = { buildTools }; +export { buildTools }; diff --git a/scripts/casestudies/index.js b/scripts/casestudies/index.js index 22011781f1be..8e5ed249288c 100644 --- a/scripts/casestudies/index.js +++ b/scripts/casestudies/index.js @@ -1,7 +1,7 @@ -const { readdir, writeFile, readFile } = require('fs').promises; -const { convertToJson } = require('../utils'); +import { readdir, writeFile, readFile } from 'fs/promises'; +import { convertToJson } from '../utils.js'; -module.exports = async function buildCaseStudiesList(dirWithCaseStudy, writeFilePath) { +export async function buildCaseStudiesList(dirWithCaseStudy, writeFilePath) { try { const files = await readdir(dirWithCaseStudy); const caseStudiesList = []; @@ -16,4 +16,4 @@ module.exports = async function buildCaseStudiesList(dirWithCaseStudy, writeFile } catch (err) { throw new Error(err); } -}; +} diff --git a/scripts/compose.js b/scripts/compose.js index 18d8d724420d..63c653554b20 100644 --- a/scripts/compose.js +++ b/scripts/compose.js @@ -2,10 +2,10 @@ * Script based on https://github.com/timlrx/tailwind-nextjs-starter-blog/blob/master/scripts/compose.js */ -const fs = require('fs'); -const inquirer = require('inquirer'); -const dedent = require('dedent'); -const moment = require('moment'); +import fs from 'fs'; +import inquirer from 'inquirer'; +import dedent from 'dedent'; +import moment from 'moment'; const genFrontMatter = (answers) => { const d = new Date(); diff --git a/scripts/dashboard/build-dashboard.js b/scripts/dashboard/build-dashboard.js index 00e2049a6338..07489c2eae59 100644 --- a/scripts/dashboard/build-dashboard.js +++ b/scripts/dashboard/build-dashboard.js @@ -1,7 +1,7 @@ -const { writeFile } = require('fs-extra'); -const { resolve } = require('path'); -const { graphql } = require('@octokit/graphql'); -const { Queries } = require('./issue-queries'); +import { writeFile } from 'fs-extra'; +import { resolve } from 'path'; +import { graphql } from '@octokit/graphql'; +import { Queries } from './issue-queries'; /** * Introduces a delay in the execution flow. @@ -181,7 +181,7 @@ if (require.main === module) { start(resolve(__dirname, '..', '..', 'dashboard.json')); } -module.exports = { +export { getLabel, monthsSince, mapGoodFirstIssues, diff --git a/scripts/dashboard/issue-queries.js b/scripts/dashboard/issue-queries.js index 4b2e5a87853c..7eafae9fbd3a 100644 --- a/scripts/dashboard/issue-queries.js +++ b/scripts/dashboard/issue-queries.js @@ -1,4 +1,4 @@ -exports.Queries = Object.freeze({ +export const Queries = Object.freeze({ pullRequestById: ` query IssueByID($id: ID!) { node(id: $id) { diff --git a/scripts/finance/index.js b/scripts/finance/index.js index c5ab35346c0d..f0ed465b8475 100644 --- a/scripts/finance/index.js +++ b/scripts/finance/index.js @@ -1,10 +1,8 @@ -const { - promises: { mkdir } -} = require('fs'); -const { resolve } = require('path'); -const writeJSON = require('../utils/readAndWriteJson.js'); +import { resolve } from 'path'; +import { mkdir } from 'fs/promises'; +import { writeJSON } from '../utils/readAndWriteJson.js'; -module.exports = async function buildFinanceInfoList({ currentDir, configDir, financeDir, year, jsonDataDir }) { +export async function buildFinanceInfoList({ currentDir, configDir, financeDir, year, jsonDataDir }) { try { const expensesPath = resolve(currentDir, configDir, financeDir, year, 'Expenses.yml'); const expensesLinkPath = resolve(currentDir, configDir, financeDir, year, 'ExpensesLink.yml'); @@ -22,4 +20,4 @@ module.exports = async function buildFinanceInfoList({ currentDir, configDir, fi } catch (err) { throw new Error(err); } -}; +} diff --git a/scripts/index.js b/scripts/index.js index afe99ff7ca11..1211c9fe54e4 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -1,11 +1,14 @@ -const { resolve } = require('path'); -const fs = require('fs'); -const rssFeed = require('./build-rss'); -const buildPostList = require('./build-post-list'); -const buildCaseStudiesList = require('./casestudies'); -const buildAdoptersList = require('./adopters'); -const buildFinanceInfoList = require('./finance'); +import { resolve, dirname } from 'path'; +import fs from 'fs'; +import { fileURLToPath } from 'url'; +import { rssFeed } from './build-rss.js'; +import { buildPostList } from './build-post-list.js'; +import { buildCaseStudiesList } from './casestudies/index.js'; +import { buildAdoptersList } from './adopters/index.js'; +import { buildFinanceInfoList } from './finance/index.js'; +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); async function start() { await buildPostList(); rssFeed('blog', 'AsyncAPI Initiative Blog RSS Feed', 'AsyncAPI Initiative Blog', 'rss.xml'); @@ -40,6 +43,6 @@ async function start() { }); } -module.exports = start; +export { start }; start(); diff --git a/scripts/markdown/check-markdown.js b/scripts/markdown/check-markdown.js index 7088a1c4d0fc..49fbc74b28f1 100644 --- a/scripts/markdown/check-markdown.js +++ b/scripts/markdown/check-markdown.js @@ -1,6 +1,6 @@ -const fs = require('fs'); -const matter = require('gray-matter'); -const path = require('path'); +import fs from 'fs'; +import matter from 'gray-matter'; +import path from 'path'; /** * Checks if a given string is a valid URL. diff --git a/scripts/tools/categorylist.js b/scripts/tools/categorylist.js index dc81be15a320..3ba7f2583517 100644 --- a/scripts/tools/categorylist.js +++ b/scripts/tools/categorylist.js @@ -103,4 +103,4 @@ const categoryList = [ } ]; -module.exports = { categoryList }; +export { categoryList }; diff --git a/scripts/tools/combine-tools.js b/scripts/tools/combine-tools.js index 01be1ec876dc..2f296412ac1b 100644 --- a/scripts/tools/combine-tools.js +++ b/scripts/tools/combine-tools.js @@ -1,11 +1,11 @@ -const fs = require('fs'); -const Ajv = require('ajv'); -const addFormats = require('ajv-formats'); -const Fuse = require('fuse.js'); -const { languagesColor, technologiesColor } = require('./tags-color'); -const { categoryList } = require('./categorylist.js'); -const { createToolObject } = require('./tools-object'); -const schema = require('./tools-schema.json'); +import fs from 'fs'; +import Ajv from 'ajv'; +import addFormats from 'ajv-formats'; +import Fuse from 'fuse.js'; +import { languagesColor, technologiesColor } from './tags-color.js'; +import { categoryList } from './categorylist.js'; +import { createToolObject } from './tools-object.js'; +import schema from './tools-schema.json'; const ajv = new Ajv(); addFormats(ajv, ['uri']); @@ -139,4 +139,4 @@ const combineTools = async (automatedTools, manualTools, toolsPath, tagsPath) => fs.writeFileSync(tagsPath, JSON.stringify({ languages: languageList, technologies: technologyList })); }; -module.exports = { combineTools }; +export { combineTools }; diff --git a/scripts/tools/extract-tools-github.js b/scripts/tools/extract-tools-github.js index 1db138a95add..71a2a8cbb1f6 100644 --- a/scripts/tools/extract-tools-github.js +++ b/scripts/tools/extract-tools-github.js @@ -1,4 +1,5 @@ -const axios = require('axios'); +import axios from 'axios'; + require('dotenv').config(); const getData = async () => { @@ -16,4 +17,4 @@ const getData = async () => { } }; -module.exports = { getData }; +export { getData }; diff --git a/scripts/tools/tags-color.js b/scripts/tools/tags-color.js index 3483de2b0b08..d6a905060988 100644 --- a/scripts/tools/tags-color.js +++ b/scripts/tools/tags-color.js @@ -175,4 +175,4 @@ const technologiesColor = [ } ]; -module.exports = { languagesColor, technologiesColor }; +export { languagesColor, technologiesColor }; diff --git a/scripts/tools/tools-object.js b/scripts/tools/tools-object.js index 57b152e49570..16b86877784f 100644 --- a/scripts/tools/tools-object.js +++ b/scripts/tools/tools-object.js @@ -1,14 +1,14 @@ -const axios = require('axios'); -const Ajv = require('ajv'); -const addFormats = require('ajv-formats'); -const Fuse = require('fuse.js'); -const schema = require('./tools-schema.json'); -const { categoryList } = require('./categorylist'); +import axios from 'axios'; +import Ajv from 'ajv'; +import addFormats from 'ajv-formats'; +import Fuse from 'fuse.js'; +import schema from './tools-schema.json'; +import { categoryList } from './categorylist'; +import { convertToJson } from '../utils'; const ajv = new Ajv(); addFormats(ajv, ['uri']); const validate = ajv.compile(schema); -const { convertToJson } = require('../utils'); // Config options set for the Fuse object const options = { @@ -115,4 +115,4 @@ async function convertTools(data) { return finalToolsObject; } -module.exports = { convertTools, createToolObject }; +export { convertTools, createToolObject }; diff --git a/scripts/utils.js b/scripts/utils.js index fa893a6de22e..dee033fc9504 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -1,4 +1,4 @@ -const yaml = require('yaml'); +import yaml from 'yaml'; function convertToJson(contentYAMLorJSON) { // Axios handles conversion to JSON by default, if data returned from the server allows it @@ -23,4 +23,4 @@ function convertToJson(contentYAMLorJSON) { } } -module.exports = { convertToJson }; +export { convertToJson }; diff --git a/scripts/utils/readAndWriteJson.js b/scripts/utils/readAndWriteJson.js index e3e2a6f2b6e3..7fca9fd10116 100644 --- a/scripts/utils/readAndWriteJson.js +++ b/scripts/utils/readAndWriteJson.js @@ -1,9 +1,7 @@ -const { - promises: { readFile, writeFile } -} = require('fs'); -const { convertToJson } = require('../utils'); +import { writeFile, readFile } from 'fs/promises'; +import { convertToJson } from '../utils.js'; -module.exports = async function writeJSON(readPath, writePath) { +export async function writeJSON(readPath, writePath) { let readContent; let jsonContent; @@ -27,4 +25,4 @@ module.exports = async function writeJSON(readPath, writePath) { } catch (err) { throw new Error(`Error while writing file\nError: ${err}`); } -}; +} diff --git a/utils/getStatic.ts b/utils/getStatic.ts index 56af2cf6b1ca..98796d580c1b 100644 --- a/utils/getStatic.ts +++ b/utils/getStatic.ts @@ -1,6 +1,6 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import i18nextConfig from '../next-i18next.config'; +import i18nextConfig from '../next-i18next.config.js'; /** * Retrieves the internationalization paths for the supported locales. @@ -9,8 +9,8 @@ import i18nextConfig from '../next-i18next.config'; export const getI18nPaths = () => i18nextConfig.i18n.locales.map((lng) => ({ params: { - lang: lng - } + lang: lng, + }, })); /** @@ -19,7 +19,7 @@ export const getI18nPaths = () => */ export const getStaticPaths = () => ({ fallback: false, - paths: getI18nPaths() + paths: getI18nPaths(), }); /** @@ -31,7 +31,7 @@ export const getStaticPaths = () => ({ export async function getI18nProps(ctx: any, ns = ['common']) { const locale = ctx?.params?.lang; const props = { - ...(await serverSideTranslations(locale, ns)) + ...(await serverSideTranslations(locale, ns)), }; return props; @@ -45,7 +45,7 @@ export async function getI18nProps(ctx: any, ns = ['common']) { export function makeStaticProps(ns = {}) { return async function getStaticProps(ctx: any) { return { - props: await getI18nProps(ctx, ns as any) + props: await getI18nProps(ctx, ns as any), }; }; } diff --git a/utils/languageDetector.ts b/utils/languageDetector.ts index e3db95e0f17d..5af3ded38188 100644 --- a/utils/languageDetector.ts +++ b/utils/languageDetector.ts @@ -1,8 +1,8 @@ import languageDetector from 'next-language-detector'; -import i18nextConfig from '../next-i18next.config'; +import i18nextConfig from '../next-i18next.config.js'; export default languageDetector({ supportedLngs: i18nextConfig.i18n.locales, - fallbackLng: i18nextConfig.i18n.defaultLocale + fallbackLng: i18nextConfig.i18n.defaultLocale, }); From fbb0e61c0a1f228d9babaec2c76049c54fbb64b2 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 00:43:18 +0530 Subject: [PATCH 008/183] rename next config file --- next-i18next.config.js => next-i18next.config.cjs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename next-i18next.config.js => next-i18next.config.cjs (100%) diff --git a/next-i18next.config.js b/next-i18next.config.cjs similarity index 100% rename from next-i18next.config.js rename to next-i18next.config.cjs From fd80ef2e9180c39dcebfd23d927fe85a82ba8eed Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 00:43:25 +0530 Subject: [PATCH 009/183] add new path config --- next-i18next.config.cjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/next-i18next.config.cjs b/next-i18next.config.cjs index 854dbe88c0ac..6ee70f95d5fe 100644 --- a/next-i18next.config.cjs +++ b/next-i18next.config.cjs @@ -1,4 +1,8 @@ -const config = { +// The file is required to be named next-i18next.config.cjs so we can use it in next.config.js. +// https://github.com/i18next/next-i18next/issues/2185#issuecomment-1618307556 +process.env.I18NEXT_DEFAULT_CONFIG_PATH = './next-i18next.config.cjs'; + +module.exports = { i18n: { locales: ['en', 'de'], defaultLocale: 'en', @@ -7,4 +11,3 @@ const config = { react: { useSuspense: false } // this line } }; -export default config; From f5b38a70e3dbbafc4ea00959a555fcfd5b716e75 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 00:44:02 +0530 Subject: [PATCH 010/183] update import names --- pages/_document.tsx | 2 +- utils/getStatic.ts | 2 +- utils/languageDetector.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/_document.tsx b/pages/_document.tsx index b71582a10850..ac793e9eced9 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -1,7 +1,7 @@ import Document, { Head, Html, Main, NextScript } from 'next/document'; import React from 'react'; -import i18nextConfig from '../next-i18next.config.js'; +import i18nextConfig from '../next-i18next.config.cjs'; class MyDocument extends Document { static async getInitialProps(ctx: any) { diff --git a/utils/getStatic.ts b/utils/getStatic.ts index 98796d580c1b..304654e6f6de 100644 --- a/utils/getStatic.ts +++ b/utils/getStatic.ts @@ -1,6 +1,6 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import i18nextConfig from '../next-i18next.config.js'; +import i18nextConfig from '../next-i18next.config.cjs'; /** * Retrieves the internationalization paths for the supported locales. diff --git a/utils/languageDetector.ts b/utils/languageDetector.ts index 5af3ded38188..3d4c810dafb2 100644 --- a/utils/languageDetector.ts +++ b/utils/languageDetector.ts @@ -1,6 +1,6 @@ import languageDetector from 'next-language-detector'; -import i18nextConfig from '../next-i18next.config.js'; +import i18nextConfig from '../next-i18next.config.cjs'; export default languageDetector({ supportedLngs: i18nextConfig.i18n.locales, From 7b6c3b9d507878c74b9270ae4bbcfd71bf607e35 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 00:51:18 +0530 Subject: [PATCH 011/183] rename utils file to ts --- scripts/{utils.js => utils.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{utils.js => utils.ts} (100%) diff --git a/scripts/utils.js b/scripts/utils.ts similarity index 100% rename from scripts/utils.js rename to scripts/utils.ts From a8c12ea12cd4bfa370057f586daf4519544638a0 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 12:36:41 +0530 Subject: [PATCH 012/183] add types --- scripts/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/utils.ts b/scripts/utils.ts index dee033fc9504..17044631ec5c 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -1,6 +1,6 @@ import yaml from 'yaml'; -function convertToJson(contentYAMLorJSON) { +function convertToJson(contentYAMLorJSON: string) { // Axios handles conversion to JSON by default, if data returned from the server allows it // So if returned content is not a string (not YAML), we just return JSON back if (typeof contentYAMLorJSON !== 'string') { @@ -10,11 +10,13 @@ function convertToJson(contentYAMLorJSON) { // Check if the content is valid JSON before attempting to parse as YAML try { const jsonContent = JSON.parse(contentYAMLorJSON); + return jsonContent; } catch (jsonError) { // If it's not valid JSON, try parsing it as YAML try { const yamlContent = yaml.parse(contentYAMLorJSON); + return yamlContent; } catch (yamlError) { // If parsing as YAML also fails, throw an error From e2097cc3b76acfa254d417ab7a5e7a56b83a1a1f Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 12:36:50 +0530 Subject: [PATCH 013/183] update import --- scripts/casestudies/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/casestudies/index.js b/scripts/casestudies/index.js index 8e5ed249288c..e5dae72ac5a5 100644 --- a/scripts/casestudies/index.js +++ b/scripts/casestudies/index.js @@ -1,5 +1,5 @@ import { readdir, writeFile, readFile } from 'fs/promises'; -import { convertToJson } from '../utils.js'; +import { convertToJson } from '../utils'; export async function buildCaseStudiesList(dirWithCaseStudy, writeFilePath) { try { From c01fb85232dddb02134378c37e55941e78421c14 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 12:37:12 +0530 Subject: [PATCH 014/183] rename --- jest.config.js => jest.config.cjs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jest.config.js => jest.config.cjs (100%) diff --git a/jest.config.js b/jest.config.cjs similarity index 100% rename from jest.config.js rename to jest.config.cjs From c7a7247bf5bb40f85f7610be197b834121bafe53 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 12:37:47 +0530 Subject: [PATCH 015/183] rename to ts --- scripts/{index.js => index.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{index.js => index.ts} (100%) diff --git a/scripts/index.js b/scripts/index.ts similarity index 100% rename from scripts/index.js rename to scripts/index.ts From a49c8a2ad103027094bf69649e8f0e55bf5b9f8e Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:01:08 +0530 Subject: [PATCH 016/183] rename compose to ts --- scripts/{compose.js => compose.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{compose.js => compose.ts} (100%) diff --git a/scripts/compose.js b/scripts/compose.ts similarity index 100% rename from scripts/compose.js rename to scripts/compose.ts From 342432a958816d2184327b7e3824e5c006304e9c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:01:43 +0530 Subject: [PATCH 017/183] rename build docs to ts --- scripts/{build-docs.js => build-docs.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{build-docs.js => build-docs.ts} (100%) diff --git a/scripts/build-docs.js b/scripts/build-docs.ts similarity index 100% rename from scripts/build-docs.js rename to scripts/build-docs.ts From 9e8efd8f9d061cbf396682f5c849dd72b90e846f Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:03:21 +0530 Subject: [PATCH 018/183] rename build meeting to ts --- scripts/{build-meetings.js => build-meetings.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{build-meetings.js => build-meetings.ts} (100%) diff --git a/scripts/build-meetings.js b/scripts/build-meetings.ts similarity index 100% rename from scripts/build-meetings.js rename to scripts/build-meetings.ts From 2e94f4ca6e81249cf0ba17a9a366c148d07ba308 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:03:44 +0530 Subject: [PATCH 019/183] rename build newsroom --- scripts/{build-newsroom-videos.js => build-newsroom-videos.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{build-newsroom-videos.js => build-newsroom-videos.ts} (100%) diff --git a/scripts/build-newsroom-videos.js b/scripts/build-newsroom-videos.ts similarity index 100% rename from scripts/build-newsroom-videos.js rename to scripts/build-newsroom-videos.ts From 6b6c4ea6ef813817e6f25f53a6489e01c6b6f32a Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:04:20 +0530 Subject: [PATCH 020/183] rename build postlist to ts --- scripts/{build-post-list.js => build-post-list.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{build-post-list.js => build-post-list.ts} (100%) diff --git a/scripts/build-post-list.js b/scripts/build-post-list.ts similarity index 100% rename from scripts/build-post-list.js rename to scripts/build-post-list.ts From 136bd49dabd592cdf12b5da523dcc4939d96256f Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:05:07 +0530 Subject: [PATCH 021/183] rename build rss --- scripts/{build-rss.js => build-rss.ts} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename scripts/{build-rss.js => build-rss.ts} (98%) diff --git a/scripts/build-rss.js b/scripts/build-rss.ts similarity index 98% rename from scripts/build-rss.js rename to scripts/build-rss.ts index bda4c61664cc..5090da207555 100644 --- a/scripts/build-rss.js +++ b/scripts/build-rss.ts @@ -1,6 +1,6 @@ import fs from 'fs/promises'; import json2xml from 'jgexml/json2xml.js'; -import posts from '../config/posts.json' assert { type: 'json' }; +import posts from '../config/posts.json'; function getAllPosts() { return posts; From 3e1536a727d81f46a4f2cdd8535c777f5dd51568 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:05:57 +0530 Subject: [PATCH 022/183] rename build tools to ts --- scripts/{build-tools.js => build-tools.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{build-tools.js => build-tools.ts} (100%) diff --git a/scripts/build-tools.js b/scripts/build-tools.ts similarity index 100% rename from scripts/build-tools.js rename to scripts/build-tools.ts From 2528190d1d0cc15ddf2c9a4da673adbab3193d4d Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:27:26 +0530 Subject: [PATCH 023/183] rename readWriteJSON to ts --- scripts/utils/{readAndWriteJson.js => readAndWriteJson.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/utils/{readAndWriteJson.js => readAndWriteJson.ts} (100%) diff --git a/scripts/utils/readAndWriteJson.js b/scripts/utils/readAndWriteJson.ts similarity index 100% rename from scripts/utils/readAndWriteJson.js rename to scripts/utils/readAndWriteJson.ts From 34b1cefbe2891fa5b8f3256fd4f8421382114e31 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:27:39 +0530 Subject: [PATCH 024/183] add type assertion of json --- scripts/build-rss.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/build-rss.ts b/scripts/build-rss.ts index 5090da207555..cf12e9a79ce7 100644 --- a/scripts/build-rss.ts +++ b/scripts/build-rss.ts @@ -1,6 +1,7 @@ import fs from 'fs/promises'; import json2xml from 'jgexml/json2xml.js'; -import posts from '../config/posts.json'; + +import posts from '../config/posts.json' assert { type: 'json' }; function getAllPosts() { return posts; @@ -13,6 +14,7 @@ function clean(s) { s = s.split('<').join('<'); s = s.split('>').join('>'); s = s.split('"').join('"'); + return s; } @@ -20,12 +22,15 @@ export async function rssFeed(type, title, desc, outputPath) { try { let posts = getAllPosts()[`${type}`]; const missingDatePosts = posts.filter((post) => !post.date); + posts = posts.filter((post) => post.date); posts.sort((i1, i2) => { const i1Date = new Date(i1.date); const i2Date = new Date(i2.date); + if (i1.featured && !i2.featured) return -1; if (!i1.featured && i2.featured) return 1; + return i2Date - i1Date; }); @@ -38,6 +43,7 @@ export async function rssFeed(type, title, desc, outputPath) { const feed = {}; const rss = {}; + rss['@version'] = '2.0'; rss['@xmlns:atom'] = 'http://www.w3.org/2005/Atom'; rss.channel = {}; @@ -75,13 +81,16 @@ export async function rssFeed(type, title, desc, outputPath) { guid, pubDate }; + if (post.cover) { const enclosure = {}; + enclosure['@url'] = base + post.cover; enclosure['@length'] = 15026; // dummy value, anything works enclosure['@type'] = 'image/jpeg'; if (typeof enclosure['@url'] === 'string') { const tmp = enclosure['@url'].toLowerCase(); + if (tmp.indexOf('.png') >= 0) enclosure['@type'] = 'image/png'; if (tmp.indexOf('.svg') >= 0) enclosure['@type'] = 'image/svg+xml'; if (tmp.indexOf('.webp') >= 0) enclosure['@type'] = 'image/webp'; @@ -94,6 +103,7 @@ export async function rssFeed(type, title, desc, outputPath) { feed.rss = rss; const xml = json2xml.getXml(feed, '@', '', 2); + await fs.writeFile(`./public/${outputPath}`, xml, 'utf8'); } catch (err) { throw new Error(`Failed to generate RSS feed: ${err.message}`); From cecc10e6fdc073468f2286cd9035938ab62100ab Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 21 Nov 2024 15:31:06 +0530 Subject: [PATCH 025/183] rename all files to ts --- scripts/adopters/{index.js => index.ts} | 0 scripts/casestudies/{index.js => index.ts} | 0 scripts/dashboard/{build-dashboard.js => build-dashboard.ts} | 0 scripts/dashboard/{issue-queries.js => issue-queries.ts} | 0 scripts/finance/{index.js => index.ts} | 0 scripts/markdown/{check-markdown.js => check-markdown.ts} | 0 scripts/tools/{categorylist.js => categorylist.ts} | 0 scripts/tools/{combine-tools.js => combine-tools.ts} | 0 .../tools/{extract-tools-github.js => extract-tools-github.ts} | 0 scripts/tools/{tags-color.js => tags-color.ts} | 0 scripts/tools/{tools-object.js => tools-object.ts} | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename scripts/adopters/{index.js => index.ts} (100%) rename scripts/casestudies/{index.js => index.ts} (100%) rename scripts/dashboard/{build-dashboard.js => build-dashboard.ts} (100%) rename scripts/dashboard/{issue-queries.js => issue-queries.ts} (100%) rename scripts/finance/{index.js => index.ts} (100%) rename scripts/markdown/{check-markdown.js => check-markdown.ts} (100%) rename scripts/tools/{categorylist.js => categorylist.ts} (100%) rename scripts/tools/{combine-tools.js => combine-tools.ts} (100%) rename scripts/tools/{extract-tools-github.js => extract-tools-github.ts} (100%) rename scripts/tools/{tags-color.js => tags-color.ts} (100%) rename scripts/tools/{tools-object.js => tools-object.ts} (100%) diff --git a/scripts/adopters/index.js b/scripts/adopters/index.ts similarity index 100% rename from scripts/adopters/index.js rename to scripts/adopters/index.ts diff --git a/scripts/casestudies/index.js b/scripts/casestudies/index.ts similarity index 100% rename from scripts/casestudies/index.js rename to scripts/casestudies/index.ts diff --git a/scripts/dashboard/build-dashboard.js b/scripts/dashboard/build-dashboard.ts similarity index 100% rename from scripts/dashboard/build-dashboard.js rename to scripts/dashboard/build-dashboard.ts diff --git a/scripts/dashboard/issue-queries.js b/scripts/dashboard/issue-queries.ts similarity index 100% rename from scripts/dashboard/issue-queries.js rename to scripts/dashboard/issue-queries.ts diff --git a/scripts/finance/index.js b/scripts/finance/index.ts similarity index 100% rename from scripts/finance/index.js rename to scripts/finance/index.ts diff --git a/scripts/markdown/check-markdown.js b/scripts/markdown/check-markdown.ts similarity index 100% rename from scripts/markdown/check-markdown.js rename to scripts/markdown/check-markdown.ts diff --git a/scripts/tools/categorylist.js b/scripts/tools/categorylist.ts similarity index 100% rename from scripts/tools/categorylist.js rename to scripts/tools/categorylist.ts diff --git a/scripts/tools/combine-tools.js b/scripts/tools/combine-tools.ts similarity index 100% rename from scripts/tools/combine-tools.js rename to scripts/tools/combine-tools.ts diff --git a/scripts/tools/extract-tools-github.js b/scripts/tools/extract-tools-github.ts similarity index 100% rename from scripts/tools/extract-tools-github.js rename to scripts/tools/extract-tools-github.ts diff --git a/scripts/tools/tags-color.js b/scripts/tools/tags-color.ts similarity index 100% rename from scripts/tools/tags-color.js rename to scripts/tools/tags-color.ts diff --git a/scripts/tools/tools-object.js b/scripts/tools/tools-object.ts similarity index 100% rename from scripts/tools/tools-object.js rename to scripts/tools/tools-object.ts From adb15fecb58e15a7cc8d20bc04acbff8edb513d4 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 22 Nov 2024 00:27:01 +0530 Subject: [PATCH 026/183] update imports --- scripts/adopters/index.ts | 6 ++++-- scripts/build-docs.ts | 15 ++++++++++++++- scripts/build-meetings.ts | 3 ++- scripts/build-newsroom-videos.ts | 4 +++- scripts/build-post-list.ts | 17 +++++++++++++---- scripts/build-rss.ts | 2 +- scripts/build-tools.ts | 7 ++++--- scripts/casestudies/index.ts | 4 +++- scripts/dashboard/build-dashboard.ts | 27 +++++++++++++++++++-------- scripts/finance/index.ts | 8 ++++++-- scripts/index.ts | 14 ++++++++------ scripts/tools/combine-tools.ts | 28 ++++++++++++++++++++++------ scripts/tools/tools-object.ts | 14 +++++++++----- scripts/utils/readAndWriteJson.ts | 5 +++-- 14 files changed, 111 insertions(+), 43 deletions(-) diff --git a/scripts/adopters/index.ts b/scripts/adopters/index.ts index 9018b80054ac..56235f6677e6 100644 --- a/scripts/adopters/index.ts +++ b/scripts/adopters/index.ts @@ -1,9 +1,11 @@ -import { resolve, dirname } from 'path'; +import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; -import { writeJSON } from '../utils/readAndWriteJson.js'; + +import { writeJSON } from '../utils/readAndWriteJson'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); + export async function buildAdoptersList() { writeJSON('config/adopters.yml', resolve(__dirname, '../../config', 'adopters.json')); } diff --git a/scripts/build-docs.ts b/scripts/build-docs.ts index b0183e13cf7b..f63f4914709f 100644 --- a/scripts/build-docs.ts +++ b/scripts/build-docs.ts @@ -39,6 +39,7 @@ function buildNavTree(navItems) { if (!item.isSection) { if (item.sectionId) { const section = tree[item.rootSectionId]?.children[item.sectionId]; + if (!section) { tree[item.rootSectionId].children[item.sectionId] = { item, @@ -62,6 +63,7 @@ function buildNavTree(navItems) { }) .reduce((obj, key) => { obj[key] = allChildren[key]; + return obj; }, {}); @@ -93,15 +95,20 @@ function buildNavTree(navItems) { const convertDocPosts = (docObject) => { try { let docsArray = []; + // certain entries in the DocPosts are either a parent to many posts or itself a post. + docsArray.push(docObject?.item || docObject); if (docObject.children) { const { children } = docObject; + Object.keys(children).forEach((child) => { const docChildArray = convertDocPosts(children[child]); + docsArray = [...docsArray, ...docChildArray]; }); } + return docsArray; } catch (err) { throw new Error('Error in convertDocPosts:', err); @@ -118,8 +125,10 @@ function addDocButtons(docPosts, treePosts) { structuredPosts.push(treePosts[rootElement].item); if (treePosts[rootElement].children) { const { children } = treePosts[rootElement]; + Object.keys(children).forEach((child) => { const docChildArray = convertDocPosts(children[child]); + structuredPosts = [...structuredPosts, ...docChildArray]; }); } @@ -130,11 +139,13 @@ function addDocButtons(docPosts, treePosts) { // Traversing the structuredPosts in order to add `nextPage` and `prevPage` details for each page const countDocPages = structuredPosts.length; + structuredPosts = structuredPosts.map((post, index) => { // post item specifying the root Section or sub-section in the docs are excluded as // they doesn't comprise any Doc Page or content to be shown in website. if (post?.isRootSection || post?.isSection || index == 0) { if (post?.isRootSection || index == 0) rootSections.push(post.title); + return post; } @@ -181,12 +192,14 @@ function addDocButtons(docPosts, treePosts) { } } } + return docPost; }); } catch (err) { throw new Error('An error occurred while adding doc buttons:', err); } + return structuredPosts; } -export { buildNavTree, addDocButtons, convertDocPosts }; +export { addDocButtons, buildNavTree, convertDocPosts }; diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index 4a76d021e853..68a810704fd8 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -1,6 +1,6 @@ import { writeFileSync } from 'fs'; -import { resolve } from 'path'; import { google } from 'googleapis'; +import { resolve } from 'path'; async function buildMeetings(writePath) { let auth; @@ -44,6 +44,7 @@ async function buildMeetings(writePath) { }); const eventsForHuman = JSON.stringify(eventsItems, null, ' '); + console.log('The following events got fetched', eventsForHuman); writeFileSync(writePath, eventsForHuman); diff --git a/scripts/build-newsroom-videos.ts b/scripts/build-newsroom-videos.ts index 7cd4917c7199..e78b0ffd9af1 100644 --- a/scripts/build-newsroom-videos.ts +++ b/scripts/build-newsroom-videos.ts @@ -1,6 +1,6 @@ import { writeFileSync } from 'fs'; -import { resolve } from 'path'; import fetch from 'node-fetch'; +import { resolve } from 'path'; async function buildNewsroomVideos(writePath) { try { @@ -21,6 +21,7 @@ async function buildNewsroomVideos(writePath) { } const data = await response.json(); + console.log(data); if (!data.items || !Array.isArray(data.items)) { @@ -35,6 +36,7 @@ async function buildNewsroomVideos(writePath) { })); const videoData = JSON.stringify(videoDataItems, null, ' '); + console.log('The following are the Newsroom Youtube videos: ', videoData); writeFileSync(writePath, videoData); diff --git a/scripts/build-post-list.ts b/scripts/build-post-list.ts index 946cc6456166..2e4c56a3eec7 100644 --- a/scripts/build-post-list.ts +++ b/scripts/build-post-list.ts @@ -1,12 +1,13 @@ -import { readFileSync, writeFileSync, readdirSync, statSync, existsSync } from 'fs'; -import { resolve, basename, dirname } from 'path'; +import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs'; import frontMatter from 'gray-matter'; +import { markdownToTxt } from 'markdown-to-txt'; import toc from 'markdown-toc'; import markdownTocUtils from 'markdown-toc/lib/utils.js'; +import { basename, dirname, resolve } from 'path'; import readingTime from 'reading-time'; -import { markdownToTxt } from 'markdown-to-txt'; import { fileURLToPath } from 'url'; -import { buildNavTree, addDocButtons } from './build-docs.js'; + +import { addDocButtons, buildNavTree } from './build-docs'; const { slugify } = markdownTocUtils; @@ -40,6 +41,7 @@ const addItem = (details) => { export async function buildPostList() { walkDirectories(postDirectories, result); const treePosts = buildNavTree(result.docs.filter((p) => p.slug.startsWith('/docs/'))); + result.docsTree = treePosts; result.docs = addDocButtons(result.docs, treePosts); if (process.env.NODE_ENV === 'production') { @@ -60,6 +62,7 @@ function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, s const fileNameWithSection = [fileName, '_section.mdx'].join('/'); const slug = fileName.replace(new RegExp(`^${basePath}`), ''); const slugElements = slug.split('/'); + if (isDirectory(fileName)) { if (existsSync(fileNameWithSection)) { // Passing a second argument to frontMatter disables cache. See https://github.com/asyncapi/website/issues/1057 @@ -83,11 +86,13 @@ function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, s details.slug = slug; addItem(details); const rootId = details.parent || details.rootSectionId; + walkDirectories([[fileName, slug]], result, details.weight, details.title, details.sectionId, rootId); } else if (file.endsWith('.mdx') && !fileName.endsWith('/_section.mdx')) { const fileContent = readFileSync(fileName, 'utf-8'); // Passing a second argument to frontMatter disables cache. See https://github.com/asyncapi/website/issues/1057 const { data, content } = frontMatter(fileContent, {}); + details = data; details.toc = toc(content, { slugify: slugifyToC }).json; details.readingTime = Math.ceil(readingTime(content).minutes); @@ -103,6 +108,7 @@ function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, s if (details.slug.includes('/reference/specification/') && !details.title) { const fileBaseName = basename(data.slug); // ex. v2.0.0 | v2.1.0-next-spec.1 const fileName = fileBaseName.split('-')[0]; // v2.0.0 | v2.1.0 + details.weight = specWeight--; if (fileName.startsWith('v')) { @@ -146,13 +152,16 @@ function slugifyToC(str) { let slug; // Try to match heading ids like {# myHeadingId} const headingIdMatch = str.match(/[\s]?\{\#([\w\d\-_]+)\}/); + if (headingIdMatch && headingIdMatch.length >= 2) { slug = headingIdMatch[1]; } else { // Try to match heading ids like {} const anchorTagMatch = str.match(/[\s]*= 2) slug = anchorTagMatch[1]; } + return slug || slugify(str, { firsth1: true, maxdepth: 6 }); } diff --git a/scripts/build-rss.ts b/scripts/build-rss.ts index cf12e9a79ce7..77700c192fa0 100644 --- a/scripts/build-rss.ts +++ b/scripts/build-rss.ts @@ -1,5 +1,5 @@ import fs from 'fs/promises'; -import json2xml from 'jgexml/json2xml.js'; +import json2xml from 'jgexml/json2xml'; import posts from '../config/posts.json' assert { type: 'json' }; diff --git a/scripts/build-tools.ts b/scripts/build-tools.ts index 47e0d806faa7..e18ea0a24611 100644 --- a/scripts/build-tools.ts +++ b/scripts/build-tools.ts @@ -1,8 +1,9 @@ import fs from 'fs-extra'; import { resolve } from 'path'; -import { getData } from './tools/extract-tools-github.js'; -import { convertTools } from './tools/tools-object.js'; -import { combineTools } from './tools/combine-tools.js'; + +import { combineTools } from './tools/combine-tools'; +import { getData } from './tools/extract-tools-github'; +import { convertTools } from './tools/tools-object'; const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPath) => { try { diff --git a/scripts/casestudies/index.ts b/scripts/casestudies/index.ts index e5dae72ac5a5..7aa77b59d787 100644 --- a/scripts/casestudies/index.ts +++ b/scripts/casestudies/index.ts @@ -1,10 +1,12 @@ -import { readdir, writeFile, readFile } from 'fs/promises'; +import { readdir, readFile, writeFile } from 'fs/promises'; + import { convertToJson } from '../utils'; export async function buildCaseStudiesList(dirWithCaseStudy, writeFilePath) { try { const files = await readdir(dirWithCaseStudy); const caseStudiesList = []; + for (const file of files) { const caseStudyFileName = [dirWithCaseStudy, file].join('/'); const caseStudyContent = await readFile(caseStudyFileName, 'utf-8'); diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index 07489c2eae59..b616111484f2 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -1,6 +1,7 @@ +import { graphql } from '@octokit/graphql'; import { writeFile } from 'fs-extra'; import { resolve } from 'path'; -import { graphql } from '@octokit/graphql'; + import { Queries } from './issue-queries'; /** @@ -26,7 +27,7 @@ async function getDiscussions(query, pageSize, endCursor = null) { if (result.rateLimit.remaining <= 100) { console.log( - `[WARNING] GitHub GraphQL rateLimit`, + '[WARNING] GitHub GraphQL rateLimit', `cost = ${result.rateLimit.cost}`, `limit = ${result.rateLimit.limit}`, `remaining = ${result.rateLimit.remaining}`, @@ -41,9 +42,11 @@ async function getDiscussions(query, pageSize, endCursor = null) { if (!hasNextPage) { return result.search.nodes; } + return result.search.nodes.concat(await getDiscussions(query, pageSize, result.search.pageInfo.endCursor)); } catch (e) { console.error(e); + return Promise.reject(e); } } @@ -60,6 +63,7 @@ async function getDiscussionByID(isPR, id) { return result; } catch (e) { console.error(e); + return Promise.reject(e); } } @@ -69,8 +73,10 @@ async function processHotDiscussions(batch) { batch.map(async (discussion) => { try { const isPR = discussion.__typename === 'PullRequest'; + if (discussion.comments.pageInfo.hasNextPage) { const fetchedDiscussion = await getDiscussionByID(isPR, discussion.id); + discussion = fetchedDiscussion.node; } @@ -111,12 +117,14 @@ async function getHotDiscussions(discussions) { for (let i = 0; i < discussions.length; i += batchSize) { const batch = discussions.slice(i, i + batchSize); const batchResults = await processHotDiscussions(batch); + await pause(1000); result.push(...batchResults); } result.sort((ElemA, ElemB) => ElemB.score - ElemA.score); const filteredResult = result.filter((issue) => issue.author !== 'asyncapi-bot'); + return filteredResult.slice(0, 12); } @@ -149,6 +157,7 @@ async function mapGoodFirstIssues(issues) { function getLabel(issue, filter) { const result = issue.labels.nodes.find((label) => label.name.startsWith(filter)); + return result?.name.split('/')[1]; } @@ -156,6 +165,7 @@ function monthsSince(date) { const seconds = Math.floor((new Date() - new Date(date)) / 1000); // 2592000 = number of seconds in a month = 30 * 24 * 60 * 60 const months = seconds / 2592000; + return Math.floor(months); } @@ -169,6 +179,7 @@ async function start(writePath) { getHotDiscussions(discussions), mapGoodFirstIssues(rawGoodFirstIssues) ]); + return await writeToFile({ hotDiscussions, goodFirstIssues }, writePath); } catch (e) { console.log('There were some issues parsing data from github.'); @@ -182,13 +193,13 @@ if (require.main === module) { } export { - getLabel, - monthsSince, - mapGoodFirstIssues, - getHotDiscussions, getDiscussionByID, getDiscussions, - writeToFile, + getHotDiscussions, + getLabel, + mapGoodFirstIssues, + monthsSince, + processHotDiscussions, start, - processHotDiscussions + writeToFile }; diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index f0ed465b8475..34d08fe4f88e 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -1,6 +1,7 @@ -import { resolve } from 'path'; import { mkdir } from 'fs/promises'; -import { writeJSON } from '../utils/readAndWriteJson.js'; +import { resolve } from 'path'; + +import { writeJSON } from '../utils/readAndWriteJson'; export async function buildFinanceInfoList({ currentDir, configDir, financeDir, year, jsonDataDir }) { try { @@ -9,13 +10,16 @@ export async function buildFinanceInfoList({ currentDir, configDir, financeDir, // Ensure the directory exists before writing the files const jsonDirectory = resolve(currentDir, configDir, financeDir, jsonDataDir); + await mkdir(jsonDirectory, { recursive: true }); // Write Expenses and ExpensesLink to JSON files const expensesJsonPath = resolve(jsonDirectory, 'Expenses.json'); + await writeJSON(expensesPath, expensesJsonPath); const expensesLinkJsonPath = resolve(jsonDirectory, 'ExpensesLink.json'); + await writeJSON(expensesLinkPath, expensesLinkJsonPath); } catch (err) { throw new Error(err); diff --git a/scripts/index.ts b/scripts/index.ts index 1211c9fe54e4..fa6bb97afa7f 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -1,14 +1,16 @@ -import { resolve, dirname } from 'path'; import fs from 'fs'; +import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; -import { rssFeed } from './build-rss.js'; -import { buildPostList } from './build-post-list.js'; -import { buildCaseStudiesList } from './casestudies/index.js'; -import { buildAdoptersList } from './adopters/index.js'; -import { buildFinanceInfoList } from './finance/index.js'; + +import { buildAdoptersList } from './adopters/index'; +import { buildPostList } from './build-post-list'; +import { rssFeed } from './build-rss'; +import { buildCaseStudiesList } from './casestudies/index'; +import { buildFinanceInfoList } from './finance/index'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); + async function start() { await buildPostList(); rssFeed('blog', 'AsyncAPI Initiative Blog RSS Feed', 'AsyncAPI Initiative Blog', 'rss.xml'); diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 2f296412ac1b..60f984cf1a0e 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -1,17 +1,20 @@ -import fs from 'fs'; import Ajv from 'ajv'; import addFormats from 'ajv-formats'; -import Fuse from 'fuse.js'; -import { languagesColor, technologiesColor } from './tags-color.js'; -import { categoryList } from './categorylist.js'; -import { createToolObject } from './tools-object.js'; +import fs from 'fs'; +import Fuse from 'fuse'; + +import { categoryList } from './categorylist'; +import { languagesColor, technologiesColor } from './tags-color'; +import { createToolObject } from './tools-object'; import schema from './tools-schema.json'; const ajv = new Ajv(); + addFormats(ajv, ['uri']); const validate = ajv.compile(schema); const finalTools = {}; + for (const category of categoryList) { finalTools[category.name] = { description: category.description, @@ -42,8 +45,10 @@ const getFinalTool = async (toolObject) => { // there might be a tool without language if (toolObject.filters.language) { const languageArray = []; + if (typeof toolObject.filters.language === 'string') { const languageSearch = await languageFuse.search(toolObject.filters.language); + if (languageSearch.length) { languageArray.push(languageSearch[0].item); } else { @@ -54,6 +59,7 @@ const getFinalTool = async (toolObject) => { color: 'bg-[#57f281]', borderColor: 'border-[#37f069]' }; + languageList.push(languageObject); languageArray.push(languageObject); languageFuse = new Fuse(languageList, options); @@ -61,6 +67,7 @@ const getFinalTool = async (toolObject) => { } else { for (const language of toolObject?.filters?.language) { const languageSearch = await languageFuse.search(language); + if (languageSearch.length > 0) { languageArray.push(languageSearch[0].item); } else { @@ -71,6 +78,7 @@ const getFinalTool = async (toolObject) => { color: 'bg-[#57f281]', borderColor: 'border-[#37f069]' }; + languageList.push(languageObject); languageArray.push(languageObject); languageFuse = new Fuse(languageList, options); @@ -80,9 +88,11 @@ const getFinalTool = async (toolObject) => { finalObject.filters.language = languageArray; } const technologyArray = []; + if (toolObject.filters.technology) { for (const technology of toolObject?.filters?.technology) { const technologySearch = await technologyFuse.search(technology); + if (technologySearch.length > 0) { technologyArray.push(technologySearch[0].item); } else { @@ -93,6 +103,7 @@ const getFinalTool = async (toolObject) => { color: 'bg-[#61d0f2]', borderColor: 'border-[#40ccf7]' }; + technologyList.push(technologyObject); technologyArray.push(technologyObject); technologyFuse = new Fuse(technologyList, options); @@ -100,6 +111,7 @@ const getFinalTool = async (toolObject) => { } } finalObject.filters.technology = technologyArray; + return finalObject; }; @@ -108,6 +120,7 @@ const getFinalTool = async (toolObject) => { const combineTools = async (automatedTools, manualTools, toolsPath, tagsPath) => { for (const key in automatedTools) { const finalToolsList = []; + if (automatedTools[key].toolsList.length) { for (const tool of automatedTools[key].toolsList) { finalToolsList.push(await getFinalTool(tool)); @@ -117,17 +130,20 @@ const combineTools = async (automatedTools, manualTools, toolsPath, tagsPath) => for (const tool of manualTools[key].toolsList) { let isAsyncAPIrepo; const isValid = await validate(tool); + if (isValid) { if (tool?.links?.repoUrl) { const url = new URL(tool.links.repoUrl); + isAsyncAPIrepo = url.href.startsWith('https://github.com/asyncapi/'); } else isAsyncAPIrepo = false; const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); + finalToolsList.push(await getFinalTool(toolObject)); } else { console.error('Script is not failing, it is just dropping errors for further investigation'); console.error(`Invalid ${tool.title} .asyncapi-tool file.`); - console.error(`Located in manual-tools.json file`); + console.error('Located in manual-tools.json file'); console.error('Validation errors:', JSON.stringify(validate.errors, null, 2)); } } diff --git a/scripts/tools/tools-object.ts b/scripts/tools/tools-object.ts index 16b86877784f..5482daa91898 100644 --- a/scripts/tools/tools-object.ts +++ b/scripts/tools/tools-object.ts @@ -1,12 +1,14 @@ -import axios from 'axios'; import Ajv from 'ajv'; import addFormats from 'ajv-formats'; +import axios from 'axios'; import Fuse from 'fuse.js'; -import schema from './tools-schema.json'; -import { categoryList } from './categorylist'; + import { convertToJson } from '../utils'; +import { categoryList } from './categorylist'; +import schema from './tools-schema.json'; const ajv = new Ajv(); + addFormats(ajv, ['uri']); const validate = ajv.compile(schema); @@ -39,6 +41,7 @@ const createToolObject = async (toolFile, repositoryUrl = '', repoDescription = isAsyncAPIOwner: isAsyncAPIrepo } }; + return resultantObject; }; @@ -92,8 +95,8 @@ async function convertTools(data) { if (categorySearch.length) { const searchedCategoryName = categorySearch[0].item.name; - if (!finalToolsObject[searchedCategoryName].toolsList.find((element) => element === toolObject)) - finalToolsObject[searchedCategoryName].toolsList.push(toolObject); + + if (!finalToolsObject[searchedCategoryName].toolsList.find((element) => element === toolObject)) finalToolsObject[searchedCategoryName].toolsList.push(toolObject); } else { // if Tool object has a category, not defined in our categorylist, then this provides a `other` category to the tool. if (!finalToolsObject.Others.toolsList.find((element) => element === toolObject)) @@ -112,6 +115,7 @@ async function convertTools(data) { throw err; } } + return finalToolsObject; } diff --git a/scripts/utils/readAndWriteJson.ts b/scripts/utils/readAndWriteJson.ts index 7fca9fd10116..0b8721a8379b 100644 --- a/scripts/utils/readAndWriteJson.ts +++ b/scripts/utils/readAndWriteJson.ts @@ -1,5 +1,6 @@ -import { writeFile, readFile } from 'fs/promises'; -import { convertToJson } from '../utils.js'; +import { readFile, writeFile } from 'fs/promises'; + +import { convertToJson } from '../utils'; export async function writeJSON(readPath, writePath) { let readContent; From a05df3f8137d4c27a08613bd30ded1e55d723f66 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 22 Nov 2024 00:32:46 +0530 Subject: [PATCH 027/183] update file extentions --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 13ce5e81207a..7cf2290b00bd 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "build": "npm run build-scripts && next build", "test": "jest --passWithNoTests", "build:pages": "node --loader ts-node/esm scripts/build-pages.ts && npm run format:mdx", - "build:posts": "node scripts/index.js", + "build:posts": "node --loader ts-node/esm scripts/index.ts", "build-scripts": "npm run build:pages && npm run lint:mdx && npm run build:posts", - "write:blog": "node ./scripts/compose.js", + "write:blog": "node --loader ts-node/esm ./scripts/compose.ts", "start": "npx serve@latest out", "export": "next export", "lint": "next lint", @@ -19,12 +19,12 @@ "format:mdx": "prettier --write \"**/*.mdx\"", "lint:mdx": "remark \"**/*.mdx\"", "generate:assets": "echo \"No assets to configure\"", - "generate:meetings": "node scripts/build-meetings.js", - "generate:dashboard": "node scripts/dashboard/build-dashboard.js", - "generate:videos": "node scripts/build-newsroom-videos.js", - "generate:tools": "node scripts/build-tools.js", + "generate:meetings": "node --loader ts-node/esm scripts/build-meetings.ts", + "generate:dashboard": "node --loader ts-node/esm scripts/dashboard/build-dashboard.ts", + "generate:videos": "node --loader ts-node/esm scripts/build-newsroom-videos.ts", + "generate:tools": "node --loader ts-node/esm scripts/build-tools.ts", "test:netlify": "deno test --allow-env --trace-ops netlify/**/*.test.ts", - "test:md": "node scripts/markdown/check-markdown.js", + "test:md": "node --loader ts-node/esm scripts/markdown/check-markdown.ts", "dev:storybook": "storybook dev -p 6006", "build:storybook": "storybook build" }, From 8cb082b484cf3fcb45b807cd2c59aadba7e5d5a5 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 22 Nov 2024 00:40:32 +0530 Subject: [PATCH 028/183] add ts-node config --- tsconfig.json | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index d7c7683d9403..0d6447d7f8c6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,18 @@ "@/*": ["./*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "types/**/*.d.ts", "**/*.json"], - "exclude": ["node_modules", "netlify"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + "types/**/*.d.ts", + "**/*.json" + ], + "exclude": ["node_modules", "netlify"], + "include": ["scripts/**/*"], + "ts-node": { + "esm": true, + "experimentalSpecifierResolution": "node", + "transpileOnly": true + } } From b656d31c8320afaf2322aeb6be444fe4c6663607 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 22 Nov 2024 18:35:28 +0530 Subject: [PATCH 029/183] fix eslint issues. use promise.all instead of await in a loop --- scripts/casestudies/index.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/casestudies/index.ts b/scripts/casestudies/index.ts index 7aa77b59d787..1db47f373e0c 100644 --- a/scripts/casestudies/index.ts +++ b/scripts/casestudies/index.ts @@ -2,20 +2,25 @@ import { readdir, readFile, writeFile } from 'fs/promises'; import { convertToJson } from '../utils'; -export async function buildCaseStudiesList(dirWithCaseStudy, writeFilePath) { +export async function buildCaseStudiesList(dirWithCaseStudy: string, writeFilePath: string) { try { const files = await readdir(dirWithCaseStudy); - const caseStudiesList = []; - for (const file of files) { - const caseStudyFileName = [dirWithCaseStudy, file].join('/'); - const caseStudyContent = await readFile(caseStudyFileName, 'utf-8'); - const jsonContent = convertToJson(caseStudyContent); + // Process all files in parallel using Promise.all + const caseStudiesList = await Promise.all( + files.map(async (file) => { + const caseStudyFileName = [dirWithCaseStudy, file].join('/'); + const caseStudyContent = await readFile(caseStudyFileName, 'utf-8'); - caseStudiesList.push(jsonContent); - await writeFile(writeFilePath, JSON.stringify(caseStudiesList)); - } + return convertToJson(caseStudyContent); + }) + ); + + // Write the complete list once after all files are processed + await writeFile(writeFilePath, JSON.stringify(caseStudiesList)); + + return caseStudiesList; } catch (err) { - throw new Error(err); + throw new Error(err instanceof Error ? err.message : String(err)); } } From 717135f5bb80d993f25364307842daa9e7676185 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 22 Nov 2024 19:27:34 +0530 Subject: [PATCH 030/183] fix eslint error --- scripts/build-pages.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build-pages.ts b/scripts/build-pages.ts index ed6eda670f98..901adc8c4947 100644 --- a/scripts/build-pages.ts +++ b/scripts/build-pages.ts @@ -16,6 +16,7 @@ export function capitalizeJsxTags(content: string) { if (capitalizeTags.includes(letter.toLowerCase())) { return `<${match[1] === '/' ? '/' : ''}${letter[0].toUpperCase()}${letter.slice(1)}`; } + return match; }); } From e8e30ebf8576d0cfcc22839488816f29fb4f7637 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 22 Nov 2024 19:31:43 +0530 Subject: [PATCH 031/183] rename --- scripts/utils/{readAndWriteJson.ts => readAndWriteJson.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/utils/{readAndWriteJson.ts => readAndWriteJson.js} (100%) diff --git a/scripts/utils/readAndWriteJson.ts b/scripts/utils/readAndWriteJson.js similarity index 100% rename from scripts/utils/readAndWriteJson.ts rename to scripts/utils/readAndWriteJson.js From 212e5485c02e61d064f24be51e20df21af4e7fb3 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 22 Nov 2024 19:31:49 +0530 Subject: [PATCH 032/183] rename --- scripts/utils/{readAndWriteJson.js => readAndWriteJson.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/utils/{readAndWriteJson.js => readAndWriteJson.ts} (100%) diff --git a/scripts/utils/readAndWriteJson.js b/scripts/utils/readAndWriteJson.ts similarity index 100% rename from scripts/utils/readAndWriteJson.js rename to scripts/utils/readAndWriteJson.ts From d3acd8158deadcbcb41409d077908226e9c4d2b3 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 18:35:02 +0530 Subject: [PATCH 033/183] fix eslint error --- scripts/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/index.ts b/scripts/index.ts index fa6bb97afa7f..96fcafcb384e 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -8,13 +8,13 @@ import { rssFeed } from './build-rss'; import { buildCaseStudiesList } from './casestudies/index'; import { buildFinanceInfoList } from './finance/index'; -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const currentFilePath = fileURLToPath(import.meta.url); +const currentDirPath = dirname(currentFilePath); async function start() { await buildPostList(); rssFeed('blog', 'AsyncAPI Initiative Blog RSS Feed', 'AsyncAPI Initiative Blog', 'rss.xml'); - await buildCaseStudiesList('config/casestudies', resolve(__dirname, '../config', 'case-studies.json')); + await buildCaseStudiesList('config/casestudies', resolve(currentDirPath, '../config', 'case-studies.json')); await buildAdoptersList(); const financeDir = resolve('.', 'config', 'finance'); From 09a2fccc62c5d5cd72cbe82a98495f0f375482d5 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 18:46:20 +0530 Subject: [PATCH 034/183] add error type --- scripts/build-tools.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/build-tools.ts b/scripts/build-tools.ts index e18ea0a24611..114d481cc0a5 100644 --- a/scripts/build-tools.ts +++ b/scripts/build-tools.ts @@ -1,3 +1,4 @@ +import assert from 'assert'; import fs from 'fs-extra'; import { resolve } from 'path'; @@ -5,7 +6,7 @@ import { combineTools } from './tools/combine-tools'; import { getData } from './tools/extract-tools-github'; import { convertTools } from './tools/tools-object'; -const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPath) => { +const buildTools = async (automatedToolsPath: string, manualToolsPath: string, toolsPath: string, tagsPath: string) => { try { const githubExtractData = await getData(); const automatedTools = await convertTools(githubExtractData); @@ -14,6 +15,7 @@ const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPa await combineTools(automatedTools, require(manualToolsPath), toolsPath, tagsPath); } catch (err) { + assert(err instanceof Error); throw new Error(`An error occurred while building tools: ${err.message}`); } }; From f5fac70475a7a589c2a878c7191c452e3f2e5c6e Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 18:46:29 +0530 Subject: [PATCH 035/183] add new types --- package-lock.json | 40 ++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ 2 files changed, 42 insertions(+) diff --git a/package-lock.json b/package-lock.json index 82a8b0119b9b..48e2778e309d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,6 +93,8 @@ "@storybook/nextjs": "^8.2.4", "@storybook/react": "^8.2.4", "@storybook/test": "^8.2.4", + "@types/fs-extra": "^11.0.4", + "@types/inquirer": "^9.0.7", "@types/lodash": "^4.17.0", "@types/node": "^20", "@types/react": "^18.0.1", @@ -7602,6 +7604,16 @@ "@types/send": "*" } }, + "node_modules/@types/fs-extra": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz", + "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==", + "dev": true, + "dependencies": { + "@types/jsonfile": "*", + "@types/node": "*" + } + }, "node_modules/@types/geojson": { "version": "7946.0.14", "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", @@ -7644,6 +7656,16 @@ "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" }, + "node_modules/@types/inquirer": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-9.0.7.tgz", + "integrity": "sha512-Q0zyBupO6NxGRZut/JdmqYKOnN95Eg5V8Csg3PGKkP+FnvsUZx1jAyK7fztIszxxMuoBA6E3KXWvdZVXIpx60g==", + "dev": true, + "dependencies": { + "@types/through": "*", + "rxjs": "^7.2.0" + } + }, "node_modules/@types/is-empty": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@types/is-empty/-/is-empty-1.2.3.tgz", @@ -7690,6 +7712,15 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/jsonfile": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz", + "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/lodash": { "version": "4.17.6", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.6.tgz", @@ -7894,6 +7925,15 @@ "integrity": "sha512-hcZhlNvMkQG/k1vcZ6yHOl6WAYftQ2MLfTHcYRZ2xYZFD8tGVnE3qFV0lj1smQeDSR7/yY0PyuUalauf33bJeA==", "dev": true }, + "node_modules/@types/through": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.33.tgz", + "integrity": "sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/unist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", diff --git a/package.json b/package.json index 7cf2290b00bd..fc38f85d1729 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,8 @@ "@storybook/nextjs": "^8.2.4", "@storybook/react": "^8.2.4", "@storybook/test": "^8.2.4", + "@types/fs-extra": "^11.0.4", + "@types/inquirer": "^9.0.7", "@types/lodash": "^4.17.0", "@types/node": "^20", "@types/react": "^18.0.1", From 2f782e73fb7ad8ec7d7871e8e37cf483d580d4ee Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 18:46:34 +0530 Subject: [PATCH 036/183] add types --- scripts/compose.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/compose.ts b/scripts/compose.ts index 63c653554b20..764d2cb9556e 100644 --- a/scripts/compose.ts +++ b/scripts/compose.ts @@ -2,15 +2,16 @@ * Script based on https://github.com/timlrx/tailwind-nextjs-starter-blog/blob/master/scripts/compose.js */ +import dedent from 'dedent'; import fs from 'fs'; import inquirer from 'inquirer'; -import dedent from 'dedent'; import moment from 'moment'; -const genFrontMatter = (answers) => { +const genFrontMatter = (answers:ComposePromptType) => { const d = new Date(); const date = [d.getFullYear(), `0${d.getMonth() + 1}`.slice(-2), `0${d.getDate()}`.slice(-2)].join('-'); const tagArray = answers.tags.split(','); + tagArray.forEach((tag, index) => (tagArray[index] = tag.trim())); const tags = `'${tagArray.join("','")}'`; @@ -93,6 +94,14 @@ const genFrontMatter = (answers) => { return frontMatter; }; +type ComposePromptType = { + title: string; + excerpt: string; + tags: string; + type: string; + canonical: string; +} + inquirer .prompt([ { @@ -122,7 +131,7 @@ inquirer type: 'input' } ]) - .then((answers) => { + .then((answers:ComposePromptType) => { // Remove special characters and replace space with - const fileName = answers.title .toLowerCase() @@ -131,6 +140,7 @@ inquirer .replace(/-+/g, '-'); const frontMatter = genFrontMatter(answers); const filePath = `pages/blog/${fileName || 'untitled'}.md`; + fs.writeFile(filePath, frontMatter, { flag: 'wx' }, (err) => { if (err) { throw err; From 1a1f47d835ffa8ff4d97251fe2323f8ff0311990 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 18:50:27 +0530 Subject: [PATCH 037/183] refactor and fix eslint errors --- scripts/compose.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/compose.ts b/scripts/compose.ts index 764d2cb9556e..3339c51d261b 100644 --- a/scripts/compose.ts +++ b/scripts/compose.ts @@ -7,12 +7,20 @@ import fs from 'fs'; import inquirer from 'inquirer'; import moment from 'moment'; -const genFrontMatter = (answers:ComposePromptType) => { - const d = new Date(); - const date = [d.getFullYear(), `0${d.getMonth() + 1}`.slice(-2), `0${d.getDate()}`.slice(-2)].join('-'); +type ComposePromptType = { + title: string; + excerpt: string; + tags: string; + type: string; + canonical: string; +}; + +const genFrontMatter = (answers: ComposePromptType) => { const tagArray = answers.tags.split(','); - tagArray.forEach((tag, index) => (tagArray[index] = tag.trim())); + tagArray.forEach((tag: string, index: number) => { + tagArray[index] = tag.trim(); + }); const tags = `'${tagArray.join("','")}'`; let frontMatter = dedent`--- @@ -94,14 +102,6 @@ const genFrontMatter = (answers:ComposePromptType) => { return frontMatter; }; -type ComposePromptType = { - title: string; - excerpt: string; - tags: string; - type: string; - canonical: string; -} - inquirer .prompt([ { @@ -131,7 +131,7 @@ inquirer type: 'input' } ]) - .then((answers:ComposePromptType) => { + .then((answers: ComposePromptType) => { // Remove special characters and replace space with - const fileName = answers.title .toLowerCase() From 75a53d4096896e2f80da60d4eec28e38db3253d6 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 19:34:00 +0530 Subject: [PATCH 038/183] use google apis and add types --- scripts/build-newsroom-videos.ts | 67 ++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/scripts/build-newsroom-videos.ts b/scripts/build-newsroom-videos.ts index e78b0ffd9af1..057a334d3b12 100644 --- a/scripts/build-newsroom-videos.ts +++ b/scripts/build-newsroom-videos.ts @@ -1,26 +1,36 @@ +import assert from 'assert'; import { writeFileSync } from 'fs'; -import fetch from 'node-fetch'; -import { resolve } from 'path'; +import type { youtube_v3 } from 'googleapis'; +import { google } from 'googleapis'; +import { dirname, resolve } from 'path'; +import process from 'process'; +import { fileURLToPath } from 'url'; -async function buildNewsroomVideos(writePath) { +const currentFilePath = fileURLToPath(import.meta.url); +const currentDirPath = dirname(currentFilePath); + +console.log(process.env.YOUTUBE_TOKEN); +const youtube = google.youtube({ + version: 'v3', + auth: process.env.YOUTUBE_TOKEN +}); + +async function buildNewsroomVideos(writePath: string) { try { - const response = await fetch( - `https://youtube.googleapis.com/youtube/v3/search?${new URLSearchParams({ - key: process.env.YOUTUBE_TOKEN, - part: 'snippet', - channelId: 'UCIz9zGwDLbrYQcDKVXdOstQ', - eventType: 'completed', - type: 'video', - order: 'Date', - maxResults: 5 - })}` - ); - - if (!response.ok) { + const response = await youtube.search.list({ + part: ['snippet'], + channelId: 'UCIz9zGwDLbrYQcDKVXdOstQ', + eventType: 'completed', + type: ['video'], + order: 'date', + maxResults: 5 + } as youtube_v3.Params$Resource$Search$List); + + if (response.status !== 200) { throw new Error(`HTTP error! with status code: ${response.status}`); } - const data = await response.json(); + const data = await response.data; console.log(data); @@ -28,12 +38,18 @@ async function buildNewsroomVideos(writePath) { throw new Error('Invalid data structure received from YouTube API'); } - const videoDataItems = data.items.map((video) => ({ - image_url: video.snippet.thumbnails.high.url, - title: video.snippet.title, - description: video.snippet.description, - videoId: video.id.videoId - })); + const videoDataItems = data.items.map((video) => { + if (!video.snippet) { + throw new Error('Invalid data structure received from YouTube API'); + } + + return { + image_url: video.snippet.thumbnails!.high!.url, + title: video.snippet.title, + description: video.snippet.description, + videoId: video.id!.videoId + }; + }); const videoData = JSON.stringify(videoDataItems, null, ' '); @@ -43,13 +59,14 @@ async function buildNewsroomVideos(writePath) { return videoData; } catch (err) { + assert(err instanceof Error); throw new Error(`Failed to build newsroom videos: ${err.message}`); } } /* istanbul ignore next */ -if (require.main === module) { - buildNewsroomVideos(resolve(__dirname, '../config', 'newsroom_videos.json')); +if (process.argv[1] === fileURLToPath(import.meta.url)) { + buildNewsroomVideos(resolve(currentDirPath, '../config', 'newsroom_videos.json')); } export { buildNewsroomVideos }; From 74d199fc0a38f23ee13726bd8fe3b8cf0b14424f Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 19:34:20 +0530 Subject: [PATCH 039/183] remove console log --- scripts/build-newsroom-videos.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/build-newsroom-videos.ts b/scripts/build-newsroom-videos.ts index 057a334d3b12..100afaa328fa 100644 --- a/scripts/build-newsroom-videos.ts +++ b/scripts/build-newsroom-videos.ts @@ -9,7 +9,6 @@ import { fileURLToPath } from 'url'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); -console.log(process.env.YOUTUBE_TOKEN); const youtube = google.youtube({ version: 'v3', auth: process.env.YOUTUBE_TOKEN From 0459723a180a86c01738da8d48943714f962ff62 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 19:35:36 +0530 Subject: [PATCH 040/183] add specific rules for the script folder --- .eslintrc | 173 ++++++++++++++++++++---------------------------------- 1 file changed, 65 insertions(+), 108 deletions(-) diff --git a/.eslintrc b/.eslintrc index f77da8144e9c..2fe6b4c8dad3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,18 +4,15 @@ "next/core-web-vitals", "eslint:recommended", "plugin:prettier/recommended", - "plugin:storybook/recommended" + "plugin:storybook/recommended", ], "env": { "browser": true, "es2021": true, "node": true, - "jest": true + "jest": true, }, - "plugins": [ - "react", - "jsx-a11y" - ], + "plugins": ["react", "jsx-a11y"], "rules": { "prettier/prettier": [ "error", @@ -33,47 +30,43 @@ "insertPragma": false, "requirePragma": false, "jsxSingleQuote": true, - "printWidth": 120 - } + "printWidth": 120, + }, ], "max-len": [ "error", { "code": 120, "ignoreUrls": true, - "ignorePattern": "(className=\\{[\\s\\S]*\\}|.*\\}|'.*'|className='.*')" // Ignore classnames - } - ] + "ignorePattern": "(className=\\{[\\s\\S]*\\}|.*\\}|'.*'|className='.*')", // Ignore classnames + }, + ], }, "globals": { "React": true, "expect": true, "jsdom": true, - "JSX": true + "JSX": true, }, "overrides": [ // Configuration for TypeScript files { - "files": [ - "**/*.ts", - "**/*.tsx", - "netlify/*.ts" - ], + "files": ["**/*.ts", "**/*.tsx", "netlify/*.ts"], "plugins": [ "@typescript-eslint", "tailwindcss", "unused-imports", - "simple-import-sort" + "simple-import-sort", ], "extends": [ "plugin:tailwindcss/recommended", "airbnb-typescript", "next/core-web-vitals", "plugin:prettier/recommended", - "plugin:storybook/recommended" + "plugin:storybook/recommended", ], "parserOptions": { - "project": "./tsconfig.json" + "project": "./tsconfig.json", }, "rules": { "react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable @@ -89,7 +82,7 @@ "error", "ForInStatement", "LabeledStatement", - "WithStatement" + "WithStatement", ], // Overrides Airbnb configuration and enable no-restricted-syntax "import/prefer-default-export": "off", // Named export is easier to refactor automatically "tailwindcss/no-custom-classname": "off", // Disabled otherwise nightmare to allow each custom tailwind classes @@ -101,8 +94,8 @@ "unused-imports/no-unused-vars": [ "error", { - "argsIgnorePattern": "^_" - } + "argsIgnorePattern": "^_", + }, ], // Variables "init-declarations": "off", @@ -126,42 +119,30 @@ "off", "stroustrup", { - "allowSingleLine": true - } + "allowSingleLine": true, + }, ], "camelcase": "off", "capitalized-comments": "off", - "comma-dangle": [ - "error", - "never" - ], + "comma-dangle": ["error", "never"], "comma-spacing": [ 2, { "before": false, - "after": true - } - ], - "comma-style": [ - "error", - "last" + "after": true, + }, ], + "comma-style": ["error", "last"], "eol-last": "error", "func-call-spacing": "error", "func-name-matching": "error", "func-names": "off", "func-style": "off", - "jsx-quotes": [ - "error", - "prefer-single" - ], + "jsx-quotes": ["error", "prefer-single"], "key-spacing": "error", "keyword-spacing": "error", "line-comment-position": "off", - "linebreak-style": [ - "error", - "unix" - ], + "linebreak-style": ["error", "unix"], "lines-around-comment": [ "error", { @@ -174,22 +155,22 @@ "allowObjectStart": true, "allowObjectEnd": false, "allowArrayStart": true, - "allowArrayEnd": false - } + "allowArrayEnd": false, + }, ], "max-depth": "error", "max-lines": [ "error", { - "max": 2000 - } + "max": 2000, + }, ], "max-nested-callbacks": "error", "max-statements-per-line": [ "error", { - "max": 2 - } + "max": 2, + }, ], "multiline-comment-style": "off", "multiline-ternary": "off", @@ -198,13 +179,10 @@ "newline-per-chained-call": [ "error", { - "ignoreChainWithDepth": 4 - } - ], - "newline-after-var": [ - "error", - "always" + "ignoreChainWithDepth": 4, + }, ], + "newline-after-var": ["error", "always"], "no-array-constructor": "error", "no-lonely-if": "error", "no-mixed-operators": "off", @@ -213,8 +191,8 @@ "no-multiple-empty-lines": [ "error", { - "max": 1 - } + "max": 1, + }, ], "no-negated-condition": "error", "no-nested-ternary": "error", @@ -227,63 +205,39 @@ "no-whitespace-before-property": "error", "nonblock-statement-body-position": "error", "object-curly-newline": "off", - "object-curly-spacing": [ - "error", - "always" - ], + "object-curly-spacing": ["error", "always"], "object-property-newline": "off", - "padded-blocks": [ - "error", - "never" - ], + "padded-blocks": ["error", "never"], "padding-line-between-statements": [ "error", { "blankLine": "always", "prev": "*", - "next": "return" + "next": "return", }, { "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" + "prev": ["const", "let", "var"], + "next": "*", }, { "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "quote-props": [ - "error", - "as-needed" + "prev": ["const", "let", "var"], + "next": ["const", "let", "var"], + }, ], + "quote-props": ["error", "as-needed"], "quotes": [ "error", "single", { - "avoidEscape": true - } + "avoidEscape": true, + }, ], - "require-jsdoc": "warn", + "require-jsdoc": "off", "semi": "error", "semi-spacing": "error", - "semi-style": [ - "error", - "last" - ], + "semi-style": ["error", "last"], "sort-keys": "off", "sort-vars": "off", "space-before-blocks": "error", @@ -296,22 +250,25 @@ "always", { "block": { - "exceptions": [ - "!" - ] - } - } + "exceptions": ["!"], + }, + }, ], - "switch-colon-spacing": "error" - } + "switch-colon-spacing": "error", + }, }, { - "files": [ - "components/logos/*" - ], + "files": ["components/logos/*"], + "rules": { + "max-len": "off", + }, + }, + { + "files": ["scripts/*"], "rules": { - "max-len": "off" - } - } - ] + "import/no-extraneous-dependencies": "off", + "no-console": "off", + }, + }, + ], } From 24ff781ed51f205e0552361e0349eb38ff729559 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 21:11:54 +0530 Subject: [PATCH 041/183] refactor dir variables --- scripts/adopters/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/adopters/index.ts b/scripts/adopters/index.ts index 56235f6677e6..0e6b9ecfa888 100644 --- a/scripts/adopters/index.ts +++ b/scripts/adopters/index.ts @@ -3,9 +3,10 @@ import { fileURLToPath } from 'url'; import { writeJSON } from '../utils/readAndWriteJson'; -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); + +const currentFilePath = fileURLToPath(import.meta.url); +const currentDirPath = dirname(currentFilePath); export async function buildAdoptersList() { - writeJSON('config/adopters.yml', resolve(__dirname, '../../config', 'adopters.json')); + writeJSON('config/adopters.yml', resolve(currentDirPath, '../../config', 'adopters.json')); } From 39821b700f8e5c427730747d96b0d4c7c825a378 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 23 Nov 2024 21:16:29 +0530 Subject: [PATCH 042/183] add types and refactor it --- scripts/finance/index.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index 34d08fe4f88e..2fddbf7f41ab 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -1,9 +1,24 @@ +import assert from 'assert'; import { mkdir } from 'fs/promises'; import { resolve } from 'path'; import { writeJSON } from '../utils/readAndWriteJson'; -export async function buildFinanceInfoList({ currentDir, configDir, financeDir, year, jsonDataDir }) { +interface BuildFinanceInfoListProps { + currentDir: string; + configDir: string; + financeDir: string; + year: string; + jsonDataDir: string; +} + +export async function buildFinanceInfoList({ + currentDir, + configDir, + financeDir, + year, + jsonDataDir +}: BuildFinanceInfoListProps) { try { const expensesPath = resolve(currentDir, configDir, financeDir, year, 'Expenses.yml'); const expensesLinkPath = resolve(currentDir, configDir, financeDir, year, 'ExpensesLink.yml'); @@ -22,6 +37,7 @@ export async function buildFinanceInfoList({ currentDir, configDir, financeDir, await writeJSON(expensesLinkPath, expensesLinkJsonPath); } catch (err) { - throw new Error(err); + assert(err instanceof Error); + throw new Error(err.message); } } From 00ed279d454ed5ae05cd1ff4ab099f0fbc7119d1 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 24 Nov 2024 14:38:10 +0530 Subject: [PATCH 043/183] refactor: update eslint rules --- .eslintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 2fe6b4c8dad3..bc865d7ebfc0 100644 --- a/.eslintrc +++ b/.eslintrc @@ -264,7 +264,7 @@ }, }, { - "files": ["scripts/*"], + "files": ["scripts/**/*"], "rules": { "import/no-extraneous-dependencies": "off", "no-console": "off", From 8bf03da5ea7ec3eb7695804f764b0424c2fead41 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 24 Nov 2024 17:25:56 +0530 Subject: [PATCH 044/183] reformat document --- pages/_document.tsx | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/pages/_document.tsx b/pages/_document.tsx index ac793e9eced9..fecd327edff1 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -12,51 +12,27 @@ class MyDocument extends Document { render() { // eslint-disable-next-line no-underscore-dangle - const currentLocale = - this.props.__NEXT_DATA__.query.locale || i18nextConfig.i18n.defaultLocale; + const currentLocale = this.props.__NEXT_DATA__.query.locale || i18nextConfig.i18n.defaultLocale; return ( {/* Load Work Sans font */} - - + + {/* eslint-disable-next-line max-len */} {/* Icons */} - - - - + + + + - +
From 15ffa2bfc7f9e9685ac44a953a834c1b49c99a1a Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 24 Nov 2024 18:18:30 +0530 Subject: [PATCH 045/183] update include paths --- tsconfig.json | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 0d6447d7f8c6..fbc1bc06d441 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,15 +16,8 @@ "@/*": ["./*"] } }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - "types/**/*.d.ts", - "**/*.json" - ], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.json"], "exclude": ["node_modules", "netlify"], - "include": ["scripts/**/*"], "ts-node": { "esm": true, "experimentalSpecifierResolution": "node", From 02e679a7d08eb5a3963ee7241930f5cebff57d78 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 24 Nov 2024 18:25:33 +0530 Subject: [PATCH 046/183] use dynamic import --- scripts/build-rss.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build-rss.ts b/scripts/build-rss.ts index 77700c192fa0..9eda115bc4d7 100644 --- a/scripts/build-rss.ts +++ b/scripts/build-rss.ts @@ -1,9 +1,9 @@ import fs from 'fs/promises'; import json2xml from 'jgexml/json2xml'; -import posts from '../config/posts.json' assert { type: 'json' }; +async function getAllPosts() { + const posts = (await import('../config/posts.json', { assert: { type: 'json' } })).default; -function getAllPosts() { return posts; } @@ -20,7 +20,7 @@ function clean(s) { export async function rssFeed(type, title, desc, outputPath) { try { - let posts = getAllPosts()[`${type}`]; + let posts = (await getAllPosts())[`${type}`]; const missingDatePosts = posts.filter((post) => !post.date); posts = posts.filter((post) => post.date); From 227995de28432fd7b3b6a288bc21881384ee51f6 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 26 Nov 2024 23:12:17 +0530 Subject: [PATCH 047/183] reformat eslintrc --- .eslintrc | 173 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 111 insertions(+), 62 deletions(-) diff --git a/.eslintrc b/.eslintrc index bc865d7ebfc0..176e8dd85088 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,15 +4,18 @@ "next/core-web-vitals", "eslint:recommended", "plugin:prettier/recommended", - "plugin:storybook/recommended", + "plugin:storybook/recommended" ], "env": { "browser": true, "es2021": true, "node": true, - "jest": true, + "jest": true }, - "plugins": ["react", "jsx-a11y"], + "plugins": [ + "react", + "jsx-a11y" + ], "rules": { "prettier/prettier": [ "error", @@ -30,43 +33,47 @@ "insertPragma": false, "requirePragma": false, "jsxSingleQuote": true, - "printWidth": 120, - }, + "printWidth": 120 + } ], "max-len": [ "error", { "code": 120, "ignoreUrls": true, - "ignorePattern": "(className=\\{[\\s\\S]*\\}|.*\\}|'.*'|className='.*')", // Ignore classnames - }, - ], + "ignorePattern": "(className=\\{[\\s\\S]*\\}|.*\\}|'.*'|className='.*')" // Ignore classnames + } + ] }, "globals": { "React": true, "expect": true, "jsdom": true, - "JSX": true, + "JSX": true }, "overrides": [ // Configuration for TypeScript files { - "files": ["**/*.ts", "**/*.tsx", "netlify/*.ts"], + "files": [ + "**/*.ts", + "**/*.tsx", + "netlify/*.ts" + ], "plugins": [ "@typescript-eslint", "tailwindcss", "unused-imports", - "simple-import-sort", + "simple-import-sort" ], "extends": [ "plugin:tailwindcss/recommended", "airbnb-typescript", "next/core-web-vitals", "plugin:prettier/recommended", - "plugin:storybook/recommended", + "plugin:storybook/recommended" ], "parserOptions": { - "project": "./tsconfig.json", + "project": "./tsconfig.json" }, "rules": { "react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable @@ -82,7 +89,7 @@ "error", "ForInStatement", "LabeledStatement", - "WithStatement", + "WithStatement" ], // Overrides Airbnb configuration and enable no-restricted-syntax "import/prefer-default-export": "off", // Named export is easier to refactor automatically "tailwindcss/no-custom-classname": "off", // Disabled otherwise nightmare to allow each custom tailwind classes @@ -94,8 +101,8 @@ "unused-imports/no-unused-vars": [ "error", { - "argsIgnorePattern": "^_", - }, + "argsIgnorePattern": "^_" + } ], // Variables "init-declarations": "off", @@ -119,30 +126,42 @@ "off", "stroustrup", { - "allowSingleLine": true, - }, + "allowSingleLine": true + } ], "camelcase": "off", "capitalized-comments": "off", - "comma-dangle": ["error", "never"], + "comma-dangle": [ + "error", + "never" + ], "comma-spacing": [ 2, { "before": false, - "after": true, - }, + "after": true + } + ], + "comma-style": [ + "error", + "last" ], - "comma-style": ["error", "last"], "eol-last": "error", "func-call-spacing": "error", "func-name-matching": "error", "func-names": "off", "func-style": "off", - "jsx-quotes": ["error", "prefer-single"], + "jsx-quotes": [ + "error", + "prefer-single" + ], "key-spacing": "error", "keyword-spacing": "error", "line-comment-position": "off", - "linebreak-style": ["error", "unix"], + "linebreak-style": [ + "error", + "unix" + ], "lines-around-comment": [ "error", { @@ -155,22 +174,22 @@ "allowObjectStart": true, "allowObjectEnd": false, "allowArrayStart": true, - "allowArrayEnd": false, - }, + "allowArrayEnd": false + } ], "max-depth": "error", "max-lines": [ "error", { - "max": 2000, - }, + "max": 2000 + } ], "max-nested-callbacks": "error", "max-statements-per-line": [ "error", { - "max": 2, - }, + "max": 2 + } ], "multiline-comment-style": "off", "multiline-ternary": "off", @@ -179,10 +198,13 @@ "newline-per-chained-call": [ "error", { - "ignoreChainWithDepth": 4, - }, + "ignoreChainWithDepth": 4 + } + ], + "newline-after-var": [ + "error", + "always" ], - "newline-after-var": ["error", "always"], "no-array-constructor": "error", "no-lonely-if": "error", "no-mixed-operators": "off", @@ -191,8 +213,8 @@ "no-multiple-empty-lines": [ "error", { - "max": 1, - }, + "max": 1 + } ], "no-negated-condition": "error", "no-nested-ternary": "error", @@ -205,39 +227,63 @@ "no-whitespace-before-property": "error", "nonblock-statement-body-position": "error", "object-curly-newline": "off", - "object-curly-spacing": ["error", "always"], + "object-curly-spacing": [ + "error", + "always" + ], "object-property-newline": "off", - "padded-blocks": ["error", "never"], + "padded-blocks": [ + "error", + "never" + ], "padding-line-between-statements": [ "error", { "blankLine": "always", "prev": "*", - "next": "return", + "next": "return" }, { "blankLine": "always", - "prev": ["const", "let", "var"], - "next": "*", + "prev": [ + "const", + "let", + "var" + ], + "next": "*" }, { "blankLine": "any", - "prev": ["const", "let", "var"], - "next": ["const", "let", "var"], - }, + "prev": [ + "const", + "let", + "var" + ], + "next": [ + "const", + "let", + "var" + ] + } + ], + "quote-props": [ + "error", + "as-needed" ], - "quote-props": ["error", "as-needed"], "quotes": [ "error", "single", { - "avoidEscape": true, - }, + "avoidEscape": true + } ], - "require-jsdoc": "off", + "require-jsdoc": "warn", "semi": "error", "semi-spacing": "error", - "semi-style": ["error", "last"], + "semi-style": [ + "error", + "last" + ], "sort-keys": "off", "sort-vars": "off", "space-before-blocks": "error", @@ -250,25 +296,28 @@ "always", { "block": { - "exceptions": ["!"], - }, - }, + "exceptions": [ + "!" + ] + } + } ], - "switch-colon-spacing": "error", - }, + "switch-colon-spacing": "error" + } }, { - "files": ["components/logos/*"], + "files": [ + "components/logos/*" + ], "rules": { - "max-len": "off", + "max-len": "off" }, - }, - { + "files": ["scripts/**/*"], "rules": { "import/no-extraneous-dependencies": "off", - "no-console": "off", - }, - }, - ], -} + "no-console": "off" + } + } + ] +} \ No newline at end of file From 599ab9e4914353dbad81354aa04d7abe7e37450f Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 12:26:33 +0530 Subject: [PATCH 048/183] update rules --- .eslintrc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.eslintrc b/.eslintrc index 176e8dd85088..744817b665f6 100644 --- a/.eslintrc +++ b/.eslintrc @@ -311,13 +311,15 @@ ], "rules": { "max-len": "off" - }, - - "files": ["scripts/**/*"], + } + }, + { + "files": ["scripts/**/*"], "rules": { "import/no-extraneous-dependencies": "off", - "no-console": "off" + "no-console": "off", + "require-jsdoc":"off" } - } + } ] } \ No newline at end of file From e71fcbaf94161c2bcd6624b80d525742290fea2b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 12:27:49 +0530 Subject: [PATCH 049/183] change tabs to spaces --- .eslintrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.eslintrc b/.eslintrc index 744817b665f6..cb6d2cb8a0dd 100644 --- a/.eslintrc +++ b/.eslintrc @@ -313,13 +313,13 @@ "max-len": "off" } }, - { - "files": ["scripts/**/*"], + { + "files": ["scripts/**/*"], "rules": { "import/no-extraneous-dependencies": "off", "no-console": "off", - "require-jsdoc":"off" + "require-jsdoc":"off" } - } + } ] } \ No newline at end of file From 851d1af6bb9a2120938fe31f59cddcd4e6ffc15b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 14:25:03 +0530 Subject: [PATCH 050/183] update ts node config --- package-lock.json | 454 +++++++++++++++++++++++++++++++++++++++++++--- package.json | 16 +- tsconfig.json | 1 - 3 files changed, 435 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index e9ab82f13858..56b91aa614b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,6 +78,8 @@ "swiper": "^11.0.7", "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", + "ts-node": "^10.9.2", + "tsx": "^4.19.2", "typescript": "^5.3.3", "yaml": "^2.3.4" }, @@ -124,8 +126,7 @@ "remark-cli": "^12.0.1", "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", - "storybook": "^8.2.4", - "ts-node": "^10.9.2" + "storybook": "^8.2.4" } }, "node_modules/@adobe/css-tools": { @@ -2420,7 +2421,6 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "devOptional": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -2432,7 +2432,6 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "devOptional": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -2754,6 +2753,21 @@ "node": ">=12" } }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/openbsd-x64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", @@ -7200,26 +7214,22 @@ "node_modules/@tsconfig/node10": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", - "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", - "devOptional": true + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==" }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "devOptional": true + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "devOptional": true + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" }, "node_modules/@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "devOptional": true + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" }, "node_modules/@types/acorn": { "version": "4.0.6", @@ -10816,8 +10826,7 @@ "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "devOptional": true + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" }, "node_modules/cross-spawn": { "version": "7.0.6", @@ -14682,7 +14691,6 @@ "version": "4.7.5", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", - "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -18338,8 +18346,7 @@ "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "devOptional": true + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" }, "node_modules/makeerror": { "version": "1.0.12", @@ -26281,7 +26288,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "dev": true, "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } @@ -28709,7 +28715,6 @@ "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "devOptional": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -28752,7 +28757,6 @@ "version": "8.14.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "devOptional": true, "bin": { "acorn": "bin/acorn" }, @@ -28764,7 +28768,6 @@ "version": "8.3.4", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", - "devOptional": true, "dependencies": { "acorn": "^8.11.0" }, @@ -28775,14 +28778,12 @@ "node_modules/ts-node/node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "devOptional": true + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" }, "node_modules/ts-node/node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "devOptional": true, "engines": { "node": ">=0.3.1" } @@ -28862,6 +28863,407 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/tsx": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", + "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", + "dependencies": { + "esbuild": "~0.23.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" + } + }, "node_modules/tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -29892,8 +30294,7 @@ "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "devOptional": true + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" }, "node_modules/v8-to-istanbul": { "version": "9.3.0", @@ -30641,7 +31042,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "devOptional": true, "engines": { "node": ">=6" } diff --git a/package.json b/package.json index fc38f85d1729..0f7a3c4748f0 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,10 @@ "dev": "npm run build-scripts && next dev", "build": "npm run build-scripts && next build", "test": "jest --passWithNoTests", - "build:pages": "node --loader ts-node/esm scripts/build-pages.ts && npm run format:mdx", - "build:posts": "node --loader ts-node/esm scripts/index.ts", + "build:pages": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/build-pages.ts && npm run format:mdx", + "build:posts": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/index.ts", "build-scripts": "npm run build:pages && npm run lint:mdx && npm run build:posts", - "write:blog": "node --loader ts-node/esm ./scripts/compose.ts", + "write:blog": "node --loader ts-node/esm --no-warnings=ExperimentalWarning ./scripts/compose.ts", "start": "npx serve@latest out", "export": "next export", "lint": "next lint", @@ -19,12 +19,12 @@ "format:mdx": "prettier --write \"**/*.mdx\"", "lint:mdx": "remark \"**/*.mdx\"", "generate:assets": "echo \"No assets to configure\"", - "generate:meetings": "node --loader ts-node/esm scripts/build-meetings.ts", - "generate:dashboard": "node --loader ts-node/esm scripts/dashboard/build-dashboard.ts", - "generate:videos": "node --loader ts-node/esm scripts/build-newsroom-videos.ts", - "generate:tools": "node --loader ts-node/esm scripts/build-tools.ts", + "generate:meetings": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/build-meetings.ts", + "generate:dashboard": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/dashboard/build-dashboard.ts", + "generate:videos": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/build-newsroom-videos.ts", + "generate:tools": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/build-tools.ts", "test:netlify": "deno test --allow-env --trace-ops netlify/**/*.test.ts", - "test:md": "node --loader ts-node/esm scripts/markdown/check-markdown.ts", + "test:md": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/markdown/check-markdown.ts", "dev:storybook": "storybook dev -p 6006", "build:storybook": "storybook build" }, diff --git a/tsconfig.json b/tsconfig.json index fbc1bc06d441..b73954042008 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,6 @@ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.json"], "exclude": ["node_modules", "netlify"], "ts-node": { - "esm": true, "experimentalSpecifierResolution": "node", "transpileOnly": true } From 81d6cfc2af0eec8606cbabda3d599e849f19c40a Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 16:22:29 +0530 Subject: [PATCH 051/183] migrate tools scripts --- package-lock.json | 454 ++------------------------ scripts/build-tools.ts | 1 + scripts/tools/combine-tools.ts | 4 +- scripts/tools/extract-tools-github.ts | 3 +- scripts/tools/tools-object.ts | 5 +- 5 files changed, 34 insertions(+), 433 deletions(-) diff --git a/package-lock.json b/package-lock.json index 56b91aa614b7..e9ab82f13858 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,8 +78,6 @@ "swiper": "^11.0.7", "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", - "ts-node": "^10.9.2", - "tsx": "^4.19.2", "typescript": "^5.3.3", "yaml": "^2.3.4" }, @@ -126,7 +124,8 @@ "remark-cli": "^12.0.1", "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", - "storybook": "^8.2.4" + "storybook": "^8.2.4", + "ts-node": "^10.9.2" } }, "node_modules/@adobe/css-tools": { @@ -2421,6 +2420,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "devOptional": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -2432,6 +2432,7 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "devOptional": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -2753,21 +2754,6 @@ "node": ">=12" } }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", - "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, "node_modules/@esbuild/openbsd-x64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", @@ -7214,22 +7200,26 @@ "node_modules/@tsconfig/node10": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", - "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==" + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "devOptional": true }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "devOptional": true }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "devOptional": true }, "node_modules/@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "devOptional": true }, "node_modules/@types/acorn": { "version": "4.0.6", @@ -10826,7 +10816,8 @@ "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "devOptional": true }, "node_modules/cross-spawn": { "version": "7.0.6", @@ -14691,6 +14682,7 @@ "version": "4.7.5", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", + "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -18346,7 +18338,8 @@ "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "devOptional": true }, "node_modules/makeerror": { "version": "1.0.12", @@ -26288,6 +26281,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } @@ -28715,6 +28709,7 @@ "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "devOptional": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -28757,6 +28752,7 @@ "version": "8.14.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "devOptional": true, "bin": { "acorn": "bin/acorn" }, @@ -28768,6 +28764,7 @@ "version": "8.3.4", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "devOptional": true, "dependencies": { "acorn": "^8.11.0" }, @@ -28778,12 +28775,14 @@ "node_modules/ts-node/node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "devOptional": true }, "node_modules/ts-node/node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "devOptional": true, "engines": { "node": ">=0.3.1" } @@ -28863,407 +28862,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/tsx": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", - "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", - "dependencies": { - "esbuild": "~0.23.0", - "get-tsconfig": "^4.7.5" - }, - "bin": { - "tsx": "dist/cli.mjs" - }, - "engines": { - "node": ">=18.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - } - }, - "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", - "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", - "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", - "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", - "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", - "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/darwin-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", - "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", - "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", - "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", - "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", - "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", - "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-loong64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", - "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", - "cpu": [ - "loong64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", - "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", - "cpu": [ - "mips64el" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", - "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", - "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", - "cpu": [ - "riscv64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-s390x": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", - "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", - "cpu": [ - "s390x" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", - "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", - "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", - "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/sunos-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", - "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/win32-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", - "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/win32-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", - "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/win32-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", - "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/esbuild": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", - "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.23.1", - "@esbuild/android-arm": "0.23.1", - "@esbuild/android-arm64": "0.23.1", - "@esbuild/android-x64": "0.23.1", - "@esbuild/darwin-arm64": "0.23.1", - "@esbuild/darwin-x64": "0.23.1", - "@esbuild/freebsd-arm64": "0.23.1", - "@esbuild/freebsd-x64": "0.23.1", - "@esbuild/linux-arm": "0.23.1", - "@esbuild/linux-arm64": "0.23.1", - "@esbuild/linux-ia32": "0.23.1", - "@esbuild/linux-loong64": "0.23.1", - "@esbuild/linux-mips64el": "0.23.1", - "@esbuild/linux-ppc64": "0.23.1", - "@esbuild/linux-riscv64": "0.23.1", - "@esbuild/linux-s390x": "0.23.1", - "@esbuild/linux-x64": "0.23.1", - "@esbuild/netbsd-x64": "0.23.1", - "@esbuild/openbsd-arm64": "0.23.1", - "@esbuild/openbsd-x64": "0.23.1", - "@esbuild/sunos-x64": "0.23.1", - "@esbuild/win32-arm64": "0.23.1", - "@esbuild/win32-ia32": "0.23.1", - "@esbuild/win32-x64": "0.23.1" - } - }, "node_modules/tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -30294,7 +29892,8 @@ "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "devOptional": true }, "node_modules/v8-to-istanbul": { "version": "9.3.0", @@ -31042,6 +30641,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "devOptional": true, "engines": { "node": ">=6" } diff --git a/scripts/build-tools.ts b/scripts/build-tools.ts index 114d481cc0a5..9dfb88f12e80 100644 --- a/scripts/build-tools.ts +++ b/scripts/build-tools.ts @@ -13,6 +13,7 @@ const buildTools = async (automatedToolsPath: string, manualToolsPath: string, t await fs.writeFile(automatedToolsPath, JSON.stringify(automatedTools, null, ' ')); + // eslint-disable-next-line import/no-dynamic-require, global-require await combineTools(automatedTools, require(manualToolsPath), toolsPath, tagsPath); } catch (err) { assert(err instanceof Error); diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 60f984cf1a0e..1a98de91ebde 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -1,12 +1,12 @@ import Ajv from 'ajv'; import addFormats from 'ajv-formats'; import fs from 'fs'; -import Fuse from 'fuse'; +import Fuse from 'fuse.js'; import { categoryList } from './categorylist'; import { languagesColor, technologiesColor } from './tags-color'; import { createToolObject } from './tools-object'; -import schema from './tools-schema.json'; +import schema from './tools-schema.json' assert { type: 'json' }; const ajv = new Ajv(); diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index 71a2a8cbb1f6..7b9831dfd67c 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -1,6 +1,7 @@ import axios from 'axios'; +import dotenv from 'dotenv'; -require('dotenv').config(); +dotenv.config(); const getData = async () => { try { diff --git a/scripts/tools/tools-object.ts b/scripts/tools/tools-object.ts index 5482daa91898..d7bb1f8b9e86 100644 --- a/scripts/tools/tools-object.ts +++ b/scripts/tools/tools-object.ts @@ -5,7 +5,7 @@ import Fuse from 'fuse.js'; import { convertToJson } from '../utils'; import { categoryList } from './categorylist'; -import schema from './tools-schema.json'; +import schema from './tools-schema.json' assert { type: 'json' }; const ajv = new Ajv(); @@ -56,8 +56,7 @@ async function convertTools(data) { // initialising finalToolsObject with all categories inside it with proper elements in each category for (const index in categoryList) { finalToolsObject[categoryList[index].name] = { - description: categoryList[index].description, - toolsList: [] + description: categoryList[index].de }; } From c5b5c9ffa8f980b73c3e6d350bc688543ee6b8be Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 16:30:22 +0530 Subject: [PATCH 052/183] refactor __dirname variable --- scripts/build-tools.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/build-tools.ts b/scripts/build-tools.ts index 9dfb88f12e80..72a0fa2b4af0 100644 --- a/scripts/build-tools.ts +++ b/scripts/build-tools.ts @@ -1,11 +1,15 @@ import assert from 'assert'; import fs from 'fs-extra'; -import { resolve } from 'path'; +import { dirname, resolve } from 'path'; +import { fileURLToPath } from 'url'; import { combineTools } from './tools/combine-tools'; import { getData } from './tools/extract-tools-github'; import { convertTools } from './tools/tools-object'; +const currentFilePath = fileURLToPath(import.meta.url); +const currentDirPath = dirname(currentFilePath); + const buildTools = async (automatedToolsPath: string, manualToolsPath: string, toolsPath: string, tagsPath: string) => { try { const githubExtractData = await getData(); @@ -22,11 +26,11 @@ const buildTools = async (automatedToolsPath: string, manualToolsPath: string, t }; /* istanbul ignore next */ -if (require.main === module) { - const automatedToolsPath = resolve(__dirname, '../config', 'tools-automated.json'); - const manualToolsPath = resolve(__dirname, '../config', 'tools-manual.json'); - const toolsPath = resolve(__dirname, '../config', 'tools.json'); - const tagsPath = resolve(__dirname, '../config', 'all-tags.json'); +if (process.argv[1] === fileURLToPath(import.meta.url)) { + const automatedToolsPath = resolve(currentDirPath, '../config', 'tools-automated.json'); + const manualToolsPath = resolve(currentDirPath, '../config', 'tools-manual.json'); + const toolsPath = resolve(currentDirPath, '../config', 'tools.json'); + const tagsPath = resolve(currentDirPath, '../config', 'all-tags.json'); buildTools(automatedToolsPath, manualToolsPath, toolsPath, tagsPath); } From a42104e2f801c061c903b4d30df7e303df3321d6 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 16:34:19 +0530 Subject: [PATCH 053/183] refactor function in build-rss --- scripts/build-rss.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/build-rss.ts b/scripts/build-rss.ts index 9eda115bc4d7..51fe12483963 100644 --- a/scripts/build-rss.ts +++ b/scripts/build-rss.ts @@ -7,15 +7,17 @@ async function getAllPosts() { return posts; } -function clean(s) { - s = s.split('<span>').join(''); - s = s.split('&').join('&'); - s = s.split(''').join("'"); - s = s.split('<').join('<'); - s = s.split('>').join('>'); - s = s.split('"').join('"'); - - return s; +function clean(s: string) { + let cleanS = s; + + cleanS = cleanS.split('<span>').join(''); + cleanS = cleanS.split('&').join('&'); + cleanS = cleanS.split(''').join("'"); + cleanS = cleanS.split('<').join('<'); + cleanS = cleanS.split('>').join('>'); + cleanS = cleanS.split('"').join('"'); + + return cleanS; } export async function rssFeed(type, title, desc, outputPath) { From add1c284b08084a51cce16363dec233b641784f9 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 16:36:20 +0530 Subject: [PATCH 054/183] add new package type --- types/packages/jgexml__json2xml.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 types/packages/jgexml__json2xml.d.ts diff --git a/types/packages/jgexml__json2xml.d.ts b/types/packages/jgexml__json2xml.d.ts new file mode 100644 index 000000000000..7c5bd65dce9c --- /dev/null +++ b/types/packages/jgexml__json2xml.d.ts @@ -0,0 +1,9 @@ +declare module 'jgexml/json2xml' { + interface Json2Xml { + getXml(feed: unknown, attributePrefix: string, defaultValue: string, indentLevel: number): string; + } + + const json2xml: Json2Xml; + + export = json2xml; +} From b776dc76ecf454d2edc3b3ce92f52b69c4bc02f1 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 16:59:52 +0530 Subject: [PATCH 055/183] Added error handling for undefined types --- scripts/build-meetings.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index 68a810704fd8..30feba8a3dd7 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -1,8 +1,9 @@ +import assert from 'assert'; import { writeFileSync } from 'fs'; import { google } from 'googleapis'; import { resolve } from 'path'; -async function buildMeetings(writePath) { +async function buildMeetings(writePath: string) { let auth; let calendar; @@ -14,6 +15,7 @@ async function buildMeetings(writePath) { calendar = google.calendar({ version: 'v3', auth }); } catch (err) { + assert(err instanceof Error); throw new Error(`Authentication failed: ${err.message}`); } @@ -31,7 +33,16 @@ async function buildMeetings(writePath) { timeMin }); + // check if the response is valid and not undefined + if (!eventsList.data.items || !Array.isArray(eventsList.data.items)) { + throw new Error('Invalid data structure received from Google Calendar API'); + } + eventsItems = eventsList.data.items.map((e) => { + if (!e.start || !e.start.dateTime) { + throw new Error('start.dateTime is missing in the event'); + } + return { title: e.summary, calLink: e.htmlLink, @@ -49,6 +60,7 @@ async function buildMeetings(writePath) { writeFileSync(writePath, eventsForHuman); } catch (err) { + assert(err instanceof Error); throw new Error(`Failed to fetch or process events: ${err.message}`); } } From 5b82b5dc4dd62de354a940ad78b34ff485adde45 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 17:05:48 +0530 Subject: [PATCH 056/183] add types --- scripts/utils/readAndWriteJson.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/utils/readAndWriteJson.ts b/scripts/utils/readAndWriteJson.ts index 0b8721a8379b..6e5e65a17a5e 100644 --- a/scripts/utils/readAndWriteJson.ts +++ b/scripts/utils/readAndWriteJson.ts @@ -2,7 +2,7 @@ import { readFile, writeFile } from 'fs/promises'; import { convertToJson } from '../utils'; -export async function writeJSON(readPath, writePath) { +export async function writeJSON(readPath: string, writePath: string) { let readContent; let jsonContent; From 0916549c84c7f84fc317c2d258cd341143962ca7 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 27 Nov 2024 17:12:37 +0530 Subject: [PATCH 057/183] refactor adopter/index.ts --- scripts/adopters/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/adopters/index.ts b/scripts/adopters/index.ts index 0e6b9ecfa888..c7307049bf59 100644 --- a/scripts/adopters/index.ts +++ b/scripts/adopters/index.ts @@ -3,7 +3,6 @@ import { fileURLToPath } from 'url'; import { writeJSON } from '../utils/readAndWriteJson'; - const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); From ba0a99a8a55b8be5dce384f850cf2adcc6e8134c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 12 Dec 2024 16:09:28 +0530 Subject: [PATCH 058/183] use tsx instead of ts-node --- package-lock.json | 467 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 20 +- 2 files changed, 458 insertions(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index c6f5f8d96d3e..3d2a04d88f4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,6 +78,7 @@ "swiper": "^11.0.7", "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", + "tsx": "^4.19.2", "typescript": "^5.3.3", "yaml": "^2.3.4" }, @@ -124,8 +125,7 @@ "remark-cli": "^12.0.1", "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", - "storybook": "^8.2.4", - "ts-node": "^10.9.2" + "storybook": "^8.2.4" } }, "node_modules/@adobe/css-tools": { @@ -2420,7 +2420,8 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "devOptional": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -2432,7 +2433,8 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "devOptional": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -2754,6 +2756,21 @@ "node": ">=12" } }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/openbsd-x64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", @@ -7201,25 +7218,29 @@ "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", - "devOptional": true + "optional": true, + "peer": true }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "devOptional": true + "optional": true, + "peer": true }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "devOptional": true + "optional": true, + "peer": true }, "node_modules/@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "devOptional": true + "optional": true, + "peer": true }, "node_modules/@types/acorn": { "version": "4.0.6", @@ -10817,7 +10838,8 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "devOptional": true + "optional": true, + "peer": true }, "node_modules/cross-spawn": { "version": "7.0.6", @@ -14686,7 +14708,6 @@ "version": "4.7.5", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", - "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -18343,7 +18364,8 @@ "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "devOptional": true + "optional": true, + "peer": true }, "node_modules/makeerror": { "version": "1.0.12", @@ -26285,7 +26307,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "dev": true, "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } @@ -28713,7 +28734,8 @@ "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "devOptional": true, + "optional": true, + "peer": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -28756,7 +28778,8 @@ "version": "8.14.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "devOptional": true, + "optional": true, + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -28768,7 +28791,8 @@ "version": "8.3.4", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", - "devOptional": true, + "optional": true, + "peer": true, "dependencies": { "acorn": "^8.11.0" }, @@ -28780,13 +28804,15 @@ "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "devOptional": true + "optional": true, + "peer": true }, "node_modules/ts-node/node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "devOptional": true, + "optional": true, + "peer": true, "engines": { "node": ">=0.3.1" } @@ -28866,6 +28892,407 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/tsx": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", + "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", + "dependencies": { + "esbuild": "~0.23.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" + } + }, "node_modules/tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -29897,7 +30324,8 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "devOptional": true + "optional": true, + "peer": true }, "node_modules/v8-to-istanbul": { "version": "9.3.0", @@ -30645,7 +31073,8 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "devOptional": true, + "optional": true, + "peer": true, "engines": { "node": ">=6" } diff --git a/package.json b/package.json index 0f7a3c4748f0..92ece21c0c9f 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,10 @@ "dev": "npm run build-scripts && next dev", "build": "npm run build-scripts && next build", "test": "jest --passWithNoTests", - "build:pages": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/build-pages.ts && npm run format:mdx", - "build:posts": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/index.ts", + "build:pages": "tsx scripts/build-pages.ts && npm run format:mdx", + "build:posts": "tsx scripts/index.ts", "build-scripts": "npm run build:pages && npm run lint:mdx && npm run build:posts", - "write:blog": "node --loader ts-node/esm --no-warnings=ExperimentalWarning ./scripts/compose.ts", + "write:blog": "tsx ./scripts/compose.ts", "start": "npx serve@latest out", "export": "next export", "lint": "next lint", @@ -19,12 +19,12 @@ "format:mdx": "prettier --write \"**/*.mdx\"", "lint:mdx": "remark \"**/*.mdx\"", "generate:assets": "echo \"No assets to configure\"", - "generate:meetings": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/build-meetings.ts", - "generate:dashboard": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/dashboard/build-dashboard.ts", - "generate:videos": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/build-newsroom-videos.ts", - "generate:tools": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/build-tools.ts", + "generate:meetings": "tsx scripts/build-meetings.ts", + "generate:dashboard": "tsx scripts/dashboard/build-dashboard.ts", + "generate:videos": "tsx scripts/build-newsroom-videos.ts", + "generate:tools": "tsx scripts/build-tools.ts", "test:netlify": "deno test --allow-env --trace-ops netlify/**/*.test.ts", - "test:md": "node --loader ts-node/esm --no-warnings=ExperimentalWarning scripts/markdown/check-markdown.ts", + "test:md": "tsx scripts/markdown/check-markdown.ts", "dev:storybook": "storybook dev -p 6006", "build:storybook": "storybook build" }, @@ -115,6 +115,7 @@ "swiper": "^11.0.7", "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", + "tsx": "^4.19.2", "typescript": "^5.3.3", "yaml": "^2.3.4" }, @@ -161,7 +162,6 @@ "remark-cli": "^12.0.1", "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", - "storybook": "^8.2.4", - "ts-node": "^10.9.2" + "storybook": "^8.2.4" } } From c76a556d5d4d31f1830436f66de5cb6cfbf04a1f Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 12 Dec 2024 17:27:12 +0530 Subject: [PATCH 059/183] add types for build RSS --- scripts/build-rss.ts | 29 ++++++++++++++++++----------- types/scripts/build-rss.ts | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 types/scripts/build-rss.ts diff --git a/scripts/build-rss.ts b/scripts/build-rss.ts index 51fe12483963..28298b7bb7e6 100644 --- a/scripts/build-rss.ts +++ b/scripts/build-rss.ts @@ -1,6 +1,9 @@ +import assert from 'assert'; import fs from 'fs/promises'; import json2xml from 'jgexml/json2xml'; +import type { BlogPostTypes, Enclosure, RSS, RSSItemType } from '@/types/scripts/build-rss'; + async function getAllPosts() { const posts = (await import('../config/posts.json', { assert: { type: 'json' } })).default; @@ -20,9 +23,9 @@ function clean(s: string) { return cleanS; } -export async function rssFeed(type, title, desc, outputPath) { +export async function rssFeed(type: BlogPostTypes, rssTitle: string, desc: string, outputPath: string) { try { - let posts = (await getAllPosts())[`${type}`]; + let posts = (await getAllPosts())[`${type}`] as any[]; const missingDatePosts = posts.filter((post) => !post.date); posts = posts.filter((post) => post.date); @@ -33,7 +36,7 @@ export async function rssFeed(type, title, desc, outputPath) { if (i1.featured && !i2.featured) return -1; if (!i1.featured && i2.featured) return 1; - return i2Date - i1Date; + return i2Date.getTime() - i1Date.getTime(); }); if (missingDatePosts.length > 0) { @@ -43,15 +46,15 @@ export async function rssFeed(type, title, desc, outputPath) { const base = 'https://www.asyncapi.com'; const tracking = '?utm_source=rss'; - const feed = {}; - const rss = {}; + const feed = {} as { rss: RSS }; + const rss = {} as RSS; rss['@version'] = '2.0'; rss['@xmlns:atom'] = 'http://www.w3.org/2005/Atom'; - rss.channel = {}; - rss.channel.title = title; + rss.channel = {} as RSS['channel']; + rss.channel.title = rssTitle; rss.channel.link = `${base}/${outputPath}`; - rss.channel['atom:link'] = {}; + rss.channel['atom:link'] = {} as RSS['channel']['atom:link']; rss.channel['atom:link']['@rel'] = 'self'; rss.channel['atom:link']['@href'] = rss.channel.link; rss.channel['atom:link']['@type'] = 'application/rss+xml'; @@ -75,17 +78,17 @@ export async function rssFeed(type, title, desc, outputPath) { const pubDate = new Date(date).toUTCString(); const description = clean(excerpt); const guid = { '@isPermaLink': true, '': link }; - const item = { + const item: RSSItemType = { title, description, link, category: type, guid, pubDate - }; + } as RSSItemType; if (post.cover) { - const enclosure = {}; + const enclosure = {} as Enclosure; enclosure['@url'] = base + post.cover; enclosure['@length'] = 15026; // dummy value, anything works @@ -93,8 +96,11 @@ export async function rssFeed(type, title, desc, outputPath) { if (typeof enclosure['@url'] === 'string') { const tmp = enclosure['@url'].toLowerCase(); + // eslint-disable-next-line max-depth if (tmp.indexOf('.png') >= 0) enclosure['@type'] = 'image/png'; + // eslint-disable-next-line max-depth if (tmp.indexOf('.svg') >= 0) enclosure['@type'] = 'image/svg+xml'; + // eslint-disable-next-line max-depth if (tmp.indexOf('.webp') >= 0) enclosure['@type'] = 'image/webp'; } item.enclosure = enclosure; @@ -108,6 +114,7 @@ export async function rssFeed(type, title, desc, outputPath) { await fs.writeFile(`./public/${outputPath}`, xml, 'utf8'); } catch (err) { + assert(err instanceof Error); throw new Error(`Failed to generate RSS feed: ${err.message}`); } } diff --git a/types/scripts/build-rss.ts b/types/scripts/build-rss.ts new file mode 100644 index 000000000000..3780fdbb0453 --- /dev/null +++ b/types/scripts/build-rss.ts @@ -0,0 +1,37 @@ +export type BlogPostTypes = 'docs' | 'blog' | 'about' | 'docsTree'; +export type Enclosure = { + '@url': string; + '@length': number; + '@type': string; + enclosure: Enclosure; +}; + +export type RSSItemType = { + title: string; + description: string; + link: string; + category: BlogPostTypes; + guid: any; + pubDate: string; + enclosure: Enclosure; +}; +export type RSS = { + '@version': string; + '@xmlns:atom': string; + channel: { + title: string; + link: string; + 'atom:link': { + '@rel': string; + '@href': string; + '@type': string; + }; + description: string; + language: string; + copyright: string; + webMaster: string; + pubDate: string; // UTC string format + generator: string; + item: RSSItemType[]; + }; +}; From 5f7c9bbfec4c30a812ea2970cba4dd93540e4460 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 14 Dec 2024 16:51:27 +0530 Subject: [PATCH 060/183] revert name --- next-i18next.config.cjs => next-i18next.config.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename next-i18next.config.cjs => next-i18next.config.js (100%) diff --git a/next-i18next.config.cjs b/next-i18next.config.js similarity index 100% rename from next-i18next.config.cjs rename to next-i18next.config.js From 5097c35a2c20fab888d0701f418ad0e243412f82 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 14 Dec 2024 16:51:37 +0530 Subject: [PATCH 061/183] fix name --- next-i18next.config.js => next-i18next.config.cjs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename next-i18next.config.js => next-i18next.config.cjs (100%) diff --git a/next-i18next.config.js b/next-i18next.config.cjs similarity index 100% rename from next-i18next.config.js rename to next-i18next.config.cjs From 65a1873a7f7873ef4930fa345336cbda23365159 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 14 Dec 2024 16:52:43 +0530 Subject: [PATCH 062/183] fix name --- next-i18next.config.cjs => next-i18next.config.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename next-i18next.config.cjs => next-i18next.config.js (100%) diff --git a/next-i18next.config.cjs b/next-i18next.config.js similarity index 100% rename from next-i18next.config.cjs rename to next-i18next.config.js From a699313c736dbb5e9d257e0184512cb670b2f062 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 14 Dec 2024 16:53:09 +0530 Subject: [PATCH 063/183] fix name --- next-i18next.config.js => next-i18next.config.cjs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename next-i18next.config.js => next-i18next.config.cjs (100%) diff --git a/next-i18next.config.js b/next-i18next.config.cjs similarity index 100% rename from next-i18next.config.js rename to next-i18next.config.cjs From 794212895c36b33d8f3cb874ea145241402e3d7d Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 14 Dec 2024 16:55:31 +0530 Subject: [PATCH 064/183] Original name --- next-i18next.config.cjs => next-i18next.config.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename next-i18next.config.cjs => next-i18next.config.js (100%) diff --git a/next-i18next.config.cjs b/next-i18next.config.js similarity index 100% rename from next-i18next.config.cjs rename to next-i18next.config.js From bdc0ad0932414f7d7d6899eab91e7d1a1537b924 Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sat, 14 Dec 2024 16:56:02 +0530 Subject: [PATCH 065/183] Rename next-i18next.config.js to next-i18next.config.cjs --- next-i18next.config.js => next-i18next.config.cjs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename next-i18next.config.js => next-i18next.config.cjs (100%) diff --git a/next-i18next.config.js b/next-i18next.config.cjs similarity index 100% rename from next-i18next.config.js rename to next-i18next.config.cjs From b87f48a902fbc845554eacd28aeb15e21877e79b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 14 Dec 2024 18:06:58 +0530 Subject: [PATCH 066/183] migrate build-post-list.ts --- scripts/build-post-list.ts | 122 ++++++++++++++++-------------- types/packages/markdown-toc.d.ts | 30 ++++++++ types/scripts/build-posts-list.ts | 34 +++++++++ 3 files changed, 131 insertions(+), 55 deletions(-) create mode 100644 types/packages/markdown-toc.d.ts create mode 100644 types/scripts/build-posts-list.ts diff --git a/scripts/build-post-list.ts b/scripts/build-post-list.ts index 2e4c56a3eec7..51273274adc9 100644 --- a/scripts/build-post-list.ts +++ b/scripts/build-post-list.ts @@ -1,27 +1,31 @@ +/* eslint-disable max-depth */ +import type { PathLike } from 'fs'; import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs'; import frontMatter from 'gray-matter'; import { markdownToTxt } from 'markdown-to-txt'; import toc from 'markdown-toc'; -import markdownTocUtils from 'markdown-toc/lib/utils.js'; +import markdownTocUtils from 'markdown-toc/lib/utils'; import { basename, dirname, resolve } from 'path'; import readingTime from 'reading-time'; import { fileURLToPath } from 'url'; +import type { Details, Result, TableOfContentsItem } from '@/types/scripts/build-posts-list'; + import { addDocButtons, buildNavTree } from './build-docs'; const { slugify } = markdownTocUtils; -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const currentFilePath = fileURLToPath(import.meta.url); +const currentDirPath = dirname(currentFilePath); let specWeight = 100; -const result = { +const finalResult: Result = { docs: [], blog: [], about: [], docsTree: {} }; -const releaseNotes = []; +const releaseNotes: string[] = []; const basePath = 'pages'; const postDirectories = [ // order of these directories is important, as the blog should come before docs, to create a list of available release notes, which will later be used to release-note-link for spec docs @@ -30,34 +34,57 @@ const postDirectories = [ [`${basePath}/about`, '/about'] ]; -const addItem = (details) => { - if (details.slug.startsWith('/docs')) result.docs.push(details); - else if (details.slug.startsWith('/blog')) result.blog.push(details); - else if (details.slug.startsWith('/about')) result.about.push(details); - else { - } -}; +function slugifyToC(str: string) { + let slug; + // Try to match heading ids like {# myHeadingId} + const headingIdMatch = str.match(/[\s]?\{#([\w\d\-_]+)\}/); -export async function buildPostList() { - walkDirectories(postDirectories, result); - const treePosts = buildNavTree(result.docs.filter((p) => p.slug.startsWith('/docs/'))); + if (headingIdMatch && headingIdMatch.length >= 2) { + [, slug] = headingIdMatch; + } else { + // Try to match heading ids like {} + const anchorTagMatch = str.match(/[\s]*= 2) [, slug] = anchorTagMatch; } - writeFileSync(resolve(__dirname, '..', 'config', 'posts.json'), JSON.stringify(result, null, ' ')); + + return slug || slugify(str, { firsth1: true, maxdepth: 6 }); } -function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, sectionId, rootSectionId) { +function capitalize(text: string) { + return text + .split(/[\s-]/g) + .map((word) => `${word[0].toUpperCase()}${word.substr(1)}`) + .join(' '); +} + +const addItem = (details: Details) => { + if (!details.slug) { + throw new Error('details.slug is required'); + } + if (details.slug.startsWith('/docs')) finalResult.docs.push(details); + else if (details.slug.startsWith('/blog')) finalResult.blog.push(details); + else if (details.slug.startsWith('/about')) finalResult.about.push(details); +}; + +function isDirectory(dir: PathLike) { + return statSync(dir).isDirectory(); +} +function walkDirectories( + directories: string[][], + result: Result, + sectionTitle?: string, + sectionId?: string | undefined, + rootSectionId?: string | undefined, + sectionWeight = 0 +) { for (const dir of directories) { const directory = dir[0]; const sectionSlug = dir[1] || ''; const files = readdirSync(directory); for (const file of files) { - let details; + let details: Details; const fileName = [directory, file].join('/'); const fileNameWithSection = [fileName, '_section.mdx'].join('/'); const slug = fileName.replace(new RegExp(`^${basePath}`), ''); @@ -66,7 +93,7 @@ function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, s if (isDirectory(fileName)) { if (existsSync(fileNameWithSection)) { // Passing a second argument to frontMatter disables cache. See https://github.com/asyncapi/website/issues/1057 - details = frontMatter(readFileSync(fileNameWithSection, 'utf-8'), {}).data; + details = frontMatter(readFileSync(fileNameWithSection, 'utf-8'), {}).data as Details; details.title = details.title || capitalize(basename(fileName)); } else { details = { @@ -87,13 +114,13 @@ function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, s addItem(details); const rootId = details.parent || details.rootSectionId; - walkDirectories([[fileName, slug]], result, details.weight, details.title, details.sectionId, rootId); + walkDirectories([[fileName, slug]], result, details.title, details.sectionId, rootId, details.weight); } else if (file.endsWith('.mdx') && !fileName.endsWith('/_section.mdx')) { const fileContent = readFileSync(fileName, 'utf-8'); // Passing a second argument to frontMatter disables cache. See https://github.com/asyncapi/website/issues/1057 const { data, content } = frontMatter(fileContent, {}); - details = data; + details = data as Details; details.toc = toc(content, { slugify: slugifyToC }).json; details.readingTime = Math.ceil(readingTime(content).minutes); details.excerpt = details.excerpt || markdownToTxt(content).substr(0, 200); @@ -107,14 +134,14 @@ function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, s details.slug = details.isIndex ? sectionSlug : slug.replace(/\.mdx$/, ''); if (details.slug.includes('/reference/specification/') && !details.title) { const fileBaseName = basename(data.slug); // ex. v2.0.0 | v2.1.0-next-spec.1 - const fileName = fileBaseName.split('-')[0]; // v2.0.0 | v2.1.0 + const fileNameOfBaseName = fileBaseName.split('-')[0]; // v2.0.0 | v2.1.0 details.weight = specWeight--; - if (fileName.startsWith('v')) { - details.title = capitalize(fileName.slice(1)); + if (fileNameOfBaseName.startsWith('v')) { + details.title = capitalize(fileNameOfBaseName.slice(1)); } else { - details.title = capitalize(fileName); + details.title = capitalize(fileNameOfBaseName); } if (releaseNotes.includes(details.title)) { @@ -133,9 +160,9 @@ function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, s // To create a list of available ReleaseNotes list, which will be used to add details.releaseNoteLink attribute. if (file.startsWith('release-notes') && dir[1] === '/blog') { - const fileName_without_extension = file.slice(0, -4); + const fileNameWithoutExtension = file.slice(0, -4); // removes the file extension. For example, release-notes-2.1.0.md -> release-notes-2.1.0 - const version = fileName_without_extension.slice(fileName_without_extension.lastIndexOf('-') + 1); + const version = fileNameWithoutExtension.slice(fileNameWithoutExtension.lastIndexOf('-') + 1); // gets the version from the name of the releaseNote .md file (from /blog). For example, version = 2.1.0 if fileName_without_extension = release-notes-2.1.0 releaseNotes.push(version); @@ -148,30 +175,15 @@ function walkDirectories(directories, result, sectionWeight = 0, sectionTitle, s } } -function slugifyToC(str) { - let slug; - // Try to match heading ids like {# myHeadingId} - const headingIdMatch = str.match(/[\s]?\{\#([\w\d\-_]+)\}/); - - if (headingIdMatch && headingIdMatch.length >= 2) { - slug = headingIdMatch[1]; - } else { - // Try to match heading ids like {} - const anchorTagMatch = str.match(/[\s]* p.slug.startsWith('/docs/'))); - if (anchorTagMatch && anchorTagMatch.length >= 2) slug = anchorTagMatch[1]; + finalResult.docsTree = treePosts; + finalResult.docs = addDocButtons(finalResult.docs, treePosts); + if (process.env.NODE_ENV === 'production') { + // console.log(inspect(result, { depth: null, colors: true })) } - - return slug || slugify(str, { firsth1: true, maxdepth: 6 }); -} - -function isDirectory(dir) { - return statSync(dir).isDirectory(); -} - -function capitalize(text) { - return text - .split(/[\s\-]/g) - .map((word) => `${word[0].toUpperCase()}${word.substr(1)}`) - .join(' '); + writeFileSync(resolve(currentDirPath, '..', 'config', 'posts.json'), JSON.stringify(finalResult, null, ' ')); } diff --git a/types/packages/markdown-toc.d.ts b/types/packages/markdown-toc.d.ts new file mode 100644 index 000000000000..bd0d08adf879 --- /dev/null +++ b/types/packages/markdown-toc.d.ts @@ -0,0 +1,30 @@ +// src/types/markdown-toc.d.ts + +declare module 'markdown-toc' { + interface TocItem { + content: string; + slug: string; + lvl: number; + i: number; + } + + interface TocResult { + json: TocItem[]; + content: string; + highest: number; + tokens: any[]; + } + + interface TocOptions { + firsth1?: boolean; + maxdepth?: number; + slugify?: (str: string) => string; + } + + function toc(markdown: string, options?: TocOptions): TocResult; + + export = toc; +} +declare module 'markdown-toc/lib/utils' { + export function slugify(str: string, options?: Object): string; +} diff --git a/types/scripts/build-posts-list.ts b/types/scripts/build-posts-list.ts new file mode 100644 index 000000000000..aa2565870ccf --- /dev/null +++ b/types/scripts/build-posts-list.ts @@ -0,0 +1,34 @@ +export interface TableOfContentsItem { + content: string; + slug: string; + lvl: number; +} + +export interface Details { + title: string; + isSection?: boolean; + parent?: string; + sectionId?: string; + isRootSection?: boolean; + rootSectionId?: string; + sectionWeight?: number; + slug?: string; + toc?: TableOfContentsItem[]; + readingTime?: number; + excerpt?: string; + sectionSlug?: string; + sectionTitle?: string; + id?: string; + isIndex?: boolean; + weight?: number; + releaseNoteLink?: string; + isPrerelease?: boolean; + [key: string]: any; // For any additional properties +} + +export interface Result { + docs: any[]; + blog: any[]; + about: any[]; + docsTree: Record; +} From 647fa16266ebf78b2136210dcbadbe01e402b0e3 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 14 Dec 2024 19:40:40 +0530 Subject: [PATCH 067/183] use old package-lock file --- package-lock.json | 629 +--------------------------------------------- 1 file changed, 2 insertions(+), 627 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d2a04d88f4e..82080d33a35c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,7 +78,6 @@ "swiper": "^11.0.7", "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", - "tsx": "^4.19.2", "typescript": "^5.3.3", "yaml": "^2.3.4" }, @@ -94,8 +93,6 @@ "@storybook/nextjs": "^8.2.4", "@storybook/react": "^8.2.4", "@storybook/test": "^8.2.4", - "@types/fs-extra": "^11.0.4", - "@types/inquirer": "^9.0.7", "@types/lodash": "^4.17.0", "@types/node": "^20", "@types/react": "^18.0.1", @@ -2416,30 +2413,6 @@ "yarn": ">=1.22.18" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "optional": true, - "peer": true, - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "optional": true, - "peer": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, "node_modules/@docsearch/css": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.6.0.tgz", @@ -2756,21 +2729,6 @@ "node": ">=12" } }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", - "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, "node_modules/@esbuild/openbsd-x64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", @@ -7214,34 +7172,6 @@ "node": ">=10.13.0" } }, - "node_modules/@tsconfig/node10": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", - "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", - "optional": true, - "peer": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "optional": true, - "peer": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "optional": true, - "peer": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "optional": true, - "peer": true - }, "node_modules/@types/acorn": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz", @@ -7625,16 +7555,6 @@ "@types/send": "*" } }, - "node_modules/@types/fs-extra": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz", - "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==", - "dev": true, - "dependencies": { - "@types/jsonfile": "*", - "@types/node": "*" - } - }, "node_modules/@types/geojson": { "version": "7946.0.14", "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", @@ -7677,16 +7597,6 @@ "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" }, - "node_modules/@types/inquirer": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-9.0.7.tgz", - "integrity": "sha512-Q0zyBupO6NxGRZut/JdmqYKOnN95Eg5V8Csg3PGKkP+FnvsUZx1jAyK7fztIszxxMuoBA6E3KXWvdZVXIpx60g==", - "dev": true, - "dependencies": { - "@types/through": "*", - "rxjs": "^7.2.0" - } - }, "node_modules/@types/is-empty": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@types/is-empty/-/is-empty-1.2.3.tgz", @@ -7733,15 +7643,6 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, - "node_modules/@types/jsonfile": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz", - "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/lodash": { "version": "4.17.6", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.6.tgz", @@ -7946,15 +7847,6 @@ "integrity": "sha512-hcZhlNvMkQG/k1vcZ6yHOl6WAYftQ2MLfTHcYRZ2xYZFD8tGVnE3qFV0lj1smQeDSR7/yY0PyuUalauf33bJeA==", "dev": true }, - "node_modules/@types/through": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.33.tgz", - "integrity": "sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/unist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", @@ -10834,13 +10726,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "optional": true, - "peer": true - }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -14708,6 +14593,7 @@ "version": "4.7.5", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", + "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -18360,13 +18246,6 @@ "semver": "bin/semver.js" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "optional": true, - "peer": true - }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -26307,6 +26186,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } @@ -28730,93 +28610,6 @@ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" }, - "node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "optional": true, - "peer": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/ts-node/node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "optional": true, - "peer": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ts-node/node_modules/acorn-walk": { - "version": "8.3.4", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", - "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", - "optional": true, - "peer": true, - "dependencies": { - "acorn": "^8.11.0" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ts-node/node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "optional": true, - "peer": true - }, - "node_modules/ts-node/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "optional": true, - "peer": true, - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/ts-pnp": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", @@ -28892,407 +28685,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/tsx": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", - "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", - "dependencies": { - "esbuild": "~0.23.0", - "get-tsconfig": "^4.7.5" - }, - "bin": { - "tsx": "dist/cli.mjs" - }, - "engines": { - "node": ">=18.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - } - }, - "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", - "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", - "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", - "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", - "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", - "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/darwin-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", - "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", - "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", - "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", - "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", - "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", - "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-loong64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", - "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", - "cpu": [ - "loong64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", - "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", - "cpu": [ - "mips64el" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", - "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", - "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", - "cpu": [ - "riscv64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-s390x": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", - "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", - "cpu": [ - "s390x" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", - "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", - "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", - "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/sunos-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", - "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/win32-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", - "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/win32-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", - "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/win32-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", - "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/esbuild": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", - "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.23.1", - "@esbuild/android-arm": "0.23.1", - "@esbuild/android-arm64": "0.23.1", - "@esbuild/android-x64": "0.23.1", - "@esbuild/darwin-arm64": "0.23.1", - "@esbuild/darwin-x64": "0.23.1", - "@esbuild/freebsd-arm64": "0.23.1", - "@esbuild/freebsd-x64": "0.23.1", - "@esbuild/linux-arm": "0.23.1", - "@esbuild/linux-arm64": "0.23.1", - "@esbuild/linux-ia32": "0.23.1", - "@esbuild/linux-loong64": "0.23.1", - "@esbuild/linux-mips64el": "0.23.1", - "@esbuild/linux-ppc64": "0.23.1", - "@esbuild/linux-riscv64": "0.23.1", - "@esbuild/linux-s390x": "0.23.1", - "@esbuild/linux-x64": "0.23.1", - "@esbuild/netbsd-x64": "0.23.1", - "@esbuild/openbsd-arm64": "0.23.1", - "@esbuild/openbsd-x64": "0.23.1", - "@esbuild/sunos-x64": "0.23.1", - "@esbuild/win32-arm64": "0.23.1", - "@esbuild/win32-ia32": "0.23.1", - "@esbuild/win32-x64": "0.23.1" - } - }, "node_modules/tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -30320,13 +29712,6 @@ "node": ">=6" } }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "optional": true, - "peer": true - }, "node_modules/v8-to-istanbul": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", @@ -31069,16 +30454,6 @@ "node": ">=12" } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "optional": true, - "peer": true, - "engines": { - "node": ">=6" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", From 6f8bb5dec058bf3f3e0d92a5da72324895e96a26 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 14 Dec 2024 19:43:06 +0530 Subject: [PATCH 068/183] No code changes made --- package-lock.json | 459 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 457 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 82080d33a35c..f440c3958584 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,6 +78,7 @@ "swiper": "^11.0.7", "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", + "tsx": "^4.19.2", "typescript": "^5.3.3", "yaml": "^2.3.4" }, @@ -93,6 +94,8 @@ "@storybook/nextjs": "^8.2.4", "@storybook/react": "^8.2.4", "@storybook/test": "^8.2.4", + "@types/fs-extra": "^11.0.4", + "@types/inquirer": "^9.0.7", "@types/lodash": "^4.17.0", "@types/node": "^20", "@types/react": "^18.0.1", @@ -2729,6 +2732,21 @@ "node": ">=12" } }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/openbsd-x64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", @@ -7555,6 +7573,16 @@ "@types/send": "*" } }, + "node_modules/@types/fs-extra": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz", + "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==", + "dev": true, + "dependencies": { + "@types/jsonfile": "*", + "@types/node": "*" + } + }, "node_modules/@types/geojson": { "version": "7946.0.14", "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", @@ -7597,6 +7625,16 @@ "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" }, + "node_modules/@types/inquirer": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-9.0.7.tgz", + "integrity": "sha512-Q0zyBupO6NxGRZut/JdmqYKOnN95Eg5V8Csg3PGKkP+FnvsUZx1jAyK7fztIszxxMuoBA6E3KXWvdZVXIpx60g==", + "dev": true, + "dependencies": { + "@types/through": "*", + "rxjs": "^7.2.0" + } + }, "node_modules/@types/is-empty": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@types/is-empty/-/is-empty-1.2.3.tgz", @@ -7643,6 +7681,15 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/jsonfile": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz", + "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/lodash": { "version": "4.17.6", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.6.tgz", @@ -7847,6 +7894,15 @@ "integrity": "sha512-hcZhlNvMkQG/k1vcZ6yHOl6WAYftQ2MLfTHcYRZ2xYZFD8tGVnE3qFV0lj1smQeDSR7/yY0PyuUalauf33bJeA==", "dev": true }, + "node_modules/@types/through": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.33.tgz", + "integrity": "sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/unist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", @@ -14593,7 +14649,6 @@ "version": "4.7.5", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", - "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -26186,7 +26241,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "dev": true, "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } @@ -28685,6 +28739,407 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/tsx": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", + "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", + "dependencies": { + "esbuild": "~0.23.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" + } + }, "node_modules/tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", From 32bf9bd88bca9655f530f535e350c7f12d5800d4 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 17 Dec 2024 17:30:21 +0530 Subject: [PATCH 069/183] migrate check-markdown.ts --- scripts/markdown/check-markdown.ts | 46 ++++++++++++++++-------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/scripts/markdown/check-markdown.ts b/scripts/markdown/check-markdown.ts index 89362a73e0d0..ad6a6dc6a6d4 100644 --- a/scripts/markdown/check-markdown.ts +++ b/scripts/markdown/check-markdown.ts @@ -1,15 +1,15 @@ +import fs from 'fs/promises'; import matter from 'gray-matter'; import path from 'path'; -const fs = require('fs').promises; - /** * Checks if a given string is a valid URL. * @param {string} str - The string to validate as a URL. * @returns {boolean} True if the string is a valid URL, false otherwise. */ -function isValidURL(str) { +function isValidURL(str: string) { try { + // eslint-disable-next-line no-new new URL(str); return true; @@ -18,19 +18,23 @@ function isValidURL(str) { } } -/** - * Validates the frontmatter of a blog post. - * @param {object} frontmatter - The frontmatter object to validate. - * @param {string} filePath - The path to the file being validated. - * @returns {string[]|null} An array of validation error messages, or null if no errors. - */ -function validateBlogs(frontmatter) { +interface FrontMatter { + title: string; + date: string; + type: string; + tags: string[]; + cover: string; + weight?: number; + authors: { name: string; link: string; photo: string }[]; +} + +function validateBlogs(frontmatter: FrontMatter) { const requiredAttributes = ['title', 'date', 'type', 'tags', 'cover', 'authors']; const errors = []; // Check for required attributes requiredAttributes.forEach((attr) => { - if (!frontmatter.hasOwnProperty(attr)) { + if (!Object.prototype.hasOwnProperty.call(frontmatter, attr)) { errors.push(`${attr} is missing`); } }); @@ -52,9 +56,7 @@ function validateBlogs(frontmatter) { // Validate authors (must be an array with valid attributes) if (frontmatter.authors) { - if (!Array.isArray(frontmatter.authors)) { - errors.push('Authors should be an array'); - } else { + if (Array.isArray(frontmatter.authors)) { frontmatter.authors.forEach((author, index) => { if (!author.name) { errors.push(`Author at index ${index} is missing a name`); @@ -66,19 +68,15 @@ function validateBlogs(frontmatter) { errors.push(`Author at index ${index} is missing a photo`); } }); + } else { + errors.push('Authors should be an array'); } } return errors.length ? errors : null; } -/** - * Validates the frontmatter of a documentation file. - * @param {object} frontmatter - The frontmatter object to validate. - * @param {string} filePath - The path to the file being validated. - * @returns {string[]|null} An array of validation error messages, or null if no errors. - */ -function validateDocs(frontmatter) { +function validateDocs(frontmatter: FrontMatter) { const errors = []; // Check if title exists and is a string @@ -100,7 +98,11 @@ function validateDocs(frontmatter) { * @param {Function} validateFunction - The function used to validate the frontmatter. * @param {string} [relativePath=''] - The relative path of the folder for logging purposes. */ -async function checkMarkdownFiles(folderPath, validateFunction, relativePath = '') { +async function checkMarkdownFiles( + folderPath: string, + validateFunction: (frontmatter: any) => string[] | null, + relativePath = '' +) { try { const files = await fs.readdir(folderPath); const filePromises = files.map(async (file) => { From 1c9828e3a1af5d9b9b39723c55858968bad3a19a Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 19 Dec 2024 17:10:20 +0530 Subject: [PATCH 070/183] feat: add TypeScript types for tools and categories --- scripts/tools/categorylist.ts | 4 +- scripts/tools/extract-tools-github.ts | 1 + scripts/tools/tags-color.ts | 6 +- scripts/tools/tools-object.ts | 17 +++- types/scripts/tools.ts | 113 ++++++++++++++++++++++++++ 5 files changed, 134 insertions(+), 7 deletions(-) create mode 100644 types/scripts/tools.ts diff --git a/scripts/tools/categorylist.ts b/scripts/tools/categorylist.ts index 3ba7f2583517..81bc3a4664f3 100644 --- a/scripts/tools/categorylist.ts +++ b/scripts/tools/categorylist.ts @@ -1,5 +1,7 @@ +import type { CategoryListItem } from '@/types/scripts/tools'; + // Various categories to define the category in which a tool has to be listed -const categoryList = [ +const categoryList: CategoryListItem[] = [ { name: 'APIs', tag: 'api', diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index 7b9831dfd67c..56c5d6be1aa3 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -4,6 +4,7 @@ import dotenv from 'dotenv'; dotenv.config(); const getData = async () => { + // eslint-disable-next-line no-useless-catch try { const result = await axios.get('https://api.github.com/search/code?q=filename:.asyncapi-tool', { headers: { diff --git a/scripts/tools/tags-color.ts b/scripts/tools/tags-color.ts index d6a905060988..5fb1ca41974f 100644 --- a/scripts/tools/tags-color.ts +++ b/scripts/tools/tags-color.ts @@ -1,5 +1,7 @@ +import type { LanguageColorItem } from '@/types/scripts/tools'; + // Language and Technology tags along with their colors in UI are defined here. -const languagesColor = [ +const languagesColor: LanguageColorItem[] = [ { name: 'Go/Golang', color: 'bg-[#8ECFDF]', @@ -87,7 +89,7 @@ const languagesColor = [ } ]; -const technologiesColor = [ +const technologiesColor: LanguageColorItem[] = [ { name: 'Node.js', color: 'bg-[#BDFF67]', diff --git a/scripts/tools/tools-object.ts b/scripts/tools/tools-object.ts index 4b15f8b9af6e..8a2efac31c25 100644 --- a/scripts/tools/tools-object.ts +++ b/scripts/tools/tools-object.ts @@ -1,8 +1,11 @@ import Ajv from 'ajv'; import addFormats from 'ajv-formats'; +import assert from 'assert'; import axios from 'axios'; import Fuse from 'fuse.js'; +import type { AsyncAPITool, ToolsData, ToolsListObject } from '@/types/scripts/tools'; + import { convertToJson } from '../utils'; import { categoryList } from './categorylist'; import schema from './tools-schema.json'; @@ -27,7 +30,12 @@ const fuse = new Fuse(categoryList, options); // isAsyncAPIrepo boolean variable to define whether the tool repository is under // AsyncAPI organization or not, to create a JSON tool object as required in the frontend // side to show ToolCard. -const createToolObject = async (toolFile, repositoryUrl = '', repoDescription = '', isAsyncAPIrepo = '') => { +const createToolObject = async ( + toolFile: AsyncAPITool, + repositoryUrl = '', + repoDescription = '', + isAsyncAPIrepo: boolean | string = '' +) => { const resultantObject = { title: toolFile.title, description: toolFile?.description ? toolFile.description : repoDescription, @@ -49,9 +57,9 @@ const createToolObject = async (toolFile, repositoryUrl = '', repoDescription = // using the defined JSON schema, categorising each tool inside their defined categories // and creating a JSON tool object in which all the tools are listed in defined // categories order, which is then updated in `automated-tools.json` file. -async function convertTools(data) { +async function convertTools(data: ToolsData) { try { - let finalToolsObject = {}; + let finalToolsObject: ToolsListObject = {}; const dataArray = data.items; // initialising finalToolsObject with all categories inside it with proper elements in each category @@ -93,7 +101,7 @@ async function convertTools(data) { // Tool Object is appended to each category array according to Fuse search for categories inside Tool Object await Promise.all( - jsonToolFileContent.filters.categories.map(async (category) => { + jsonToolFileContent.filters.categories.map(async (category: string) => { const categorySearch = await fuse.search(category); const targetCategory = categorySearch.length ? categorySearch[0].item.name : 'Others'; const { toolsList } = finalToolsObject[targetCategory]; @@ -119,6 +127,7 @@ async function convertTools(data) { return finalToolsObject; } catch (err) { + assert(err instanceof Error); throw new Error(`Error processing tool: ${err.message}`); } } diff --git a/types/scripts/tools.ts b/types/scripts/tools.ts new file mode 100644 index 000000000000..3270e74913fa --- /dev/null +++ b/types/scripts/tools.ts @@ -0,0 +1,113 @@ +interface Links { + websiteUrl?: string; // URL to the website where your project hosts some demo or project landing page. + docsUrl?: string; // URL to project documentation. + repoUrl?: string; // URL to project codebase. +} + +type Language = + | 'Go' + | 'Java' + | 'JavaScript' + | 'HTML' + | 'C/C++' + | 'C#' + | 'Python' + | 'TypeScript' + | 'Kotlin' + | 'Scala' + | 'Markdown' + | 'YAML' + | 'R' + | 'Ruby' + | 'Rust' + | 'Shell' + | 'Groovy'; + +type Technology = + | 'Node js' + | 'Hermes' + | 'React JS' + | '.NET' + | 'ASP.NET' + | 'Springboot' + | 'AWS' + | 'Docker' + | 'Node-red' + | 'Maven' + | 'Saas' + | 'Kubernetes-native' + | 'Scala' + | 'Azure' + | 'Jenkins' + | 'Flask'; + +type Category = + | 'api' + | 'code-first' + | 'code-generator' + | 'converter' + | 'directory' + | 'documentation-generator' + | 'editor' + | 'ui-component' + | 'dsl' + | 'framework' + | 'github-action' + | 'mocking-and-testing' + | 'validator' + | 'compare-tool' + | 'other' + | 'cli' + | 'bundler' + | 'ide-extension'; + +export type CategoryListItem = { + name: string; + tag: string; + description: string; +}; + +export type LanguageColorItem = { + name: string; + color: string; + borderColor: string; +}; + +interface Filters { + language?: Language | string | Array; // Language referred to is the runtime language selected by the user. + technology?: Array; // List of different technologies used in the tool. + categories: Array; // Categories are used to group tools by different use cases. + hasCommercial?: boolean; // Indicate if your tool is open source or commercial offering. +} +// Note: this definition is implemented from the schema located at scripts/tools/tools-schema.json + +export interface AsyncAPITool { + title: string; // Human-readable name of the tool. + description?: string; // Custom description to override repository description. + links?: Links; // Links to website, documentation, and repository. + filters: Filters; // Filter properties. +} + +export type ToolsData = { + items: { + name: string; + url: string; + path: string; + html_url: string; + repository: { + full_name: string; + html_url: string; + owner: { + login: string; + }; + description: string; + }; + }[]; +}; + +export type ToolsListObject = { + [key: string]: { + description: string; + toolsList: AsyncAPITool[]; + }; +}; From 6c129b644c5e28aa2213d978ee2f4a050c176a9c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 20 Dec 2024 13:46:06 +0530 Subject: [PATCH 071/183] update type --- types/scripts/tools.ts | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/types/scripts/tools.ts b/types/scripts/tools.ts index 3270e74913fa..969ae5763004 100644 --- a/types/scripts/tools.ts +++ b/types/scripts/tools.ts @@ -4,43 +4,6 @@ interface Links { repoUrl?: string; // URL to project codebase. } -type Language = - | 'Go' - | 'Java' - | 'JavaScript' - | 'HTML' - | 'C/C++' - | 'C#' - | 'Python' - | 'TypeScript' - | 'Kotlin' - | 'Scala' - | 'Markdown' - | 'YAML' - | 'R' - | 'Ruby' - | 'Rust' - | 'Shell' - | 'Groovy'; - -type Technology = - | 'Node js' - | 'Hermes' - | 'React JS' - | '.NET' - | 'ASP.NET' - | 'Springboot' - | 'AWS' - | 'Docker' - | 'Node-red' - | 'Maven' - | 'Saas' - | 'Kubernetes-native' - | 'Scala' - | 'Azure' - | 'Jenkins' - | 'Flask'; - type Category = | 'api' | 'code-first' @@ -74,8 +37,8 @@ export type LanguageColorItem = { }; interface Filters { - language?: Language | string | Array; // Language referred to is the runtime language selected by the user. - technology?: Array; // List of different technologies used in the tool. + language?: Array; + technology?: Array; categories: Array; // Categories are used to group tools by different use cases. hasCommercial?: boolean; // Indicate if your tool is open source or commercial offering. } From fca9e36f3a68777d37b202c40cd7d446bcdc2b1c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 20 Dec 2024 15:39:15 +0530 Subject: [PATCH 072/183] feat: enhance type safety in combine-tools script with TypeScript types --- scripts/tools/combine-tools.ts | 80 ++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 974dcf0201a3..720962029e28 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -1,8 +1,11 @@ +/* eslint-disable max-depth */ import Ajv from 'ajv'; import addFormats from 'ajv-formats'; import fs from 'fs'; import Fuse from 'fuse.js'; +import type { AsyncAPITool, LanguageColorItem, ToolsListObject } from '@/types/scripts/tools.js'; + import { categoryList } from './categorylist.js'; import { languagesColor, technologiesColor } from './tags-color'; import { createToolObject } from './tools-object'; @@ -13,7 +16,7 @@ const ajv = new Ajv(); addFormats(ajv, ['uri']); const validate = ajv.compile(schema); -const finalTools = {}; +const finalTools: ToolsListObject = {}; for (const category of categoryList) { finalTools[category.name] = { @@ -39,12 +42,12 @@ let technologyFuse = new Fuse(technologyList, options); // takes individual tool object and inserts borderColor and backgroundColor of the tags of // languages and technologies, for Tool Card in website. -const getFinalTool = async (toolObject) => { +const getFinalTool = async (toolObject: AsyncAPITool) => { const finalObject = toolObject; // there might be a tool without language if (toolObject.filters.language) { - const languageArray = []; + const languageArray: LanguageColorItem[] = []; if (typeof toolObject.filters.language === 'string') { const languageSearch = await languageFuse.search(toolObject.filters.language); @@ -65,7 +68,7 @@ const getFinalTool = async (toolObject) => { languageFuse = new Fuse(languageList, options); } } else { - for (const language of toolObject?.filters?.language) { + for (const language of toolObject.filters.language) { const languageSearch = await languageFuse.search(language); if (languageSearch.length > 0) { @@ -74,7 +77,7 @@ const getFinalTool = async (toolObject) => { // adds a new language object in the Fuse list as well as in tool object // so that it isn't missed out in the UI. const languageObject = { - name: language, + name: language as string, color: 'bg-[#57f281]', borderColor: 'border-[#37f069]' }; @@ -90,7 +93,7 @@ const getFinalTool = async (toolObject) => { const technologyArray = []; if (toolObject.filters.technology) { - for (const technology of toolObject?.filters?.technology) { + for (const technology of toolObject.filters.technology) { const technologySearch = await technologyFuse.search(technology); if (technologySearch.length > 0) { @@ -99,7 +102,7 @@ const getFinalTool = async (toolObject) => { // adds a new technology object in the Fuse list as well as in tool object // so that it isn't missed out in the UI. const technologyObject = { - name: technology, + name: technology as string, color: 'bg-[#61d0f2]', borderColor: 'border-[#40ccf7]' }; @@ -117,43 +120,46 @@ const getFinalTool = async (toolObject) => { // Combine the automated tools and manual tools list into single JSON object file, and // lists down all the language and technology tags in one JSON file. -const combineTools = async (automatedTools, manualTools, toolsPath, tagsPath) => { +const combineTools = async (automatedTools: any, manualTools: any, toolsPath: string, tagsPath: string) => { try { + // eslint-disable-next-line no-restricted-syntax for (const key in automatedTools) { - const finalToolsList = []; + if (Object.prototype.hasOwnProperty.call(automatedTools, key)) { + const finalToolsList = []; - if (automatedTools[key].toolsList.length) { - for (const tool of automatedTools[key].toolsList) { - finalToolsList.push(await getFinalTool(tool)); + if (automatedTools[key].toolsList.length) { + for (const tool of automatedTools[key].toolsList) { + finalToolsList.push(await getFinalTool(tool)); + } } - } - if (manualTools[key]?.toolsList?.length) { - for (const tool of manualTools[key].toolsList) { - let isAsyncAPIrepo; - const isValid = await validate(tool); - - if (isValid) { - if (tool?.links?.repoUrl) { - const url = new URL(tool.links.repoUrl); - - isAsyncAPIrepo = url.href.startsWith('https://github.com/asyncapi/'); - } else isAsyncAPIrepo = false; - const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); - - finalToolsList.push(await getFinalTool(toolObject)); - } else { - console.error({ - message: 'Tool validation failed', - tool: tool.title, - source: 'manual-tools.json', - errors: validate.errors, - note: 'Script continues execution, error logged for investigation' - }); + if (manualTools[key]?.toolsList?.length) { + for (const tool of manualTools[key].toolsList) { + let isAsyncAPIrepo; + const isValid = await validate(tool); + + if (isValid) { + if (tool?.links?.repoUrl) { + const url = new URL(tool.links.repoUrl); + + isAsyncAPIrepo = url.href.startsWith('https://github.com/asyncapi/'); + } else isAsyncAPIrepo = false; + const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); + + finalToolsList.push(await getFinalTool(toolObject)); + } else { + console.error({ + message: 'Tool validation failed', + tool: tool.title, + source: 'manual-tools.json', + errors: validate.errors, + note: 'Script continues execution, error logged for investigation' + }); + } } } + finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); + finalTools[key].toolsList = finalToolsList; } - finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); - finalTools[key].toolsList = finalToolsList; } fs.writeFileSync(toolsPath, JSON.stringify(finalTools)); fs.writeFileSync(tagsPath, JSON.stringify({ languages: languageList, technologies: technologyList })); From 6a26d064c237c44ce0e157ab53566e0c667f0e80 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 20 Dec 2024 16:10:05 +0530 Subject: [PATCH 073/183] chore: disable eslint rule for no-await-in-loop in combine-tools script --- scripts/tools/combine-tools.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 720962029e28..9d2cefceeee2 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-await-in-loop */ /* eslint-disable max-depth */ import Ajv from 'ajv'; import addFormats from 'ajv-formats'; From 1541bc76e964e50f1daaa25661a9ac897c873cc5 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 21 Dec 2024 13:01:48 +0530 Subject: [PATCH 074/183] feat: improve type safety and refactor dashboard script functions --- scripts/dashboard/build-dashboard.ts | 37 +++++++++++++--------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index b616111484f2..8d85edd0679f 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -1,23 +1,27 @@ import { graphql } from '@octokit/graphql'; +import assert from 'assert'; import { writeFile } from 'fs-extra'; import { resolve } from 'path'; import { Queries } from './issue-queries'; -/** - * Introduces a delay in the execution flow. - * @param {number} ms - The number of milliseconds to pause. - * @returns {Promise} A promise that resolves after the specified delay. - */ -async function pause(ms) { +async function pause(ms: number): Promise { return new Promise((res) => { setTimeout(res, ms); }); } -async function getDiscussions(query, pageSize, endCursor = null) { +function monthsSince(date: string) { + const seconds = Math.floor((new Date().valueOf() - new Date(date).valueOf()) / 1000); + // 2592000 = number of seconds in a month = 30 * 24 * 60 * 60 + const months = seconds / 2592000; + + return Math.floor(months); +} + +async function getDiscussions(query: string, pageSize: number, endCursor = null): Promise { try { - const result = await graphql(query, { + const result: any = await graphql(query, { first: pageSize, after: endCursor, headers: { @@ -51,7 +55,7 @@ async function getDiscussions(query, pageSize, endCursor = null) { } } -async function getDiscussionByID(isPR, id) { +async function getDiscussionByID(isPR: boolean, id: string) { try { const result = await graphql(isPR ? Queries.pullRequestById : Queries.issueById, { id, @@ -128,10 +132,11 @@ async function getHotDiscussions(discussions) { return filteredResult.slice(0, 12); } -async function writeToFile(content, writePath) { +async function writeToFile(content: string, writePath: string) { try { await writeFile(writePath, JSON.stringify(content, null, ' ')); } catch (error) { + assert(error instanceof Error); console.error('Failed to write dashboard data:', { error: error.message, writePath @@ -161,15 +166,7 @@ function getLabel(issue, filter) { return result?.name.split('/')[1]; } -function monthsSince(date) { - const seconds = Math.floor((new Date() - new Date(date)) / 1000); - // 2592000 = number of seconds in a month = 30 * 24 * 60 * 60 - const months = seconds / 2592000; - - return Math.floor(months); -} - -async function start(writePath) { +async function start(writePath: string): Promise { try { const issues = await getDiscussions(Queries.hotDiscussionsIssues, 20); const PRs = await getDiscussions(Queries.hotDiscussionsPullRequests, 20); @@ -180,7 +177,7 @@ async function start(writePath) { mapGoodFirstIssues(rawGoodFirstIssues) ]); - return await writeToFile({ hotDiscussions, goodFirstIssues }, writePath); + await writeToFile({ hotDiscussions, goodFirstIssues }, writePath); } catch (e) { console.log('There were some issues parsing data from github.'); console.log(e); From 12378991f715afa60247188d0667d6d2c82f8672 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 21 Dec 2024 16:10:20 +0530 Subject: [PATCH 075/183] feat: add TypeScript types for dashboard script and enhance type safety --- scripts/dashboard/build-dashboard.ts | 63 +++++++--- types/scripts/dashboard.ts | 171 +++++++++++++++++++++++++++ 2 files changed, 215 insertions(+), 19 deletions(-) create mode 100644 types/scripts/dashboard.ts diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index 8d85edd0679f..70024b9333ea 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -3,6 +3,17 @@ import assert from 'assert'; import { writeFile } from 'fs-extra'; import { resolve } from 'path'; +import type { + Discussion, + GoodFirstIssues, + HotDiscussionsIssuesNode, + HotDiscussionsPullRequestsNode, + IssueById, + MappedIssue, + ProcessedDiscussion, + PullRequestById +} from '@/types/scripts/dashboard'; + import { Queries } from './issue-queries'; async function pause(ms: number): Promise { @@ -19,7 +30,17 @@ function monthsSince(date: string) { return Math.floor(months); } -async function getDiscussions(query: string, pageSize: number, endCursor = null): Promise { +function getLabel(issue: GoodFirstIssues, filter: string) { + const result = issue.labels.nodes.find((label) => label.name.startsWith(filter)); + + return result?.name.split('/')[1]; +} + +async function getDiscussions( + query: string, + pageSize: number, + endCursor = null +): Promise { try { const result: any = await graphql(query, { first: pageSize, @@ -55,9 +76,9 @@ async function getDiscussions(query: string, pageSize: number, endCursor = null) } } -async function getDiscussionByID(isPR: boolean, id: string) { +async function getDiscussionByID(isPR: boolean, id: string): Promise { try { - const result = await graphql(isPR ? Queries.pullRequestById : Queries.issueById, { + const result: PullRequestById | IssueById = await graphql(isPR ? Queries.pullRequestById : Queries.issueById, { id, headers: { authorization: `token ${process.env.GITHUB_TOKEN}` @@ -72,15 +93,17 @@ async function getDiscussionByID(isPR: boolean, id: string) { } } -async function processHotDiscussions(batch) { +async function processHotDiscussions(batch: HotDiscussionsIssuesNode[]) { return Promise.all( batch.map(async (discussion) => { try { + // eslint-disable-next-line no-underscore-dangle const isPR = discussion.__typename === 'PullRequest'; - if (discussion.comments.pageInfo.hasNextPage) { + if (discussion.comments.pageInfo!.hasNextPage) { const fetchedDiscussion = await getDiscussionByID(isPR, discussion.id); + // eslint-disable-next-line no-param-reassign discussion = fetchedDiscussion.node; } @@ -92,7 +115,7 @@ async function processHotDiscussions(batch) { const finalInteractionsCount = isPR ? interactionsCount + discussion.reviews.totalCount + - discussion.reviews.nodes.reduce((acc, curr) => acc + curr.comments.totalCount, 0) + discussion.reviews.nodes!.reduce((acc, curr) => acc + curr.comments.totalCount, 0) : interactionsCount; return { @@ -114,14 +137,16 @@ async function processHotDiscussions(batch) { ); } -async function getHotDiscussions(discussions) { - const result = []; +async function getHotDiscussions(discussions: HotDiscussionsIssuesNode[]) { + const result: ProcessedDiscussion[] = []; const batchSize = 5; for (let i = 0; i < discussions.length; i += batchSize) { const batch = discussions.slice(i, i + batchSize); + // eslint-disable-next-line no-await-in-loop const batchResults = await processHotDiscussions(batch); + // eslint-disable-next-line no-await-in-loop await pause(1000); result.push(...batchResults); } @@ -132,7 +157,13 @@ async function getHotDiscussions(discussions) { return filteredResult.slice(0, 12); } -async function writeToFile(content: string, writePath: string) { +async function writeToFile( + content: { + hotDiscussions: ProcessedDiscussion[]; + goodFirstIssues: MappedIssue[]; + }, + writePath: string +) { try { await writeFile(writePath, JSON.stringify(content, null, ' ')); } catch (error) { @@ -145,7 +176,7 @@ async function writeToFile(content: string, writePath: string) { } } -async function mapGoodFirstIssues(issues) { +async function mapGoodFirstIssues(issues: GoodFirstIssues[]) { return issues.map((issue) => ({ id: issue.id, title: issue.title, @@ -160,17 +191,11 @@ async function mapGoodFirstIssues(issues) { })); } -function getLabel(issue, filter) { - const result = issue.labels.nodes.find((label) => label.name.startsWith(filter)); - - return result?.name.split('/')[1]; -} - async function start(writePath: string): Promise { try { - const issues = await getDiscussions(Queries.hotDiscussionsIssues, 20); - const PRs = await getDiscussions(Queries.hotDiscussionsPullRequests, 20); - const rawGoodFirstIssues = await getDiscussions(Queries.goodFirstIssues, 20); + const issues = (await getDiscussions(Queries.hotDiscussionsIssues, 20)) as HotDiscussionsIssuesNode[]; + const PRs = (await getDiscussions(Queries.hotDiscussionsPullRequests, 20)) as HotDiscussionsPullRequestsNode[]; + const rawGoodFirstIssues: GoodFirstIssues[] = await getDiscussions(Queries.goodFirstIssues, 20); const discussions = issues.concat(PRs); const [hotDiscussions, goodFirstIssues] = await Promise.all([ getHotDiscussions(discussions), diff --git a/types/scripts/dashboard.ts b/types/scripts/dashboard.ts new file mode 100644 index 000000000000..e2fbb12913eb --- /dev/null +++ b/types/scripts/dashboard.ts @@ -0,0 +1,171 @@ +interface RateLimit { + limit: number; + cost: number; + remaining: number; + resetAt: string; +} + +interface PageInfo { + hasNextPage: boolean; + endCursor?: string; +} + +interface Reactions { + totalCount: number; +} + +interface Author { + login: string; +} + +interface Repository { + name: string; +} + +interface Label { + name: string; + color: string; +} + +interface Assignees { + totalCount: number; +} + +interface TimelineItems { + updatedAt: string; +} + +interface Comments { + totalCount: number; + pageInfo?: PageInfo; + nodes: { + reactions: Reactions; + }[]; +} + +interface Reviews { + totalCount: number; + nodes?: { + lastEditedAt: string; + comments: { + totalCount: number; + }; + }[]; +} + +export interface PullRequestById { + node: { + __typename: string; + assignees: Assignees; + timelineItems: TimelineItems; + author: Author; + id: string; + title: string; + resourcePath: string; + repository: Repository; + reactions: Reactions; + reviews: Reviews; + comments: Comments; + labels: { + nodes: Label[]; + }; + }; +} + +export interface IssueById { + node: { + __typename: string; + assignees: Assignees; + timelineItems: TimelineItems; + author: Author; + id: string; + repository: Repository; + labels: { + nodes: Label[]; + }; + title: string; + resourcePath: string; + reactions: Reactions; + comments: Comments; + reviews: Reviews; + }; +} + +export interface GoodFirstIssues { + __typename: string; + assignees: Assignees; + author: Author; + id: string; + title: string; + resourcePath: string; + repository: Repository; + labels: { + nodes: Label[]; + }; +} + +export interface HotDiscussionsIssuesNode { + __typename: string; + assignees: Assignees; + timelineItems: TimelineItems; + author: Author; + id: string; + title: string; + resourcePath: string; + repository: Repository; + labels: { + nodes: Label[]; + }; + reactions: Reactions; + comments: Comments; + reviews: Reviews; +} + +export interface HotDiscussionsPullRequestsNode { + __typename: string; + assignees: Assignees; + timelineItems: TimelineItems; + author: Author; + id: string; + title: string; + resourcePath: string; + repository: Repository; + labels: { + nodes: Label[]; + }; + reactions: Reactions; + reviews: Reviews; + comments: Comments; +} +export interface Discussion { + data: { + search: { + pageInfo: PageInfo; + nodes: HotDiscussionsPullRequestsNode[] | HotDiscussionsIssuesNode[] | GoodFirstIssues[]; + }; + }; + rateLimit: RateLimit; +} + +export interface ProcessedDiscussion { + id: string; + isPR: boolean; + isAssigned: boolean; + title: string; + author: string; + resourcePath: string; + repo: string; + labels: Label[]; + score: number; +} + +export interface MappedIssue { + id: string; + title: string; + isAssigned: boolean; + resourcePath: string; + repo: string; + author: string; + area: string; + labels: Label[]; +} From 324e278b41c088f146216ebf3dbb9c4fcb186fd6 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 21 Dec 2024 16:45:28 +0530 Subject: [PATCH 076/183] No code changes detected. --- package-lock.json | 1702 ++------------------------------------------- 1 file changed, 57 insertions(+), 1645 deletions(-) diff --git a/package-lock.json b/package-lock.json index 52991c72a4be..065932dda911 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2470,256 +2470,6 @@ } } }, - "node_modules/@emnapi/runtime": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.2.0.tgz", - "integrity": "sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==", - "dev": true, - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", - "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", - "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", - "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", - "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", - "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", - "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", - "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", - "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", - "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz", - "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", - "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", - "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", - "cpu": [ - "loong64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", - "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", - "cpu": [ - "mips64el" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", - "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", - "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", - "cpu": [ - "riscv64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", - "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", - "cpu": [ - "s390x" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@esbuild/linux-x64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", @@ -2735,96 +2485,6 @@ "node": ">=12" } }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", - "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", - "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", - "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", - "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", - "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", - "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@esbuild/win32-x64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", @@ -3135,368 +2795,32 @@ "deprecated": "Use @eslint/object-schema instead", "dev": true }, - "node_modules/@img/sharp-darwin-arm64": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.4.tgz", - "integrity": "sha512-p0suNqXufJs9t3RqLBO6vvrgr5OhgbWp76s5gTRvdmxmuv9E1rcaqGUsl3l4mKVmXPkTkTErXediAui4x+8PSA==", + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.2.tgz", + "integrity": "sha512-E441q4Qdb+7yuyiADVi5J+44x8ctlrqn8XgkDTwr4qPJzWkaHwD489iZ4nGDgcuya4iMN3ULV6NwbhRZJ9Z7SQ==", "cpu": [ - "arm64" + "x64" ], "dev": true, "optional": true, "os": [ - "darwin" + "linux" ], "engines": { - "glibc": ">=2.26", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-arm64": "1.0.2" - } - }, - "node_modules/@img/sharp-darwin-x64": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.4.tgz", - "integrity": "sha512-0l7yRObwtTi82Z6ebVI2PnHT8EB2NxBgpK2MiKJZJ7cz32R4lxd001ecMhzzsZig3Yv9oclvqqdV93jo9hy+Dw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "glibc": ">=2.26", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-x64": "1.0.2" - } - }, - "node_modules/@img/sharp-libvips-darwin-arm64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.2.tgz", - "integrity": "sha512-tcK/41Rq8IKlSaKRCCAuuY3lDJjQnYIW1UXU1kxcEKrfL8WR7N6+rzNoOxoQRJWTAECuKwgAHnPvqXGN8XfkHA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "macos": ">=11", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-darwin-x64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.2.tgz", - "integrity": "sha512-Ofw+7oaWa0HiiMiKWqqaZbaYV3/UGL2wAPeLuJTx+9cXpCRdvQhCLG0IH8YGwM0yGWGLpsF4Su9vM1o6aer+Fw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "macos": ">=10.13", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.2.tgz", - "integrity": "sha512-iLWCvrKgeFoglQxdEwzu1eQV04o8YeYGFXtfWU26Zr2wWT3q3MTzC+QTCO3ZQfWd3doKHT4Pm2kRmLbupT+sZw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.28", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.2.tgz", - "integrity": "sha512-x7kCt3N00ofFmmkkdshwj3vGPCnmiDh7Gwnd4nUwZln2YjqPxV1NlTyZOvoDWdKQVDL911487HOueBvrpflagw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.26", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-s390x": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.2.tgz", - "integrity": "sha512-cmhQ1J4qVhfmS6szYW7RT+gLJq9dH2i4maq+qyXayUSn9/3iY2ZeWpbAgSpSVbV2E1JUL2Gg7pwnYQ1h8rQIog==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.28", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-x64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.2.tgz", - "integrity": "sha512-E441q4Qdb+7yuyiADVi5J+44x8ctlrqn8XgkDTwr4qPJzWkaHwD489iZ4nGDgcuya4iMN3ULV6NwbhRZJ9Z7SQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.26", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linuxmusl-arm64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.2.tgz", - "integrity": "sha512-3CAkndNpYUrlDqkCM5qhksfE+qSIREVpyoeHIU6jd48SJZViAmznoQQLAv4hVXF7xyUB9zf+G++e2v1ABjCbEQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "musl": ">=1.2.2", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linuxmusl-x64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.2.tgz", - "integrity": "sha512-VI94Q6khIHqHWNOh6LLdm9s2Ry4zdjWJwH56WoiJU7NTeDwyApdZZ8c+SADC8OH98KWNQXnE01UdJ9CSfZvwZw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "musl": ">=1.2.2", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-linux-arm": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.4.tgz", - "integrity": "sha512-RUgBD1c0+gCYZGCCe6mMdTiOFS0Zc/XrN0fYd6hISIKcDUbAW5NtSQW9g/powkrXYm6Vzwd6y+fqmExDuCdHNQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.28", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-arm": "1.0.2" - } - }, - "node_modules/@img/sharp-linux-arm64": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.4.tgz", - "integrity": "sha512-2800clwVg1ZQtxwSoTlHvtm9ObgAax7V6MTAB/hDT945Tfyy3hVkmiHpeLPCKYqYR1Gcmv1uDZ3a4OFwkdBL7Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.26", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-arm64": "1.0.2" - } - }, - "node_modules/@img/sharp-linux-s390x": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.4.tgz", - "integrity": "sha512-h3RAL3siQoyzSoH36tUeS0PDmb5wINKGYzcLB5C6DIiAn2F3udeFAum+gj8IbA/82+8RGCTn7XW8WTFnqag4tQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.31", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-s390x": "1.0.2" - } - }, - "node_modules/@img/sharp-linux-x64": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.4.tgz", - "integrity": "sha512-GoR++s0XW9DGVi8SUGQ/U4AeIzLdNjHka6jidVwapQ/JebGVQIpi52OdyxCNVRE++n1FCLzjDovJNozif7w/Aw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.26", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-x64": "1.0.2" - } - }, - "node_modules/@img/sharp-linuxmusl-arm64": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.4.tgz", - "integrity": "sha512-nhr1yC3BlVrKDTl6cO12gTpXMl4ITBUZieehFvMntlCXFzH2bvKG76tBL2Y/OqhupZt81pR7R+Q5YhJxW0rGgQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "musl": ">=1.2.2", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", + "glibc": ">=2.26", "npm": ">=9.6.5", "pnpm": ">=7.1.0", "yarn": ">=3.2.0" }, "funding": { "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-arm64": "1.0.2" } }, - "node_modules/@img/sharp-linuxmusl-x64": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.4.tgz", - "integrity": "sha512-uCPTku0zwqDmZEOi4ILyGdmW76tH7dm8kKlOIV1XC5cLyJ71ENAAqarOHQh0RLfpIpbV5KOpXzdU6XkJtS0daw==", + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.2.tgz", + "integrity": "sha512-VI94Q6khIHqHWNOh6LLdm9s2Ry4zdjWJwH56WoiJU7NTeDwyApdZZ8c+SADC8OH98KWNQXnE01UdJ9CSfZvwZw==", "cpu": [ "x64" ], @@ -3507,31 +2831,28 @@ ], "engines": { "musl": ">=1.2.2", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0", "yarn": ">=3.2.0" }, "funding": { "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-x64": "1.0.2" } }, - "node_modules/@img/sharp-wasm32": { + "node_modules/@img/sharp-linux-x64": { "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.4.tgz", - "integrity": "sha512-Bmmauh4sXUsUqkleQahpdNXKvo+wa1V9KhT2pDA4VJGKwnKMJXiSTGphn0gnJrlooda0QxCtXc6RX1XAU6hMnQ==", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.4.tgz", + "integrity": "sha512-GoR++s0XW9DGVi8SUGQ/U4AeIzLdNjHka6jidVwapQ/JebGVQIpi52OdyxCNVRE++n1FCLzjDovJNozif7w/Aw==", "cpu": [ - "wasm32" + "x64" ], "dev": true, "optional": true, - "dependencies": { - "@emnapi/runtime": "^1.1.1" - }, + "os": [ + "linux" + ], "engines": { + "glibc": ">=2.26", "node": "^18.17.0 || ^20.3.0 || >=21.0.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0", @@ -3539,21 +2860,25 @@ }, "funding": { "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.2" } }, - "node_modules/@img/sharp-win32-ia32": { + "node_modules/@img/sharp-linuxmusl-x64": { "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.4.tgz", - "integrity": "sha512-99SJ91XzUhYHbx7uhK3+9Lf7+LjwMGQZMDlO/E/YVJ7Nc3lyDFZPGhjwiYdctoH2BOzW9+TnfqcaMKt0jHLdqw==", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.4.tgz", + "integrity": "sha512-uCPTku0zwqDmZEOi4ILyGdmW76tH7dm8kKlOIV1XC5cLyJ71ENAAqarOHQh0RLfpIpbV5KOpXzdU6XkJtS0daw==", "cpu": [ - "ia32" + "x64" ], "dev": true, "optional": true, "os": [ - "win32" + "linux" ], "engines": { + "musl": ">=1.2.2", "node": "^18.17.0 || ^20.3.0 || >=21.0.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0", @@ -3561,6 +2886,9 @@ }, "funding": { "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.0.2" } }, "node_modules/@img/sharp-win32-x64": { @@ -4384,319 +3712,31 @@ "@netlify/esbuild-sunos-64": "0.14.39", "@netlify/esbuild-windows-32": "0.14.39", "@netlify/esbuild-windows-64": "0.14.39", - "@netlify/esbuild-windows-arm64": "0.14.39" - } - }, - "node_modules/@netlify/esbuild-android-64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-android-64/-/esbuild-android-64-0.14.39.tgz", - "integrity": "sha512-azq+lsvjRsKLap8ubIwSJXGyknUACqYu5h98Fvyoh40Qk4QXIVKl16JIJ4s+B7jy2k9qblEc5c4nxdDA3aGbVA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-android-arm64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-android-arm64/-/esbuild-android-arm64-0.14.39.tgz", - "integrity": "sha512-WhIP7ePq4qMC1sxoaeB9SsJqSW6uzW7XDj/IuWl1l9r94nwxywU1sYdVLaF2mZr15njviazYjVr8x1d+ipwL3w==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-darwin-64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-darwin-64/-/esbuild-darwin-64-0.14.39.tgz", - "integrity": "sha512-eF4GvLYiDxtcyjFT55+h+8c8A2HltjeMezCqkt3AQSgOdu1nhlvwbBhIdg2dyM6gKEaEm5hBtTbicEDSwsLodA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-darwin-arm64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.39.tgz", - "integrity": "sha512-b7rtnX/VtYwNbUCxs3eulrCWJ+u2YvqDcXiIV1ka+od+N0fTx+4RrVkVp1lha9L0wEJYK9J7UWZOMLMyd1ynRg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-freebsd-64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.39.tgz", - "integrity": "sha512-XtusxDJt2hUKUdggbTFolMx0kJL2zEa4STI7YwpB+ukEWoW5rODZjiLZbqqYLcjDH8k4YwHaMxs103L8eButEQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-freebsd-arm64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.39.tgz", - "integrity": "sha512-A9XZKai+k6kfndCtN6Dh2usT28V0+OGxzFdZsANONPQiEUTrGZCgwcHWiVlVn7SeAwPR1tKZreTnvrfj8cj7hA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-linux-32": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-32/-/esbuild-linux-32-0.14.39.tgz", - "integrity": "sha512-ZQnqk/82YRvINY+aF+LlGfRZ19c5mH0jaxsO046GpIOPx6PcXHG8JJ2lg+vLJVe4zFPohxzabcYpwFuT4cg/GA==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-linux-64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-64/-/esbuild-linux-64-0.14.39.tgz", - "integrity": "sha512-IQtswVw7GAKNX/3yV390wSfSXvMWy0d5cw8csAffwBk9gupftY2lzepK4Cn6uD/aqLt3Iku33FbHop/2nPGfQA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-linux-arm": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-arm/-/esbuild-linux-arm-0.14.39.tgz", - "integrity": "sha512-QdOzQniOed0Bz1cTC9TMMwvtAqKayYv66H4edJlbvElC81yJZF/c9XhmYWJ6P5g4nkChZubQ5RcQwTLmrFGexg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-linux-arm64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.39.tgz", - "integrity": "sha512-4Jie4QV6pWWuGN7TAshNMGbdTA9+VbRkv3rPIxhgK5gBfmsAV1yRKsumE4Y77J0AZNRiOriyoec4zc1qkmI3zg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-linux-mips64le": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.39.tgz", - "integrity": "sha512-Htozxr95tw4tSd86YNbCLs1eoYQzNu/cHpzFIkuJoztZueUhl8XpRvBdob7n3kEjW1gitLWAIn8XUwSt+aJ1Tg==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-linux-ppc64le": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.39.tgz", - "integrity": "sha512-tFy0ufWIdjeuk1rPHee00TZlhr9OSF00Ufb4ROFyt2ArKuMSkWRJuDgx6MtZcAnCIN4cybo/xWl3MKTM+scnww==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-linux-riscv64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.39.tgz", - "integrity": "sha512-ZzfKvwIxL7wQnYbVFpyNW0wotnLoKageUEM57RbjekesJoNQnqUR6Usm+LDZoB8iRsI58VX1IxnstP0cX8vOHw==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-linux-s390x": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.39.tgz", - "integrity": "sha512-yjC0mFwnuMRoh0WcF0h71MF71ytZBFEQQTRdgiGT0+gbC4UApBqnTkJdLx32RscBKi9skbMChiJ748hDJou6FA==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-netbsd-64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.39.tgz", - "integrity": "sha512-mIq4znOoz3YfTVdv3sIWfR4Zx5JgMnT4srlhC5KYVHibhxvyDdin5txldYXmR4Zv4dZd6DSuWFsn441aUegHeA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-openbsd-64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.39.tgz", - "integrity": "sha512-+t6QdzJCngH19hV7ClpFAeFDI2ko/HNcFbiNwaXTMVLB3hWi1sJtn+fzZck5HfzN4qsajAVqZq4nwX69SSt25A==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-sunos-64": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-sunos-64/-/esbuild-sunos-64-0.14.39.tgz", - "integrity": "sha512-HLfXG6i2p3wyyyWHeeP4ShGDJ1zRMnf9YLJLe2ezv2KqvcKw/Un/m/FBuDW1p13oSUO7ShISMzgc1dw1GGBEOQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@netlify/esbuild-windows-32": { - "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-windows-32/-/esbuild-windows-32-0.14.39.tgz", - "integrity": "sha512-ZpSQcKbVSCU3ln7mHpsL/5dWsUqCNdTnC5YAArnaOwdrlIunrsbo5j4MOZRRcGExb2uvTc/rb+D3mlGb8j1rkA==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" + "@netlify/esbuild-windows-arm64": "0.14.39" } }, - "node_modules/@netlify/esbuild-windows-64": { + "node_modules/@netlify/esbuild-linux-64": { "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-windows-64/-/esbuild-windows-64-0.14.39.tgz", - "integrity": "sha512-I3gCdO8+6IDhT4Y1ZmV4o2Gg0oELv7N4kCcE4kqclz10fWHNjf19HQNHyBJe0AWnFV5ZfT154VVD31dqgwpgFw==", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-64/-/esbuild-linux-64-0.14.39.tgz", + "integrity": "sha512-IQtswVw7GAKNX/3yV390wSfSXvMWy0d5cw8csAffwBk9gupftY2lzepK4Cn6uD/aqLt3Iku33FbHop/2nPGfQA==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ - "win32" + "linux" ], "engines": { "node": ">=12" } }, - "node_modules/@netlify/esbuild-windows-arm64": { + "node_modules/@netlify/esbuild-windows-64": { "version": "0.14.39", - "resolved": "https://registry.npmjs.org/@netlify/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.39.tgz", - "integrity": "sha512-WX52W8U1lsfWcz6NWoSpDs57lgiiMHN23seq8G2bvxzGS/tvYD3dxVLLW5UPoKSnFDyVQT7b6Zkt6AkBten1yQ==", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-windows-64/-/esbuild-windows-64-0.14.39.tgz", + "integrity": "sha512-I3gCdO8+6IDhT4Y1ZmV4o2Gg0oELv7N4kCcE4kqclz10fWHNjf19HQNHyBJe0AWnFV5ZfT154VVD31dqgwpgFw==", "cpu": [ - "arm64" + "x64" ], "dev": true, "optional": true, @@ -4940,126 +3980,6 @@ } } }, - "node_modules/@next/swc-darwin-arm64": { - "version": "14.2.20", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.20.tgz", - "integrity": "sha512-WDfq7bmROa5cIlk6ZNonNdVhKmbCv38XteVFYsxea1vDJt3SnYGgxLGMTXQNfs5OkFvAhmfKKrwe7Y0Hs+rWOg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-darwin-x64": { - "version": "14.2.20", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.20.tgz", - "integrity": "sha512-XIQlC+NAmJPfa2hruLvr1H1QJJeqOTDV+v7tl/jIdoFvqhoihvSNykLU/G6NMgoeo+e/H7p/VeWSOvMUHKtTIg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.2.20", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.20.tgz", - "integrity": "sha512-pnzBrHTPXIMm5QX3QC8XeMkpVuoAYOmyfsO4VlPn+0NrHraNuWjdhe+3xLq01xR++iCvX+uoeZmJDKcOxI201Q==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.2.20", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.20.tgz", - "integrity": "sha512-WhJJAFpi6yqmUx1momewSdcm/iRXFQS0HU2qlUGlGE/+98eu7JWLD5AAaP/tkK1mudS/rH2f9E3WCEF2iYDydQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.2.20", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.20.tgz", - "integrity": "sha512-ao5HCbw9+iG1Kxm8XsGa3X174Ahn17mSYBQlY6VGsdsYDAbz/ZP13wSLfvlYoIDn1Ger6uYA+yt/3Y9KTIupRg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-musl": { - "version": "14.2.20", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.20.tgz", - "integrity": "sha512-CXm/kpnltKTT7945np6Td3w7shj/92TMRPyI/VvveFe8+YE+/YOJ5hyAWK5rpx711XO1jBCgXl211TWaxOtkaA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.2.20", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.20.tgz", - "integrity": "sha512-upJn2HGQgKNDbXVfIgmqT2BN8f3z/mX8ddoyi1I565FHbfowVK5pnMEwauvLvaJf4iijvuKq3kw/b6E9oIVRWA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.2.20", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.20.tgz", - "integrity": "sha512-igQW/JWciTGJwj3G1ipalD2V20Xfx3ywQy17IV0ciOUBbFhNfyU1DILWsTi32c8KmqgIDviUEulW/yPb2FF90w==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@next/swc-win32-x64-msvc": { "version": "14.2.20", "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.20.tgz", @@ -5615,146 +4535,6 @@ "@parcel/watcher-win32-x64": "2.4.1" } }, - "node_modules/@parcel/watcher-android-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz", - "integrity": "sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.4.1.tgz", - "integrity": "sha512-ln41eihm5YXIY043vBrrHfn94SIBlqOWmoROhsMVTSXGh0QahKGy77tfEywQ7v3NywyxBBkGIfrWRHm0hsKtzA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.4.1.tgz", - "integrity": "sha512-yrw81BRLjjtHyDu7J61oPuSoeYWR3lDElcPGJyOvIXmor6DEo7/G2u1o7I38cwlcoBHQFULqF6nesIX3tsEXMg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-freebsd-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.4.1.tgz", - "integrity": "sha512-TJa3Pex/gX3CWIx/Co8k+ykNdDCLx+TuZj3f3h7eOjgpdKM+Mnix37RYsYU4LHhiYJz3DK5nFCCra81p6g050w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.4.1.tgz", - "integrity": "sha512-4rVYDlsMEYfa537BRXxJ5UF4ddNwnr2/1O4MHM5PjI9cvV2qymvhwZSFgXqbS8YoTk5i/JR0L0JDs69BUn45YA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.4.1.tgz", - "integrity": "sha512-BJ7mH985OADVLpbrzCLgrJ3TOpiZggE9FMblfO65PlOCdG++xJpKUJ0Aol74ZUIYfb8WsRlUdgrZxKkz3zXWYA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-musl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.4.1.tgz", - "integrity": "sha512-p4Xb7JGq3MLgAfYhslU2SjoV9G0kI0Xry0kuxeG/41UfpjHGOhv7UoUDAz/jb1u2elbhazy4rRBL8PegPJFBhA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, "node_modules/@parcel/watcher-linux-x64-glibc": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.4.1.tgz", @@ -5785,54 +4565,7 @@ "dev": true, "optional": true, "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-wasm": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-wasm/-/watcher-wasm-2.4.1.tgz", - "integrity": "sha512-/ZR0RxqxU/xxDGzbzosMjh4W6NdYFMqq2nvo2b8SLi7rsl/4jkL8S5stIikorNkdR50oVDvqb/3JT05WM+CRRA==", - "bundleDependencies": [ - "napi-wasm" - ], - "dev": true, - "dependencies": { - "is-glob": "^4.0.3", - "micromatch": "^4.0.5", - "napi-wasm": "^1.1.0" - }, - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": { - "version": "1.1.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/@parcel/watcher-win32-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.4.1.tgz", - "integrity": "sha512-Uq2BPp5GWhrq/lcuItCHoqxjULU1QYEcyjSO5jqqOK8RNFDBQnenMMx4gAl3v8GiWa59E9+uDM7yZ6LxwUIfRg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" + "linux" ], "engines": { "node": ">= 10.0.0" @@ -5842,18 +4575,19 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/@parcel/watcher-win32-ia32": { + "node_modules/@parcel/watcher-wasm": { "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.4.1.tgz", - "integrity": "sha512-maNRit5QQV2kgHFSYwftmPBxiuK5u4DXjbXx7q6eKjq5dsLXZ4FJiVvlcw35QXzk0KrUecJmuVFbj4uV9oYrcw==", - "cpu": [ - "ia32" + "resolved": "https://registry.npmjs.org/@parcel/watcher-wasm/-/watcher-wasm-2.4.1.tgz", + "integrity": "sha512-/ZR0RxqxU/xxDGzbzosMjh4W6NdYFMqq2nvo2b8SLi7rsl/4jkL8S5stIikorNkdR50oVDvqb/3JT05WM+CRRA==", + "bundleDependencies": [ + "napi-wasm" ], "dev": true, - "optional": true, - "os": [ - "win32" - ], + "dependencies": { + "is-glob": "^4.0.3", + "micromatch": "^4.0.5", + "napi-wasm": "^1.1.0" + }, "engines": { "node": ">= 10.0.0" }, @@ -5862,6 +4596,12 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, "node_modules/@parcel/watcher-win32-x64": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.4.1.tgz", @@ -14355,19 +13095,6 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -28811,246 +27538,6 @@ "fsevents": "~2.3.3" } }, - "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", - "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", - "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", - "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/android-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", - "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", - "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/darwin-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", - "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", - "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", - "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", - "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", - "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", - "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-loong64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", - "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", - "cpu": [ - "loong64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", - "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", - "cpu": [ - "mips64el" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", - "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", - "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", - "cpu": [ - "riscv64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/linux-s390x": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", - "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", - "cpu": [ - "s390x" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, "node_modules/tsx/node_modules/@esbuild/linux-x64": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", @@ -29066,81 +27553,6 @@ "node": ">=18" } }, - "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", - "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", - "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/sunos-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", - "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/win32-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", - "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/tsx/node_modules/@esbuild/win32-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", - "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, "node_modules/tsx/node_modules/@esbuild/win32-x64": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", From ad7268c25e7fceb8730d7abe9c2c155cde9be621 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 21 Dec 2024 16:52:13 +0530 Subject: [PATCH 077/183] update package json --- package-lock.json | 1662 +++++++++++++++++++++++++++++++++++++++- rename.ps1 | 14 + types/githubGraphQL.ts | 95 +++ 3 files changed, 1734 insertions(+), 37 deletions(-) create mode 100644 rename.ps1 create mode 100644 types/githubGraphQL.ts diff --git a/package-lock.json b/package-lock.json index 065932dda911..52991c72a4be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2470,6 +2470,256 @@ } } }, + "node_modules/@emnapi/runtime": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.2.0.tgz", + "integrity": "sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==", + "dev": true, + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", + "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", + "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", + "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", + "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", + "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", + "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", + "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", + "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", + "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz", + "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", + "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", + "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", + "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", + "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", + "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", + "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/linux-x64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", @@ -2485,6 +2735,96 @@ "node": ">=12" } }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", + "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", + "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", + "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", + "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", + "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/win32-x64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", @@ -2795,6 +3135,168 @@ "deprecated": "Use @eslint/object-schema instead", "dev": true }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.4.tgz", + "integrity": "sha512-p0suNqXufJs9t3RqLBO6vvrgr5OhgbWp76s5gTRvdmxmuv9E1rcaqGUsl3l4mKVmXPkTkTErXediAui4x+8PSA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "glibc": ">=2.26", + "node": "^18.17.0 || ^20.3.0 || >=21.0.0", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.0.2" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.4.tgz", + "integrity": "sha512-0l7yRObwtTi82Z6ebVI2PnHT8EB2NxBgpK2MiKJZJ7cz32R4lxd001ecMhzzsZig3Yv9oclvqqdV93jo9hy+Dw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "glibc": ">=2.26", + "node": "^18.17.0 || ^20.3.0 || >=21.0.0", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.0.2" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.2.tgz", + "integrity": "sha512-tcK/41Rq8IKlSaKRCCAuuY3lDJjQnYIW1UXU1kxcEKrfL8WR7N6+rzNoOxoQRJWTAECuKwgAHnPvqXGN8XfkHA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "macos": ">=11", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.2.tgz", + "integrity": "sha512-Ofw+7oaWa0HiiMiKWqqaZbaYV3/UGL2wAPeLuJTx+9cXpCRdvQhCLG0IH8YGwM0yGWGLpsF4Su9vM1o6aer+Fw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "macos": ">=10.13", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.2.tgz", + "integrity": "sha512-iLWCvrKgeFoglQxdEwzu1eQV04o8YeYGFXtfWU26Zr2wWT3q3MTzC+QTCO3ZQfWd3doKHT4Pm2kRmLbupT+sZw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "glibc": ">=2.28", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.2.tgz", + "integrity": "sha512-x7kCt3N00ofFmmkkdshwj3vGPCnmiDh7Gwnd4nUwZln2YjqPxV1NlTyZOvoDWdKQVDL911487HOueBvrpflagw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "glibc": ">=2.26", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.2.tgz", + "integrity": "sha512-cmhQ1J4qVhfmS6szYW7RT+gLJq9dH2i4maq+qyXayUSn9/3iY2ZeWpbAgSpSVbV2E1JUL2Gg7pwnYQ1h8rQIog==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "glibc": ">=2.28", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, "node_modules/@img/sharp-libvips-linux-x64": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.2.tgz", @@ -2817,12 +3319,160 @@ "url": "https://opencollective.com/libvips" } }, - "node_modules/@img/sharp-libvips-linuxmusl-x64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.2.tgz", - "integrity": "sha512-VI94Q6khIHqHWNOh6LLdm9s2Ry4zdjWJwH56WoiJU7NTeDwyApdZZ8c+SADC8OH98KWNQXnE01UdJ9CSfZvwZw==", + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.2.tgz", + "integrity": "sha512-3CAkndNpYUrlDqkCM5qhksfE+qSIREVpyoeHIU6jd48SJZViAmznoQQLAv4hVXF7xyUB9zf+G++e2v1ABjCbEQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "musl": ">=1.2.2", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.2.tgz", + "integrity": "sha512-VI94Q6khIHqHWNOh6LLdm9s2Ry4zdjWJwH56WoiJU7NTeDwyApdZZ8c+SADC8OH98KWNQXnE01UdJ9CSfZvwZw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "musl": ">=1.2.2", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.4.tgz", + "integrity": "sha512-RUgBD1c0+gCYZGCCe6mMdTiOFS0Zc/XrN0fYd6hISIKcDUbAW5NtSQW9g/powkrXYm6Vzwd6y+fqmExDuCdHNQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "glibc": ">=2.28", + "node": "^18.17.0 || ^20.3.0 || >=21.0.0", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.0.2" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.4.tgz", + "integrity": "sha512-2800clwVg1ZQtxwSoTlHvtm9ObgAax7V6MTAB/hDT945Tfyy3hVkmiHpeLPCKYqYR1Gcmv1uDZ3a4OFwkdBL7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "glibc": ">=2.26", + "node": "^18.17.0 || ^20.3.0 || >=21.0.0", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.0.2" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.4.tgz", + "integrity": "sha512-h3RAL3siQoyzSoH36tUeS0PDmb5wINKGYzcLB5C6DIiAn2F3udeFAum+gj8IbA/82+8RGCTn7XW8WTFnqag4tQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "glibc": ">=2.31", + "node": "^18.17.0 || ^20.3.0 || >=21.0.0", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.0.2" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.4.tgz", + "integrity": "sha512-GoR++s0XW9DGVi8SUGQ/U4AeIzLdNjHka6jidVwapQ/JebGVQIpi52OdyxCNVRE++n1FCLzjDovJNozif7w/Aw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "glibc": ">=2.26", + "node": "^18.17.0 || ^20.3.0 || >=21.0.0", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.2" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.4.tgz", + "integrity": "sha512-nhr1yC3BlVrKDTl6cO12gTpXMl4ITBUZieehFvMntlCXFzH2bvKG76tBL2Y/OqhupZt81pR7R+Q5YhJxW0rGgQ==", "cpu": [ - "x64" + "arm64" ], "dev": true, "optional": true, @@ -2831,18 +3481,22 @@ ], "engines": { "musl": ">=1.2.2", + "node": "^18.17.0 || ^20.3.0 || >=21.0.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0", "yarn": ">=3.2.0" }, "funding": { "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.0.2" } }, - "node_modules/@img/sharp-linux-x64": { + "node_modules/@img/sharp-linuxmusl-x64": { "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.4.tgz", - "integrity": "sha512-GoR++s0XW9DGVi8SUGQ/U4AeIzLdNjHka6jidVwapQ/JebGVQIpi52OdyxCNVRE++n1FCLzjDovJNozif7w/Aw==", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.4.tgz", + "integrity": "sha512-uCPTku0zwqDmZEOi4ILyGdmW76tH7dm8kKlOIV1XC5cLyJ71ENAAqarOHQh0RLfpIpbV5KOpXzdU6XkJtS0daw==", "cpu": [ "x64" ], @@ -2852,7 +3506,7 @@ "linux" ], "engines": { - "glibc": ">=2.26", + "musl": ">=1.2.2", "node": "^18.17.0 || ^20.3.0 || >=21.0.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0", @@ -2862,23 +3516,44 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-x64": "1.0.2" + "@img/sharp-libvips-linuxmusl-x64": "1.0.2" } }, - "node_modules/@img/sharp-linuxmusl-x64": { + "node_modules/@img/sharp-wasm32": { "version": "0.33.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.4.tgz", - "integrity": "sha512-uCPTku0zwqDmZEOi4ILyGdmW76tH7dm8kKlOIV1XC5cLyJ71ENAAqarOHQh0RLfpIpbV5KOpXzdU6XkJtS0daw==", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.4.tgz", + "integrity": "sha512-Bmmauh4sXUsUqkleQahpdNXKvo+wa1V9KhT2pDA4VJGKwnKMJXiSTGphn0gnJrlooda0QxCtXc6RX1XAU6hMnQ==", "cpu": [ - "x64" + "wasm32" + ], + "dev": true, + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.1.1" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0", + "yarn": ">=3.2.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.4.tgz", + "integrity": "sha512-99SJ91XzUhYHbx7uhK3+9Lf7+LjwMGQZMDlO/E/YVJ7Nc3lyDFZPGhjwiYdctoH2BOzW9+TnfqcaMKt0jHLdqw==", + "cpu": [ + "ia32" ], "dev": true, "optional": true, "os": [ - "linux" + "win32" ], "engines": { - "musl": ">=1.2.2", "node": "^18.17.0 || ^20.3.0 || >=21.0.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0", @@ -2886,9 +3561,6 @@ }, "funding": { "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-x64": "1.0.2" } }, "node_modules/@img/sharp-win32-x64": { @@ -3715,17 +4387,289 @@ "@netlify/esbuild-windows-arm64": "0.14.39" } }, + "node_modules/@netlify/esbuild-android-64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-android-64/-/esbuild-android-64-0.14.39.tgz", + "integrity": "sha512-azq+lsvjRsKLap8ubIwSJXGyknUACqYu5h98Fvyoh40Qk4QXIVKl16JIJ4s+B7jy2k9qblEc5c4nxdDA3aGbVA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-android-arm64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-android-arm64/-/esbuild-android-arm64-0.14.39.tgz", + "integrity": "sha512-WhIP7ePq4qMC1sxoaeB9SsJqSW6uzW7XDj/IuWl1l9r94nwxywU1sYdVLaF2mZr15njviazYjVr8x1d+ipwL3w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-darwin-64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-darwin-64/-/esbuild-darwin-64-0.14.39.tgz", + "integrity": "sha512-eF4GvLYiDxtcyjFT55+h+8c8A2HltjeMezCqkt3AQSgOdu1nhlvwbBhIdg2dyM6gKEaEm5hBtTbicEDSwsLodA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-darwin-arm64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.39.tgz", + "integrity": "sha512-b7rtnX/VtYwNbUCxs3eulrCWJ+u2YvqDcXiIV1ka+od+N0fTx+4RrVkVp1lha9L0wEJYK9J7UWZOMLMyd1ynRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-freebsd-64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.39.tgz", + "integrity": "sha512-XtusxDJt2hUKUdggbTFolMx0kJL2zEa4STI7YwpB+ukEWoW5rODZjiLZbqqYLcjDH8k4YwHaMxs103L8eButEQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-freebsd-arm64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.39.tgz", + "integrity": "sha512-A9XZKai+k6kfndCtN6Dh2usT28V0+OGxzFdZsANONPQiEUTrGZCgwcHWiVlVn7SeAwPR1tKZreTnvrfj8cj7hA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-linux-32": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-32/-/esbuild-linux-32-0.14.39.tgz", + "integrity": "sha512-ZQnqk/82YRvINY+aF+LlGfRZ19c5mH0jaxsO046GpIOPx6PcXHG8JJ2lg+vLJVe4zFPohxzabcYpwFuT4cg/GA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@netlify/esbuild-linux-64": { "version": "0.14.39", "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-64/-/esbuild-linux-64-0.14.39.tgz", "integrity": "sha512-IQtswVw7GAKNX/3yV390wSfSXvMWy0d5cw8csAffwBk9gupftY2lzepK4Cn6uD/aqLt3Iku33FbHop/2nPGfQA==", "cpu": [ - "x64" + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-linux-arm": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-arm/-/esbuild-linux-arm-0.14.39.tgz", + "integrity": "sha512-QdOzQniOed0Bz1cTC9TMMwvtAqKayYv66H4edJlbvElC81yJZF/c9XhmYWJ6P5g4nkChZubQ5RcQwTLmrFGexg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-linux-arm64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.39.tgz", + "integrity": "sha512-4Jie4QV6pWWuGN7TAshNMGbdTA9+VbRkv3rPIxhgK5gBfmsAV1yRKsumE4Y77J0AZNRiOriyoec4zc1qkmI3zg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-linux-mips64le": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.39.tgz", + "integrity": "sha512-Htozxr95tw4tSd86YNbCLs1eoYQzNu/cHpzFIkuJoztZueUhl8XpRvBdob7n3kEjW1gitLWAIn8XUwSt+aJ1Tg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-linux-ppc64le": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.39.tgz", + "integrity": "sha512-tFy0ufWIdjeuk1rPHee00TZlhr9OSF00Ufb4ROFyt2ArKuMSkWRJuDgx6MtZcAnCIN4cybo/xWl3MKTM+scnww==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-linux-riscv64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.39.tgz", + "integrity": "sha512-ZzfKvwIxL7wQnYbVFpyNW0wotnLoKageUEM57RbjekesJoNQnqUR6Usm+LDZoB8iRsI58VX1IxnstP0cX8vOHw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-linux-s390x": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.39.tgz", + "integrity": "sha512-yjC0mFwnuMRoh0WcF0h71MF71ytZBFEQQTRdgiGT0+gbC4UApBqnTkJdLx32RscBKi9skbMChiJ748hDJou6FA==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-netbsd-64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.39.tgz", + "integrity": "sha512-mIq4znOoz3YfTVdv3sIWfR4Zx5JgMnT4srlhC5KYVHibhxvyDdin5txldYXmR4Zv4dZd6DSuWFsn441aUegHeA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-openbsd-64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.39.tgz", + "integrity": "sha512-+t6QdzJCngH19hV7ClpFAeFDI2ko/HNcFbiNwaXTMVLB3hWi1sJtn+fzZck5HfzN4qsajAVqZq4nwX69SSt25A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-sunos-64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-sunos-64/-/esbuild-sunos-64-0.14.39.tgz", + "integrity": "sha512-HLfXG6i2p3wyyyWHeeP4ShGDJ1zRMnf9YLJLe2ezv2KqvcKw/Un/m/FBuDW1p13oSUO7ShISMzgc1dw1GGBEOQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@netlify/esbuild-windows-32": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-windows-32/-/esbuild-windows-32-0.14.39.tgz", + "integrity": "sha512-ZpSQcKbVSCU3ln7mHpsL/5dWsUqCNdTnC5YAArnaOwdrlIunrsbo5j4MOZRRcGExb2uvTc/rb+D3mlGb8j1rkA==", + "cpu": [ + "ia32" ], "dev": true, "optional": true, "os": [ - "linux" + "win32" ], "engines": { "node": ">=12" @@ -3747,6 +4691,22 @@ "node": ">=12" } }, + "node_modules/@netlify/esbuild-windows-arm64": { + "version": "0.14.39", + "resolved": "https://registry.npmjs.org/@netlify/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.39.tgz", + "integrity": "sha512-WX52W8U1lsfWcz6NWoSpDs57lgiiMHN23seq8G2bvxzGS/tvYD3dxVLLW5UPoKSnFDyVQT7b6Zkt6AkBten1yQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@netlify/functions": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-2.8.0.tgz", @@ -3980,6 +4940,126 @@ } } }, + "node_modules/@next/swc-darwin-arm64": { + "version": "14.2.20", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.20.tgz", + "integrity": "sha512-WDfq7bmROa5cIlk6ZNonNdVhKmbCv38XteVFYsxea1vDJt3SnYGgxLGMTXQNfs5OkFvAhmfKKrwe7Y0Hs+rWOg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "14.2.20", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.20.tgz", + "integrity": "sha512-XIQlC+NAmJPfa2hruLvr1H1QJJeqOTDV+v7tl/jIdoFvqhoihvSNykLU/G6NMgoeo+e/H7p/VeWSOvMUHKtTIg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "14.2.20", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.20.tgz", + "integrity": "sha512-pnzBrHTPXIMm5QX3QC8XeMkpVuoAYOmyfsO4VlPn+0NrHraNuWjdhe+3xLq01xR++iCvX+uoeZmJDKcOxI201Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "14.2.20", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.20.tgz", + "integrity": "sha512-WhJJAFpi6yqmUx1momewSdcm/iRXFQS0HU2qlUGlGE/+98eu7JWLD5AAaP/tkK1mudS/rH2f9E3WCEF2iYDydQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "14.2.20", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.20.tgz", + "integrity": "sha512-ao5HCbw9+iG1Kxm8XsGa3X174Ahn17mSYBQlY6VGsdsYDAbz/ZP13wSLfvlYoIDn1Ger6uYA+yt/3Y9KTIupRg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "14.2.20", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.20.tgz", + "integrity": "sha512-CXm/kpnltKTT7945np6Td3w7shj/92TMRPyI/VvveFe8+YE+/YOJ5hyAWK5rpx711XO1jBCgXl211TWaxOtkaA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "14.2.20", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.20.tgz", + "integrity": "sha512-upJn2HGQgKNDbXVfIgmqT2BN8f3z/mX8ddoyi1I565FHbfowVK5pnMEwauvLvaJf4iijvuKq3kw/b6E9oIVRWA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "14.2.20", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.20.tgz", + "integrity": "sha512-igQW/JWciTGJwj3G1ipalD2V20Xfx3ywQy17IV0ciOUBbFhNfyU1DILWsTi32c8KmqgIDviUEulW/yPb2FF90w==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@next/swc-win32-x64-msvc": { "version": "14.2.20", "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.20.tgz", @@ -4535,6 +5615,146 @@ "@parcel/watcher-win32-x64": "2.4.1" } }, + "node_modules/@parcel/watcher-android-arm64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz", + "integrity": "sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-arm64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.4.1.tgz", + "integrity": "sha512-ln41eihm5YXIY043vBrrHfn94SIBlqOWmoROhsMVTSXGh0QahKGy77tfEywQ7v3NywyxBBkGIfrWRHm0hsKtzA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-x64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.4.1.tgz", + "integrity": "sha512-yrw81BRLjjtHyDu7J61oPuSoeYWR3lDElcPGJyOvIXmor6DEo7/G2u1o7I38cwlcoBHQFULqF6nesIX3tsEXMg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-freebsd-x64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.4.1.tgz", + "integrity": "sha512-TJa3Pex/gX3CWIx/Co8k+ykNdDCLx+TuZj3f3h7eOjgpdKM+Mnix37RYsYU4LHhiYJz3DK5nFCCra81p6g050w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-glibc": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.4.1.tgz", + "integrity": "sha512-4rVYDlsMEYfa537BRXxJ5UF4ddNwnr2/1O4MHM5PjI9cvV2qymvhwZSFgXqbS8YoTk5i/JR0L0JDs69BUn45YA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-glibc": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.4.1.tgz", + "integrity": "sha512-BJ7mH985OADVLpbrzCLgrJ3TOpiZggE9FMblfO65PlOCdG++xJpKUJ0Aol74ZUIYfb8WsRlUdgrZxKkz3zXWYA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-musl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.4.1.tgz", + "integrity": "sha512-p4Xb7JGq3MLgAfYhslU2SjoV9G0kI0Xry0kuxeG/41UfpjHGOhv7UoUDAz/jb1u2elbhazy4rRBL8PegPJFBhA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, "node_modules/@parcel/watcher-linux-x64-glibc": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.4.1.tgz", @@ -4575,19 +5795,65 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/@parcel/watcher-wasm": { + "node_modules/@parcel/watcher-wasm": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-wasm/-/watcher-wasm-2.4.1.tgz", + "integrity": "sha512-/ZR0RxqxU/xxDGzbzosMjh4W6NdYFMqq2nvo2b8SLi7rsl/4jkL8S5stIikorNkdR50oVDvqb/3JT05WM+CRRA==", + "bundleDependencies": [ + "napi-wasm" + ], + "dev": true, + "dependencies": { + "is-glob": "^4.0.3", + "micromatch": "^4.0.5", + "napi-wasm": "^1.1.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/@parcel/watcher-win32-arm64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.4.1.tgz", + "integrity": "sha512-Uq2BPp5GWhrq/lcuItCHoqxjULU1QYEcyjSO5jqqOK8RNFDBQnenMMx4gAl3v8GiWa59E9+uDM7yZ6LxwUIfRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-ia32": { "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-wasm/-/watcher-wasm-2.4.1.tgz", - "integrity": "sha512-/ZR0RxqxU/xxDGzbzosMjh4W6NdYFMqq2nvo2b8SLi7rsl/4jkL8S5stIikorNkdR50oVDvqb/3JT05WM+CRRA==", - "bundleDependencies": [ - "napi-wasm" + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.4.1.tgz", + "integrity": "sha512-maNRit5QQV2kgHFSYwftmPBxiuK5u4DXjbXx7q6eKjq5dsLXZ4FJiVvlcw35QXzk0KrUecJmuVFbj4uV9oYrcw==", + "cpu": [ + "ia32" ], "dev": true, - "dependencies": { - "is-glob": "^4.0.3", - "micromatch": "^4.0.5", - "napi-wasm": "^1.1.0" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { "node": ">= 10.0.0" }, @@ -4596,12 +5862,6 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": { - "version": "1.1.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, "node_modules/@parcel/watcher-win32-x64": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.4.1.tgz", @@ -13095,6 +14355,19 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -27538,6 +28811,246 @@ "fsevents": "~2.3.3" } }, + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/tsx/node_modules/@esbuild/linux-x64": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", @@ -27553,6 +29066,81 @@ "node": ">=18" } }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/tsx/node_modules/@esbuild/win32-x64": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", diff --git a/rename.ps1 b/rename.ps1 new file mode 100644 index 000000000000..808386296623 --- /dev/null +++ b/rename.ps1 @@ -0,0 +1,14 @@ +# Define the root folder +$rootFolder = "scripts" + +# Get all .js files recursively +$jsFiles = Get-ChildItem -Path $rootFolder -Recurse -Filter "*.js" + +# Loop through each .js file and run the git mv command +foreach ($file in $jsFiles) { + # Construct the new file name with .ts extension + $newFileName = $file.FullName -replace "\.js$", ".ts" + + # Execute the git mv command + git mv $file.FullName $newFileName +} diff --git a/types/githubGraphQL.ts b/types/githubGraphQL.ts new file mode 100644 index 000000000000..e748e84eacef --- /dev/null +++ b/types/githubGraphQL.ts @@ -0,0 +1,95 @@ +export interface RateLimit { + limit: number; + cost: number; + remaining: number; + resetAt: string; +} + +export interface Assignee { + totalCount: number; +} + +export interface TimelineItem { + updatedAt: string; +} + +export interface Author { + login: string; +} + +export interface Repository { + name: string; +} + +export interface Reaction { + totalCount: number; +} + +export interface Review { + lastEditedAt?: string; + comments: { + totalCount: number; + }; +} + +export interface Label { + name: string; + color: string; +} + +export interface PageInfo { + hasNextPage: boolean; + endCursor?: string; +} + +export interface CommentNode { + reactions: Reaction; +} + +export interface Comments { + totalCount: number; + pageInfo: PageInfo; + nodes: CommentNode[]; +} + +export interface Issue { + assignees: Assignee[]; + timelineItems: TimelineItem[]; + author: Author; + id: string; + repository: Repository; + labels?: Label[]; + title: string; + resourcePath: string; + reactions: Reaction; + comments: Comments; +} + +export interface PullRequest extends Issue { + reviews: { + totalCount: number; + nodes: Review[]; + }; +} + +export interface SearchResultNode { + __typename: "Issue" | "PullRequest"; + id: string; + assignees: Assignee[]; + author: Author; + repository: Repository; + labels?: Label[]; + title: string; + resourcePath: string; +} + +export interface SearchResult { + pageInfo: PageInfo; + nodes: SearchResultNode[]; +} + +export interface QueryResponse { + node?: T; + rateLimit: RateLimit; + search?: SearchResult; +} \ No newline at end of file From 1ec94b3aad1c496065a4a16ce9d497e18b5b7fa0 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 21 Dec 2024 16:54:05 +0530 Subject: [PATCH 078/183] refactor: remove console log from buildPostList function --- scripts/build-post-list.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/build-post-list.ts b/scripts/build-post-list.ts index 51273274adc9..d4577786fd32 100644 --- a/scripts/build-post-list.ts +++ b/scripts/build-post-list.ts @@ -176,7 +176,6 @@ function walkDirectories( } export async function buildPostList() { - console.log('buildPostList ...'); walkDirectories(postDirectories, finalResult); const treePosts = buildNavTree(finalResult.docs.filter((p: TableOfContentsItem) => p.slug.startsWith('/docs/'))); From 4bf9c1b45936e290f1c7be1552187ba6c9e7b427 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 21 Dec 2024 17:02:25 +0530 Subject: [PATCH 079/183] fix: update workflow to conditionally install dependencies based on package.json existence --- .github/workflows/if-nodejs-pr-testing.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index d5489e7ab8f2..07aebbc07bd7 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -67,8 +67,9 @@ jobs: uses: actions/setup-node@v4 with: node-version: '${{ steps.nodeversion.outputs.version }}' - - name: Install dependencies - run: npm ci + - if: steps.packagejson.outputs.exists == 'true' + name: Install dependencies + run: npm install - if: steps.packagejson.outputs.exists == 'true' name: Test run: npm test --if-present From f377a6667d432a00500ae05dc7c7ce21cd7c2b4c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 21 Dec 2024 17:41:59 +0530 Subject: [PATCH 080/183] chore: remove unused PowerShell script and TypeScript type definitions --- rename.ps1 | 14 ------- types/githubGraphQL.ts | 95 ------------------------------------------ 2 files changed, 109 deletions(-) delete mode 100644 rename.ps1 delete mode 100644 types/githubGraphQL.ts diff --git a/rename.ps1 b/rename.ps1 deleted file mode 100644 index 808386296623..000000000000 --- a/rename.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -# Define the root folder -$rootFolder = "scripts" - -# Get all .js files recursively -$jsFiles = Get-ChildItem -Path $rootFolder -Recurse -Filter "*.js" - -# Loop through each .js file and run the git mv command -foreach ($file in $jsFiles) { - # Construct the new file name with .ts extension - $newFileName = $file.FullName -replace "\.js$", ".ts" - - # Execute the git mv command - git mv $file.FullName $newFileName -} diff --git a/types/githubGraphQL.ts b/types/githubGraphQL.ts deleted file mode 100644 index e748e84eacef..000000000000 --- a/types/githubGraphQL.ts +++ /dev/null @@ -1,95 +0,0 @@ -export interface RateLimit { - limit: number; - cost: number; - remaining: number; - resetAt: string; -} - -export interface Assignee { - totalCount: number; -} - -export interface TimelineItem { - updatedAt: string; -} - -export interface Author { - login: string; -} - -export interface Repository { - name: string; -} - -export interface Reaction { - totalCount: number; -} - -export interface Review { - lastEditedAt?: string; - comments: { - totalCount: number; - }; -} - -export interface Label { - name: string; - color: string; -} - -export interface PageInfo { - hasNextPage: boolean; - endCursor?: string; -} - -export interface CommentNode { - reactions: Reaction; -} - -export interface Comments { - totalCount: number; - pageInfo: PageInfo; - nodes: CommentNode[]; -} - -export interface Issue { - assignees: Assignee[]; - timelineItems: TimelineItem[]; - author: Author; - id: string; - repository: Repository; - labels?: Label[]; - title: string; - resourcePath: string; - reactions: Reaction; - comments: Comments; -} - -export interface PullRequest extends Issue { - reviews: { - totalCount: number; - nodes: Review[]; - }; -} - -export interface SearchResultNode { - __typename: "Issue" | "PullRequest"; - id: string; - assignees: Assignee[]; - author: Author; - repository: Repository; - labels?: Label[]; - title: string; - resourcePath: string; -} - -export interface SearchResult { - pageInfo: PageInfo; - nodes: SearchResultNode[]; -} - -export interface QueryResponse { - node?: T; - rateLimit: RateLimit; - search?: SearchResult; -} \ No newline at end of file From b96f1427c4629f732f418274b2c2b6f43583438e Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 21 Dec 2024 17:44:25 +0530 Subject: [PATCH 081/183] refactor: add type annotations to capitalizeJsxTags function parameters --- scripts/build-pages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-pages.ts b/scripts/build-pages.ts index 901adc8c4947..3c7dc9e74879 100644 --- a/scripts/build-pages.ts +++ b/scripts/build-pages.ts @@ -12,7 +12,7 @@ if (!fs.existsSync(TARGET_DIR)) { } export function capitalizeJsxTags(content: string) { - return content.replace(/<\/?(\w+)/g, function (match, letter) { + return content.replace(/<\/?(\w+)/g, function (match: string, letter: string): string { if (capitalizeTags.includes(letter.toLowerCase())) { return `<${match[1] === '/' ? '/' : ''}${letter[0].toUpperCase()}${letter.slice(1)}`; } From a08e8fb39800544eb157b6ea96c0898087a1c4d9 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 24 Dec 2024 16:57:55 +0530 Subject: [PATCH 082/183] refactor: migrate build-docs --- scripts/build-docs.ts | 113 ++++++++++++++++++------------ scripts/build-post-list.ts | 6 +- types/scripts/build-docs.ts | 12 ++++ types/scripts/build-posts-list.ts | 17 +++-- 4 files changed, 96 insertions(+), 52 deletions(-) create mode 100644 types/scripts/build-docs.ts diff --git a/scripts/build-docs.ts b/scripts/build-docs.ts index f63f4914709f..8acaf536f1ef 100644 --- a/scripts/build-docs.ts +++ b/scripts/build-docs.ts @@ -1,10 +1,14 @@ +import assert from 'assert'; import lodash from 'lodash'; +import type { NavTree, NavTreeItem, RecursiveChildren } from '@/types/scripts/build-docs'; +import type { Details, NavigationPage } from '@/types/scripts/build-posts-list'; + const { sortBy } = lodash; -function buildNavTree(navItems) { +function buildNavTree(navItems: Details[]) { try { - const tree = { + const tree: NavTree = { welcome: { item: { title: 'Welcome', @@ -15,7 +19,7 @@ function buildNavTree(navItems) { sectionWeight: 0, slug: '/docs' }, - children: {} + children: {} as RecursiveChildren } }; @@ -25,7 +29,7 @@ function buildNavTree(navItems) { sortedItems.forEach((item) => { // identify main sections if (item.isRootSection) { - tree[item.rootSectionId] = { item, children: {} }; + tree[item.rootSectionId!] = { item, children: {} }; } // identify subsections @@ -33,52 +37,68 @@ function buildNavTree(navItems) { if (!tree[item.parent]) { throw new Error(`Parent section ${item.parent} not found for item ${item.title}`); } - tree[item.parent].children[item.sectionId] = { item, children: [] }; + + (tree[item.parent].children as RecursiveChildren)[item.sectionId!] = { item, children: [] as Details[] }; } if (!item.isSection) { + const rootSectionChildren = tree[item.rootSectionId!].children as RecursiveChildren; + if (item.sectionId) { - const section = tree[item.rootSectionId]?.children[item.sectionId]; + const section = rootSectionChildren[item.sectionId]; if (!section) { - tree[item.rootSectionId].children[item.sectionId] = { + rootSectionChildren[item.sectionId] = { item, - children: [] + children: [] as Details[] }; } - tree[item.rootSectionId].children[item.sectionId].children.push(item); + (rootSectionChildren[item.sectionId].children! as Details[]).push(item); } else { - tree[item.rootSectionId].children[item.title] = { item }; + rootSectionChildren[item.title] = { item }; } } }); for (const [rootKey, rootValue] of Object.entries(tree)) { - const allChildren = rootValue.children; - const allChildrenKeys = Object.keys(allChildren); + const allChildren = rootValue.children as RecursiveChildren; + const allChildrenKeys = Object.keys(allChildren as RecursiveChildren); rootValue.children = allChildrenKeys .sort((prev, next) => { - return allChildren[prev].item.weight - allChildren[next].item.weight; + return allChildren[prev]!.item.weight! - allChildren[next]!.item.weight!; }) - .reduce((obj, key) => { - obj[key] = allChildren[key]; - - return obj; - }, {}); + .reduce( + ( + obj: { + [key: string]: NavTreeItem; + }, + key + ) => { + // eslint-disable-next-line no-param-reassign + obj[key] = allChildren[key]; + + return obj; + }, + {} + ); // handling subsections if (allChildrenKeys.length > 1) { for (const key of allChildrenKeys) { - if (allChildren[key].children) { - allChildren[key].children.sort((prev, next) => { - return prev.weight - next.weight; + const childrenOfAllChildren = allChildren[key].children as Details[]; + + // eslint-disable-next-line max-depth + if (childrenOfAllChildren) { + childrenOfAllChildren!.sort((prev, next) => { + return prev.weight! - next.weight!; }); } // point in slug for specification subgroup to the latest specification version + // eslint-disable-next-line max-depth if (rootKey === 'reference' && key === 'specification') { - allChildren[key].item.href = allChildren[key].children.find((c) => c.isPrerelease === undefined).slug; + allChildren[key].item.href = childrenOfAllChildren.find((c) => c.isPrerelease === undefined)!.slug; } } } @@ -86,15 +106,16 @@ function buildNavTree(navItems) { return tree; } catch (err) { + assert(err instanceof Error); throw new Error(`Failed to build navigation tree: ${err.message}`); } } // A recursion function, works on the logic of Depth First Search to traverse all the root and child posts of the // DocTree to get sequential order of the Doc Posts -const convertDocPosts = (docObject) => { +const convertDocPosts = (docObject: NavTree | Details) => { try { - let docsArray = []; + let docsArray: Details[] = []; // certain entries in the DocPosts are either a parent to many posts or itself a post. @@ -103,7 +124,7 @@ const convertDocPosts = (docObject) => { const { children } = docObject; Object.keys(children).forEach((child) => { - const docChildArray = convertDocPosts(children[child]); + const docChildArray = convertDocPosts(children[child] as Details); docsArray = [...docsArray, ...docChildArray]; }); @@ -111,13 +132,14 @@ const convertDocPosts = (docObject) => { return docsArray; } catch (err) { + assert(err instanceof Error); throw new Error('Error in convertDocPosts:', err); } }; -function addDocButtons(docPosts, treePosts) { - let structuredPosts = []; - const rootSections = []; +function addDocButtons(docPosts: Details[], treePosts: NavTree) { + let structuredPosts: Details[] = []; + const rootSections: string[] = []; try { // Traversing the whole DocTree and storing each post inside them in sequential order @@ -125,9 +147,10 @@ function addDocButtons(docPosts, treePosts) { structuredPosts.push(treePosts[rootElement].item); if (treePosts[rootElement].children) { const { children } = treePosts[rootElement]; + const childrenTyped = children as NavTree | Details; - Object.keys(children).forEach((child) => { - const docChildArray = convertDocPosts(children[child]); + Object.keys(childrenTyped).forEach((child) => { + const docChildArray = convertDocPosts(childrenTyped[child]); structuredPosts = [...structuredPosts, ...docChildArray]; }); @@ -135,7 +158,7 @@ function addDocButtons(docPosts, treePosts) { }); // Appending the content of welcome page of Docs from the posts.json - structuredPosts[0] = docPosts.filter((p) => p.slug === '/docs')[0]; + [structuredPosts[0]] = docPosts.filter((p) => p.slug === '/docs'); // Traversing the structuredPosts in order to add `nextPage` and `prevPage` details for each page const countDocPages = structuredPosts.length; @@ -143,15 +166,15 @@ function addDocButtons(docPosts, treePosts) { structuredPosts = structuredPosts.map((post, index) => { // post item specifying the root Section or sub-section in the docs are excluded as // they doesn't comprise any Doc Page or content to be shown in website. - if (post?.isRootSection || post?.isSection || index == 0) { - if (post?.isRootSection || index == 0) rootSections.push(post.title); + if (post?.isRootSection || post?.isSection || index === 0) { + if (post?.isRootSection || index === 0) rootSections.push(post.title); return post; } - let nextPage = {}; - let prevPage = {}; - let docPost = post; + let nextPage = {} as NavigationPage; + let prevPage = {} as NavigationPage; + let docPost = post as Details; // checks whether the next page for the current docPost item exists or not if (index + 1 < countDocPages) { @@ -168,6 +191,7 @@ function addDocButtons(docPosts, treePosts) { href: structuredPosts[index + 2].slug }; } + docPost = { ...docPost, nextPage }; } @@ -180,22 +204,21 @@ function addDocButtons(docPosts, treePosts) { title: structuredPosts[index - 1].title, href: structuredPosts[index - 1].slug }; - docPost = { ...docPost, prevPage }; - } else { + docPost = { ...docPost, prevPage } as Details; + } else if (index - 2 >= 0) { // additonal check for the first page of Docs so that it doesn't give any Segementation fault - if (index - 2 >= 0) { - prevPage = { - title: `${structuredPosts[index - 1]?.isRootSection ? rootSections[rootSections.length - 2] : rootSections[rootSections.length - 1]} - ${structuredPosts[index - 2].title}`, - href: structuredPosts[index - 2].slug - }; - docPost = { ...docPost, prevPage }; - } + prevPage = { + title: `${structuredPosts[index - 1]?.isRootSection ? rootSections[rootSections.length - 2] : rootSections[rootSections.length - 1]} - ${structuredPosts[index - 2].title}`, + href: structuredPosts[index - 2].slug + }; + docPost = { ...docPost, prevPage } as Details; } } return docPost; }); } catch (err) { + assert(err instanceof Error); throw new Error('An error occurred while adding doc buttons:', err); } diff --git a/scripts/build-post-list.ts b/scripts/build-post-list.ts index d4577786fd32..f466bebf30fe 100644 --- a/scripts/build-post-list.ts +++ b/scripts/build-post-list.ts @@ -9,7 +9,7 @@ import { basename, dirname, resolve } from 'path'; import readingTime from 'reading-time'; import { fileURLToPath } from 'url'; -import type { Details, Result, TableOfContentsItem } from '@/types/scripts/build-posts-list'; +import type { Details, Result } from '@/types/scripts/build-posts-list'; import { addDocButtons, buildNavTree } from './build-docs'; @@ -177,7 +177,9 @@ function walkDirectories( export async function buildPostList() { walkDirectories(postDirectories, finalResult); - const treePosts = buildNavTree(finalResult.docs.filter((p: TableOfContentsItem) => p.slug.startsWith('/docs/'))); + + const filteredResult = finalResult.docs.filter((p: Details) => p.slug!.startsWith('/docs/')); + const treePosts = buildNavTree(filteredResult); finalResult.docsTree = treePosts; finalResult.docs = addDocButtons(finalResult.docs, treePosts); diff --git a/types/scripts/build-docs.ts b/types/scripts/build-docs.ts new file mode 100644 index 000000000000..46f035524ae2 --- /dev/null +++ b/types/scripts/build-docs.ts @@ -0,0 +1,12 @@ +import type { Details } from './build-posts-list'; + +export type NavTreeItem = { + item: Details; + // eslint-disable-next-line no-use-before-define + children?: RecursiveChildren | Array
; +}; +export type RecursiveChildren = { [key: string]: NavTreeItem }; + +export type NavTree = { + [key: string]: NavTreeItem | Details; +}; diff --git a/types/scripts/build-posts-list.ts b/types/scripts/build-posts-list.ts index aa2565870ccf..2bb89b85bdbe 100644 --- a/types/scripts/build-posts-list.ts +++ b/types/scripts/build-posts-list.ts @@ -1,9 +1,14 @@ +import type { NavTree } from './build-docs'; + export interface TableOfContentsItem { content: string; slug: string; lvl: number; } - +export type NavigationPage = { + title: string; + href?: string; +}; export interface Details { title: string; isSection?: boolean; @@ -23,12 +28,14 @@ export interface Details { weight?: number; releaseNoteLink?: string; isPrerelease?: boolean; + nextPage?: NavigationPage; + prevPage?: NavigationPage; [key: string]: any; // For any additional properties } export interface Result { - docs: any[]; - blog: any[]; - about: any[]; - docsTree: Record; + docs: Details[]; + blog: Details[]; + about: Details[]; + docsTree: NavTree; } From 7007d2f5aaaaffbd206cfcb50c32982f14c2c5bf Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 24 Dec 2024 17:10:49 +0530 Subject: [PATCH 083/183] refactor: remove unused URL validation function from check-markdown.ts --- scripts/markdown/check-markdown.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/markdown/check-markdown.ts b/scripts/markdown/check-markdown.ts index ad6a6dc6a6d4..706a5533abb4 100644 --- a/scripts/markdown/check-markdown.ts +++ b/scripts/markdown/check-markdown.ts @@ -2,11 +2,6 @@ import fs from 'fs/promises'; import matter from 'gray-matter'; import path from 'path'; -/** - * Checks if a given string is a valid URL. - * @param {string} str - The string to validate as a URL. - * @returns {boolean} True if the string is a valid URL, false otherwise. - */ function isValidURL(str: string) { try { // eslint-disable-next-line no-new From 5bba79d2b62d49c74095c741176aafa584ceb9a5 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 26 Dec 2024 17:50:00 +0530 Subject: [PATCH 084/183] chore: update Jest configuration and dependencies for TypeScript support --- jest.config.cjs | 8 +- package-lock.json | 208 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 6 +- 3 files changed, 210 insertions(+), 12 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index 39211f19dc49..45416dd16122 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,4 +1,8 @@ module.exports = { + transform: { + '^.+\\.ts?$': 'ts-jest' + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], verbose: true, collectCoverage: true, coverageReporters: ['text', 'lcov', 'json-summary'], @@ -6,5 +10,5 @@ module.exports = { collectCoverageFrom: ['scripts/**/*.js'], coveragePathIgnorePatterns: ['scripts/compose.js'], // To disallow netlify edge function tests from running - testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], -}; \ No newline at end of file + testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'] +}; diff --git a/package-lock.json b/package-lock.json index 52991c72a4be..c97a2f7d7fd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,7 +79,6 @@ "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", "tsx": "^4.19.2", - "typescript": "^5.3.3", "yaml": "^2.3.4" }, "devDependencies": { @@ -96,6 +95,7 @@ "@storybook/test": "^8.2.4", "@types/fs-extra": "^11.0.4", "@types/inquirer": "^9.0.7", + "@types/jest": "^29.5.14", "@types/lodash": "^4.17.0", "@types/node": "^20", "@types/react": "^18.0.1", @@ -125,7 +125,9 @@ "remark-cli": "^12.0.1", "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", - "storybook": "^8.2.4" + "storybook": "^8.2.4", + "ts-jest": "^29.2.5", + "typescript": "^5.7.2" } }, "node_modules/@adobe/css-tools": { @@ -7594,6 +7596,48 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/jest": { + "version": "29.5.14", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.14.tgz", + "integrity": "sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==", + "dev": true, + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "node_modules/@types/jest/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@types/jest/node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/@types/js-yaml": { "version": "4.0.9", "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", @@ -8852,6 +8896,12 @@ "astring": "bin/astring" } }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -9623,6 +9673,18 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -11972,6 +12034,21 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.815", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.815.tgz", @@ -13934,6 +14011,27 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/filesize": { "version": "10.1.2", "resolved": "https://registry.npmjs.org/filesize/-/filesize-10.1.2.tgz", @@ -16607,6 +16705,46 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/jake": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", + "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", + "dev": true, + "dependencies": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jake/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/jake/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -18222,6 +18360,12 @@ "semver": "bin/semver.js" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -26699,9 +26843,9 @@ } }, "node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "bin": { "semver": "bin/semver.js" }, @@ -28718,6 +28862,54 @@ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" }, + "node_modules/ts-jest": { + "version": "29.2.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.5.tgz", + "integrity": "sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==", + "dev": true, + "dependencies": { + "bs-logger": "^0.2.6", + "ejs": "^3.1.10", + "fast-json-stable-stringify": "^2.1.0", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "^4.1.2", + "make-error": "^1.3.6", + "semver": "^7.6.3", + "yargs-parser": "^21.1.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/transform": "^29.0.0", + "@jest/types": "^29.0.0", + "babel-jest": "^29.0.0", + "jest": "^29.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/transform": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, "node_modules/ts-pnp": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", @@ -29341,9 +29533,9 @@ "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" }, "node_modules/typescript": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", - "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index ad3bc0e19a6f..a02a503bad2a 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,6 @@ "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", "tsx": "^4.19.2", - "typescript": "^5.3.3", "yaml": "^2.3.4" }, "devDependencies": { @@ -133,6 +132,7 @@ "@storybook/test": "^8.2.4", "@types/fs-extra": "^11.0.4", "@types/inquirer": "^9.0.7", + "@types/jest": "^29.5.14", "@types/lodash": "^4.17.0", "@types/node": "^20", "@types/react": "^18.0.1", @@ -162,6 +162,8 @@ "remark-cli": "^12.0.1", "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", - "storybook": "^8.2.4" + "storybook": "^8.2.4", + "ts-jest": "^29.2.5", + "typescript": "^5.7.2" } } From 84fa86cfc61934695ed47765f0cc7cae9c69f626 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 26 Dec 2024 18:02:06 +0530 Subject: [PATCH 085/183] chore: enable ES module support in Jest configuration --- jest.config.cjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jest.config.cjs b/jest.config.cjs index 45416dd16122..3f4e5310aee4 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -10,5 +10,12 @@ module.exports = { collectCoverageFrom: ['scripts/**/*.js'], coveragePathIgnorePatterns: ['scripts/compose.js'], // To disallow netlify edge function tests from running - testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'] + testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], + // Enable ES module support + extensionsToTreatAsEsm: ['.ts', '.tsx'], + globals: { + 'ts-jest': { + useESM: true + } + } }; From 7e49ca8d4abc1adf7fe88968ecc6ef72186c12a3 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 26 Dec 2024 18:12:39 +0530 Subject: [PATCH 086/183] chore: update Jest configuration for TypeScript file handling and coverage --- jest.config.cjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index 3f4e5310aee4..92836f6f34c7 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,14 +1,14 @@ module.exports = { transform: { - '^.+\\.ts?$': 'ts-jest' + '^.+\\.tsx?$': 'ts-jest' }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], verbose: true, collectCoverage: true, coverageReporters: ['text', 'lcov', 'json-summary'], coverageDirectory: 'coverage', - collectCoverageFrom: ['scripts/**/*.js'], - coveragePathIgnorePatterns: ['scripts/compose.js'], + collectCoverageFrom: ['scripts/**/*.ts'], + coveragePathIgnorePatterns: ['scripts/compose.ts'], // To disallow netlify edge function tests from running testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], // Enable ES module support From 4820f6a1df4c116706d2dbd2158335f102880d83 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 26 Dec 2024 19:45:30 +0530 Subject: [PATCH 087/183] chore: update Jest configuration to set test environment to Node --- jest.config.cjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jest.config.cjs b/jest.config.cjs index 92836f6f34c7..26c854b57cff 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,6 +1,7 @@ module.exports = { + testEnvironment: 'node', transform: { - '^.+\\.tsx?$': 'ts-jest' + "^.+.tsx?$": ["ts-jest",{}], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], verbose: true, From e1c67c50bb2d9f2f3f7e37159030b05f7e869946 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 26 Dec 2024 19:48:47 +0530 Subject: [PATCH 088/183] chore: enable ES module support in ts-jest transformer --- jest.config.cjs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index 26c854b57cff..d2d13c468f31 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,7 +1,7 @@ module.exports = { testEnvironment: 'node', transform: { - "^.+.tsx?$": ["ts-jest",{}], + "^.+.tsx?$": ["ts-jest",{useESM: true}], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], verbose: true, @@ -14,9 +14,4 @@ module.exports = { testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], // Enable ES module support extensionsToTreatAsEsm: ['.ts', '.tsx'], - globals: { - 'ts-jest': { - useESM: true - } - } }; From c93d5a1507ef206f160b25bbe34095a943a08a9b Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sat, 28 Dec 2024 09:28:55 +0000 Subject: [PATCH 089/183] refactor: update case studies import to default export and improve type imports --- scripts/casestudies/index.ts | 2 +- scripts/index.ts | 2 +- scripts/tools/combine-tools.ts | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/casestudies/index.ts b/scripts/casestudies/index.ts index 1db47f373e0c..073c2a4304a9 100644 --- a/scripts/casestudies/index.ts +++ b/scripts/casestudies/index.ts @@ -2,7 +2,7 @@ import { readdir, readFile, writeFile } from 'fs/promises'; import { convertToJson } from '../utils'; -export async function buildCaseStudiesList(dirWithCaseStudy: string, writeFilePath: string) { +export default async function buildCaseStudiesList(dirWithCaseStudy: string, writeFilePath: string) { try { const files = await readdir(dirWithCaseStudy); diff --git a/scripts/index.ts b/scripts/index.ts index f731287f2852..31d61f20eb71 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url'; import { buildAdoptersList } from './adopters/index'; import { buildPostList } from './build-post-list'; import { rssFeed } from './build-rss'; -import { buildCaseStudiesList } from './casestudies/index'; +import buildCaseStudiesList from './casestudies/index'; import { buildFinanceInfoList } from './finance/index'; const currentFilePath = fileURLToPath(import.meta.url); diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 9d2cefceeee2..c9ebe8046b58 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -5,9 +5,9 @@ import addFormats from 'ajv-formats'; import fs from 'fs'; import Fuse from 'fuse.js'; -import type { AsyncAPITool, LanguageColorItem, ToolsListObject } from '@/types/scripts/tools.js'; +import type { AsyncAPITool, LanguageColorItem, ToolsListObject } from '@/types/scripts/tools'; -import { categoryList } from './categorylist.js'; +import { categoryList } from './categorylist'; import { languagesColor, technologiesColor } from './tags-color'; import { createToolObject } from './tools-object'; import schema from './tools-schema.json'; @@ -43,7 +43,7 @@ let technologyFuse = new Fuse(technologyList, options); // takes individual tool object and inserts borderColor and backgroundColor of the tags of // languages and technologies, for Tool Card in website. -const getFinalTool = async (toolObject: AsyncAPITool) => { +async function getFinalTool(toolObject: AsyncAPITool) { const finalObject = toolObject; // there might be a tool without language @@ -69,7 +69,7 @@ const getFinalTool = async (toolObject: AsyncAPITool) => { languageFuse = new Fuse(languageList, options); } } else { - for (const language of toolObject.filters.language) { + for (const language of toolObject?.filters?.language ?? []) { const languageSearch = await languageFuse.search(language); if (languageSearch.length > 0) { @@ -94,7 +94,7 @@ const getFinalTool = async (toolObject: AsyncAPITool) => { const technologyArray = []; if (toolObject.filters.technology) { - for (const technology of toolObject.filters.technology) { + for (const technology of toolObject?.filters?.technology ?? []) { const technologySearch = await technologyFuse.search(technology); if (technologySearch.length > 0) { @@ -117,7 +117,7 @@ const getFinalTool = async (toolObject: AsyncAPITool) => { finalObject.filters.technology = technologyArray; return finalObject; -}; +} // Combine the automated tools and manual tools list into single JSON object file, and // lists down all the language and technology tags in one JSON file. From fb22081372a1af8aaa3fc2aa5ebb726bff5722d0 Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sat, 28 Dec 2024 09:36:28 +0000 Subject: [PATCH 090/183] refactor: update Jest configuration for improved TypeScript support --- jest.config.cjs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index d2d13c468f31..042b910544e8 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,9 +1,4 @@ module.exports = { - testEnvironment: 'node', - transform: { - "^.+.tsx?$": ["ts-jest",{useESM: true}], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], verbose: true, collectCoverage: true, coverageReporters: ['text', 'lcov', 'json-summary'], @@ -12,6 +7,9 @@ module.exports = { coveragePathIgnorePatterns: ['scripts/compose.ts'], // To disallow netlify edge function tests from running testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], - // Enable ES module support - extensionsToTreatAsEsm: ['.ts', '.tsx'], -}; + transform: { + "^.+\\.[tj]sx?$": ["ts-jest",{ + "tsconfig": "tsconfig.json" + }], + }, +}; \ No newline at end of file From 470cc185ef73231be7401b5bb3c939f5701db087 Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sat, 28 Dec 2024 10:18:55 +0000 Subject: [PATCH 091/183] refactor: change imports to default exports for consistency --- scripts/adopters/index.ts | 2 +- scripts/finance/index.ts | 4 ++-- scripts/index.ts | 2 +- scripts/utils/readAndWriteJson.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/adopters/index.ts b/scripts/adopters/index.ts index c7307049bf59..5f59b8c791e3 100644 --- a/scripts/adopters/index.ts +++ b/scripts/adopters/index.ts @@ -1,7 +1,7 @@ import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; -import { writeJSON } from '../utils/readAndWriteJson'; +import writeJSON from '../utils/readAndWriteJson'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index 2fddbf7f41ab..fdec87a2c466 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -2,7 +2,7 @@ import assert from 'assert'; import { mkdir } from 'fs/promises'; import { resolve } from 'path'; -import { writeJSON } from '../utils/readAndWriteJson'; +import writeJSON from '../utils/readAndWriteJson'; interface BuildFinanceInfoListProps { currentDir: string; @@ -12,7 +12,7 @@ interface BuildFinanceInfoListProps { jsonDataDir: string; } -export async function buildFinanceInfoList({ +export default async function buildFinanceInfoList({ currentDir, configDir, financeDir, diff --git a/scripts/index.ts b/scripts/index.ts index 31d61f20eb71..8379e2b61b3b 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -6,7 +6,7 @@ import { buildAdoptersList } from './adopters/index'; import { buildPostList } from './build-post-list'; import { rssFeed } from './build-rss'; import buildCaseStudiesList from './casestudies/index'; -import { buildFinanceInfoList } from './finance/index'; +import buildFinanceInfoList from './finance/index'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); diff --git a/scripts/utils/readAndWriteJson.ts b/scripts/utils/readAndWriteJson.ts index 6e5e65a17a5e..f8cdf3ea1778 100644 --- a/scripts/utils/readAndWriteJson.ts +++ b/scripts/utils/readAndWriteJson.ts @@ -2,7 +2,7 @@ import { readFile, writeFile } from 'fs/promises'; import { convertToJson } from '../utils'; -export async function writeJSON(readPath: string, writePath: string) { +export default async function writeJSON(readPath: string, writePath: string) { let readContent; let jsonContent; From 6e0ef28180d083f493ab560172b143e432f56958 Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sat, 28 Dec 2024 10:19:40 +0000 Subject: [PATCH 092/183] refactor: update test imports to remove file extensions for consistency --- tests/adopters/index.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/adopters/index.test.js b/tests/adopters/index.test.js index 8218a7f398f4..0664824f189d 100644 --- a/tests/adopters/index.test.js +++ b/tests/adopters/index.test.js @@ -1,8 +1,8 @@ const { resolve } = require('path'); -const writeJSON = require('../../scripts/utils/readAndWriteJson.js'); +const writeJSON = require('../../scripts/utils/readAndWriteJson'); const buildAdoptersList = require('../../scripts/adopters/index'); -jest.mock('../../scripts/utils/readAndWriteJson.js'); +jest.mock('../../scripts/utils/readAndWriteJson'); describe('buildAdoptersList', () => { From 7a3730d31098998f5ae7af17b16707507a4e2796 Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sat, 28 Dec 2024 12:30:54 +0000 Subject: [PATCH 093/183] refactor: simplify Jest transform configuration for TypeScript files --- jest.config.cjs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index 3ea5d667434a..30ae9cc0a965 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -8,11 +8,6 @@ module.exports = { // To disallow netlify edge function tests from running testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], transform: { - '^.+\\.[tj]sx?$': [ - 'ts-jest', - { - tsconfig: 'tsconfig.json' - } - ] + '^.+.tsx?$': ['ts-jest', {}] } }; From 7ef191aecd30a42520b3bf6ebdd3216b6ef2ddb0 Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sat, 28 Dec 2024 12:37:26 +0000 Subject: [PATCH 094/183] refactor: update dynamic import for manual tools and mock axios in tests --- scripts/build-tools.ts | 5 +++-- tests/tools/tools-object.test.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/build-tools.ts b/scripts/build-tools.ts index 72a0fa2b4af0..b5dff56dad83 100644 --- a/scripts/build-tools.ts +++ b/scripts/build-tools.ts @@ -17,8 +17,9 @@ const buildTools = async (automatedToolsPath: string, manualToolsPath: string, t await fs.writeFile(automatedToolsPath, JSON.stringify(automatedTools, null, ' ')); - // eslint-disable-next-line import/no-dynamic-require, global-require - await combineTools(automatedTools, require(manualToolsPath), toolsPath, tagsPath); + const manualTools = await import(manualToolsPath); + + await combineTools(automatedTools, manualTools, toolsPath, tagsPath); } catch (err) { assert(err instanceof Error); throw new Error(`An error occurred while building tools: ${err.message}`); diff --git a/tests/tools/tools-object.test.js b/tests/tools/tools-object.test.js index 2577a2a27d94..12f26cb62e6e 100644 --- a/tests/tools/tools-object.test.js +++ b/tests/tools/tools-object.test.js @@ -17,6 +17,7 @@ jest.mock('../../scripts/tools/categorylist', () => ({ describe('Tools Object', () => { beforeEach(() => { + axios.get = jest.fn(); axios.get.mockClear(); console.error = jest.fn(); }); From b3476a5406d5c9c4acefa4b1967ed5937a905494 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 29 Dec 2024 15:14:18 +0530 Subject: [PATCH 095/183] refactor: update path resolution to use fileURLToPath for better compatibility --- scripts/markdown/check-markdown.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/markdown/check-markdown.ts b/scripts/markdown/check-markdown.ts index 706a5533abb4..4a80afb4c7c5 100644 --- a/scripts/markdown/check-markdown.ts +++ b/scripts/markdown/check-markdown.ts @@ -1,6 +1,10 @@ import fs from 'fs/promises'; import matter from 'gray-matter'; -import path from 'path'; +import path, { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const currentFilePath = fileURLToPath(import.meta.url); +const currentDirPath = dirname(currentFilePath); function isValidURL(str: string) { try { @@ -135,8 +139,8 @@ async function checkMarkdownFiles( } } -const docsFolderPath = path.resolve(__dirname, '../../markdown/docs'); -const blogsFolderPath = path.resolve(__dirname, '../../markdown/blog'); +const docsFolderPath = path.resolve(currentDirPath, '../../markdown/docs'); +const blogsFolderPath = path.resolve(currentDirPath, '../../markdown/blog'); async function main() { try { @@ -151,7 +155,7 @@ async function main() { } /* istanbul ignore next */ -if (require.main === module) { +if (process.argv[1] === fileURLToPath(import.meta.url)) { main(); } From 9590dd1cb76d0916a732afb9b02cc8dc49c2a983 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 29 Dec 2024 15:31:02 +0530 Subject: [PATCH 096/183] refactor: update path resolution to use fileURLToPath for improved compatibility --- scripts/build-meetings.ts | 10 +++++++--- scripts/dashboard/build-dashboard.ts | 12 ++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index 30feba8a3dd7..8a0cd099529c 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -1,7 +1,11 @@ import assert from 'assert'; import { writeFileSync } from 'fs'; import { google } from 'googleapis'; -import { resolve } from 'path'; +import { dirname, resolve } from 'path'; +import { fileURLToPath } from 'url'; + +const currentFilePath = fileURLToPath(import.meta.url); +const currentDirPath = dirname(currentFilePath); async function buildMeetings(writePath: string) { let auth; @@ -66,8 +70,8 @@ async function buildMeetings(writePath: string) { } /* istanbul ignore next */ -if (require.main === module) { - buildMeetings(resolve(__dirname, '../config', 'meetings.json')); +if (process.argv[1] === fileURLToPath(import.meta.url)) { + buildMeetings(resolve(currentDirPath, '../config', 'meetings.json')); } export { buildMeetings }; diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index 70024b9333ea..fa2ef96d437f 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -1,7 +1,8 @@ import { graphql } from '@octokit/graphql'; import assert from 'assert'; -import { writeFile } from 'fs-extra'; -import { resolve } from 'path'; +import { writeFile } from 'fs/promises'; +import { dirname, resolve } from 'path'; +import { fileURLToPath } from 'url'; import type { Discussion, @@ -16,6 +17,9 @@ import type { import { Queries } from './issue-queries'; +const currentFilePath = fileURLToPath(import.meta.url); +const currentDirPath = dirname(currentFilePath); + async function pause(ms: number): Promise { return new Promise((res) => { setTimeout(res, ms); @@ -210,8 +214,8 @@ async function start(writePath: string): Promise { } /* istanbul ignore next */ -if (require.main === module) { - start(resolve(__dirname, '..', '..', 'dashboard.json')); +if (process.argv[1] === fileURLToPath(import.meta.url)) { + start(resolve(currentDirPath, '..', '..', 'dashboard.json')); } export { From d6b0e2a82ff07866a8f880ea84d9eebb5eb97763 Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sun, 29 Dec 2024 10:55:33 +0000 Subject: [PATCH 097/183] refactor: improve optional chaining usage and enhance tool validation logging --- scripts/tools/combine-tools.ts | 69 +++++++++++++++++----------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index c9ebe8046b58..201d126bba8c 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -69,7 +69,8 @@ async function getFinalTool(toolObject: AsyncAPITool) { languageFuse = new Fuse(languageList, options); } } else { - for (const language of toolObject?.filters?.language ?? []) { + // eslint-disable-next-line no-unsafe-optional-chaining + for (const language of toolObject?.filters?.language) { const languageSearch = await languageFuse.search(language); if (languageSearch.length > 0) { @@ -94,7 +95,8 @@ async function getFinalTool(toolObject: AsyncAPITool) { const technologyArray = []; if (toolObject.filters.technology) { - for (const technology of toolObject?.filters?.technology ?? []) { + // eslint-disable-next-line no-unsafe-optional-chaining + for (const technology of toolObject?.filters?.technology) { const technologySearch = await technologyFuse.search(technology); if (technologySearch.length > 0) { @@ -123,44 +125,43 @@ async function getFinalTool(toolObject: AsyncAPITool) { // lists down all the language and technology tags in one JSON file. const combineTools = async (automatedTools: any, manualTools: any, toolsPath: string, tagsPath: string) => { try { - // eslint-disable-next-line no-restricted-syntax + // eslint-disable-next-line no-restricted-syntax, guard-for-in for (const key in automatedTools) { - if (Object.prototype.hasOwnProperty.call(automatedTools, key)) { - const finalToolsList = []; + const finalToolsList = []; - if (automatedTools[key].toolsList.length) { - for (const tool of automatedTools[key].toolsList) { - finalToolsList.push(await getFinalTool(tool)); - } + if (automatedTools[key].toolsList.length) { + for (const tool of automatedTools[key].toolsList) { + finalToolsList.push(await getFinalTool(tool)); } - if (manualTools[key]?.toolsList?.length) { - for (const tool of manualTools[key].toolsList) { - let isAsyncAPIrepo; - const isValid = await validate(tool); - - if (isValid) { - if (tool?.links?.repoUrl) { - const url = new URL(tool.links.repoUrl); - - isAsyncAPIrepo = url.href.startsWith('https://github.com/asyncapi/'); - } else isAsyncAPIrepo = false; - const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); - - finalToolsList.push(await getFinalTool(toolObject)); - } else { - console.error({ - message: 'Tool validation failed', - tool: tool.title, - source: 'manual-tools.json', - errors: validate.errors, - note: 'Script continues execution, error logged for investigation' - }); - } + } + if (manualTools[key]?.toolsList?.length) { + for (const tool of manualTools[key].toolsList) { + let isAsyncAPIrepo; + const isValid = await validate(tool); + + if (isValid) { + if (tool?.links?.repoUrl) { + const url = new URL(tool.links.repoUrl); + + isAsyncAPIrepo = url.href.startsWith('https://github.com/asyncapi/'); + } else isAsyncAPIrepo = false; + const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); + + finalToolsList.push(await getFinalTool(toolObject)); + } else { + console.error({ + message: 'Tool validation failed', + tool: tool.title, + source: 'manual-tools.json', + errors: validate.errors, + note: 'Script continues execution, error logged for investigation' + }); } } - finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); - finalTools[key].toolsList = finalToolsList; } + finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); + console.log('finalToolsList', finalToolsList, '\n', 'key', key, '\n'); + finalTools[key].toolsList = finalToolsList; } fs.writeFileSync(toolsPath, JSON.stringify(finalTools)); fs.writeFileSync(tagsPath, JSON.stringify({ languages: languageList, technologies: technologyList })); From c0e918f929d0ddb34e919c72d941b3a8af4e3f15 Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sun, 29 Dec 2024 11:03:50 +0000 Subject: [PATCH 098/183] refactor: enable ESM support in ts-jest transform configuration --- jest.config.cjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jest.config.cjs b/jest.config.cjs index 30ae9cc0a965..ca545d591ef9 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -8,6 +8,11 @@ module.exports = { // To disallow netlify edge function tests from running testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], transform: { - '^.+.tsx?$': ['ts-jest', {}] + '^.+.tsx?$': [ + 'ts-jest', + { + useESM: true + } + ] } }; From d142cd0fc1fe1357cfbfffd25588671001db6a1f Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sun, 29 Dec 2024 11:16:55 +0000 Subject: [PATCH 099/183] refactor: update ts-jest configuration to use ESNext module in tsconfig --- jest.config.cjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jest.config.cjs b/jest.config.cjs index ca545d591ef9..61d3ff7e66b1 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -11,7 +11,10 @@ module.exports = { '^.+.tsx?$': [ 'ts-jest', { - useESM: true + useESM: true, + tsconfig: { + module: 'ESNext' + } } ] } From d15c741c88b1696648365caa1c5aec8a4610c33b Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sun, 29 Dec 2024 11:21:59 +0000 Subject: [PATCH 100/183] refactor: add support for ESM by updating Jest configuration and TypeScript target --- jest.config.cjs | 1 + tsconfig.json | 1 + 2 files changed, 2 insertions(+) diff --git a/jest.config.cjs b/jest.config.cjs index 61d3ff7e66b1..b9a4827164f1 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -7,6 +7,7 @@ module.exports = { coveragePathIgnorePatterns: ['scripts/compose.ts', 'scripts/tools/categorylist.ts', 'scripts/tools/tags-color.ts'], // To disallow netlify edge function tests from running testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], + extensionsToTreatAsEsm: ['.ts', '.tsx'], transform: { '^.+.tsx?$': [ 'ts-jest', diff --git a/tsconfig.json b/tsconfig.json index b73954042008..f8ecb4013c5f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,7 @@ "noEmit": true, "esModuleInterop": true, "module": "esnext", + "target": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, From 279237c7a60443683f1fbd9bd86a138cd7c21cac Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sun, 29 Dec 2024 11:24:39 +0000 Subject: [PATCH 101/183] refactor: enhance Jest configuration for ESM support and improve module resolution --- jest.config.cjs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index b9a4827164f1..b2ee93748582 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -5,18 +5,24 @@ module.exports = { coverageDirectory: 'coverage', collectCoverageFrom: ['scripts/**/*.ts'], coveragePathIgnorePatterns: ['scripts/compose.ts', 'scripts/tools/categorylist.ts', 'scripts/tools/tags-color.ts'], - // To disallow netlify edge function tests from running testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], - extensionsToTreatAsEsm: ['.ts', '.tsx'], transform: { - '^.+.tsx?$': [ + '^.+\\.tsx?$': [ 'ts-jest', { useESM: true, tsconfig: { - module: 'ESNext' + module: 'ESNext', + moduleResolution: 'node', + resolveJsonModule: true, + esModuleInterop: true } } - ] + ], + '^.+\\.json$': ['ts-jest', { useESM: true }] + }, + extensionsToTreatAsEsm: ['.ts', '.tsx'], + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1' } }; From 0b683375a5e9a181b4644742afdcc32f1665314e Mon Sep 17 00:00:00 2001 From: Zeel Rajodiya Date: Sun, 29 Dec 2024 11:28:20 +0000 Subject: [PATCH 102/183] refactor: update Jest configuration to use ES2022 module and target --- jest.config.cjs | 5 +++-- tsconfig.json | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index b2ee93748582..8a6a062c34e7 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -12,10 +12,11 @@ module.exports = { { useESM: true, tsconfig: { - module: 'ESNext', + module: 'ES2022', moduleResolution: 'node', resolveJsonModule: true, - esModuleInterop: true + esModuleInterop: true, + target: 'ES2024' } } ], diff --git a/tsconfig.json b/tsconfig.json index f8ecb4013c5f..01d5198c7ea0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,8 +6,8 @@ "strict": true, "noEmit": true, "esModuleInterop": true, - "module": "esnext", - "target": "esnext", + "module": "ES2022", + "target": "ES2024", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, From 76dee3244137bf3fd431540b11c1c91f5bf15432 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Mon, 30 Dec 2024 15:54:54 +0530 Subject: [PATCH 103/183] refactor: simplify JSON import in build-rss and remove debug log in combine-tools --- scripts/build-rss.ts | 2 +- scripts/tools/combine-tools.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/build-rss.ts b/scripts/build-rss.ts index d452075476e4..1de38eb419d2 100644 --- a/scripts/build-rss.ts +++ b/scripts/build-rss.ts @@ -5,7 +5,7 @@ import json2xml from 'jgexml/json2xml'; import type { BlogPostTypes, RSS, RSSItemType } from '@/types/scripts/build-rss'; async function getAllPosts() { - const posts = (await import('../config/posts.json', { assert: { type: 'json' } })).default; + const posts = (await import('../config/posts.json')).default; return posts; } diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 201d126bba8c..d8a79a50b23a 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -160,7 +160,6 @@ const combineTools = async (automatedTools: any, manualTools: any, toolsPath: st } } finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); - console.log('finalToolsList', finalToolsList, '\n', 'key', key, '\n'); finalTools[key].toolsList = finalToolsList; } fs.writeFileSync(toolsPath, JSON.stringify(finalTools)); From a2202160f5382437194beae236158694acdce4ad Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Mon, 30 Dec 2024 16:24:20 +0530 Subject: [PATCH 104/183] Revert "refactor: improve optional chaining usage and enhance tool validation logging" This reverts commit d6b0e2a82ff07866a8f880ea84d9eebb5eb97763. --- scripts/tools/combine-tools.ts | 68 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index d8a79a50b23a..c9ebe8046b58 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -69,8 +69,7 @@ async function getFinalTool(toolObject: AsyncAPITool) { languageFuse = new Fuse(languageList, options); } } else { - // eslint-disable-next-line no-unsafe-optional-chaining - for (const language of toolObject?.filters?.language) { + for (const language of toolObject?.filters?.language ?? []) { const languageSearch = await languageFuse.search(language); if (languageSearch.length > 0) { @@ -95,8 +94,7 @@ async function getFinalTool(toolObject: AsyncAPITool) { const technologyArray = []; if (toolObject.filters.technology) { - // eslint-disable-next-line no-unsafe-optional-chaining - for (const technology of toolObject?.filters?.technology) { + for (const technology of toolObject?.filters?.technology ?? []) { const technologySearch = await technologyFuse.search(technology); if (technologySearch.length > 0) { @@ -125,42 +123,44 @@ async function getFinalTool(toolObject: AsyncAPITool) { // lists down all the language and technology tags in one JSON file. const combineTools = async (automatedTools: any, manualTools: any, toolsPath: string, tagsPath: string) => { try { - // eslint-disable-next-line no-restricted-syntax, guard-for-in + // eslint-disable-next-line no-restricted-syntax for (const key in automatedTools) { - const finalToolsList = []; + if (Object.prototype.hasOwnProperty.call(automatedTools, key)) { + const finalToolsList = []; - if (automatedTools[key].toolsList.length) { - for (const tool of automatedTools[key].toolsList) { - finalToolsList.push(await getFinalTool(tool)); + if (automatedTools[key].toolsList.length) { + for (const tool of automatedTools[key].toolsList) { + finalToolsList.push(await getFinalTool(tool)); + } } - } - if (manualTools[key]?.toolsList?.length) { - for (const tool of manualTools[key].toolsList) { - let isAsyncAPIrepo; - const isValid = await validate(tool); - - if (isValid) { - if (tool?.links?.repoUrl) { - const url = new URL(tool.links.repoUrl); - - isAsyncAPIrepo = url.href.startsWith('https://github.com/asyncapi/'); - } else isAsyncAPIrepo = false; - const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); - - finalToolsList.push(await getFinalTool(toolObject)); - } else { - console.error({ - message: 'Tool validation failed', - tool: tool.title, - source: 'manual-tools.json', - errors: validate.errors, - note: 'Script continues execution, error logged for investigation' - }); + if (manualTools[key]?.toolsList?.length) { + for (const tool of manualTools[key].toolsList) { + let isAsyncAPIrepo; + const isValid = await validate(tool); + + if (isValid) { + if (tool?.links?.repoUrl) { + const url = new URL(tool.links.repoUrl); + + isAsyncAPIrepo = url.href.startsWith('https://github.com/asyncapi/'); + } else isAsyncAPIrepo = false; + const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); + + finalToolsList.push(await getFinalTool(toolObject)); + } else { + console.error({ + message: 'Tool validation failed', + tool: tool.title, + source: 'manual-tools.json', + errors: validate.errors, + note: 'Script continues execution, error logged for investigation' + }); + } } } + finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); + finalTools[key].toolsList = finalToolsList; } - finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); - finalTools[key].toolsList = finalToolsList; } fs.writeFileSync(toolsPath, JSON.stringify(finalTools)); fs.writeFileSync(tagsPath, JSON.stringify({ languages: languageList, technologies: technologyList })); From e97421874f2716872b10f104a1db05e20d4de680 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Mon, 30 Dec 2024 17:01:01 +0530 Subject: [PATCH 105/183] refactor: update type definitions for discussions and improve null handling --- scripts/dashboard/build-dashboard.ts | 6 +++--- types/scripts/dashboard.ts | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index fa2ef96d437f..80d6c18e06ad 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -43,10 +43,10 @@ function getLabel(issue: GoodFirstIssues, filter: string) { async function getDiscussions( query: string, pageSize: number, - endCursor = null -): Promise { + endCursor: null | string = null +): Promise { try { - const result: any = await graphql(query, { + const result: Discussion = await graphql(query, { first: pageSize, after: endCursor, headers: { diff --git a/types/scripts/dashboard.ts b/types/scripts/dashboard.ts index e2fbb12913eb..d71d953fef5a 100644 --- a/types/scripts/dashboard.ts +++ b/types/scripts/dashboard.ts @@ -7,7 +7,7 @@ interface RateLimit { interface PageInfo { hasNextPage: boolean; - endCursor?: string; + endCursor: string | null; } interface Reactions { @@ -138,11 +138,9 @@ export interface HotDiscussionsPullRequestsNode { comments: Comments; } export interface Discussion { - data: { - search: { - pageInfo: PageInfo; - nodes: HotDiscussionsPullRequestsNode[] | HotDiscussionsIssuesNode[] | GoodFirstIssues[]; - }; + search: { + pageInfo: PageInfo; + nodes: HotDiscussionsPullRequestsNode[]; }; rateLimit: RateLimit; } From 4215898c427f512a861634238fd4552be70136c3 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Mon, 30 Dec 2024 17:34:49 +0530 Subject: [PATCH 106/183] refactor: improve optional chaining for language filter in getFinalTool function --- scripts/tools/combine-tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index c9ebe8046b58..4f434bf91ceb 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -47,7 +47,7 @@ async function getFinalTool(toolObject: AsyncAPITool) { const finalObject = toolObject; // there might be a tool without language - if (toolObject.filters.language) { + if (toolObject.filters?.language) { const languageArray: LanguageColorItem[] = []; if (typeof toolObject.filters.language === 'string') { From 74a6afadc3e34bfa821fdf75b51f775783219ed6 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Mon, 30 Dec 2024 17:40:05 +0530 Subject: [PATCH 107/183] refactor: clean up code formatting and improve consistency across utility functions --- utils/getStatic.ts | 10 +++++----- utils/getUniqueCategories.ts | 21 ++++++++++++-------- utils/languageDetector.ts | 2 +- utils/redirect.ts | 37 ++++++++++++++++++------------------ utils/staticHelpers.ts | 4 ++-- 5 files changed, 40 insertions(+), 34 deletions(-) diff --git a/utils/getStatic.ts b/utils/getStatic.ts index c540f7d3c1fb..6ae14a76fddb 100644 --- a/utils/getStatic.ts +++ b/utils/getStatic.ts @@ -9,8 +9,8 @@ import i18nextConfig from '../next-i18next.config.cjs'; export const getI18nPaths = () => i18nextConfig.i18n.locales.map((lng) => ({ params: { - lang: lng, - }, + lang: lng + } })); /** @@ -19,7 +19,7 @@ export const getI18nPaths = () => */ export const getStaticPaths = () => ({ fallback: false, - paths: getI18nPaths(), + paths: getI18nPaths() }); /** @@ -31,7 +31,7 @@ export const getStaticPaths = () => ({ export async function getI18nProps(ctx: any, ns = ['common']) { const locale = ctx?.params?.lang ? ctx.params.lang : 'en'; const props = { - ...(await serverSideTranslations(locale, ns)), + ...(await serverSideTranslations(locale, ns)) }; return props; @@ -45,7 +45,7 @@ export async function getI18nProps(ctx: any, ns = ['common']) { export function makeStaticProps(ns = {}) { return async function getStaticProps(ctx: any) { return { - props: await getI18nProps(ctx, ns as any), + props: await getI18nProps(ctx, ns as any) }; }; } diff --git a/utils/getUniqueCategories.ts b/utils/getUniqueCategories.ts index d239ee12c478..0c75626ce980 100644 --- a/utils/getUniqueCategories.ts +++ b/utils/getUniqueCategories.ts @@ -7,13 +7,18 @@ import Expenses from '../config/finance/json-data/Expenses.json'; * @returns {string[]} An array of unique expense categories. */ export const getUniqueCategories = (): string[] => { - const allCategories: string[] = []; - for (const month in Expenses) { - Expenses[month as keyof typeof Expenses].forEach((entry: { Category: string }) => { - if (!allCategories.includes(entry.Category)) { - allCategories.push(entry.Category); - } - }); + const allCategories: string[] = []; + + // eslint-disable-next-line no-restricted-syntax + for (const month in Expenses) { + if (Object.prototype.hasOwnProperty.call(Expenses, month)) { + Expenses[month as keyof typeof Expenses].forEach((entry: { Category: string }) => { + if (!allCategories.includes(entry.Category)) { + allCategories.push(entry.Category); + } + }); } - return allCategories; + } + + return allCategories; }; diff --git a/utils/languageDetector.ts b/utils/languageDetector.ts index 3d4c810dafb2..425ffe880a4f 100644 --- a/utils/languageDetector.ts +++ b/utils/languageDetector.ts @@ -4,5 +4,5 @@ import i18nextConfig from '../next-i18next.config.cjs'; export default languageDetector({ supportedLngs: i18nextConfig.i18n.locales, - fallbackLng: i18nextConfig.i18n.defaultLocale, + fallbackLng: i18nextConfig.i18n.defaultLocale }); diff --git a/utils/redirect.ts b/utils/redirect.ts index d4419d0f6e22..06472bda8563 100644 --- a/utils/redirect.ts +++ b/utils/redirect.ts @@ -9,35 +9,36 @@ import languageDetector from './languageDetector'; * @returns null */ export function useRedirect(to: string | undefined): any { - const router = useRouter(); + const router = useRouter(); - const toUrl = to || router.asPath; + const toUrl = to || router.asPath; - // language detection - useEffect(() => { - const detectedLng = languageDetector.detect(); + // language detection + useEffect(() => { + const detectedLng = languageDetector.detect(); - if (toUrl.startsWith(`/${detectedLng}`) && router.route === '/404') { // prevent endless loop - router.replace(`/${detectedLng}${router.route}`); + if (toUrl.startsWith(`/${detectedLng}`) && router.route === '/404') { + // prevent endless loop + router.replace(`/${detectedLng}${router.route}`); - return; - } + return; + } - languageDetector.cache!(detectedLng!); - router.replace(`/${detectedLng}${toUrl}`); - }); + languageDetector.cache!(detectedLng!); + router.replace(`/${detectedLng}${toUrl}`); + }); - return null; -}; + return null; +} /** * Component that redirects the user to the current URL with a language prefix. * @returns null */ export const Redirect = () => { - useRedirect(undefined); + useRedirect(undefined); - return null; + return null; }; /** @@ -46,7 +47,7 @@ export const Redirect = () => { * @returns A component that redirects the user to the specified URL. */ export const getRedirect = (to: string) => () => { - useRedirect(to); + useRedirect(to); - return null; + return null; }; diff --git a/utils/staticHelpers.ts b/utils/staticHelpers.ts index ecc22f628472..8dc1c6196c39 100644 --- a/utils/staticHelpers.ts +++ b/utils/staticHelpers.ts @@ -169,8 +169,8 @@ export const generateCaseStudyContent = (data: any) => { ] }, { - title: "Production-use AsyncAPI document", - content: fullExample, + title: 'Production-use AsyncAPI document', + content: fullExample } ]; }; From 739005f29785b3a8f4cc707064235b6417f2cafc Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 13:13:48 +0530 Subject: [PATCH 108/183] refactor: change getData to an exported function and update TypeScript target version --- scripts/tools/extract-tools-github.ts | 6 ++---- tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index 56c5d6be1aa3..6ccda3149020 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -3,7 +3,7 @@ import dotenv from 'dotenv'; dotenv.config(); -const getData = async () => { +export async function getData(): Promise { // eslint-disable-next-line no-useless-catch try { const result = await axios.get('https://api.github.com/search/code?q=filename:.asyncapi-tool', { @@ -17,6 +17,4 @@ const getData = async () => { } catch (err) { throw err; } -}; - -export { getData }; +} diff --git a/tsconfig.json b/tsconfig.json index 01d5198c7ea0..2d156a6a71b9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "noEmit": true, "esModuleInterop": true, "module": "ES2022", - "target": "ES2024", + "target": "ES2022", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, From 3e903068113a907b0749deb3508751f50d8b418f Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 13:17:50 +0530 Subject: [PATCH 109/183] refactor: remove unused slugify function declaration from markdown-toc module --- types/packages/markdown-toc.d.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/packages/markdown-toc.d.ts b/types/packages/markdown-toc.d.ts index bd0d08adf879..6fcb1f5d6ae3 100644 --- a/types/packages/markdown-toc.d.ts +++ b/types/packages/markdown-toc.d.ts @@ -25,6 +25,3 @@ declare module 'markdown-toc' { export = toc; } -declare module 'markdown-toc/lib/utils' { - export function slugify(str: string, options?: Object): string; -} From 52888af62a7b889b48794db0be439455b6c968c1 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 13:23:33 +0530 Subject: [PATCH 110/183] refactor: update guid type in RSSItemType to include isPermaLink property --- types/scripts/build-rss.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/scripts/build-rss.ts b/types/scripts/build-rss.ts index 093992ed8e1d..ea2b8a2632ad 100644 --- a/types/scripts/build-rss.ts +++ b/types/scripts/build-rss.ts @@ -11,7 +11,10 @@ export type RSSItemType = { description: string; link: string; category: BlogPostTypes; - guid: any; + guid: { + '@isPermaLink': boolean; + '': string; + }; pubDate: string; enclosure: Enclosure; }; From 72dd6f63fbac466a803cf8952f0723f77d05c67b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 13:32:00 +0530 Subject: [PATCH 111/183] refactor: replace manual path joining with path.join for better compatibility --- scripts/casestudies/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/casestudies/index.ts b/scripts/casestudies/index.ts index 073c2a4304a9..170e42414e46 100644 --- a/scripts/casestudies/index.ts +++ b/scripts/casestudies/index.ts @@ -1,4 +1,5 @@ import { readdir, readFile, writeFile } from 'fs/promises'; +import { join } from 'path'; import { convertToJson } from '../utils'; @@ -9,7 +10,7 @@ export default async function buildCaseStudiesList(dirWithCaseStudy: string, wri // Process all files in parallel using Promise.all const caseStudiesList = await Promise.all( files.map(async (file) => { - const caseStudyFileName = [dirWithCaseStudy, file].join('/'); + const caseStudyFileName = join(dirWithCaseStudy, file); const caseStudyContent = await readFile(caseStudyFileName, 'utf-8'); return convertToJson(caseStudyContent); From 912f64b87750ab90df29e2b2d84eae1a5530a8f2 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 13:39:34 +0530 Subject: [PATCH 112/183] refactor: change parameter type of convertToJson function to unknown for better type safety --- scripts/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/utils.ts b/scripts/utils.ts index 17044631ec5c..9da0d06090fc 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -1,6 +1,6 @@ import yaml from 'yaml'; -function convertToJson(contentYAMLorJSON: string) { +function convertToJson(contentYAMLorJSON: unknown): any { // Axios handles conversion to JSON by default, if data returned from the server allows it // So if returned content is not a string (not YAML), we just return JSON back if (typeof contentYAMLorJSON !== 'string') { From d46470c75a71bc89efc673597d88e516e04c6726 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 13:40:38 +0530 Subject: [PATCH 113/183] refactor: add return type Promise to buildFinanceInfoList function for better clarity --- scripts/finance/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index fdec87a2c466..1867dd45ecc8 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -18,7 +18,7 @@ export default async function buildFinanceInfoList({ financeDir, year, jsonDataDir -}: BuildFinanceInfoListProps) { +}: BuildFinanceInfoListProps): Promise { try { const expensesPath = resolve(currentDir, configDir, financeDir, year, 'Expenses.yml'); const expensesLinkPath = resolve(currentDir, configDir, financeDir, year, 'ExpensesLink.yml'); From e2017c52ddb5e1908c47279aa30d2ac060bc06c6 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 14:32:54 +0530 Subject: [PATCH 114/183] refactor: use optional chaining for safer access to video properties in buildNewsroomVideos function --- scripts/build-newsroom-videos.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build-newsroom-videos.ts b/scripts/build-newsroom-videos.ts index 100afaa328fa..7272ecf8a308 100644 --- a/scripts/build-newsroom-videos.ts +++ b/scripts/build-newsroom-videos.ts @@ -43,10 +43,10 @@ async function buildNewsroomVideos(writePath: string) { } return { - image_url: video.snippet.thumbnails!.high!.url, + image_url: video.snippet.thumbnails?.high?.url, title: video.snippet.title, description: video.snippet.description, - videoId: video.id!.videoId + videoId: video.id?.videoId }; }); From d0f0ccd930e7bf0afa6eea8f31a41183a953983b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 14:51:43 +0530 Subject: [PATCH 115/183] refactor: simplify interfaces by introducing BasicIssueOrPR for shared properties --- types/scripts/dashboard.ts | 80 ++++++++++---------------------------- 1 file changed, 21 insertions(+), 59 deletions(-) diff --git a/types/scripts/dashboard.ts b/types/scripts/dashboard.ts index d71d953fef5a..d6e8545d34a6 100644 --- a/types/scripts/dashboard.ts +++ b/types/scripts/dashboard.ts @@ -53,86 +53,48 @@ interface Reviews { }[]; } +interface BasicIssueOrPR { + __typename: string; + id: string; + title: string; + author: Author; + assignees: Assignees; + resourcePath: string; + repository: Repository; + labels: { + nodes: Label[]; + }; +} + export interface PullRequestById { node: { - __typename: string; - assignees: Assignees; - timelineItems: TimelineItems; - author: Author; - id: string; - title: string; - resourcePath: string; - repository: Repository; reactions: Reactions; reviews: Reviews; + timelineItems: TimelineItems; comments: Comments; - labels: { - nodes: Label[]; - }; - }; + } & BasicIssueOrPR; } export interface IssueById { node: { - __typename: string; - assignees: Assignees; timelineItems: TimelineItems; - author: Author; - id: string; - repository: Repository; - labels: { - nodes: Label[]; - }; - title: string; - resourcePath: string; reactions: Reactions; comments: Comments; reviews: Reviews; - }; + } & BasicIssueOrPR; } -export interface GoodFirstIssues { - __typename: string; - assignees: Assignees; - author: Author; - id: string; - title: string; - resourcePath: string; - repository: Repository; - labels: { - nodes: Label[]; - }; -} +export interface GoodFirstIssues extends BasicIssueOrPR {} -export interface HotDiscussionsIssuesNode { - __typename: string; - assignees: Assignees; +export interface HotDiscussionsIssuesNode extends BasicIssueOrPR { timelineItems: TimelineItems; - author: Author; - id: string; - title: string; - resourcePath: string; - repository: Repository; - labels: { - nodes: Label[]; - }; reactions: Reactions; comments: Comments; reviews: Reviews; } -export interface HotDiscussionsPullRequestsNode { - __typename: string; - assignees: Assignees; +export interface HotDiscussionsPullRequestsNode extends BasicIssueOrPR { timelineItems: TimelineItems; - author: Author; - id: string; - title: string; - resourcePath: string; - repository: Repository; - labels: { - nodes: Label[]; - }; reactions: Reactions; reviews: Reviews; comments: Comments; @@ -147,10 +109,10 @@ export interface Discussion { export interface ProcessedDiscussion { id: string; - isPR: boolean; - isAssigned: boolean; title: string; author: string; + isPR: boolean; + isAssigned: boolean; resourcePath: string; repo: string; labels: Label[]; From 56c4b52a6306456d9a034160862b76e5c2ee3234 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 15:35:24 +0530 Subject: [PATCH 116/183] refactor: enhance MarkdownToken interface with optional properties for better flexibility --- types/packages/markdown-toc.d.ts | 21 ++++++++++++++++++++- types/scripts/build-posts-list.ts | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/types/packages/markdown-toc.d.ts b/types/packages/markdown-toc.d.ts index 6fcb1f5d6ae3..ec969c5c5535 100644 --- a/types/packages/markdown-toc.d.ts +++ b/types/packages/markdown-toc.d.ts @@ -8,11 +8,30 @@ declare module 'markdown-toc' { i: number; } + interface MarkdownToken { + type: string; + level: number; + + // Optional properties for headings + hLevel?: number; + + // Optional properties for inline content + content?: string; + lines?: [number, number][]; + + // Optional properties for nested tokens + children?: MarkdownToken[]; + + // Optional properties for inline tokens + lvl?: number; + i?: number; + seen?: number; + } interface TocResult { json: TocItem[]; content: string; highest: number; - tokens: any[]; + tokens: MarkdownToken[]; } interface TocOptions { diff --git a/types/scripts/build-posts-list.ts b/types/scripts/build-posts-list.ts index 2bb89b85bdbe..1da2a8b11e94 100644 --- a/types/scripts/build-posts-list.ts +++ b/types/scripts/build-posts-list.ts @@ -4,6 +4,7 @@ export interface TableOfContentsItem { content: string; slug: string; lvl: number; + i: number; } export type NavigationPage = { title: string; From b62f48bdfaf0537863c2f08dd4784e52d7f21a84 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 16:56:31 +0530 Subject: [PATCH 117/183] refactor: update tool handling by replacing dynamic import with JSON parsing and enhancing type definitions for better clarity and safety --- scripts/build-tools.ts | 2 +- scripts/tools/combine-tools.ts | 18 +++++--- types/scripts/tools.ts | 81 ++++++++++++++++++++++------------ 3 files changed, 68 insertions(+), 33 deletions(-) diff --git a/scripts/build-tools.ts b/scripts/build-tools.ts index b5dff56dad83..4b9dac3088a1 100644 --- a/scripts/build-tools.ts +++ b/scripts/build-tools.ts @@ -17,7 +17,7 @@ const buildTools = async (automatedToolsPath: string, manualToolsPath: string, t await fs.writeFile(automatedToolsPath, JSON.stringify(automatedTools, null, ' ')); - const manualTools = await import(manualToolsPath); + const manualTools = JSON.parse(await fs.readFile(manualToolsPath, 'utf-8')); await combineTools(automatedTools, manualTools, toolsPath, tagsPath); } catch (err) { diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 4f434bf91ceb..6f2ab53c2264 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -5,7 +5,7 @@ import addFormats from 'ajv-formats'; import fs from 'fs'; import Fuse from 'fuse.js'; -import type { AsyncAPITool, LanguageColorItem, ToolsListObject } from '@/types/scripts/tools'; +import type { AsyncAPITool, FinalAsyncAPITool, FinalToolsListObject, LanguageColorItem } from '@/types/scripts/tools'; import { categoryList } from './categorylist'; import { languagesColor, technologiesColor } from './tags-color'; @@ -17,7 +17,7 @@ const ajv = new Ajv(); addFormats(ajv, ['uri']); const validate = ajv.compile(schema); -const finalTools: ToolsListObject = {}; +const finalTools: FinalToolsListObject = {}; for (const category of categoryList) { finalTools[category.name] = { @@ -44,7 +44,15 @@ let technologyFuse = new Fuse(technologyList, options); // takes individual tool object and inserts borderColor and backgroundColor of the tags of // languages and technologies, for Tool Card in website. async function getFinalTool(toolObject: AsyncAPITool) { - const finalObject = toolObject; + const finalObject: FinalAsyncAPITool = { + ...toolObject, + filters: { + language: [], + technology: [], + categories: toolObject.filters.categories, + hasCommercial: toolObject.filters.hasCommercial + } + } as FinalAsyncAPITool; // there might be a tool without language if (toolObject.filters?.language) { @@ -78,7 +86,7 @@ async function getFinalTool(toolObject: AsyncAPITool) { // adds a new language object in the Fuse list as well as in tool object // so that it isn't missed out in the UI. const languageObject = { - name: language as string, + name: language, color: 'bg-[#57f281]', borderColor: 'border-[#37f069]' }; @@ -103,7 +111,7 @@ async function getFinalTool(toolObject: AsyncAPITool) { // adds a new technology object in the Fuse list as well as in tool object // so that it isn't missed out in the UI. const technologyObject = { - name: technology as string, + name: technology, color: 'bg-[#61d0f2]', borderColor: 'border-[#40ccf7]' }; diff --git a/types/scripts/tools.ts b/types/scripts/tools.ts index 969ae5763004..2985070d5ab5 100644 --- a/types/scripts/tools.ts +++ b/types/scripts/tools.ts @@ -24,6 +24,7 @@ type Category = | 'bundler' | 'ide-extension'; +// Base types export type CategoryListItem = { name: string; tag: string; @@ -36,41 +37,67 @@ export type LanguageColorItem = { borderColor: string; }; -interface Filters { - language?: Array; - technology?: Array; - categories: Array; // Categories are used to group tools by different use cases. - hasCommercial?: boolean; // Indicate if your tool is open source or commercial offering. +// Filter types +export interface Filters { + language?: Array; + technology?: Array; + categories: Array; + hasCommercial?: boolean; } -// Note: this definition is implemented from the schema located at scripts/tools/tools-schema.json -export interface AsyncAPITool { - title: string; // Human-readable name of the tool. - description?: string; // Custom description to override repository description. - links?: Links; // Links to website, documentation, and repository. - filters: Filters; // Filter properties. +// Instead of extending BaseFilters, create a separate interface +export interface FinalFilters { + language: LanguageColorItem[]; + technology: LanguageColorItem[]; + categories: Array; + hasCommercial: boolean; } +// Tool types +type BaseAsyncAPITool = { + title: string; + description?: string; + links?: Links; +}; + +export interface AsyncAPITool extends BaseAsyncAPITool { + filters: Filters; +} + +export interface FinalAsyncAPITool extends BaseAsyncAPITool { + description: string; // Make required in final + filters: FinalFilters; +} + +// Repository and tools data types +type Repository = { + full_name: string; + html_url: string; + owner: { + login: string; + }; + description: string; +}; + +type ToolItem = { + name: string; + url: string; + path: string; + html_url: string; + repository: Repository; +}; + export type ToolsData = { - items: { - name: string; - url: string; - path: string; - html_url: string; - repository: { - full_name: string; - html_url: string; - owner: { - login: string; - }; - description: string; - }; - }[]; + items: ToolItem[]; }; -export type ToolsListObject = { +// Tools list types +type ToolsList = { [key: string]: { description: string; - toolsList: AsyncAPITool[]; + toolsList: T[]; }; }; + +export type ToolsListObject = ToolsList; +export type FinalToolsListObject = ToolsList; From d939e079dcf1b723e927e71a07dca35ce7c14279 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 31 Dec 2024 17:25:44 +0530 Subject: [PATCH 118/183] test: update mock path for readAndWriteJson to include file extension --- tests/adopters/index.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/adopters/index.test.js b/tests/adopters/index.test.js index 0664824f189d..70353d4804af 100644 --- a/tests/adopters/index.test.js +++ b/tests/adopters/index.test.js @@ -2,7 +2,7 @@ const { resolve } = require('path'); const writeJSON = require('../../scripts/utils/readAndWriteJson'); const buildAdoptersList = require('../../scripts/adopters/index'); -jest.mock('../../scripts/utils/readAndWriteJson'); +jest.mock('../../scripts/utils/readAndWriteJson.ts'); describe('buildAdoptersList', () => { From e53390876bf63c75c258bd1e38e9e7fafbc1a99d Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 1 Jan 2025 16:40:17 +0530 Subject: [PATCH 119/183] refactor: simplify Jest configuration by removing unnecessary options and streamlining transform settings --- jest.config.cjs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index 8a6a062c34e7..83ebe7bd254b 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -7,23 +7,8 @@ module.exports = { coveragePathIgnorePatterns: ['scripts/compose.ts', 'scripts/tools/categorylist.ts', 'scripts/tools/tags-color.ts'], testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - useESM: true, - tsconfig: { - module: 'ES2022', - moduleResolution: 'node', - resolveJsonModule: true, - esModuleInterop: true, - target: 'ES2024' - } - } - ], + '^.+\\.tsx?$': ['ts-jest', {}], '^.+\\.json$': ['ts-jest', { useESM: true }] }, - extensionsToTreatAsEsm: ['.ts', '.tsx'], - moduleNameMapper: { - '^(\\.{1,2}/.*)\\.js$': '$1' - } + extensionsToTreatAsEsm: ['.ts', '.tsx'] }; From beb787ef2b5cef86d4ec7114e824102bc65f6a9c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 1 Jan 2025 22:19:17 +0530 Subject: [PATCH 120/183] refactor: update imports to use named exports for consistency and clarity --- scripts/adopters/index.ts | 2 +- scripts/build-rss.ts | 4 +--- scripts/casestudies/index.ts | 2 +- scripts/finance/index.ts | 4 ++-- scripts/index.ts | 4 ++-- scripts/utils/readAndWriteJson.ts | 2 +- tests/adopters/index.test.js | 2 +- tests/build-rss.test.js | 3 ++- tests/casestudies/index.test.js | 2 +- tests/finance/index.test.js | 2 +- tests/index.test.js | 6 +++--- tests/readAndWriteJson.test.js | 2 +- 12 files changed, 17 insertions(+), 18 deletions(-) diff --git a/scripts/adopters/index.ts b/scripts/adopters/index.ts index 5f59b8c791e3..c7307049bf59 100644 --- a/scripts/adopters/index.ts +++ b/scripts/adopters/index.ts @@ -1,7 +1,7 @@ import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; -import writeJSON from '../utils/readAndWriteJson'; +import { writeJSON } from '../utils/readAndWriteJson'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); diff --git a/scripts/build-rss.ts b/scripts/build-rss.ts index 1de38eb419d2..786fb4a169fd 100644 --- a/scripts/build-rss.ts +++ b/scripts/build-rss.ts @@ -1,4 +1,3 @@ -import assert from 'assert'; import fs from 'fs/promises'; import json2xml from 'jgexml/json2xml'; @@ -119,7 +118,6 @@ export async function rssFeed(type: BlogPostTypes, rssTitle: string, desc: strin await fs.writeFile(`./public/${outputPath}`, xml, 'utf8'); } catch (err) { - assert(err instanceof Error); - throw new Error(`Failed to generate RSS feed: ${err.message}`); + throw new Error(`Failed to generate RSS feed: ${(err as Error).message}`); } } diff --git a/scripts/casestudies/index.ts b/scripts/casestudies/index.ts index 170e42414e46..7f9abe489848 100644 --- a/scripts/casestudies/index.ts +++ b/scripts/casestudies/index.ts @@ -3,7 +3,7 @@ import { join } from 'path'; import { convertToJson } from '../utils'; -export default async function buildCaseStudiesList(dirWithCaseStudy: string, writeFilePath: string) { +export async function buildCaseStudiesList(dirWithCaseStudy: string, writeFilePath: string) { try { const files = await readdir(dirWithCaseStudy); diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index 1867dd45ecc8..652a510ea0fd 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -2,7 +2,7 @@ import assert from 'assert'; import { mkdir } from 'fs/promises'; import { resolve } from 'path'; -import writeJSON from '../utils/readAndWriteJson'; +import { writeJSON } from '../utils/readAndWriteJson'; interface BuildFinanceInfoListProps { currentDir: string; @@ -12,7 +12,7 @@ interface BuildFinanceInfoListProps { jsonDataDir: string; } -export default async function buildFinanceInfoList({ +export async function buildFinanceInfoList({ currentDir, configDir, financeDir, diff --git a/scripts/index.ts b/scripts/index.ts index 8379e2b61b3b..f731287f2852 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -5,8 +5,8 @@ import { fileURLToPath } from 'url'; import { buildAdoptersList } from './adopters/index'; import { buildPostList } from './build-post-list'; import { rssFeed } from './build-rss'; -import buildCaseStudiesList from './casestudies/index'; -import buildFinanceInfoList from './finance/index'; +import { buildCaseStudiesList } from './casestudies/index'; +import { buildFinanceInfoList } from './finance/index'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); diff --git a/scripts/utils/readAndWriteJson.ts b/scripts/utils/readAndWriteJson.ts index f8cdf3ea1778..6e5e65a17a5e 100644 --- a/scripts/utils/readAndWriteJson.ts +++ b/scripts/utils/readAndWriteJson.ts @@ -2,7 +2,7 @@ import { readFile, writeFile } from 'fs/promises'; import { convertToJson } from '../utils'; -export default async function writeJSON(readPath: string, writePath: string) { +export async function writeJSON(readPath: string, writePath: string) { let readContent; let jsonContent; diff --git a/tests/adopters/index.test.js b/tests/adopters/index.test.js index 70353d4804af..62282a36c7bd 100644 --- a/tests/adopters/index.test.js +++ b/tests/adopters/index.test.js @@ -1,5 +1,5 @@ const { resolve } = require('path'); -const writeJSON = require('../../scripts/utils/readAndWriteJson'); +const { writeJSON } = require('../../scripts/utils/readAndWriteJson'); const buildAdoptersList = require('../../scripts/adopters/index'); jest.mock('../../scripts/utils/readAndWriteJson.ts'); diff --git a/tests/build-rss.test.js b/tests/build-rss.test.js index 7961740fe5c6..b091756b618a 100644 --- a/tests/build-rss.test.js +++ b/tests/build-rss.test.js @@ -1,7 +1,8 @@ const fs = require('fs'); const path = require('path'); -const rssFeed = require('../scripts/build-rss'); const { XMLParser } = require('fast-xml-parser'); +const { rssFeed } = require('../scripts/build-rss'); + const parser = new XMLParser({ ignoreAttributes: false }); const { mockRssData, title, type, desc, missingDateMockData, incompletePostMockData } = require('./fixtures/rssData'); diff --git a/tests/casestudies/index.test.js b/tests/casestudies/index.test.js index 5e5455e3902e..84181ec27c91 100644 --- a/tests/casestudies/index.test.js +++ b/tests/casestudies/index.test.js @@ -1,6 +1,6 @@ const fs = require('fs').promises; const path = require('path'); -const buildCaseStudiesList = require('../../scripts/casestudies/index'); +const { buildCaseStudiesList } = require('../../scripts/casestudies/index'); const { yaml1,yaml2,json1,json2 } = require("../fixtures/caseStudyData"); describe('buildCaseStudiesList', () => { diff --git a/tests/finance/index.test.js b/tests/finance/index.test.js index eaea82e86c60..ecfca46454d8 100644 --- a/tests/finance/index.test.js +++ b/tests/finance/index.test.js @@ -1,6 +1,6 @@ const fs = require('fs'); const path = require('path'); -const buildFinanceInfoList = require('../../scripts/finance/index'); +const { buildFinanceInfoList } = require('../../scripts/finance/index'); const { expensesYaml, expensesLinkYaml, expensesjson, expensesLinkjson } = require('../fixtures/financeData'); describe('buildFinanceInfoList', () => { diff --git a/tests/index.test.js b/tests/index.test.js index f1d3850a37c5..256792c138e2 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -1,10 +1,10 @@ +const fs = require('fs'); const rssFeed = require('../scripts/build-rss'); const { buildPostList } = require('../scripts/build-post-list'); -const buildCaseStudiesList = require('../scripts/casestudies'); +const { buildCaseStudiesList } = require('../scripts/casestudies'); const buildAdoptersList = require('../scripts/adopters'); -const buildFinanceInfoList = require('../scripts/finance'); +const { buildFinanceInfoList } = require('../scripts/finance'); const start = require('../scripts/index'); -const fs = require('fs'); jest.mock('../scripts/build-rss'); jest.mock('../scripts/build-post-list'); diff --git a/tests/readAndWriteJson.test.js b/tests/readAndWriteJson.test.js index f201f7e9a280..80e5d5afa0cf 100644 --- a/tests/readAndWriteJson.test.js +++ b/tests/readAndWriteJson.test.js @@ -1,6 +1,6 @@ const { promises: fs } = require('fs'); const { convertToJson } = require('../scripts/utils'); -const writeJSON = require("../scripts/utils/readAndWriteJson"); +const { writeJSON } = require("../scripts/utils/readAndWriteJson"); const { yamlString, jsonObject } = require("./fixtures/utilsData"); jest.mock('fs', () => ({ From 1bb48b6d1b39fcf7c550589c58939005e5b81f9c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 1 Jan 2025 22:19:24 +0530 Subject: [PATCH 121/183] refactor: simplify Jest configuration by utilizing ts-jest preset and removing unnecessary transform settings --- jest.config.cjs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index 83ebe7bd254b..e4c96f43c773 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,14 +1,12 @@ +const { createJsWithTsEsmPreset } = require('ts-jest'); + module.exports = { + ...createJsWithTsEsmPreset(), verbose: true, collectCoverage: true, coverageReporters: ['text', 'lcov', 'json-summary'], coverageDirectory: 'coverage', collectCoverageFrom: ['scripts/**/*.ts'], coveragePathIgnorePatterns: ['scripts/compose.ts', 'scripts/tools/categorylist.ts', 'scripts/tools/tags-color.ts'], - testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], - transform: { - '^.+\\.tsx?$': ['ts-jest', {}], - '^.+\\.json$': ['ts-jest', { useESM: true }] - }, - extensionsToTreatAsEsm: ['.ts', '.tsx'] + testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'] }; From 31cf251da74f545f25c69053314490ae8b88cf41 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 1 Jan 2025 22:26:18 +0530 Subject: [PATCH 122/183] refactor: enhance type safety by casting imported JSON as 'any' in getAllPosts function --- scripts/build-rss.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-rss.ts b/scripts/build-rss.ts index 786fb4a169fd..816d34bf2cbc 100644 --- a/scripts/build-rss.ts +++ b/scripts/build-rss.ts @@ -4,7 +4,7 @@ import json2xml from 'jgexml/json2xml'; import type { BlogPostTypes, RSS, RSSItemType } from '@/types/scripts/build-rss'; async function getAllPosts() { - const posts = (await import('../config/posts.json')).default; + const posts = ((await import('../config/posts.json')) as any).default; return posts; } From 585aea224f89ef0ae786b78383489642395fcf59 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 1 Jan 2025 22:32:57 +0530 Subject: [PATCH 123/183] refactor: enhance Jest configuration by integrating ts-jest preset with ESM support for JSON transformation --- jest.config.cjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jest.config.cjs b/jest.config.cjs index e4c96f43c773..539bf8ad34d2 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,7 +1,12 @@ const { createJsWithTsEsmPreset } = require('ts-jest'); +const JsWithTsEsm = createJsWithTsEsmPreset(); module.exports = { - ...createJsWithTsEsmPreset(), + ...JsWithTsEsm, + transform: { + '^.+\\.json$': ['ts-jest', { useESM: true }], + ...JsWithTsEsm.transform + }, verbose: true, collectCoverage: true, coverageReporters: ['text', 'lcov', 'json-summary'], From ef0a30df32699cde2d40d56b82e1afdca6abffbf Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 1 Jan 2025 22:36:54 +0530 Subject: [PATCH 124/183] refactor: enhance Jest configuration by enabling JSON module resolution in ts-jest preset --- jest.config.cjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jest.config.cjs b/jest.config.cjs index 539bf8ad34d2..eebd97593db7 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,6 +1,10 @@ const { createJsWithTsEsmPreset } = require('ts-jest'); -const JsWithTsEsm = createJsWithTsEsmPreset(); +const JsWithTsEsm = createJsWithTsEsmPreset({ + tsconfig: { + resolveJsonModule: true + } +}); module.exports = { ...JsWithTsEsm, transform: { From ec823ddb83337ae4ff17be872de1d93c05e3906a Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 1 Jan 2025 22:53:02 +0530 Subject: [PATCH 125/183] refactor: simplify Jest configuration by removing JSON transform settings and adjusting transformIgnorePatterns --- jest.config.cjs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index eebd97593db7..da92c0553bc7 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,21 +1,14 @@ const { createJsWithTsEsmPreset } = require('ts-jest'); -const JsWithTsEsm = createJsWithTsEsmPreset({ - tsconfig: { - resolveJsonModule: true - } -}); +const JsWithTsEsm = createJsWithTsEsmPreset(); module.exports = { ...JsWithTsEsm, - transform: { - '^.+\\.json$': ['ts-jest', { useESM: true }], - ...JsWithTsEsm.transform - }, verbose: true, collectCoverage: true, coverageReporters: ['text', 'lcov', 'json-summary'], coverageDirectory: 'coverage', collectCoverageFrom: ['scripts/**/*.ts'], coveragePathIgnorePatterns: ['scripts/compose.ts', 'scripts/tools/categorylist.ts', 'scripts/tools/tags-color.ts'], - testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'] + testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], + transformIgnorePatterns: ['node_modules/', '\\.json$'] }; From 938f0cf746a27f2dfd80c85272d9ecec74a42196 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 2 Jan 2025 14:57:02 +0530 Subject: [PATCH 126/183] refactor: update Jest configuration to specify tsconfig for ts-jest preset --- jest.config.cjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jest.config.cjs b/jest.config.cjs index da92c0553bc7..6fbbe6b83e2e 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,6 +1,8 @@ const { createJsWithTsEsmPreset } = require('ts-jest'); -const JsWithTsEsm = createJsWithTsEsmPreset(); +const JsWithTsEsm = createJsWithTsEsmPreset({ + tsconfig: 'tsconfig.json' +}); module.exports = { ...JsWithTsEsm, verbose: true, From 676cee67efd7111691356057214e7e12d17bddee Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 2 Jan 2025 16:13:15 +0530 Subject: [PATCH 127/183] refactor: clean up test files by removing test directory after execution and updating fs module import --- tests/build-pages.test.js | 2 ++ tests/readAndWriteJson.test.js | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/build-pages.test.js b/tests/build-pages.test.js index f811b1480158..9600344f6575 100644 --- a/tests/build-pages.test.js +++ b/tests/build-pages.test.js @@ -52,6 +52,8 @@ describe('copyAndRenameFiles', () => { expect(fs.existsSync(NEW_TEST_DIR)).toBe(false); ensureDirectoryExists(NEW_TEST_DIR); expect(fs.existsSync(NEW_TEST_DIR)).toBe(true); + // delete the test directory after the test + fs.rmSync(NEW_TEST_DIR, { recursive: true, force: true }); }); }); \ No newline at end of file diff --git a/tests/readAndWriteJson.test.js b/tests/readAndWriteJson.test.js index 80e5d5afa0cf..dddaa2bd979e 100644 --- a/tests/readAndWriteJson.test.js +++ b/tests/readAndWriteJson.test.js @@ -1,13 +1,11 @@ -const { promises: fs } = require('fs'); +const fs = require('fs/promises'); const { convertToJson } = require('../scripts/utils'); const { writeJSON } = require("../scripts/utils/readAndWriteJson"); const { yamlString, jsonObject } = require("./fixtures/utilsData"); -jest.mock('fs', () => ({ - promises: { - readFile: jest.fn(), - writeFile: jest.fn(), - }, +jest.mock('fs/promises', () => ({ + readFile: jest.fn(), + writeFile: jest.fn(), })); jest.mock('../scripts/utils', () => ({ From 614edc3ec34f3ada33cb245d12872ba706d39922 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 2 Jan 2025 16:24:51 +0530 Subject: [PATCH 128/183] refactor: update import statement for pathExists from fs-extra to improve compatibility --- scripts/build-post-list.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-post-list.ts b/scripts/build-post-list.ts index 2d96b28945cd..bd85281526b9 100644 --- a/scripts/build-post-list.ts +++ b/scripts/build-post-list.ts @@ -3,7 +3,7 @@ import assert from 'assert'; import type { PathLike } from 'fs'; import { readdir, readFile, stat, writeFile } from 'fs/promises'; -import { pathExists } from 'fs-extra/esm'; +import { pathExists } from 'fs-extra'; import frontMatter from 'gray-matter'; import { markdownToTxt } from 'markdown-to-txt'; import toc from 'markdown-toc'; From 833a5dd7b9b4e734487951ad11b597a50efbc38f Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 2 Jan 2025 16:30:24 +0530 Subject: [PATCH 129/183] refactor: remove assert statements and export utility functions for better error handling and reusability --- scripts/build-post-list.ts | 8 +++----- scripts/dashboard/build-dashboard.ts | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/build-post-list.ts b/scripts/build-post-list.ts index bd85281526b9..1d44f19776d2 100644 --- a/scripts/build-post-list.ts +++ b/scripts/build-post-list.ts @@ -1,6 +1,5 @@ /* eslint-disable no-await-in-loop */ /* eslint-disable max-depth */ -import assert from 'assert'; import type { PathLike } from 'fs'; import { readdir, readFile, stat, writeFile } from 'fs/promises'; import { pathExists } from 'fs-extra'; @@ -27,7 +26,7 @@ const releaseNotes: (string | undefined)[] = []; // 2. const HEADING_ID_REGEX = /[\s]*(?:\{#([a-zA-Z0-9\-_]+)\}| { +export const addItem = (details: Details) => { if (!details || typeof details.slug !== 'string') { throw new Error('Invalid details object provided to addItem'); } @@ -215,7 +214,6 @@ export async function buildPostList( finalResult.docs = addDocButtons(finalResult.docs, treePosts); await writeFile(writeFilePath, JSON.stringify(finalResult, null, ' ')); } catch (error) { - assert(error instanceof Error); - throw new Error(`Error while building post list: ${error.message}`, { cause: error }); + throw new Error(`Error while building post list: ${(error as Error).message}`, { cause: error }); } } diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index 80d6c18e06ad..34d5e484ce74 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -1,5 +1,4 @@ import { graphql } from '@octokit/graphql'; -import assert from 'assert'; import { writeFile } from 'fs/promises'; import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; @@ -171,9 +170,8 @@ async function writeToFile( try { await writeFile(writePath, JSON.stringify(content, null, ' ')); } catch (error) { - assert(error instanceof Error); console.error('Failed to write dashboard data:', { - error: error.message, + error: (error as Error).message, writePath }); throw error; From 7ca813e7a004b8166616a88d5f364519f48eb18b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 2 Jan 2025 17:23:57 +0530 Subject: [PATCH 130/183] feat: add TypeScript declaration for JSON module to improve type safety --- types/packages/json.d.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 types/packages/json.d.ts diff --git a/types/packages/json.d.ts b/types/packages/json.d.ts new file mode 100644 index 000000000000..2c290013c994 --- /dev/null +++ b/types/packages/json.d.ts @@ -0,0 +1,5 @@ +declare module '*.json' { + const value: any; + + export default value; +} From 5cdf0a5cfa7a81bc3d985de7ea8399623e515206 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 2 Jan 2025 18:40:54 +0530 Subject: [PATCH 131/183] feat: add Babel configuration and TypeScript presets for improved compatibility --- babel.config.cjs | 4 + jest.config.cjs => jest.config.js | 17 +- package-lock.json | 368 ++++++++++++------------------ package.json | 2 + tests/adopters/index.test.js | 2 +- tests/index.test.js | 6 +- 6 files changed, 161 insertions(+), 238 deletions(-) create mode 100644 babel.config.cjs rename jest.config.cjs => jest.config.js (55%) diff --git a/babel.config.cjs b/babel.config.cjs new file mode 100644 index 000000000000..e4fd99b81497 --- /dev/null +++ b/babel.config.cjs @@ -0,0 +1,4 @@ +module.exports = { + presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'], + plugins: ['babel-plugin-transform-import-meta'] +}; diff --git a/jest.config.cjs b/jest.config.js similarity index 55% rename from jest.config.cjs rename to jest.config.js index 6fbbe6b83e2e..066acf3033cc 100644 --- a/jest.config.cjs +++ b/jest.config.js @@ -1,10 +1,10 @@ -const { createJsWithTsEsmPreset } = require('ts-jest'); +// import { createJsWithTsEsmPreset } from 'ts-jest'; -const JsWithTsEsm = createJsWithTsEsmPreset({ - tsconfig: 'tsconfig.json' -}); -module.exports = { - ...JsWithTsEsm, +// const JsWithTsEsm = createJsWithTsEsmPreset({ +// tsconfig: 'tsconfig.json' +// }); +const config = { + // ...JsWithTsEsm, verbose: true, collectCoverage: true, coverageReporters: ['text', 'lcov', 'json-summary'], @@ -12,5 +12,8 @@ module.exports = { collectCoverageFrom: ['scripts/**/*.ts'], coveragePathIgnorePatterns: ['scripts/compose.ts', 'scripts/tools/categorylist.ts', 'scripts/tools/tags-color.ts'], testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], - transformIgnorePatterns: ['node_modules/', '\\.json$'] + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + roots: [''] }; + +export default config; diff --git a/package-lock.json b/package-lock.json index c97a2f7d7fd3..b37a01f48451 100644 --- a/package-lock.json +++ b/package-lock.json @@ -82,6 +82,7 @@ "yaml": "^2.3.4" }, "devDependencies": { + "@babel/preset-typescript": "^7.26.0", "@chromatic-com/storybook": "^1.6.1", "@netlify/functions": "^2.6.0", "@netlify/plugin-nextjs": "^4.41.3", @@ -105,6 +106,7 @@ "@types/react-youtube-embed": "^1.0.4", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", + "babel-plugin-transform-import-meta": "^2.2.1", "dedent": "^1.5.1", "eslint": "^8", "eslint-config-airbnb-typescript": "^17.1.0", @@ -333,11 +335,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", - "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dependencies": { - "@babel/highlight": "^7.24.7", + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", "picocolors": "^1.0.0" }, "engines": { @@ -390,25 +393,26 @@ } }, "node_modules/@babel/generator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.7.tgz", - "integrity": "sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA==", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.3.tgz", + "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", "dependencies": { - "@babel/types": "^7.24.7", + "@babel/parser": "^7.26.3", + "@babel/types": "^7.26.3", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", - "jsesc": "^2.5.1" + "jsesc": "^3.0.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz", - "integrity": "sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz", + "integrity": "sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==", "dependencies": { - "@babel/types": "^7.24.7" + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -450,18 +454,16 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.7.tgz", - "integrity": "sha512-kTkaDl7c9vO80zeX1rJxnuRpEsD5tA81yh11X1gQo+PhSti3JS+7qeZo9U4RHobKRiFPKaGK3svUAeb8D0Q7eg==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-environment-visitor": "^7.24.7", - "@babel/helper-function-name": "^7.24.7", - "@babel/helper-member-expression-to-functions": "^7.24.7", - "@babel/helper-optimise-call-expression": "^7.24.7", - "@babel/helper-replace-supers": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/helper-split-export-declaration": "^7.24.7", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.9.tgz", + "integrity": "sha512-UTZQMvt0d/rSz6KI+qdu7GQze5TIajwTS++GUozlw8VBJDEOAqSXwm1WvmYEZwqdqSGQshRocPDqrt4HBZB3fQ==", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/traverse": "^7.25.9", "semver": "^6.3.1" }, "engines": { @@ -553,39 +555,37 @@ } }, "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.7.tgz", - "integrity": "sha512-LGeMaf5JN4hAT471eJdBs/GK1DoYIJ5GCtZN/EsL6KUiiDZOvO/eKE11AMZJa2zP4zk4qe9V2O/hxAmkRc8p6w==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz", + "integrity": "sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==", "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", - "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.24.7.tgz", - "integrity": "sha512-1fuJEwIrp+97rM4RWdO+qrRsZlAeL1lQJoPqtCYWv0NL115XM93hIH4CSRln2w52SqvmY5hqdtauB6QFCDiZNQ==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "dependencies": { - "@babel/helper-environment-visitor": "^7.24.7", - "@babel/helper-module-imports": "^7.24.7", - "@babel/helper-simple-access": "^7.24.7", - "@babel/helper-split-export-declaration": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -595,20 +595,20 @@ } }, "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.24.7.tgz", - "integrity": "sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.25.9.tgz", + "integrity": "sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==", "dependencies": { - "@babel/types": "^7.24.7" + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", - "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", + "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", "engines": { "node": ">=6.9.0" } @@ -630,13 +630,13 @@ } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.24.7.tgz", - "integrity": "sha512-qTAxxBM81VEyoAY0TtLrx1oAEJc09ZK67Q9ljQToqCnA+55eNwCORaxlKyu+rNfX86o8OXRUSNUnrtsAZXM9sg==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.25.9.tgz", + "integrity": "sha512-IiDqTOTBQy0sWyeXyGSC5TBJpGFXBkRynjBeXsvbhQFKj2viwJC76Epz35YLU1fpe/Am6Vppb7W7zM4fPQzLsQ==", "dependencies": { - "@babel/helper-environment-visitor": "^7.24.7", - "@babel/helper-member-expression-to-functions": "^7.24.7", - "@babel/helper-optimise-call-expression": "^7.24.7" + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -645,25 +645,13 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/helper-simple-access": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", - "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", - "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz", - "integrity": "sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.25.9.tgz", + "integrity": "sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==", "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -681,25 +669,25 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz", - "integrity": "sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.7.tgz", - "integrity": "sha512-yy1/KvjhV/ZCL+SM7hBrvnZJ3ZuT9OuZgIJAGpPEToANvc3iM6iDvBnRjtElWibHU6n8/LPR/EjX9EtIEYO3pw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "engines": { "node": ">=6.9.0" } @@ -730,88 +718,13 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/highlight": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", - "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", - "dependencies": { - "@babel/helper-validator-identifier": "^7.24.7", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "node_modules/@babel/parser": { + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", + "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", "dependencies": { - "has-flag": "^3.0.0" + "@babel/types": "^7.26.3" }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", - "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", "bin": { "parser": "bin/babel-parser.js" }, @@ -1025,11 +938,11 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz", - "integrity": "sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz", + "integrity": "sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1133,11 +1046,11 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz", - "integrity": "sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz", + "integrity": "sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1511,13 +1424,12 @@ } }, "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.7.tgz", - "integrity": "sha512-iFI8GDxtevHJ/Z22J5xQpVqFLlMNstcLXh994xifFwxxGslr2ZXXLWgtBeLctOD63UFDArdvN6Tg8RFw+aEmjQ==", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.26.3.tgz", + "integrity": "sha512-MgR55l4q9KddUDITEzEFYn5ZsGDXMSsU9E+kh7fjRXTIC3RHqfCo8RPRbyReYJh44HQ/yomFkqbOFohXvDCiIQ==", "dependencies": { - "@babel/helper-module-transforms": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-simple-access": "^7.24.7" + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1935,14 +1847,15 @@ } }, "node_modules/@babel/plugin-transform-typescript": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.24.7.tgz", - "integrity": "sha512-iLD3UNkgx2n/HrjBesVbYX6j0yqn/sJktvbtKKgcaLIQ4bTTQ8obAypc1VpyHPD2y4Phh9zHOaAt8e/L14wCpw==", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.26.3.tgz", + "integrity": "sha512-6+5hpdr6mETwSKjmJUdYw0EIkATiQhnELWlE3kJFBwSg/BGIVwVaVbX+gOXBCdc7Ln1RXZxyWGecIXhUfnl7oA==", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-typescript": "^7.24.7" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/plugin-syntax-typescript": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -2162,15 +2075,15 @@ } }, "node_modules/@babel/preset-typescript": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.24.7.tgz", - "integrity": "sha512-SyXRe3OdWwIwalxDg5UtJnJQO+YPcTfwiIY2B0Xlddh9o7jpWLvv8X1RthIeDOxQ+O1ML5BLPCONToObyVQVuQ==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.26.0.tgz", + "integrity": "sha512-NMk1IGZ5I/oHhoXEElcm+xUnL/szL6xflkFZmoEU9xj1qSJXpiS7rsspYo92B4DRCDvZn2erT5LdsCeXAKNCkg==", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-validator-option": "^7.24.7", - "@babel/plugin-syntax-jsx": "^7.24.7", - "@babel/plugin-transform-modules-commonjs": "^7.24.7", - "@babel/plugin-transform-typescript": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "@babel/plugin-syntax-jsx": "^7.25.9", + "@babel/plugin-transform-modules-commonjs": "^7.25.9", + "@babel/plugin-transform-typescript": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -2339,31 +2252,28 @@ } }, "node_modules/@babel/template": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", - "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/parser": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.7.tgz", - "integrity": "sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA==", - "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.24.7", - "@babel/helper-environment-visitor": "^7.24.7", - "@babel/helper-function-name": "^7.24.7", - "@babel/helper-hoist-variables": "^7.24.7", - "@babel/helper-split-export-declaration": "^7.24.7", - "@babel/parser": "^7.24.7", - "@babel/types": "^7.24.7", + "version": "7.26.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", + "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.3", + "@babel/parser": "^7.26.3", + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.3", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -2372,13 +2282,12 @@ } }, "node_modules/@babel/types": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", - "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", + "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", "dependencies": { - "@babel/helper-string-parser": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -9263,6 +9172,19 @@ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", "integrity": "sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==" }, + "node_modules/babel-plugin-transform-import-meta": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-import-meta/-/babel-plugin-transform-import-meta-2.2.1.tgz", + "integrity": "sha512-AxNh27Pcg8Kt112RGa3Vod2QS2YXKKJ6+nSvRtv7qQTJAdx0MZa4UHZ4lnxHUWA2MNbLuZQv5FVab4P1CoLOWw==", + "dev": true, + "dependencies": { + "@babel/template": "^7.4.4", + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@babel/core": "^7.10.0" + } + }, "node_modules/babel-preset-current-node-syntax": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", @@ -17765,14 +17687,14 @@ } }, "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "bin": { "jsesc": "bin/jsesc" }, "engines": { - "node": ">=4" + "node": ">=6" } }, "node_modules/json-bigint": { @@ -28752,14 +28674,6 @@ "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "engines": { - "node": ">=4" - } - }, "node_modules/to-object-path": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", diff --git a/package.json b/package.json index a02a503bad2a..52a71e53ce32 100644 --- a/package.json +++ b/package.json @@ -119,6 +119,7 @@ "yaml": "^2.3.4" }, "devDependencies": { + "@babel/preset-typescript": "^7.26.0", "@chromatic-com/storybook": "^1.6.1", "@netlify/functions": "^2.6.0", "@netlify/plugin-nextjs": "^4.41.3", @@ -142,6 +143,7 @@ "@types/react-youtube-embed": "^1.0.4", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", + "babel-plugin-transform-import-meta": "^2.2.1", "dedent": "^1.5.1", "eslint": "^8", "eslint-config-airbnb-typescript": "^17.1.0", diff --git a/tests/adopters/index.test.js b/tests/adopters/index.test.js index 62282a36c7bd..eb788b137368 100644 --- a/tests/adopters/index.test.js +++ b/tests/adopters/index.test.js @@ -1,6 +1,6 @@ const { resolve } = require('path'); const { writeJSON } = require('../../scripts/utils/readAndWriteJson'); -const buildAdoptersList = require('../../scripts/adopters/index'); +const { buildAdoptersList } = require('../../scripts/adopters/index'); jest.mock('../../scripts/utils/readAndWriteJson.ts'); diff --git a/tests/index.test.js b/tests/index.test.js index 256792c138e2..936d10d141e7 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -1,10 +1,10 @@ const fs = require('fs'); -const rssFeed = require('../scripts/build-rss'); +const { rssFeed } = require('../scripts/build-rss'); const { buildPostList } = require('../scripts/build-post-list'); const { buildCaseStudiesList } = require('../scripts/casestudies'); -const buildAdoptersList = require('../scripts/adopters'); +const { buildAdoptersList } = require('../scripts/adopters'); const { buildFinanceInfoList } = require('../scripts/finance'); -const start = require('../scripts/index'); +const { start } = require('../scripts/index'); jest.mock('../scripts/build-rss'); jest.mock('../scripts/build-post-list'); From b50129081a0c6467a248664fbab151427b708a3b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 2 Jan 2025 18:58:10 +0530 Subject: [PATCH 132/183] refactor: remove assert statements and improve error handling in build scripts --- scripts/build-meetings.ts | 3 +-- scripts/build-tools.ts | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index 8a0cd099529c..5d6842246eff 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -64,8 +64,7 @@ async function buildMeetings(writePath: string) { writeFileSync(writePath, eventsForHuman); } catch (err) { - assert(err instanceof Error); - throw new Error(`Failed to fetch or process events: ${err.message}`); + throw new Error(`Failed to fetch or process events: ${(err as Error).message}`); } } diff --git a/scripts/build-tools.ts b/scripts/build-tools.ts index 4b9dac3088a1..647afefc08df 100644 --- a/scripts/build-tools.ts +++ b/scripts/build-tools.ts @@ -1,4 +1,3 @@ -import assert from 'assert'; import fs from 'fs-extra'; import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; @@ -21,14 +20,13 @@ const buildTools = async (automatedToolsPath: string, manualToolsPath: string, t await combineTools(automatedTools, manualTools, toolsPath, tagsPath); } catch (err) { - assert(err instanceof Error); - throw new Error(`An error occurred while building tools: ${err.message}`); + throw new Error(`An error occurred while building tools: ${(err as Error).message}`); } }; /* istanbul ignore next */ if (process.argv[1] === fileURLToPath(import.meta.url)) { - const automatedToolsPath = resolve(currentDirPath, '../config', 'tools-automated.json'); + const automatedToolsPath = resolve(currentDirPath, '../config', 'too ls-automated.json'); const manualToolsPath = resolve(currentDirPath, '../config', 'tools-manual.json'); const toolsPath = resolve(currentDirPath, '../config', 'tools.json'); const tagsPath = resolve(currentDirPath, '../config', 'all-tags.json'); From dd0f128c9d610e2830d0bca2e278eaf56cb3363b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 2 Jan 2025 20:03:51 +0530 Subject: [PATCH 133/183] feat: replace Google APIs client with node-fetch for YouTube data retrieval and improve error handling --- scripts/build-newsroom-videos.ts | 56 +++++++++++++------------------- types/packages/node-fetch-2.d.ts | 3 ++ 2 files changed, 25 insertions(+), 34 deletions(-) create mode 100644 types/packages/node-fetch-2.d.ts diff --git a/scripts/build-newsroom-videos.ts b/scripts/build-newsroom-videos.ts index 7272ecf8a308..54622d7fcfc1 100644 --- a/scripts/build-newsroom-videos.ts +++ b/scripts/build-newsroom-videos.ts @@ -1,7 +1,6 @@ -import assert from 'assert'; import { writeFileSync } from 'fs'; import type { youtube_v3 } from 'googleapis'; -import { google } from 'googleapis'; +import fetch from 'node-fetch-2'; import { dirname, resolve } from 'path'; import process from 'process'; import { fileURLToPath } from 'url'; @@ -9,46 +8,36 @@ import { fileURLToPath } from 'url'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); -const youtube = google.youtube({ - version: 'v3', - auth: process.env.YOUTUBE_TOKEN -}); - async function buildNewsroomVideos(writePath: string) { try { - const response = await youtube.search.list({ - part: ['snippet'], - channelId: 'UCIz9zGwDLbrYQcDKVXdOstQ', - eventType: 'completed', - type: ['video'], - order: 'date', - maxResults: 5 - } as youtube_v3.Params$Resource$Search$List); - - if (response.status !== 200) { + const response = await fetch( + `https://youtube.googleapis.com/youtube/v3/search?${new URLSearchParams({ + key: process.env.YOUTUBE_TOKEN!, + part: 'snippet', + channelId: 'UCIz9zGwDLbrYQcDKVXdOstQ', + eventType: 'completed', + type: 'video', + order: 'Date', + maxResults: '5' + })}` + ); + + if (!response.ok) { throw new Error(`HTTP error! with status code: ${response.status}`); } - const data = await response.data; - - console.log(data); + const data = await response.json(); if (!data.items || !Array.isArray(data.items)) { throw new Error('Invalid data structure received from YouTube API'); } - const videoDataItems = data.items.map((video) => { - if (!video.snippet) { - throw new Error('Invalid data structure received from YouTube API'); - } - - return { - image_url: video.snippet.thumbnails?.high?.url, - title: video.snippet.title, - description: video.snippet.description, - videoId: video.id?.videoId - }; - }); + const videoDataItems = data.items.map((video: youtube_v3.Schema$SearchResult) => ({ + image_url: video.snippet?.thumbnails?.high?.url, + title: video.snippet?.title, + description: video.snippet?.description, + videoId: video.id?.videoId + })); const videoData = JSON.stringify(videoDataItems, null, ' '); @@ -58,8 +47,7 @@ async function buildNewsroomVideos(writePath: string) { return videoData; } catch (err) { - assert(err instanceof Error); - throw new Error(`Failed to build newsroom videos: ${err.message}`); + throw new Error(`Failed to build newsroom videos: ${(err as Error).message}`); } } diff --git a/types/packages/node-fetch-2.d.ts b/types/packages/node-fetch-2.d.ts new file mode 100644 index 000000000000..b0222239a633 --- /dev/null +++ b/types/packages/node-fetch-2.d.ts @@ -0,0 +1,3 @@ +declare module 'node-fetch-2' { + export default function fetch(url: string, options?: RequestInit): Promise; +} From fb27678f0dff88e09538abc2645a19abc7b29aba Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 2 Jan 2025 20:53:37 +0530 Subject: [PATCH 134/183] feat: update Jest and Babel configuration for TypeScript support and improve test script transformation --- jest.config.js | 9 +++---- .../babel.test.config.cjs | 2 ++ tsconfig.json | 24 +++++++++++++++---- 3 files changed, 24 insertions(+), 11 deletions(-) rename babel.config.cjs => tests/babel.test.config.cjs (65%) diff --git a/jest.config.js b/jest.config.js index 066acf3033cc..c4d8f41bdfb2 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,10 +1,7 @@ -// import { createJsWithTsEsmPreset } from 'ts-jest'; - -// const JsWithTsEsm = createJsWithTsEsmPreset({ -// tsconfig: 'tsconfig.json' -// }); const config = { - // ...JsWithTsEsm, + transform: { + '^.+\\.[t|j]sx?$': ['babel-jest', { configFile: './tests/babel.test.config.cjs' }] + }, verbose: true, collectCoverage: true, coverageReporters: ['text', 'lcov', 'json-summary'], diff --git a/babel.config.cjs b/tests/babel.test.config.cjs similarity index 65% rename from babel.config.cjs rename to tests/babel.test.config.cjs index e4fd99b81497..1372e1c5149f 100644 --- a/babel.config.cjs +++ b/tests/babel.test.config.cjs @@ -1,3 +1,5 @@ +// This babel config is to transform the scripts to typescript before running the tests. + module.exports = { presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'], plugins: ['babel-plugin-transform-import-meta'] diff --git a/tsconfig.json b/tsconfig.json index 2d156a6a71b9..25b72e6eed61 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,16 @@ { "compilerOptions": { - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, "noEmit": true, "esModuleInterop": true, - "module": "ES2022", + "module": "esnext", "target": "ES2022", "moduleResolution": "bundler", "resolveJsonModule": true, @@ -14,11 +18,21 @@ "jsx": "preserve", "incremental": true, "paths": { - "@/*": ["./*"] + "@/*": [ + "./*" + ] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.json"], - "exclude": ["node_modules", "netlify"], + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + "**/*.json" + ], + "exclude": [ + "node_modules", + "netlify" + ], "ts-node": { "experimentalSpecifierResolution": "node", "transpileOnly": true From cf6cf4f6fd8f5ee13f2d9dd51203af7325900940 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 3 Jan 2025 14:30:21 +0530 Subject: [PATCH 135/183] fix: correct filename for automated tools configuration in build script --- scripts/build-tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-tools.ts b/scripts/build-tools.ts index 647afefc08df..d1b10d75945b 100644 --- a/scripts/build-tools.ts +++ b/scripts/build-tools.ts @@ -26,7 +26,7 @@ const buildTools = async (automatedToolsPath: string, manualToolsPath: string, t /* istanbul ignore next */ if (process.argv[1] === fileURLToPath(import.meta.url)) { - const automatedToolsPath = resolve(currentDirPath, '../config', 'too ls-automated.json'); + const automatedToolsPath = resolve(currentDirPath, '../config', 'tools-automated.json'); const manualToolsPath = resolve(currentDirPath, '../config', 'tools-manual.json'); const toolsPath = resolve(currentDirPath, '../config', 'tools.json'); const tagsPath = resolve(currentDirPath, '../config', 'all-tags.json'); From 791ee89a87742d482681c6d62bc46e0d38f2d712 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 3 Jan 2025 14:53:37 +0530 Subject: [PATCH 136/183] chore: remove ts-jest from package.json and package-lock.json --- package-lock.json | 149 ---------------------------------------------- package.json | 1 - 2 files changed, 150 deletions(-) diff --git a/package-lock.json b/package-lock.json index b37a01f48451..ad7b175f4de7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -128,7 +128,6 @@ "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", "storybook": "^8.2.4", - "ts-jest": "^29.2.5", "typescript": "^5.7.2" } }, @@ -8805,12 +8804,6 @@ "astring": "bin/astring" } }, - "node_modules/async": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", - "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", - "dev": true - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -9595,18 +9588,6 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, - "node_modules/bs-logger": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "dev": true, - "dependencies": { - "fast-json-stable-stringify": "2.x" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -11956,21 +11937,6 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, - "node_modules/ejs": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", - "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", - "dev": true, - "dependencies": { - "jake": "^10.8.5" - }, - "bin": { - "ejs": "bin/cli.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/electron-to-chromium": { "version": "1.4.815", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.815.tgz", @@ -13933,27 +13899,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/filelist": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", - "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", - "dev": true, - "dependencies": { - "minimatch": "^5.0.1" - } - }, - "node_modules/filelist/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/filesize": { "version": "10.1.2", "resolved": "https://registry.npmjs.org/filesize/-/filesize-10.1.2.tgz", @@ -16627,46 +16572,6 @@ "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/jake": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", - "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", - "dev": true, - "dependencies": { - "async": "^3.2.3", - "chalk": "^4.0.2", - "filelist": "^1.0.4", - "minimatch": "^3.1.2" - }, - "bin": { - "jake": "bin/cli.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jake/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/jake/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -18282,12 +18187,6 @@ "semver": "bin/semver.js" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -28776,54 +28675,6 @@ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" }, - "node_modules/ts-jest": { - "version": "29.2.5", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.5.tgz", - "integrity": "sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==", - "dev": true, - "dependencies": { - "bs-logger": "^0.2.6", - "ejs": "^3.1.10", - "fast-json-stable-stringify": "^2.1.0", - "jest-util": "^29.0.0", - "json5": "^2.2.3", - "lodash.memoize": "^4.1.2", - "make-error": "^1.3.6", - "semver": "^7.6.3", - "yargs-parser": "^21.1.1" - }, - "bin": { - "ts-jest": "cli.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" - }, - "peerDependencies": { - "@babel/core": ">=7.0.0-beta.0 <8", - "@jest/transform": "^29.0.0", - "@jest/types": "^29.0.0", - "babel-jest": "^29.0.0", - "jest": "^29.0.0", - "typescript": ">=4.3 <6" - }, - "peerDependenciesMeta": { - "@babel/core": { - "optional": true - }, - "@jest/transform": { - "optional": true - }, - "@jest/types": { - "optional": true - }, - "babel-jest": { - "optional": true - }, - "esbuild": { - "optional": true - } - } - }, "node_modules/ts-pnp": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", diff --git a/package.json b/package.json index 52a71e53ce32..f1cd8014e4c0 100644 --- a/package.json +++ b/package.json @@ -165,7 +165,6 @@ "remark-lint": "^10.0.0", "remark-mdx": "^3.0.1", "storybook": "^8.2.4", - "ts-jest": "^29.2.5", "typescript": "^5.7.2" } } From 9fe2983ce3c5548f02f85bdd9676d44e93382b26 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 3 Jan 2025 17:39:00 +0530 Subject: [PATCH 137/183] refactor: replace assert statements with error handling in scripts --- scripts/build-docs.ts | 14 +++++++------- scripts/build-meetings.ts | 8 +++++--- scripts/finance/index.ts | 8 +++++--- scripts/tools/tools-object.ts | 8 +++++--- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/scripts/build-docs.ts b/scripts/build-docs.ts index 8acaf536f1ef..c5b66ebaf2db 100644 --- a/scripts/build-docs.ts +++ b/scripts/build-docs.ts @@ -1,4 +1,3 @@ -import assert from 'assert'; import lodash from 'lodash'; import type { NavTree, NavTreeItem, RecursiveChildren } from '@/types/scripts/build-docs'; @@ -106,8 +105,11 @@ function buildNavTree(navItems: Details[]) { return tree; } catch (err) { - assert(err instanceof Error); - throw new Error(`Failed to build navigation tree: ${err.message}`); + if (err instanceof Error) { + throw new Error(`Failed to build navigation tree: ${err.message}`); + } else { + throw new Error(`Failed to build navigation tree: ${err}`); + } } } @@ -132,8 +134,7 @@ const convertDocPosts = (docObject: NavTree | Details) => { return docsArray; } catch (err) { - assert(err instanceof Error); - throw new Error('Error in convertDocPosts:', err); + throw new Error('Error in convertDocPosts:', err as Error); } }; @@ -218,8 +219,7 @@ function addDocButtons(docPosts: Details[], treePosts: NavTree) { return docPost; }); } catch (err) { - assert(err instanceof Error); - throw new Error('An error occurred while adding doc buttons:', err); + throw new Error('An error occurred while adding doc buttons:', err as Error); } return structuredPosts; diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index 5d6842246eff..acb01ca71ed7 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -1,4 +1,3 @@ -import assert from 'assert'; import { writeFileSync } from 'fs'; import { google } from 'googleapis'; import { dirname, resolve } from 'path'; @@ -19,8 +18,11 @@ async function buildMeetings(writePath: string) { calendar = google.calendar({ version: 'v3', auth }); } catch (err) { - assert(err instanceof Error); - throw new Error(`Authentication failed: ${err.message}`); + if (err instanceof Error) { + throw new Error(`Authentication failed: ${err.message}`); + } else { + throw new Error(`Authentication failed: ${err}`); + } } let eventsItems; diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index 652a510ea0fd..1f1230d79e02 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -1,4 +1,3 @@ -import assert from 'assert'; import { mkdir } from 'fs/promises'; import { resolve } from 'path'; @@ -37,7 +36,10 @@ export async function buildFinanceInfoList({ await writeJSON(expensesLinkPath, expensesLinkJsonPath); } catch (err) { - assert(err instanceof Error); - throw new Error(err.message); + if (err instanceof Error) { + throw new Error(`Error in buildFinanceInfoList: ${err.message}`); + } else { + throw new Error(`Error in buildFinanceInfoList: ${err}`); + } } } diff --git a/scripts/tools/tools-object.ts b/scripts/tools/tools-object.ts index 8a2efac31c25..f48765c7634a 100644 --- a/scripts/tools/tools-object.ts +++ b/scripts/tools/tools-object.ts @@ -1,6 +1,5 @@ import Ajv from 'ajv'; import addFormats from 'ajv-formats'; -import assert from 'assert'; import axios from 'axios'; import Fuse from 'fuse.js'; @@ -127,8 +126,11 @@ async function convertTools(data: ToolsData) { return finalToolsObject; } catch (err) { - assert(err instanceof Error); - throw new Error(`Error processing tool: ${err.message}`); + if (err instanceof Error) { + throw new Error(`Error processing tool: ${err.message}`); + } else { + throw new Error(`Error processing tool: ${err}`); + } } } From 0c3d8520691eee51b05413f66e9e705bc302277b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 4 Jan 2025 13:38:00 +0530 Subject: [PATCH 138/183] ci: replace npm install with npm ci for dependency installation in workflow --- .github/workflows/if-nodejs-pr-testing.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 07aebbc07bd7..d5489e7ab8f2 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -67,9 +67,8 @@ jobs: uses: actions/setup-node@v4 with: node-version: '${{ steps.nodeversion.outputs.version }}' - - if: steps.packagejson.outputs.exists == 'true' - name: Install dependencies - run: npm install + - name: Install dependencies + run: npm ci - if: steps.packagejson.outputs.exists == 'true' name: Test run: npm test --if-present From 2abe64b81616a63b507ec7c8507352efa5779c36 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 4 Jan 2025 14:08:50 +0530 Subject: [PATCH 139/183] feat: add JSDoc comments for improved documentation across various scripts --- .eslintrc | 3 +- scripts/adopters/index.ts | 4 ++ scripts/build-docs.ts | 24 ++++++++++- scripts/build-meetings.ts | 6 +++ scripts/build-newsroom-videos.ts | 7 ++++ scripts/build-pages.ts | 18 +++++++- scripts/build-post-list.ts | 60 +++++++++++++++++++++++++++ scripts/build-rss.ts | 20 +++++++++ scripts/build-tools.ts | 13 +++++- scripts/casestudies/index.ts | 6 +++ scripts/compose.ts | 13 +++++- scripts/dashboard/build-dashboard.ts | 57 +++++++++++++++++++++++++ scripts/finance/index.ts | 10 +++++ scripts/index.ts | 5 +++ scripts/markdown/check-markdown.ts | 21 ++++++++++ scripts/tools/combine-tools.ts | 22 +++++++--- scripts/tools/extract-tools-github.ts | 6 +++ scripts/tools/tools-object.ts | 33 +++++++++++---- scripts/utils.ts | 8 ++++ scripts/utils/readAndWriteJson.ts | 7 ++++ 20 files changed, 321 insertions(+), 22 deletions(-) diff --git a/.eslintrc b/.eslintrc index cb6d2cb8a0dd..a6efca3eae9d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -317,8 +317,7 @@ "files": ["scripts/**/*"], "rules": { "import/no-extraneous-dependencies": "off", - "no-console": "off", - "require-jsdoc":"off" + "no-console": "off" } } ] diff --git a/scripts/adopters/index.ts b/scripts/adopters/index.ts index c7307049bf59..07f7bb7ebca5 100644 --- a/scripts/adopters/index.ts +++ b/scripts/adopters/index.ts @@ -6,6 +6,10 @@ import { writeJSON } from '../utils/readAndWriteJson'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); +/** + * Builds the adopters list by converting a YAML file to JSON and writing it to a specified path. + * @returns {Promise} + */ export async function buildAdoptersList() { writeJSON('config/adopters.yml', resolve(currentDirPath, '../../config', 'adopters.json')); } diff --git a/scripts/build-docs.ts b/scripts/build-docs.ts index c5b66ebaf2db..5891e527b5e0 100644 --- a/scripts/build-docs.ts +++ b/scripts/build-docs.ts @@ -5,6 +5,13 @@ import type { Details, NavigationPage } from '@/types/scripts/build-posts-list'; const { sortBy } = lodash; +/** + * Builds a navigation tree from the given navigation items. + * + * @param {Details[]} navItems - The navigation items to build the tree from. + * @returns {NavTree} - The built navigation tree. + * @throws {Error} - Throws an error if there is an issue during the tree building process. + */ function buildNavTree(navItems: Details[]) { try { const tree: NavTree = { @@ -113,8 +120,13 @@ function buildNavTree(navItems: Details[]) { } } -// A recursion function, works on the logic of Depth First Search to traverse all the root and child posts of the -// DocTree to get sequential order of the Doc Posts +/** + * Recursively converts document posts to a sequential array. + * + * @param {NavTree | Details} docObject - The document object to convert. + * @returns {Details[]} - The sequential array of document posts. + * @throws {Error} - Throws an error if there is an issue during the conversion process. + */ const convertDocPosts = (docObject: NavTree | Details) => { try { let docsArray: Details[] = []; @@ -138,6 +150,14 @@ const convertDocPosts = (docObject: NavTree | Details) => { } }; +/** + * Adds navigation buttons to the document posts. + * + * @param {Details[]} docPosts - The document posts to add buttons to. + * @param {NavTree} treePosts - The navigation tree of the document posts. + * @returns {Details[]} - The document posts with added navigation buttons. + * @throws {Error} - Throws an error if there is an issue during the button adding process. + */ function addDocButtons(docPosts: Details[], treePosts: NavTree) { let structuredPosts: Details[] = []; const rootSections: string[] = []; diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index acb01ca71ed7..4be72627008b 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -6,6 +6,12 @@ import { fileURLToPath } from 'url'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); +/** + * Fetches upcoming meetings from Google Calendar and writes the data to a specified path. + * + * @param {string} writePath - The path to write the meeting data. + * @throws {Error} - Throws an error if there is an issue during the fetch or write process. + */ async function buildMeetings(writePath: string) { let auth; let calendar; diff --git a/scripts/build-newsroom-videos.ts b/scripts/build-newsroom-videos.ts index 54622d7fcfc1..2fb907f3d67f 100644 --- a/scripts/build-newsroom-videos.ts +++ b/scripts/build-newsroom-videos.ts @@ -8,6 +8,13 @@ import { fileURLToPath } from 'url'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); +/** + * Fetches the latest YouTube videos from the AsyncAPI channel and writes the data to a specified path. + * + * @param {string} writePath - The path to write the video data. + * @returns {Promise} - A promise that resolves to the video data in JSON format. + * @throws {Error} - Throws an error if there is an issue during the fetch or write process. + */ async function buildNewsroomVideos(writePath: string) { try { const response = await fetch( diff --git a/scripts/build-pages.ts b/scripts/build-pages.ts index 8e1617120f5a..7fa7567c5df1 100644 --- a/scripts/build-pages.ts +++ b/scripts/build-pages.ts @@ -7,7 +7,11 @@ const TARGET_DIR = 'pages'; const capitalizeTags = ['table', 'tr', 'td', 'th', 'thead', 'tbody']; -// Check if target directory doesn't exist then create it +/** + * Ensures that the specified directory exists. If it doesn't, creates it. + * + * @param {PathLike} directory - The directory path to check or create. + */ export function ensureDirectoryExists(directory: PathLike) { if (!fs.existsSync(directory)) { fs.mkdirSync(directory, { recursive: true }); @@ -15,6 +19,12 @@ export function ensureDirectoryExists(directory: PathLike) { } ensureDirectoryExists(TARGET_DIR); +/** + * Capitalizes JSX tags in the provided content string. + * + * @param {string} content - The content string to process. + * @returns {string} - The content string with capitalized JSX tags. + */ export function capitalizeJsxTags(content: string) { return content.replace(/<\/?(\w+)/g, function (match: string, letter: string): string { if (capitalizeTags.includes(letter.toLowerCase())) { @@ -25,6 +35,12 @@ export function capitalizeJsxTags(content: string) { }); } +/** + * Copies and renames files from the source directory to the target directory. + * + * @param {string} srcDir - The source directory. + * @param {string} targetDir - The target directory. + */ export function copyAndRenameFiles(srcDir: string, targetDir: string) { // Read all files and directories from source directory const entries = fs.readdirSync(srcDir, { withFileTypes: true }); diff --git a/scripts/build-post-list.ts b/scripts/build-post-list.ts index 1d44f19776d2..2e2ce4f01bfc 100644 --- a/scripts/build-post-list.ts +++ b/scripts/build-post-list.ts @@ -26,6 +26,12 @@ const releaseNotes: (string | undefined)[] = []; // 2. const HEADING_ID_REGEX = /[\s]*(?:\{#([a-zA-Z0-9\-_]+)\}| { if (!details || typeof details.slug !== 'string') { throw new Error('Invalid details object provided to addItem'); @@ -65,6 +83,13 @@ export const addItem = (details: Details) => { } }; +/** + * Gets version details based on the slug and weight. + * + * @param {string} slug - The slug of the item. + * @param {number} weight - The weight of the item. + * @returns {object} - The version details. + */ function getVersionDetails(slug: string, weight: number) { const fileBaseName = basename(slug); const versionName = fileBaseName.split('-')[0]; @@ -74,6 +99,14 @@ function getVersionDetails(slug: string, weight: number) { weight }; } + +/** + * Handles specification version details. + * + * @param {Details} details - The details of the item. + * @param {string} fileBaseName - The base name of the file. + * @returns {Details} - The updated details. + */ function handleSpecificationVersion(details: Details, fileBaseName: string) { const detailsObj = details; @@ -87,10 +120,28 @@ function handleSpecificationVersion(details: Details, fileBaseName: string) { return detailsObj; } + +/** + * Checks if the given path is a directory. + * + * @param {PathLike} dir - The path to check. + * @returns {Promise} - A promise that resolves to true if the path is a directory, false otherwise. + */ async function isDirectory(dir: PathLike) { return (await stat(dir)).isDirectory(); } +/** + * Walks through directories and processes files. + * + * @param {string[][]} directories - The directories to walk through. + * @param {Result} resultObj - The result object to store the processed data. + * @param {string} basePath - The base path for the directories. + * @param {string} [sectionTitle] - The title of the section. + * @param {string} [sectionId] - The ID of the section. + * @param {string} [rootSectionId] - The root ID of the section. + * @param {number} [sectionWeight=0] - The weight of the section. + */ async function walkDirectories( directories: string[][], resultObj: Result, @@ -190,6 +241,15 @@ async function walkDirectories( } } // Builds a list of posts from the specified directories and writes it to a file +/** + * Builds a list of posts from the specified directories and writes it to a file. + * + * @param {string[][]} postDirectories - The directories containing the posts. + * @param {string} basePath - The base path for the directories. + * @param {string} writeFilePath - The path to write the resulting post list. + * @returns {Promise} - A promise that resolves when the post list is built and written. + * @throws {Error} - Throws an error if there is an issue during the build process. + */ export async function buildPostList( postDirectories: string[][], basePath: string, diff --git a/scripts/build-rss.ts b/scripts/build-rss.ts index 816d34bf2cbc..1a1a45ca40ac 100644 --- a/scripts/build-rss.ts +++ b/scripts/build-rss.ts @@ -3,12 +3,23 @@ import json2xml from 'jgexml/json2xml'; import type { BlogPostTypes, RSS, RSSItemType } from '@/types/scripts/build-rss'; +/** + * Retrieves all blog posts from the configuration file. + * + * @returns {Promise} - A promise that resolves to the list of all blog posts. + */ async function getAllPosts() { const posts = ((await import('../config/posts.json')) as any).default; return posts; } +/** + * Cleans a string by replacing HTML entities with their corresponding characters. + * + * @param {string} s - The string to clean. + * @returns {string} - The cleaned string. + */ function clean(s: string) { let cleanS = s; @@ -22,6 +33,15 @@ function clean(s: string) { return cleanS; } +/** + * Generates an RSS feed for the specified blog post type. + * + * @param {BlogPostTypes} type - The type of blog posts to include in the RSS feed. + * @param {string} rssTitle - The title of the RSS feed. + * @param {string} desc - The description of the RSS feed. + * @param {string} outputPath - The output path for the generated RSS feed file. + * @throws {Error} - Throws an error if there is an issue during the RSS feed generation. + */ export async function rssFeed(type: BlogPostTypes, rssTitle: string, desc: string, outputPath: string) { try { let posts = (await getAllPosts())[`${type}`] as any[]; diff --git a/scripts/build-tools.ts b/scripts/build-tools.ts index d1b10d75945b..1cdc96bd3f9a 100644 --- a/scripts/build-tools.ts +++ b/scripts/build-tools.ts @@ -9,7 +9,16 @@ import { convertTools } from './tools/tools-object'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); -const buildTools = async (automatedToolsPath: string, manualToolsPath: string, toolsPath: string, tagsPath: string) => { +/** + * Builds the tools by combining automated and manual tools data, and writes the result to the specified paths. + * + * @param {string} automatedToolsPath - The path to write the automated tools data. + * @param {string} manualToolsPath - The path to read the manual tools data. + * @param {string} toolsPath - The path to write the combined tools data. + * @param {string} tagsPath - The path to write the tags data. + * @throws {Error} - Throws an error if there is an issue during the build process. + */ +async function buildTools(automatedToolsPath: string, manualToolsPath: string, toolsPath: string, tagsPath: string) { try { const githubExtractData = await getData(); const automatedTools = await convertTools(githubExtractData); @@ -22,7 +31,7 @@ const buildTools = async (automatedToolsPath: string, manualToolsPath: string, t } catch (err) { throw new Error(`An error occurred while building tools: ${(err as Error).message}`); } -}; +} /* istanbul ignore next */ if (process.argv[1] === fileURLToPath(import.meta.url)) { diff --git a/scripts/casestudies/index.ts b/scripts/casestudies/index.ts index 7f9abe489848..d1edc4f2e1cb 100644 --- a/scripts/casestudies/index.ts +++ b/scripts/casestudies/index.ts @@ -3,6 +3,12 @@ import { join } from 'path'; import { convertToJson } from '../utils'; +/** + * Builds a list of case studies from files in a directory and writes it to a specified file. + * @param {string} dirWithCaseStudy - The directory containing case study files. + * @param {string} writeFilePath - The path to write the case studies list to. + * @returns {Promise} - The list of case studies. + */ export async function buildCaseStudiesList(dirWithCaseStudy: string, writeFilePath: string) { try { const files = await readdir(dirWithCaseStudy); diff --git a/scripts/compose.ts b/scripts/compose.ts index 3339c51d261b..6b0ece21507e 100644 --- a/scripts/compose.ts +++ b/scripts/compose.ts @@ -7,6 +7,9 @@ import fs from 'fs'; import inquirer from 'inquirer'; import moment from 'moment'; +/** + * Type definition for the answers from the compose prompt. + */ type ComposePromptType = { title: string; excerpt: string; @@ -15,7 +18,13 @@ type ComposePromptType = { canonical: string; }; -const genFrontMatter = (answers: ComposePromptType) => { +/** + * Generates the front matter for a blog post based on the provided answers. + * + * @param {ComposePromptType} answers - The answers from the compose prompt. + * @returns {string} - The generated front matter. + */ +function genFrontMatter(answers: ComposePromptType) { const tagArray = answers.tags.split(','); tagArray.forEach((tag: string, index: number) => { @@ -100,7 +109,7 @@ const genFrontMatter = (answers: ComposePromptType) => { frontMatter += '\n---'; return frontMatter; -}; +} inquirer .prompt([ diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index 34d5e484ce74..88b3c292cb8d 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -19,12 +19,22 @@ import { Queries } from './issue-queries'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); +/** + * Pauses execution for a specified number of milliseconds. + * @param {number} ms - The number of milliseconds to pause. + * @returns {Promise} + */ async function pause(ms: number): Promise { return new Promise((res) => { setTimeout(res, ms); }); } +/** + * Calculates the number of months since a given date. + * @param {string} date - The date to calculate from. + * @returns {number} - The number of months since the date. + */ function monthsSince(date: string) { const seconds = Math.floor((new Date().valueOf() - new Date(date).valueOf()) / 1000); // 2592000 = number of seconds in a month = 30 * 24 * 60 * 60 @@ -33,12 +43,25 @@ function monthsSince(date: string) { return Math.floor(months); } +/** + * Retrieves a label from an issue based on a filter. + * @param {GoodFirstIssues} issue - The issue to retrieve the label from. + * @param {string} filter - The filter to apply to the label. + * @returns {string | undefined} - The label if found, otherwise undefined. + */ function getLabel(issue: GoodFirstIssues, filter: string) { const result = issue.labels.nodes.find((label) => label.name.startsWith(filter)); return result?.name.split('/')[1]; } +/** + * Fetches discussions from GitHub GraphQL API. + * @param {string} query - The GraphQL query to execute. + * @param {number} pageSize - The number of results per page. + * @param {null | string} [endCursor=null] - The cursor for pagination. + * @returns {Promise} - The fetched discussions. + */ async function getDiscussions( query: string, pageSize: number, @@ -79,6 +102,12 @@ async function getDiscussions( } } +/** + * Fetches a discussion by its ID. + * @param {boolean} isPR - Whether the discussion is a pull request. + * @param {string} id - The ID of the discussion. + * @returns {Promise} - The fetched discussion. + */ async function getDiscussionByID(isPR: boolean, id: string): Promise { try { const result: PullRequestById | IssueById = await graphql(isPR ? Queries.pullRequestById : Queries.issueById, { @@ -96,6 +125,11 @@ async function getDiscussionByID(isPR: boolean, id: string): Promise} - The processed discussions. + */ async function processHotDiscussions(batch: HotDiscussionsIssuesNode[]) { return Promise.all( batch.map(async (discussion) => { @@ -140,6 +174,11 @@ async function processHotDiscussions(batch: HotDiscussionsIssuesNode[]) { ); } +/** + * Retrieves and processes hot discussions. + * @param {HotDiscussionsIssuesNode[]} discussions - The discussions to process. + * @returns {Promise} - The processed hot discussions. + */ async function getHotDiscussions(discussions: HotDiscussionsIssuesNode[]) { const result: ProcessedDiscussion[] = []; const batchSize = 5; @@ -160,6 +199,14 @@ async function getHotDiscussions(discussions: HotDiscussionsIssuesNode[]) { return filteredResult.slice(0, 12); } +/** + * Writes content to a file. + * @param {object} content - The content to write. + * @param {ProcessedDiscussion[]} content.hotDiscussions - The hot discussions to write. + * @param {MappedIssue[]} content.goodFirstIssues - The good first issues to write. + * @param {string} writePath - The path to write the file to. + * @returns {Promise} + */ async function writeToFile( content: { hotDiscussions: ProcessedDiscussion[]; @@ -178,6 +225,11 @@ async function writeToFile( } } +/** + * Maps good first issues to a simplified format. + * @param {GoodFirstIssues[]} issues - The issues to map. + * @returns {Promise} - The mapped issues. + */ async function mapGoodFirstIssues(issues: GoodFirstIssues[]) { return issues.map((issue) => ({ id: issue.id, @@ -193,6 +245,11 @@ async function mapGoodFirstIssues(issues: GoodFirstIssues[]) { })); } +/** + * Starts the process of fetching and writing dashboard data. + * @param {string} writePath - The path to write the dashboard data to. + * @returns {Promise} + */ async function start(writePath: string): Promise { try { const issues = (await getDiscussions(Queries.hotDiscussionsIssues, 20)) as HotDiscussionsIssuesNode[]; diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index 1f1230d79e02..3f71e57633c8 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -3,6 +3,9 @@ import { resolve } from 'path'; import { writeJSON } from '../utils/readAndWriteJson'; +/** + * Interface for the properties required to build the finance info list. + */ interface BuildFinanceInfoListProps { currentDir: string; configDir: string; @@ -11,6 +14,13 @@ interface BuildFinanceInfoListProps { jsonDataDir: string; } +/** + * Builds the finance info list by reading YAML files and writing them as JSON files. + * + * @param {BuildFinanceInfoListProps} props - The properties required to build the finance info list. + * @returns {Promise} A promise that resolves when the finance info list has been built. + * @throws {Error} Throws an error if there is an issue building the finance info list. + */ export async function buildFinanceInfoList({ currentDir, configDir, diff --git a/scripts/index.ts b/scripts/index.ts index f731287f2852..d5967442e01d 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -11,6 +11,11 @@ import { buildFinanceInfoList } from './finance/index'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); +/** + * Main function to start the build process for posts, RSS feed, case studies, adopters, and finance info. + * + * @throws {Error} - Throws an error if no finance data is found in the finance directory. + */ async function start() { const postDirectories = [ ['pages/blog', '/blog'], diff --git a/scripts/markdown/check-markdown.ts b/scripts/markdown/check-markdown.ts index 4a80afb4c7c5..0ea427e26d6e 100644 --- a/scripts/markdown/check-markdown.ts +++ b/scripts/markdown/check-markdown.ts @@ -6,6 +6,11 @@ import { fileURLToPath } from 'url'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); +/** + * Checks if a string is a valid URL. + * @param {string} str - The string to check. + * @returns {boolean} - True if the string is a valid URL, false otherwise. + */ function isValidURL(str: string) { try { // eslint-disable-next-line no-new @@ -17,6 +22,9 @@ function isValidURL(str: string) { } } +/** + * Interface representing the frontmatter of a markdown file. + */ interface FrontMatter { title: string; date: string; @@ -27,6 +35,11 @@ interface FrontMatter { authors: { name: string; link: string; photo: string }[]; } +/** + * Validates the frontmatter of blog markdown files. + * @param {FrontMatter} frontmatter - The frontmatter to validate. + * @returns {string[] | null} - An array of error messages, or null if valid. + */ function validateBlogs(frontmatter: FrontMatter) { const requiredAttributes = ['title', 'date', 'type', 'tags', 'cover', 'authors']; const errors = []; @@ -75,6 +88,11 @@ function validateBlogs(frontmatter: FrontMatter) { return errors.length ? errors : null; } +/** + * Validates the frontmatter of documentation markdown files. + * @param {FrontMatter} frontmatter - The frontmatter to validate. + * @returns {string[] | null} - An array of error messages, or null if valid. + */ function validateDocs(frontmatter: FrontMatter) { const errors = []; @@ -142,6 +160,9 @@ async function checkMarkdownFiles( const docsFolderPath = path.resolve(currentDirPath, '../../markdown/docs'); const blogsFolderPath = path.resolve(currentDirPath, '../../markdown/blog'); +/** + * Main function to validate markdown files in the docs and blog folders. + */ async function main() { try { await Promise.all([ diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 6f2ab53c2264..5d7d516598b0 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -41,9 +41,14 @@ const technologyList = [...technologiesColor]; let languageFuse = new Fuse(languageList, options); let technologyFuse = new Fuse(technologyList, options); -// takes individual tool object and inserts borderColor and backgroundColor of the tags of -// languages and technologies, for Tool Card in website. -async function getFinalTool(toolObject: AsyncAPITool) { +/** + * Takes individual tool object and inserts borderColor and backgroundColor of the tags of + * languages and technologies, for Tool Card in website. + * + * @param {AsyncAPITool} toolObject - The tool object to process. + * @returns {Promise} - The processed tool object with additional properties. + */ +async function getFinalTool(toolObject: AsyncAPITool): Promise { const finalObject: FinalAsyncAPITool = { ...toolObject, filters: { @@ -127,8 +132,15 @@ async function getFinalTool(toolObject: AsyncAPITool) { return finalObject; } -// Combine the automated tools and manual tools list into single JSON object file, and -// lists down all the language and technology tags in one JSON file. +/** + * Combine the automated tools and manual tools list into a single JSON object file, and + * lists down all the language and technology tags in one JSON file. + * + * @param {any} automatedTools - The list of automated tools. + * @param {any} manualTools - The list of manual tools. + * @param {string} toolsPath - The path to save the combined tools JSON file. + * @param {string} tagsPath - The path to save the tags JSON file. + */ const combineTools = async (automatedTools: any, manualTools: any, toolsPath: string, tagsPath: string) => { try { // eslint-disable-next-line no-restricted-syntax diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index 6ccda3149020..34759a268dd2 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -3,6 +3,12 @@ import dotenv from 'dotenv'; dotenv.config(); +/** + * Fetches tool data from the GitHub API. + * + * @returns {Promise} The data from the GitHub API. + * @throws {Error} If there is an error fetching the data. + */ export async function getData(): Promise { // eslint-disable-next-line no-useless-catch try { diff --git a/scripts/tools/tools-object.ts b/scripts/tools/tools-object.ts index f48765c7634a..14c8f8043ce4 100644 --- a/scripts/tools/tools-object.ts +++ b/scripts/tools/tools-object.ts @@ -24,17 +24,26 @@ const options = { const fuse = new Fuse(categoryList, options); -// using the contents of each toolFile (extracted from Github), along with Github URL -// (repositoryUrl) of the tool, it's repository description (repoDescription) and -// isAsyncAPIrepo boolean variable to define whether the tool repository is under -// AsyncAPI organization or not, to create a JSON tool object as required in the frontend -// side to show ToolCard. -const createToolObject = async ( +/** + * Creates a tool object for the frontend ToolCard. + * Using the contents of each toolFile (extracted from Github), along with Github URL + * (repositoryUrl) of the tool, it's repository description (repoDescription) and + * isAsyncAPIrepo boolean variable to define whether the tool repository is under + * AsyncAPI organization or not, to create a JSON tool object as required in the frontend + * side to show ToolCard. + * + * @param {AsyncAPITool} toolFile - The tool file content. + * @param {string} [repositoryUrl=''] - The URL of the tool's repository. + * @param {string} [repoDescription=''] - The description of the repository. + * @param {boolean | string} [isAsyncAPIrepo=''] - Whether the tool repository is under the AsyncAPI organization. + * @returns {Promise} The tool object. + */ +async function createToolObject( toolFile: AsyncAPITool, repositoryUrl = '', repoDescription = '', isAsyncAPIrepo: boolean | string = '' -) => { +) { const resultantObject = { title: toolFile.title, description: toolFile?.description ? toolFile.description : repoDescription, @@ -50,12 +59,20 @@ const createToolObject = async ( }; return resultantObject; -}; +} // Each result obtained from the Github API call will be tested and verified // using the defined JSON schema, categorising each tool inside their defined categories // and creating a JSON tool object in which all the tools are listed in defined // categories order, which is then updated in `automated-tools.json` file. + +/** + * Converts tools data into a categorized tools list object. + * + * @param {ToolsData} data - The tools data from the GitHub API. + * @returns {Promise} The categorized tools list object. + * @throws {Error} If there is an error processing the tools. + */ async function convertTools(data: ToolsData) { try { let finalToolsObject: ToolsListObject = {}; diff --git a/scripts/utils.ts b/scripts/utils.ts index 9da0d06090fc..9c5fd37bea5f 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -1,5 +1,13 @@ import yaml from 'yaml'; +/** + * Converts a YAML or JSON string to a JSON object. + * If the input is already a JSON object, it is returned as is. + * + * @param {unknown} contentYAMLorJSON - The content to be converted, either as a YAML/JSON string or a JSON object. + * @returns {any} - The converted JSON object. + * @throws {Error} - Throws an error if the content is neither valid JSON nor valid YAML. + */ function convertToJson(contentYAMLorJSON: unknown): any { // Axios handles conversion to JSON by default, if data returned from the server allows it // So if returned content is not a string (not YAML), we just return JSON back diff --git a/scripts/utils/readAndWriteJson.ts b/scripts/utils/readAndWriteJson.ts index 6e5e65a17a5e..e017309571f3 100644 --- a/scripts/utils/readAndWriteJson.ts +++ b/scripts/utils/readAndWriteJson.ts @@ -2,6 +2,13 @@ import { readFile, writeFile } from 'fs/promises'; import { convertToJson } from '../utils'; +/** + * Reads a file, converts its content to JSON, and writes the JSON content to another file. + * + * @param {string} readPath - The path of the file to read. + * @param {string} writePath - The path of the file to write the JSON content to. + * @throws Will throw an error if reading, converting, or writing the file fails. + */ export async function writeJSON(readPath: string, writePath: string) { let readContent; let jsonContent; From 67217c8ef7cc1bfefc4eaab849680460d4660f12 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 4 Jan 2025 14:42:19 +0530 Subject: [PATCH 140/183] chore: remove unnecessary roots configuration from Jest config --- jest.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jest.config.js b/jest.config.js index c4d8f41bdfb2..b342774397f7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -9,8 +9,7 @@ const config = { collectCoverageFrom: ['scripts/**/*.ts'], coveragePathIgnorePatterns: ['scripts/compose.ts', 'scripts/tools/categorylist.ts', 'scripts/tools/tags-color.ts'], testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - roots: [''] + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'] }; export default config; From 6ab5fe769dfcd95b0d9848f39cfd396b31917449 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 4 Jan 2025 16:29:00 +0530 Subject: [PATCH 141/183] chore: clean up tsconfig.json by removing unused ts-node configuration --- tsconfig.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 25b72e6eed61..175047894056 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -32,9 +32,5 @@ "exclude": [ "node_modules", "netlify" - ], - "ts-node": { - "experimentalSpecifierResolution": "node", - "transpileOnly": true - } + ] } From 534d4f460b3bead483e7af9786b0d9c81f13295e Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 4 Jan 2025 16:31:37 +0530 Subject: [PATCH 142/183] test: remove redundant axios.get mock initialization in tools-object tests --- tests/tools/tools-object.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/tools/tools-object.test.js b/tests/tools/tools-object.test.js index 12f26cb62e6e..2577a2a27d94 100644 --- a/tests/tools/tools-object.test.js +++ b/tests/tools/tools-object.test.js @@ -17,7 +17,6 @@ jest.mock('../../scripts/tools/categorylist', () => ({ describe('Tools Object', () => { beforeEach(() => { - axios.get = jest.fn(); axios.get.mockClear(); console.error = jest.fn(); }); From 8f1941a42cc752c46c9b8982dda30d39fdf409db Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 4 Jan 2025 16:33:44 +0530 Subject: [PATCH 143/183] test: fix indentation in cleanup comment for build-pages tests --- tests/build-pages.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/build-pages.test.js b/tests/build-pages.test.js index 9600344f6575..15b559fc03ff 100644 --- a/tests/build-pages.test.js +++ b/tests/build-pages.test.js @@ -52,8 +52,8 @@ describe('copyAndRenameFiles', () => { expect(fs.existsSync(NEW_TEST_DIR)).toBe(false); ensureDirectoryExists(NEW_TEST_DIR); expect(fs.existsSync(NEW_TEST_DIR)).toBe(true); - // delete the test directory after the test - fs.rmSync(NEW_TEST_DIR, { recursive: true, force: true }); + // delete the test directory after the test + fs.rmSync(NEW_TEST_DIR, { recursive: true, force: true }); }); }); \ No newline at end of file From 95a6ec82b842a22f9cf64aa3cd09f640cdc11bfa Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 4 Jan 2025 17:11:02 +0530 Subject: [PATCH 144/183] fix: correct typo in comment for additional check in build-docs script --- scripts/build-docs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-docs.ts b/scripts/build-docs.ts index 5891e527b5e0..1180a2f333ed 100644 --- a/scripts/build-docs.ts +++ b/scripts/build-docs.ts @@ -227,7 +227,7 @@ function addDocButtons(docPosts: Details[], treePosts: NavTree) { }; docPost = { ...docPost, prevPage } as Details; } else if (index - 2 >= 0) { - // additonal check for the first page of Docs so that it doesn't give any Segementation fault + // additional check for the first page of Docs so that it doesn't give any Segementation fault prevPage = { title: `${structuredPosts[index - 1]?.isRootSection ? rootSections[rootSections.length - 2] : rootSections[rootSections.length - 1]} - ${structuredPosts[index - 2].title}`, href: structuredPosts[index - 2].slug From 4be58ec3720ef1cf6fc225b5478b63dbb226711a Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 4 Jan 2025 17:40:04 +0530 Subject: [PATCH 145/183] fix: update type annotation for validateFunction parameter in checkMarkdownFiles --- scripts/markdown/check-markdown.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/markdown/check-markdown.ts b/scripts/markdown/check-markdown.ts index 0ea427e26d6e..a8bd416065d5 100644 --- a/scripts/markdown/check-markdown.ts +++ b/scripts/markdown/check-markdown.ts @@ -117,7 +117,7 @@ function validateDocs(frontmatter: FrontMatter) { */ async function checkMarkdownFiles( folderPath: string, - validateFunction: (frontmatter: any) => string[] | null, + validateFunction: (frontmatter: FrontMatter) => string[] | null, relativePath = '' ) { try { @@ -140,7 +140,7 @@ async function checkMarkdownFiles( const fileContent = await fs.readFile(filePath, 'utf-8'); const { data: frontmatter } = matter(fileContent); - const errors = validateFunction(frontmatter); + const errors = validateFunction(frontmatter as FrontMatter); if (errors) { console.log(`Errors in file ${relativeFilePath}:`); From 45314e45a13b45bcab696f0a905abb06c216744b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 16:36:24 +0530 Subject: [PATCH 146/183] fix: add error handling for missing CALENDAR_SERVICE_ACCOUNT environment variable --- scripts/build-meetings.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index 4be72627008b..dcd9f5f5a735 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -16,6 +16,10 @@ async function buildMeetings(writePath: string) { let auth; let calendar; + if (!process.env.CALENDAR_SERVICE_ACCOUNT) { + throw new Error('CALENDAR_SERVICE_ACCOUNT environment variable is required'); + } + try { auth = new google.auth.GoogleAuth({ scopes: ['https://www.googleapis.com/auth/calendar'], From 073072b4bfbf321f0e5daf5e8b7965478f7a19cd Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 16:40:04 +0530 Subject: [PATCH 147/183] fix: add error handling for missing YOUTUBE_TOKEN and validate video data structure in buildNewsroomVideos function --- scripts/build-newsroom-videos.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/build-newsroom-videos.ts b/scripts/build-newsroom-videos.ts index 2fb907f3d67f..c6e91dd8d1c0 100644 --- a/scripts/build-newsroom-videos.ts +++ b/scripts/build-newsroom-videos.ts @@ -17,6 +17,9 @@ const currentDirPath = dirname(currentFilePath); */ async function buildNewsroomVideos(writePath: string) { try { + if (!process.env.YOUTUBE_TOKEN) { + throw new Error('YOUTUBE_TOKEN environment variable is required'); + } const response = await fetch( `https://youtube.googleapis.com/youtube/v3/search?${new URLSearchParams({ key: process.env.YOUTUBE_TOKEN!, @@ -39,12 +42,21 @@ async function buildNewsroomVideos(writePath: string) { throw new Error('Invalid data structure received from YouTube API'); } - const videoDataItems = data.items.map((video: youtube_v3.Schema$SearchResult) => ({ - image_url: video.snippet?.thumbnails?.high?.url, - title: video.snippet?.title, - description: video.snippet?.description, - videoId: video.id?.videoId - })); + const videoDataItems = data.items.map((video: youtube_v3.Schema$SearchResult) => { + if (!video.snippet?.thumbnails?.high?.url) { + throw new Error(`Missing thumbnail URL for video: ${video.id?.videoId ?? 'unknown'}`); + } + if (!video.id?.videoId) { + throw new Error(`Missing video ID for video: ${video.snippet?.title ?? 'unknown'}`); + } + + return { + image_url: video.snippet.thumbnails.high.url, + title: video.snippet.title, + description: video.snippet.description, + videoId: video.id.videoId + }; + }); const videoData = JSON.stringify(videoDataItems, null, ' '); From 42890817524e9acf301a0794e381960f3b22a2f6 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 16:45:20 +0530 Subject: [PATCH 148/183] fix: remove redundant error handling for missing CALENDAR_SERVICE_ACCOUNT environment variable in buildMeetings function --- scripts/build-meetings.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index dcd9f5f5a735..4be72627008b 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -16,10 +16,6 @@ async function buildMeetings(writePath: string) { let auth; let calendar; - if (!process.env.CALENDAR_SERVICE_ACCOUNT) { - throw new Error('CALENDAR_SERVICE_ACCOUNT environment variable is required'); - } - try { auth = new google.auth.GoogleAuth({ scopes: ['https://www.googleapis.com/auth/calendar'], From b09334ef79c1e6156f7dc7077276fa077f669a9d Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 17:16:47 +0530 Subject: [PATCH 149/183] fix: add file existence checks for Expenses.yml and ExpensesLink.yml in buildFinanceInfoList function --- scripts/finance/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index 3f71e57633c8..df5e324165bb 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -1,4 +1,4 @@ -import { mkdir } from 'fs/promises'; +import { access, constants, mkdir } from 'fs/promises'; import { resolve } from 'path'; import { writeJSON } from '../utils/readAndWriteJson'; @@ -32,6 +32,12 @@ export async function buildFinanceInfoList({ const expensesPath = resolve(currentDir, configDir, financeDir, year, 'Expenses.yml'); const expensesLinkPath = resolve(currentDir, configDir, financeDir, year, 'ExpensesLink.yml'); + await Promise.all([access(expensesPath, constants.F_OK), access(expensesLinkPath, constants.F_OK)]).catch(() => { + throw new Error( + 'Error in buildFinanceInfoList: Could not find the Expenses.yml or ExpensesLink.yml file in the finance directory.' + ); + }); + // Ensure the directory exists before writing the files const jsonDirectory = resolve(currentDir, configDir, financeDir, jsonDataDir); From c685dce307b0c00c32a02f02b784d21ab1738e13 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 17:19:43 +0530 Subject: [PATCH 150/183] fix: await rssFeed call and add error handling in start function --- scripts/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/index.ts b/scripts/index.ts index d5967442e01d..73b59ac4b179 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -26,7 +26,7 @@ async function start() { const writeFilePath = resolve(currentDirPath, '../config', 'posts.json'); await buildPostList(postDirectories, basePath, writeFilePath); - rssFeed('blog', 'AsyncAPI Initiative Blog RSS Feed', 'AsyncAPI Initiative Blog', 'rss.xml'); + await rssFeed('blog', 'AsyncAPI Initiative Blog RSS Feed', 'AsyncAPI Initiative Blog', 'rss.xml'); await buildCaseStudiesList('config/casestudies', resolve(currentDirPath, '../config', 'case-studies.json')); await buildAdoptersList(); const financeDir = resolve('.', 'config', 'finance'); @@ -60,4 +60,7 @@ async function start() { export { start }; -start(); +start().catch((err) => { + console.error(err); + process.exit(1); +}); From be99d8d377698e6456b312fa0c72968c48a31eb9 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 17:23:47 +0530 Subject: [PATCH 151/183] fix: add error handling for missing GITHUB_TOKEN environment variable in getData function --- scripts/tools/extract-tools-github.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index 34759a268dd2..76ee8666f303 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -12,6 +12,9 @@ dotenv.config(); export async function getData(): Promise { // eslint-disable-next-line no-useless-catch try { + if (!process.env.GITHUB_TOKEN) { + throw new Error('GITHUB_TOKEN environment variable is required'); + } const result = await axios.get('https://api.github.com/search/code?q=filename:.asyncapi-tool', { headers: { accept: 'application/vnd.github.text-match+json', From dbe29708e35899ae15a4135e8622051a4eb54637 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 17:37:51 +0530 Subject: [PATCH 152/183] fix: enhance error handling for GitHub API responses in getData function --- scripts/tools/extract-tools-github.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index 76ee8666f303..e93cc690e03c 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -24,6 +24,15 @@ export async function getData(): Promise { return result.data; } catch (err) { + if (axios.isAxiosError(err)) { + if (err.response?.status === 403) { + throw new Error('GitHub API rate limit exceeded. Please try again later.'); + } + if (err.response?.status === 401) { + throw new Error('Invalid GitHub token. Please check your GITHUB_TOKEN.'); + } + throw new Error(`GitHub API error: ${err.response?.data?.message || err.message}`); + } throw err; } } From 37ef4ca7de44e33aa8c293237c08b92946962bcd Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 17:52:30 +0530 Subject: [PATCH 153/183] refactor: remove file existence checks and simplify start function error handling --- scripts/finance/index.ts | 8 +------- scripts/index.ts | 5 +---- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index df5e324165bb..3f71e57633c8 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -1,4 +1,4 @@ -import { access, constants, mkdir } from 'fs/promises'; +import { mkdir } from 'fs/promises'; import { resolve } from 'path'; import { writeJSON } from '../utils/readAndWriteJson'; @@ -32,12 +32,6 @@ export async function buildFinanceInfoList({ const expensesPath = resolve(currentDir, configDir, financeDir, year, 'Expenses.yml'); const expensesLinkPath = resolve(currentDir, configDir, financeDir, year, 'ExpensesLink.yml'); - await Promise.all([access(expensesPath, constants.F_OK), access(expensesLinkPath, constants.F_OK)]).catch(() => { - throw new Error( - 'Error in buildFinanceInfoList: Could not find the Expenses.yml or ExpensesLink.yml file in the finance directory.' - ); - }); - // Ensure the directory exists before writing the files const jsonDirectory = resolve(currentDir, configDir, financeDir, jsonDataDir); diff --git a/scripts/index.ts b/scripts/index.ts index 73b59ac4b179..2abe60ae1ddb 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -60,7 +60,4 @@ async function start() { export { start }; -start().catch((err) => { - console.error(err); - process.exit(1); -}); +start(); From b94707f3d283463b53bd85e0546a2abfbc0a68d6 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 17:54:35 +0530 Subject: [PATCH 154/183] fix: remove GITHUB_TOKEN check from getData function --- scripts/tools/extract-tools-github.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index e93cc690e03c..b150c5df0703 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -12,9 +12,6 @@ dotenv.config(); export async function getData(): Promise { // eslint-disable-next-line no-useless-catch try { - if (!process.env.GITHUB_TOKEN) { - throw new Error('GITHUB_TOKEN environment variable is required'); - } const result = await axios.get('https://api.github.com/search/code?q=filename:.asyncapi-tool', { headers: { accept: 'application/vnd.github.text-match+json', From bf6f225f9e43c5281ffd59a2cd8d41305ff67c39 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 19:36:47 +0530 Subject: [PATCH 155/183] fix: add validation for missing frontmatter in validateBlogs function --- scripts/markdown/check-markdown.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/markdown/check-markdown.ts b/scripts/markdown/check-markdown.ts index a8bd416065d5..c89169ca4061 100644 --- a/scripts/markdown/check-markdown.ts +++ b/scripts/markdown/check-markdown.ts @@ -44,6 +44,10 @@ function validateBlogs(frontmatter: FrontMatter) { const requiredAttributes = ['title', 'date', 'type', 'tags', 'cover', 'authors']; const errors = []; + if (!frontmatter) { + errors.push('Frontmatter is missing'); + } + // Check for required attributes requiredAttributes.forEach((attr) => { if (!Object.prototype.hasOwnProperty.call(frontmatter, attr)) { From cf245dc77232e0d319eea1c8d7516bbff5716d2d Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 20:21:12 +0530 Subject: [PATCH 156/183] feat: implement pagination for GitHub API data retrieval in getData function --- scripts/tools/extract-tools-github.ts | 39 +++++++++++++++++++++--- tests/tools/extract-tools-github.test.js | 11 +++++-- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index b150c5df0703..d72660ae7ee7 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -1,6 +1,9 @@ +/* eslint-disable no-await-in-loop */ import axios from 'axios'; import dotenv from 'dotenv'; +import { pause } from '../utils'; + dotenv.config(); /** @@ -12,12 +15,38 @@ dotenv.config(); export async function getData(): Promise { // eslint-disable-next-line no-useless-catch try { - const result = await axios.get('https://api.github.com/search/code?q=filename:.asyncapi-tool', { - headers: { - accept: 'application/vnd.github.text-match+json', - authorization: `token ${process.env.GITHUB_TOKEN}` - } + const allItems = []; + let page = 1; + + const maxPerPage = 50; + const getReqUrl = (PerPage: number, pageNo: number) => + `https://api.github.com/search/code?q=filename:.asyncapi-tool&per_page=${PerPage}&page=${pageNo}`; + const headers = { + accept: 'application/vnd.github.text-match+json', + authorization: `token ${process.env.GITHUB_TOKEN}` + }; + const result = await axios.get(getReqUrl(maxPerPage, page), { + headers }); + const totalResults = result.data.total_count; + + allItems.push(...result.data.items); + + while (allItems.length < totalResults) { + page++; + console.log('Fetching page:', page); + // pause for 1 second to avoid rate limiting + await pause(1000); + const nextPageData = await axios.get(getReqUrl(maxPerPage, page), { + headers + }); + + const { data } = nextPageData; + + allItems.push(...data.items); + } + + result.data.items.push(...allItems); return result.data; } catch (err) { diff --git a/tests/tools/extract-tools-github.test.js b/tests/tools/extract-tools-github.test.js index 3b779db3de1d..bdaf89143737 100644 --- a/tests/tools/extract-tools-github.test.js +++ b/tests/tools/extract-tools-github.test.js @@ -8,12 +8,17 @@ describe('getData', () => { const mockData = { data: { - name: '.asyncapi-tool', - path: 'asyncapi/.asyncapi-tool', + items:[ + { + name: '.asyncapi-tool', + path: 'asyncapi/.asyncapi-tool', + } + ], + total_count: 1, }, }; - const apiBaseUrl = 'https://api.github.com/search/code?q=filename:.asyncapi-tool'; + const apiBaseUrl = 'https://api.github.com/search/code?q=filename:.asyncapi-tool&per_page=50&page=1'; const headers = { accept: 'application/vnd.github.text-match+json', authorization: `token ${process.env.GITHUB_TOKEN}`, From 509a864ab55f3487e00e938a369bb92d4e18c59b Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 20:22:11 +0530 Subject: [PATCH 157/183] fix: format mockData structure in getData tests for consistency --- tests/tools/extract-tools-github.test.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/tools/extract-tools-github.test.js b/tests/tools/extract-tools-github.test.js index bdaf89143737..1c630f405571 100644 --- a/tests/tools/extract-tools-github.test.js +++ b/tests/tools/extract-tools-github.test.js @@ -8,13 +8,13 @@ describe('getData', () => { const mockData = { data: { - items:[ - { - name: '.asyncapi-tool', - path: 'asyncapi/.asyncapi-tool', - } - ], - total_count: 1, + items:[ + { + name: '.asyncapi-tool', + path: 'asyncapi/.asyncapi-tool', + } + ], + total_count: 1, }, }; From 9d516a5a0b43ecacec2175720ac3f652c4a6b633 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 22:51:30 +0530 Subject: [PATCH 158/183] refactor: move pause function to utils and remove redundant definition from build-dashboard --- scripts/dashboard/build-dashboard.ts | 12 +----------- scripts/utils.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index 88b3c292cb8d..d90cb77f91f7 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -14,22 +14,12 @@ import type { PullRequestById } from '@/types/scripts/dashboard'; +import { pause } from '../utils'; import { Queries } from './issue-queries'; const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); -/** - * Pauses execution for a specified number of milliseconds. - * @param {number} ms - The number of milliseconds to pause. - * @returns {Promise} - */ -async function pause(ms: number): Promise { - return new Promise((res) => { - setTimeout(res, ms); - }); -} - /** * Calculates the number of months since a given date. * @param {string} date - The date to calculate from. diff --git a/scripts/utils.ts b/scripts/utils.ts index 9c5fd37bea5f..54081eb80648 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -33,4 +33,15 @@ function convertToJson(contentYAMLorJSON: unknown): any { } } -export { convertToJson }; +/** + * Pauses execution for a specified number of milliseconds. + * @param {number} ms - The number of milliseconds to pause. + * @returns {Promise} + */ +async function pause(ms: number): Promise { + return new Promise((res) => { + setTimeout(res, ms); + }); +} + +export { convertToJson, pause }; From 745127bfdcabd3995868db5b4ae42451de1c2b79 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 23:07:09 +0530 Subject: [PATCH 159/183] feat: add processManualTool function to validate and process manual tools in combine-tools script --- scripts/tools/combine-tools.ts | 64 ++++++++++++++++------------------ 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 5d7d516598b0..dcc23ffac43a 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -132,6 +132,28 @@ async function getFinalTool(toolObject: AsyncAPITool): Promise { + const isValid = await validate(tool); + + if (!isValid) { + console.error({ + message: 'Tool validation failed', + tool: tool.title, + source: 'manual-tools.json', + errors: validate.errors, + note: 'Script continues execution, error logged for investigation' + }); + + return null; + } + const isAsyncAPIrepo = tool?.links?.repoUrl + ? new URL(tool.links.repoUrl).href.startsWith('https://github.com/asyncapi/') + : false; + const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); + + return getFinalTool(toolObject); +}; + /** * Combine the automated tools and manual tools list into a single JSON object file, and * lists down all the language and technology tags in one JSON file. @@ -146,40 +168,14 @@ const combineTools = async (automatedTools: any, manualTools: any, toolsPath: st // eslint-disable-next-line no-restricted-syntax for (const key in automatedTools) { if (Object.prototype.hasOwnProperty.call(automatedTools, key)) { - const finalToolsList = []; - - if (automatedTools[key].toolsList.length) { - for (const tool of automatedTools[key].toolsList) { - finalToolsList.push(await getFinalTool(tool)); - } - } - if (manualTools[key]?.toolsList?.length) { - for (const tool of manualTools[key].toolsList) { - let isAsyncAPIrepo; - const isValid = await validate(tool); - - if (isValid) { - if (tool?.links?.repoUrl) { - const url = new URL(tool.links.repoUrl); - - isAsyncAPIrepo = url.href.startsWith('https://github.com/asyncapi/'); - } else isAsyncAPIrepo = false; - const toolObject = await createToolObject(tool, '', '', isAsyncAPIrepo); - - finalToolsList.push(await getFinalTool(toolObject)); - } else { - console.error({ - message: 'Tool validation failed', - tool: tool.title, - source: 'manual-tools.json', - errors: validate.errors, - note: 'Script continues execution, error logged for investigation' - }); - } - } - } - finalToolsList.sort((tool, anotherTool) => tool.title.localeCompare(anotherTool.title)); - finalTools[key].toolsList = finalToolsList; + const automatedResults = await Promise.all(automatedTools[key].toolsList.map(getFinalTool)); + const manualResults = manualTools[key]?.toolsList?.length + ? (await Promise.all(manualTools[key].toolsList.map(processManualTool))).filter(Boolean) + : []; + + finalTools[key].toolsList = [...automatedResults, ...manualResults].sort((tool, anotherTool) => + tool.title.localeCompare(anotherTool.title) + ); } } fs.writeFileSync(toolsPath, JSON.stringify(finalTools)); From 54df45326e3061142fe7017a658fd54f22a68c07 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 5 Jan 2025 23:08:20 +0530 Subject: [PATCH 160/183] refactor: remove max-depth eslint rule from combine-tools script --- scripts/tools/combine-tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index dcc23ffac43a..a15cf6befe09 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -1,5 +1,5 @@ /* eslint-disable no-await-in-loop */ -/* eslint-disable max-depth */ + import Ajv from 'ajv'; import addFormats from 'ajv-formats'; import fs from 'fs'; From 0ffcba42498f2ad1a637bbdc5dc5d2732f4f9953 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Tue, 7 Jan 2025 14:43:58 +0530 Subject: [PATCH 161/183] refactor: remove duplicate Scala color configuration from tags-color script --- scripts/tools/tags-color.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/tools/tags-color.ts b/scripts/tools/tags-color.ts index 5fb1ca41974f..7bc04e43b60e 100644 --- a/scripts/tools/tags-color.ts +++ b/scripts/tools/tags-color.ts @@ -47,11 +47,6 @@ const languagesColor: LanguageColorItem[] = [ color: 'bg-[#B1ACDF]', borderColor: 'border-[#756BD9]' }, - { - name: 'Scala', - color: 'bg-[#FFA299]', - borderColor: 'border-[#DF301F]' - }, { name: 'Markdown', color: 'bg-[#BABEBF]', From e57dc5dec46c99826520cf648eb62e9ad2b04f0a Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sat, 11 Jan 2025 17:35:11 +0530 Subject: [PATCH 162/183] feat(logging): integrate Winston logger for improved error handling and logging --- package-lock.json | 198 +++++++++++++++++++++++- package.json | 1 + scripts/compose.ts | 4 +- scripts/dashboard/build-dashboard.ts | 9 +- scripts/markdown/check-markdown.ts | 6 +- scripts/tools/combine-tools.ts | 19 ++- scripts/tools/tools-object.ts | 10 +- scripts/utils/logger.ts | 18 +++ tests/dashboard/build-dashboard.test.js | 15 +- tests/markdown/check-markdown.test.js | 20 ++- tests/tools/combine-tools.test.js | 9 +- tests/tools/tools-object.test.js | 25 ++- 12 files changed, 294 insertions(+), 40 deletions(-) create mode 100644 scripts/utils/logger.ts diff --git a/package-lock.json b/package-lock.json index ad7b175f4de7..e90cb67edc3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,6 +79,7 @@ "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", "tsx": "^4.19.2", + "winston": "^3.17.0", "yaml": "^2.3.4" }, "devDependencies": { @@ -2326,6 +2327,24 @@ "yarn": ">=1.22.18" } }, + "node_modules/@colors/colors": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", + "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@dabh/diagnostics": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", + "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==", + "dependencies": { + "colorspace": "1.1.x", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, "node_modules/@dagrejs/dagre": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@dagrejs/dagre/-/dagre-1.1.4.tgz", @@ -7786,6 +7805,11 @@ "@types/node": "*" } }, + "node_modules/@types/triple-beam": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", + "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==" + }, "node_modules/@types/unist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", @@ -8804,6 +8828,11 @@ "astring": "bin/astring" } }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==" + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -10360,7 +10389,6 @@ "version": "1.9.1", "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", - "dev": true, "dependencies": { "color-name": "^1.0.0", "simple-swizzle": "^0.2.2" @@ -10377,6 +10405,37 @@ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, + "node_modules/colorspace": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", + "integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==", + "dependencies": { + "color": "^3.1.3", + "text-hex": "1.0.x" + } + }, + "node_modules/colorspace/node_modules/color": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "dependencies": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, + "node_modules/colorspace/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/colorspace/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -11989,6 +12048,11 @@ "node": ">= 4" } }, + "node_modules/enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==" + }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -13865,6 +13929,11 @@ "walk-up-path": "^3.0.1" } }, + "node_modules/fecha": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", + "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==" + }, "node_modules/fetch-blob": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", @@ -14018,6 +14087,11 @@ "node": ">=0.4.0" } }, + "node_modules/fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" + }, "node_modules/follow-redirects": { "version": "1.15.6", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", @@ -17732,6 +17806,11 @@ "node": ">= 8" } }, + "node_modules/kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" + }, "node_modules/language-subtag-registry": { "version": "0.3.23", "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.23.tgz", @@ -18080,6 +18159,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/logform": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.7.0.tgz", + "integrity": "sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==", + "dependencies": { + "@colors/colors": "1.6.0", + "@types/triple-beam": "^1.3.2", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "safe-stable-stringify": "^2.3.1", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", @@ -22935,6 +23030,14 @@ "wrappy": "1" } }, + "node_modules/one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "dependencies": { + "fn.name": "1.x.x" + } + }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -26386,6 +26489,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "engines": { + "node": ">=10" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -26969,7 +27080,6 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", - "dev": true, "dependencies": { "is-arrayish": "^0.3.1" } @@ -26977,8 +27087,7 @@ "node_modules/simple-swizzle/node_modules/is-arrayish": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", - "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", - "dev": true + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" }, "node_modules/sisteransi": { "version": "1.0.5", @@ -27043,6 +27152,14 @@ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, + "node_modules/stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==", + "engines": { + "node": "*" + } + }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -28485,6 +28602,11 @@ "b4a": "^1.6.4" } }, + "node_modules/text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -28641,6 +28763,14 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/triple-beam": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", + "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==", + "engines": { + "node": ">= 14.0.0" + } + }, "node_modules/trough": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", @@ -30743,6 +30873,66 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/winston": { + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.17.0.tgz", + "integrity": "sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw==", + "dependencies": { + "@colors/colors": "^1.6.0", + "@dabh/diagnostics": "^2.0.2", + "async": "^3.2.3", + "is-stream": "^2.0.0", + "logform": "^2.7.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "safe-stable-stringify": "^2.3.1", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.9.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/winston-transport": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.9.0.tgz", + "integrity": "sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==", + "dependencies": { + "logform": "^2.7.0", + "readable-stream": "^3.6.2", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/winston-transport/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/winston/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", diff --git a/package.json b/package.json index f1cd8014e4c0..daaa6d6cb8a7 100644 --- a/package.json +++ b/package.json @@ -116,6 +116,7 @@ "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.3", "tsx": "^4.19.2", + "winston": "^3.17.0", "yaml": "^2.3.4" }, "devDependencies": { diff --git a/scripts/compose.ts b/scripts/compose.ts index 6b0ece21507e..a06acd69fee0 100644 --- a/scripts/compose.ts +++ b/scripts/compose.ts @@ -7,6 +7,8 @@ import fs from 'fs'; import inquirer from 'inquirer'; import moment from 'moment'; +import { logger } from './utils/logger'; + /** * Type definition for the answers from the compose prompt. */ @@ -159,7 +161,7 @@ inquirer }); }) .catch((error) => { - console.error(error); + logger.error(error); if (error.isTtyError) { console.log("Prompt couldn't be rendered in the current environment"); } else { diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index d90cb77f91f7..89da0c1be7ae 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -15,6 +15,7 @@ import type { } from '@/types/scripts/dashboard'; import { pause } from '../utils'; +import { logger } from '../utils/logger'; import { Queries } from './issue-queries'; const currentFilePath = fileURLToPath(import.meta.url); @@ -86,7 +87,7 @@ async function getDiscussions( return result.search.nodes.concat(await getDiscussions(query, pageSize, result.search.pageInfo.endCursor)); } catch (e) { - console.error(e); + logger.error(e); return Promise.reject(e); } @@ -109,7 +110,7 @@ async function getDiscussionByID(isPR: boolean, id: string): Promise { const isValid = await validate(tool); if (!isValid) { - console.error({ - message: 'Tool validation failed', - tool: tool.title, - source: 'manual-tools.json', - errors: validate.errors, - note: 'Script continues execution, error logged for investigation' - }); + logger.error( + JSON.stringify({ + message: 'Tool validation failed', + tool: tool.title, + source: 'manual-tools.json', + errors: validate.errors, + note: 'Script continues execution, error logged for investigation' + }), + null, + 2 + ); return null; } diff --git a/scripts/tools/tools-object.ts b/scripts/tools/tools-object.ts index 14c8f8043ce4..c70ef634b941 100644 --- a/scripts/tools/tools-object.ts +++ b/scripts/tools/tools-object.ts @@ -6,6 +6,7 @@ import Fuse from 'fuse.js'; import type { AsyncAPITool, ToolsData, ToolsListObject } from '@/types/scripts/tools'; import { convertToJson } from '../utils'; +import { logger } from '../utils/logger'; import { categoryList } from './categorylist'; import schema from './tools-schema.json'; @@ -128,14 +129,13 @@ async function convertTools(data: ToolsData) { }) ); } else { - console.error('Script is not failing, it is just dropping errors for further investigation'); - console.error('Invalid .asyncapi-tool file.'); - console.error(`Located in: ${tool.html_url}`); - console.error('Validation errors:', JSON.stringify(validate.errors, null, 2)); + logger.warn( + `Script is not failing, it is just dropping errors for further investigation.\nInvalid .asyncapi-tool file. \nLocated in: ${tool.html_url}. \nValidation errors: ${JSON.stringify(validate.errors, null, 2)}` + ); } } } catch (err) { - console.error(err); + logger.error(err); throw err; } }) diff --git a/scripts/utils/logger.ts b/scripts/utils/logger.ts new file mode 100644 index 000000000000..753a34c80bbf --- /dev/null +++ b/scripts/utils/logger.ts @@ -0,0 +1,18 @@ +import winston from 'winston'; + +const { combine, timestamp, printf, colorize, align } = winston.format; + +const logger = winston.createLogger({ + level: process.env.LOG_LEVEL || 'info', + format: combine( + colorize({ level: true }), + timestamp({ + format: 'YYYY-MM-DD hh:mm:ss.SSS A' + }), + align(), + printf((info) => `[${info.timestamp}] ${info.level}: ${info.message}`) + ), + transports: [new winston.transports.Console()] +}); + +export { logger }; diff --git a/tests/dashboard/build-dashboard.test.js b/tests/dashboard/build-dashboard.test.js index b8f2f0a96ab4..5ba5d06d906d 100644 --- a/tests/dashboard/build-dashboard.test.js +++ b/tests/dashboard/build-dashboard.test.js @@ -20,6 +20,11 @@ const { fullDiscussionDetails, mockRateLimitResponse } = require("../fixtures/dashboardData") +const { logger } = require('../../scripts/utils/logger'); + +jest.mock('../../scripts/utils/logger', () => ({ + logger: { error: jest.fn() } +})) jest.mock('@octokit/graphql'); @@ -188,9 +193,13 @@ describe('GitHub Discussions Processing', () => { await expect(getHotDiscussions([undefined])).rejects.toThrow(); - expect(consoleErrorSpy).toHaveBeenCalledWith( - 'there were some issues while parsing this item: undefined' - ); + // expect(consoleErrorSpy).toHaveBeenCalledWith( + // 'there were some issues while parsing this item: undefined' + // ); + + expect(logger.error).toHaveBeenCalledWith( + 'there were some issues while parsing this item: undefined' + ); localConsoleErrorSpy.mockRestore(); }); diff --git a/tests/markdown/check-markdown.test.js b/tests/markdown/check-markdown.test.js index 85e06b70383f..fee9db977f5c 100644 --- a/tests/markdown/check-markdown.test.js +++ b/tests/markdown/check-markdown.test.js @@ -8,6 +8,11 @@ const { validateDocs, checkMarkdownFiles } = require('../../scripts/markdown/check-markdown'); +const { logger } = require('../../scripts/utils/logger'); + +jest.mock('../../scripts/utils/logger', () => ({ + logger: { error: jest.fn() } +})) describe('Frontmatter Validator', () => { let tempDir; @@ -87,7 +92,7 @@ describe('Frontmatter Validator', () => { await expect(checkMarkdownFiles(invalidFolderPath, validateBlogs)) .rejects.toThrow('ENOENT'); - expect(mockConsoleError.mock.calls[0][0]).toContain('Error in directory'); + expect(logger.error.mock.calls[0][0]).toContain('Error in directory'); }); it('skips the "reference/specification" folder during validation', async () => { @@ -110,10 +115,11 @@ describe('Frontmatter Validator', () => { const mockReadFile = jest.spyOn(fs, 'readFile').mockRejectedValue(new Error('Test readFile error')); await expect(checkMarkdownFiles(tempDir, validateBlogs)).rejects.toThrow('Test readFile error'); - expect(mockConsoleError).toHaveBeenCalledWith( + expect(logger.error).toHaveBeenCalledWith( expect.stringContaining(`Error in directory`), expect.any(Error) ); + // expect(logger.error).toHaveBeenCalledWith('Error in directory', expect.any(Error)); mockReadFile.mockRestore(); }); @@ -125,10 +131,12 @@ describe('Frontmatter Validator', () => { expect(mockProcessExit).toHaveBeenCalledWith(1); - expect(mockConsoleError).toHaveBeenCalledWith( - 'Failed to validate markdown files:', - expect.any(Error) - ); + // expect(mockConsoleError).toHaveBeenCalledWith( + // 'Failed to validate markdown files:', + // expect.any(Error) + // ); + + expect(logger.error).toHaveBeenCalledWith('Failed to validate markdown files:', expect.any(Error)); }); it('should handle successful main function execution', async () => { diff --git a/tests/tools/combine-tools.test.js b/tests/tools/combine-tools.test.js index 622067a57462..bb69df5df514 100644 --- a/tests/tools/combine-tools.test.js +++ b/tests/tools/combine-tools.test.js @@ -19,6 +19,11 @@ const { manualToolsWithInvalidURLT11, circularTool } = require('../fixtures/combineToolsData'); +const { logger } = require('../../scripts/utils/logger'); + +jest.mock('../../scripts/utils/logger', () => ({ + logger: { error: jest.fn() } +})) jest.mock('ajv', () => { return jest.fn().mockImplementation(() => ({ @@ -111,7 +116,9 @@ describe('combineTools function', () => { it('should log validation errors to console.error', async () => { await combineTools(automatedToolsT4, manualToolsT4, toolsPath, tagsPath); - const { message, tool, source, note } = console.error.mock.calls[0][0]; + const { message, tool, source, note } = JSON.parse(logger.error.mock.calls[0][0]); + // console.log(a); + // const { message, tool, source, note } = console.error.mock.calls[0][0]; expect(message).toBe('Tool validation failed'); expect(tool).toBe('Invalid Tool'); diff --git a/tests/tools/tools-object.test.js b/tests/tools/tools-object.test.js index 2577a2a27d94..d6cf2190b307 100644 --- a/tests/tools/tools-object.test.js +++ b/tests/tools/tools-object.test.js @@ -7,6 +7,13 @@ const { createMalformedYAML } = require('../helper/toolsObjectData'); +const { logger } = require('../../scripts/utils/logger'); + +jest.mock('../../scripts/utils/logger', () => ({ + logger: { warn: jest.fn(), error: jest.fn() } +})) + + jest.mock('axios'); jest.mock('../../scripts/tools/categorylist', () => ({ categoryList: [ @@ -81,8 +88,12 @@ describe('Tools Object', () => { await convertTools(mockData); - expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Script is not failing')); - expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Invalid .asyncapi-tool file')); + // expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Script is not failing')); + // expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Invalid .asyncapi-tool file')); + + expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining( + "Script is not failing, it is just dropping errors for further investigation.\nInvalid .asyncapi-tool file.") + ) }); it('should add duplicate tool objects to the same category', async () => { @@ -140,20 +151,20 @@ describe('Tools Object', () => { title: 'No Description Tool', description: '', }); - + const repositoryDescription = 'Fallback Repository Description'; const mockData = createMockData([{ name: '.asyncapi-tool-no-description', repoName: 'no-description', description: repositoryDescription }]); - + axios.get.mockResolvedValue({ data: toolFile }); - + const result = await convertTools(mockData); - + const toolObject = result.Category1.toolsList[0]; - + expect(toolObject.description).toBe(repositoryDescription); expect(toolObject.title).toBe('No Description Tool'); }); From cc1ff86d382714268b0e27a0edb037dd4134ab45 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 12 Jan 2025 10:28:57 +0530 Subject: [PATCH 163/183] feat(logging): replace console log with Winston logger for GitHub rate limit warnings --- scripts/dashboard/build-dashboard.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index 89da0c1be7ae..84bae2ff31d3 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -68,12 +68,12 @@ async function getDiscussions( }); if (result.rateLimit.remaining <= 100) { - console.log( - '[WARNING] GitHub GraphQL rateLimit', - `cost = ${result.rateLimit.cost}`, - `limit = ${result.rateLimit.limit}`, - `remaining = ${result.rateLimit.remaining}`, - `resetAt = ${result.rateLimit.resetAt}` + logger.warn( + 'GitHub GraphQL rateLimit \n' + + `cost = ${result.rateLimit.cost}\n` + + `limit = ${result.rateLimit.limit}\n` + + `remaining = ${result.rateLimit.remaining}\n` + + `resetAt = ${result.rateLimit.resetAt}` ); } From 35b1605ca11b0e0fde04ceb791340e7cbb2e01e2 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 12 Jan 2025 10:39:42 +0530 Subject: [PATCH 164/183] test(logging): update tests to use Winston logger for warnings and errors --- tests/dashboard/build-dashboard.test.js | 16 +++++----------- tests/tools/tools-object.test.js | 3 --- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/tests/dashboard/build-dashboard.test.js b/tests/dashboard/build-dashboard.test.js index 5ba5d06d906d..a1a19d8d6627 100644 --- a/tests/dashboard/build-dashboard.test.js +++ b/tests/dashboard/build-dashboard.test.js @@ -23,7 +23,7 @@ const { const { logger } = require('../../scripts/utils/logger'); jest.mock('../../scripts/utils/logger', () => ({ - logger: { error: jest.fn() } + logger: { error: jest.fn(), warn: jest.fn() } })) jest.mock('@octokit/graphql'); @@ -81,12 +81,10 @@ describe('GitHub Discussions Processing', () => { await getDiscussions('test-query', 10); - expect(consoleLogSpy).toHaveBeenCalledWith( - '[WARNING] GitHub GraphQL rateLimit', - 'cost = 1', - 'limit = 5000', - 'remaining = 50', - expect.any(String) + expect(logger.warn).toHaveBeenCalledWith( + expect.stringContaining( + `GitHub GraphQL rateLimit \ncost = 1\nlimit = 5000\nremaining = 50` + ) ); }); @@ -193,10 +191,6 @@ describe('GitHub Discussions Processing', () => { await expect(getHotDiscussions([undefined])).rejects.toThrow(); - // expect(consoleErrorSpy).toHaveBeenCalledWith( - // 'there were some issues while parsing this item: undefined' - // ); - expect(logger.error).toHaveBeenCalledWith( 'there were some issues while parsing this item: undefined' ); diff --git a/tests/tools/tools-object.test.js b/tests/tools/tools-object.test.js index d6cf2190b307..f3517aaf5897 100644 --- a/tests/tools/tools-object.test.js +++ b/tests/tools/tools-object.test.js @@ -88,9 +88,6 @@ describe('Tools Object', () => { await convertTools(mockData); - // expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Script is not failing')); - // expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Invalid .asyncapi-tool file')); - expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining( "Script is not failing, it is just dropping errors for further investigation.\nInvalid .asyncapi-tool file.") ) From feadb64d0e244924f2bbcd7e0e4dbb7c08e6d1e5 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 12 Jan 2025 10:48:29 +0530 Subject: [PATCH 165/183] fix: use optional chaining for comments pageInfo in processHotDiscussions function --- scripts/dashboard/build-dashboard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index 84bae2ff31d3..55534d6db97f 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -128,7 +128,7 @@ async function processHotDiscussions(batch: HotDiscussionsIssuesNode[]) { // eslint-disable-next-line no-underscore-dangle const isPR = discussion.__typename === 'PullRequest'; - if (discussion.comments.pageInfo!.hasNextPage) { + if (discussion.comments.pageInfo?.hasNextPage) { const fetchedDiscussion = await getDiscussionByID(isPR, discussion.id); // eslint-disable-next-line no-param-reassign From 5618c7c0220e881aba4a2b766098b4acd9d68898 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 12 Jan 2025 10:55:23 +0530 Subject: [PATCH 166/183] refactor: improve type definitions for tools in combine-tools.ts --- scripts/tools/combine-tools.ts | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 4f56010baabe..a883f10f16a5 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -5,7 +5,13 @@ import addFormats from 'ajv-formats'; import fs from 'fs'; import Fuse from 'fuse.js'; -import type { AsyncAPITool, FinalAsyncAPITool, FinalToolsListObject, LanguageColorItem } from '@/types/scripts/tools'; +import type { + AsyncAPITool, + FinalAsyncAPITool, + FinalToolsListObject, + LanguageColorItem, + ToolsListObject +} from '@/types/scripts/tools'; import { logger } from '../utils/logger'; import { categoryList } from './categorylist'; @@ -133,7 +139,7 @@ async function getFinalTool(toolObject: AsyncAPITool): Promise { +const processManualTool = async (tool: AsyncAPITool) => { const isValid = await validate(tool); if (!isValid) { @@ -163,12 +169,17 @@ const processManualTool = async (tool: any) => { * Combine the automated tools and manual tools list into a single JSON object file, and * lists down all the language and technology tags in one JSON file. * - * @param {any} automatedTools - The list of automated tools. - * @param {any} manualTools - The list of manual tools. + * @param {ToolsListObject} automatedTools - The list of automated tools. + * @param {ToolsListObject} manualTools - The list of manual tools. * @param {string} toolsPath - The path to save the combined tools JSON file. * @param {string} tagsPath - The path to save the tags JSON file. */ -const combineTools = async (automatedTools: any, manualTools: any, toolsPath: string, tagsPath: string) => { +const combineTools = async ( + automatedTools: ToolsListObject, + manualTools: ToolsListObject, + toolsPath: string, + tagsPath: string +) => { try { // eslint-disable-next-line no-restricted-syntax for (const key in automatedTools) { @@ -179,8 +190,8 @@ const combineTools = async (automatedTools: any, manualTools: any, toolsPath: st : []; finalTools[key].toolsList = [...automatedResults, ...manualResults].sort((tool, anotherTool) => - tool.title.localeCompare(anotherTool.title) - ); + tool!.title.localeCompare(anotherTool!.title) + ) as FinalAsyncAPITool[]; } } fs.writeFileSync(toolsPath, JSON.stringify(finalTools)); From 19325be97b0871d96463b09469d6b5362b17e98c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Sun, 12 Jan 2025 14:35:00 +0530 Subject: [PATCH 167/183] refactor(jest): remove 'node' from moduleFileExtensions in jest.config.js --- jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index b342774397f7..45bc1b4ace7e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -9,7 +9,7 @@ const config = { collectCoverageFrom: ['scripts/**/*.ts'], coveragePathIgnorePatterns: ['scripts/compose.ts', 'scripts/tools/categorylist.ts', 'scripts/tools/tags-color.ts'], testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'] + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'] }; export default config; From cb5f3999465e2ebbbe4d92722c1ddcad2fb43141 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 14:06:03 +0530 Subject: [PATCH 168/183] refactor(logging): replace console.log with logger in scripts --- .eslintrc | 3 +-- scripts/build-meetings.ts | 4 +++- scripts/build-newsroom-videos.ts | 4 +++- scripts/compose.ts | 6 +++--- scripts/dashboard/build-dashboard.ts | 4 ++-- scripts/markdown/check-markdown.ts | 4 ++-- scripts/tools/extract-tools-github.ts | 4 +++- tests/dashboard/build-dashboard.test.js | 3 ++- tests/markdown/check-markdown.test.js | 4 ++-- 9 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.eslintrc b/.eslintrc index a6efca3eae9d..c507546dbfef 100644 --- a/.eslintrc +++ b/.eslintrc @@ -316,8 +316,7 @@ { "files": ["scripts/**/*"], "rules": { - "import/no-extraneous-dependencies": "off", - "no-console": "off" + "import/no-extraneous-dependencies": "off" } } ] diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index 4be72627008b..0bbc0e48b8ba 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -3,6 +3,8 @@ import { google } from 'googleapis'; import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; +import { logger } from './utils/logger'; + const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); @@ -68,7 +70,7 @@ async function buildMeetings(writePath: string) { const eventsForHuman = JSON.stringify(eventsItems, null, ' '); - console.log('The following events got fetched', eventsForHuman); + logger.info(`The following events got fetched: ${eventsForHuman}`); writeFileSync(writePath, eventsForHuman); } catch (err) { diff --git a/scripts/build-newsroom-videos.ts b/scripts/build-newsroom-videos.ts index c6e91dd8d1c0..5809b7478c23 100644 --- a/scripts/build-newsroom-videos.ts +++ b/scripts/build-newsroom-videos.ts @@ -5,6 +5,8 @@ import { dirname, resolve } from 'path'; import process from 'process'; import { fileURLToPath } from 'url'; +import { logger } from './utils/logger'; + const currentFilePath = fileURLToPath(import.meta.url); const currentDirPath = dirname(currentFilePath); @@ -60,7 +62,7 @@ async function buildNewsroomVideos(writePath: string) { const videoData = JSON.stringify(videoDataItems, null, ' '); - console.log('The following are the Newsroom Youtube videos: ', videoData); + logger.info(`The following are the Newsroom Youtube videos: ${videoData}`); writeFileSync(writePath, videoData); diff --git a/scripts/compose.ts b/scripts/compose.ts index a06acd69fee0..4a08f8bf75e6 100644 --- a/scripts/compose.ts +++ b/scripts/compose.ts @@ -156,15 +156,15 @@ inquirer if (err) { throw err; } else { - console.log(`Blog post generated successfully at ${filePath}`); + logger.info(`Blog post generated successfully at ${filePath}`); } }); }) .catch((error) => { logger.error(error); if (error.isTtyError) { - console.log("Prompt couldn't be rendered in the current environment"); + logger.error("Prompt couldn't be rendered in the current environment"); } else { - console.log('Something went wrong, sorry!'); + logger.error('Something went wrong, sorry!'); } }); diff --git a/scripts/dashboard/build-dashboard.ts b/scripts/dashboard/build-dashboard.ts index 55534d6db97f..5a561354512d 100644 --- a/scripts/dashboard/build-dashboard.ts +++ b/scripts/dashboard/build-dashboard.ts @@ -254,8 +254,8 @@ async function start(writePath: string): Promise { await writeToFile({ hotDiscussions, goodFirstIssues }, writePath); } catch (e) { - console.log('There were some issues parsing data from github.'); - console.log(e); + logger.error('There were some issues parsing data from github.'); + logger.error(e); } } diff --git a/scripts/markdown/check-markdown.ts b/scripts/markdown/check-markdown.ts index 5af722eb536e..45a0cda99d70 100644 --- a/scripts/markdown/check-markdown.ts +++ b/scripts/markdown/check-markdown.ts @@ -149,8 +149,8 @@ async function checkMarkdownFiles( const errors = validateFunction(frontmatter as FrontMatter); if (errors) { - console.log(`Errors in file ${relativeFilePath}:`); - errors.forEach((error) => console.log(` - ${error}`)); + logger.warn(`Errors in file ${relativeFilePath}:`); + errors.forEach((error) => logger.warn(` - ${error}`)); process.exitCode = 1; } } diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index d72660ae7ee7..fa4f5d644f84 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -3,6 +3,7 @@ import axios from 'axios'; import dotenv from 'dotenv'; import { pause } from '../utils'; +import { logger } from '../utils/logger'; dotenv.config(); @@ -34,7 +35,8 @@ export async function getData(): Promise { while (allItems.length < totalResults) { page++; - console.log('Fetching page:', page); + + logger.info(`Fetching page: ${page}`); // pause for 1 second to avoid rate limiting await pause(1000); const nextPageData = await axios.get(getReqUrl(maxPerPage, page), { diff --git a/tests/dashboard/build-dashboard.test.js b/tests/dashboard/build-dashboard.test.js index a1a19d8d6627..5f22a00fa180 100644 --- a/tests/dashboard/build-dashboard.test.js +++ b/tests/dashboard/build-dashboard.test.js @@ -119,7 +119,8 @@ describe('GitHub Discussions Processing', () => { const filePath = resolve(tempDir, 'error-output.json'); await start(filePath); - expect(consoleLogSpy).toHaveBeenCalledWith('There were some issues parsing data from github.'); + // expect(consoleLogSpy).toHaveBeenCalledWith('There were some issues parsing data from github.'); + expect(logger.error).toHaveBeenCalledWith('There were some issues parsing data from github.'); }); it('should successfully process and write data', async () => { diff --git a/tests/markdown/check-markdown.test.js b/tests/markdown/check-markdown.test.js index fee9db977f5c..0f5fed7b064f 100644 --- a/tests/markdown/check-markdown.test.js +++ b/tests/markdown/check-markdown.test.js @@ -11,7 +11,7 @@ const { const { logger } = require('../../scripts/utils/logger'); jest.mock('../../scripts/utils/logger', () => ({ - logger: { error: jest.fn() } + logger: { error: jest.fn(), warn: jest.fn() } })) describe('Frontmatter Validator', () => { @@ -64,7 +64,7 @@ describe('Frontmatter Validator', () => { await checkMarkdownFiles(tempDir, validateBlogs); - expect(mockConsoleLog).toHaveBeenCalledWith(expect.stringContaining('Errors in file invalid.md:')); + expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('Errors in file invalid.md:')); mockConsoleLog.mockRestore(); }); From b5bb7b09fd19f3ef468e8e56d330941fb73a07a5 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 15:36:37 +0530 Subject: [PATCH 169/183] fix(docs): simplify error handling in buildNavTree function --- scripts/build-docs.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/build-docs.ts b/scripts/build-docs.ts index 1180a2f333ed..2bfccc933a7a 100644 --- a/scripts/build-docs.ts +++ b/scripts/build-docs.ts @@ -112,11 +112,7 @@ function buildNavTree(navItems: Details[]) { return tree; } catch (err) { - if (err instanceof Error) { - throw new Error(`Failed to build navigation tree: ${err.message}`); - } else { - throw new Error(`Failed to build navigation tree: ${err}`); - } + throw new Error(`Failed to build navigation tree: ${err}`); } } From 15fc37183485e12239f362075ee25c0f89885419 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 15:46:57 +0530 Subject: [PATCH 170/183] fix(errors): simplify error handling in buildMeetings and convertTools functions --- scripts/build-meetings.ts | 6 +----- scripts/tools/tools-object.ts | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/scripts/build-meetings.ts b/scripts/build-meetings.ts index 0bbc0e48b8ba..a3b4193a02a4 100644 --- a/scripts/build-meetings.ts +++ b/scripts/build-meetings.ts @@ -26,11 +26,7 @@ async function buildMeetings(writePath: string) { calendar = google.calendar({ version: 'v3', auth }); } catch (err) { - if (err instanceof Error) { - throw new Error(`Authentication failed: ${err.message}`); - } else { - throw new Error(`Authentication failed: ${err}`); - } + throw new Error(`Authentication failed: ${err}`); } let eventsItems; diff --git a/scripts/tools/tools-object.ts b/scripts/tools/tools-object.ts index c70ef634b941..f68d1a786799 100644 --- a/scripts/tools/tools-object.ts +++ b/scripts/tools/tools-object.ts @@ -143,11 +143,7 @@ async function convertTools(data: ToolsData) { return finalToolsObject; } catch (err) { - if (err instanceof Error) { - throw new Error(`Error processing tool: ${err.message}`); - } else { - throw new Error(`Error processing tool: ${err}`); - } + throw new Error(`Error processing tool: ${err}`); } } From af6f3d5a5cd598547a0cabcc8c19ecdd135102d7 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 16:17:41 +0530 Subject: [PATCH 171/183] fix(errors): simplify error handling in buildFinanceInfoList function --- scripts/finance/index.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/finance/index.ts b/scripts/finance/index.ts index 3f71e57633c8..0e9081898730 100644 --- a/scripts/finance/index.ts +++ b/scripts/finance/index.ts @@ -46,10 +46,6 @@ export async function buildFinanceInfoList({ await writeJSON(expensesLinkPath, expensesLinkJsonPath); } catch (err) { - if (err instanceof Error) { - throw new Error(`Error in buildFinanceInfoList: ${err.message}`); - } else { - throw new Error(`Error in buildFinanceInfoList: ${err}`); - } + throw new Error(`Error in buildFinanceInfoList: ${err}`); } } From 37c7a0705d25df6ed322df56ce18b4b46a671e26 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 18:57:57 +0530 Subject: [PATCH 172/183] fix(validation): return errors when frontmatter is missing in validateBlogs function --- scripts/markdown/check-markdown.ts | 2 ++ tests/markdown/check-markdown.test.js | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/markdown/check-markdown.ts b/scripts/markdown/check-markdown.ts index 45a0cda99d70..9578ccb6ca45 100644 --- a/scripts/markdown/check-markdown.ts +++ b/scripts/markdown/check-markdown.ts @@ -48,6 +48,8 @@ function validateBlogs(frontmatter: FrontMatter) { if (!frontmatter) { errors.push('Frontmatter is missing'); + + return errors; } // Check for required attributes diff --git a/tests/markdown/check-markdown.test.js b/tests/markdown/check-markdown.test.js index 0f5fed7b064f..4eb6259b5c66 100644 --- a/tests/markdown/check-markdown.test.js +++ b/tests/markdown/check-markdown.test.js @@ -131,11 +131,6 @@ describe('Frontmatter Validator', () => { expect(mockProcessExit).toHaveBeenCalledWith(1); - // expect(mockConsoleError).toHaveBeenCalledWith( - // 'Failed to validate markdown files:', - // expect.any(Error) - // ); - expect(logger.error).toHaveBeenCalledWith('Failed to validate markdown files:', expect.any(Error)); }); @@ -155,4 +150,10 @@ describe('Frontmatter Validator', () => { expect(isValidURL('www.example.com')).toBe(false); }); + it('should throw an error if frontmatter is missing', ()=>{ + const errors = validateBlogs(undefined) + expect(errors).toEqual( + ['Frontmatter is missing'] + ); + }) }); From e870cbc5dd79191788470d1cd66c8eeff8d01948 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 19:00:38 +0530 Subject: [PATCH 173/183] test(validation): update frontmatter validation test for consistency --- tests/markdown/check-markdown.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/markdown/check-markdown.test.js b/tests/markdown/check-markdown.test.js index 4eb6259b5c66..bbb1c8f3604b 100644 --- a/tests/markdown/check-markdown.test.js +++ b/tests/markdown/check-markdown.test.js @@ -150,10 +150,10 @@ describe('Frontmatter Validator', () => { expect(isValidURL('www.example.com')).toBe(false); }); - it('should throw an error if frontmatter is missing', ()=>{ - const errors = validateBlogs(undefined) - expect(errors).toEqual( - ['Frontmatter is missing'] - ); - }) + it('should throw an error if frontmatter is missing', ()=>{ + const errors = validateBlogs(undefined) + expect(errors).toEqual( + ['Frontmatter is missing'] + ); + }) }); From 0275113b0dfb2b9b2a41aaf14e8da399e6b12dfb Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 19:32:18 +0530 Subject: [PATCH 174/183] test(meetings): add error handling tests for invalid data structure and missing start.dateTime --- tests/build-meetings.test.js | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/build-meetings.test.js b/tests/build-meetings.test.js index bd4d9db5b1ec..c6e774686734 100644 --- a/tests/build-meetings.test.js +++ b/tests/build-meetings.test.js @@ -2,7 +2,7 @@ const { google } = require('googleapis'); const path = require("path"); const { readFileSync, mkdirSync, rmSync } = require('fs'); const { buildMeetings } = require('../scripts/build-meetings'); -const { mockEvents, expectedContent } = require('../tests/fixtures/meetingsData'); +const { mockEvents, expectedContent } = require("./fixtures/meetingsData"); jest.mock('googleapis', () => { const events = { @@ -114,4 +114,34 @@ describe('buildMeetings', () => { } }); + it('should throw an error if the data structure received from Google Calendar API is invalid', async () => { + const mockCalendar = google.calendar().events.list; + mockCalendar.mockResolvedValueOnce({ + data: { + items: null // or {} or any non-array value to trigger the error + } + }); + + await expect(buildMeetings('/path/to/write')).rejects.toThrow('Invalid data structure received from Google Calendar API'); + }); + + it('should throw an error if start.dateTime is missing in the event', async () => { + const mockCalendar = google.calendar().events.list; + mockCalendar.mockResolvedValueOnce({ + data: { + items: [ + { + summary: 'Test Event', + htmlLink: 'http://example.com/event', + // start.dateTime is intentionally missing to trigger the error + start: {} + } + ] + } + }); + + await expect(buildMeetings('/path/to/write')).rejects.toThrow('start.dateTime is missing in the event'); + }); + + }); From c764d3573a796ef0767729b11529b5bc42c2d268 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 20:02:29 +0530 Subject: [PATCH 175/183] fix(videos): improve error handling for missing video properties and add test for YOUTUBE_TOKEN --- scripts/build-newsroom-videos.ts | 15 ++++----------- tests/build-newsroom-videos.test.js | 11 +++++++++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/build-newsroom-videos.ts b/scripts/build-newsroom-videos.ts index 5809b7478c23..f7e3e4e463b4 100644 --- a/scripts/build-newsroom-videos.ts +++ b/scripts/build-newsroom-videos.ts @@ -45,18 +45,11 @@ async function buildNewsroomVideos(writePath: string) { } const videoDataItems = data.items.map((video: youtube_v3.Schema$SearchResult) => { - if (!video.snippet?.thumbnails?.high?.url) { - throw new Error(`Missing thumbnail URL for video: ${video.id?.videoId ?? 'unknown'}`); - } - if (!video.id?.videoId) { - throw new Error(`Missing video ID for video: ${video.snippet?.title ?? 'unknown'}`); - } - return { - image_url: video.snippet.thumbnails.high.url, - title: video.snippet.title, - description: video.snippet.description, - videoId: video.id.videoId + image_url: video.snippet?.thumbnails?.high?.url, + title: video.snippet?.title, + description: video.snippet?.description, + videoId: video.id?.videoId }; }); diff --git a/tests/build-newsroom-videos.test.js b/tests/build-newsroom-videos.test.js index 188bc2dffc70..00d04f533ac6 100644 --- a/tests/build-newsroom-videos.test.js +++ b/tests/build-newsroom-videos.test.js @@ -1,9 +1,9 @@ const { readFileSync, removeSync, mkdirpSync, outputFileSync } = require('fs-extra'); const { resolve, join } = require('path'); -const { buildNewsroomVideos } = require('../scripts/build-newsroom-videos'); -const { mockApiResponse, expectedResult } = require('./fixtures/newsroomData'); const fetch = require('node-fetch-2'); const os = require('os'); +const { buildNewsroomVideos } = require('../scripts/build-newsroom-videos'); +const { mockApiResponse, expectedResult } = require('./fixtures/newsroomData'); jest.mock('node-fetch-2', () => jest.fn()); @@ -99,4 +99,11 @@ describe('buildNewsroomVideos', () => { expect(err.message).toMatch(/ENOENT|EACCES/); } }); + + it('should throw an error if YOUTUBE_TOKEN environment variable is not set', async () => { + delete process.env.YOUTUBE_TOKEN; + await expect(buildNewsroomVideos('/path/to/write')).rejects.toThrow('YOUTUBE_TOKEN environment variable is required'); + process.env.YOUTUBE_TOKEN = 'testkey'; + }); + }); From a8a0c64bbdf9b7b3b24fd55917dc9a148fd83d4a Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 20:04:54 +0530 Subject: [PATCH 176/183] test(videos): remove unnecessary whitespace in buildNewsroomVideos test --- tests/build-newsroom-videos.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/build-newsroom-videos.test.js b/tests/build-newsroom-videos.test.js index 00d04f533ac6..3baaab30327c 100644 --- a/tests/build-newsroom-videos.test.js +++ b/tests/build-newsroom-videos.test.js @@ -105,5 +105,4 @@ describe('buildNewsroomVideos', () => { await expect(buildNewsroomVideos('/path/to/write')).rejects.toThrow('YOUTUBE_TOKEN environment variable is required'); process.env.YOUTUBE_TOKEN = 'testkey'; }); - }); From 522f2c1880fe263e5807bac979cb9e11fef26875 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Wed, 15 Jan 2025 21:43:19 +0530 Subject: [PATCH 177/183] test(github): add pagination test for getData function and mock logger --- scripts/tools/extract-tools-github.ts | 9 ---- tests/tools/extract-tools-github.test.js | 56 +++++++++++++++++++++++- 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/scripts/tools/extract-tools-github.ts b/scripts/tools/extract-tools-github.ts index fa4f5d644f84..1e74402d645d 100644 --- a/scripts/tools/extract-tools-github.ts +++ b/scripts/tools/extract-tools-github.ts @@ -52,15 +52,6 @@ export async function getData(): Promise { return result.data; } catch (err) { - if (axios.isAxiosError(err)) { - if (err.response?.status === 403) { - throw new Error('GitHub API rate limit exceeded. Please try again later.'); - } - if (err.response?.status === 401) { - throw new Error('Invalid GitHub token. Please check your GITHUB_TOKEN.'); - } - throw new Error(`GitHub API error: ${err.response?.data?.message || err.message}`); - } throw err; } } diff --git a/tests/tools/extract-tools-github.test.js b/tests/tools/extract-tools-github.test.js index 1c630f405571..f707bb59e729 100644 --- a/tests/tools/extract-tools-github.test.js +++ b/tests/tools/extract-tools-github.test.js @@ -1,5 +1,10 @@ const axios = require('axios'); const { getData } = require('../../scripts/tools/extract-tools-github'); +const { logger } = require('../../scripts/utils/logger'); + +jest.mock('../../scripts/utils/logger', () => ({ + logger: { info: jest.fn() } +})) jest.mock('axios'); @@ -8,7 +13,7 @@ describe('getData', () => { const mockData = { data: { - items:[ + items: [ { name: '.asyncapi-tool', path: 'asyncapi/.asyncapi-tool', @@ -34,6 +39,55 @@ describe('getData', () => { ); }); + it('should return data when API call is successful, when items are more then one page', async () => { + const mockInitialResponse = { + data: { + total_count: 100, + items: Array.from({ length: 50 }, (_, index) => ({ + name: `.asyncapi-tool-${index + 1}`, + path: `asyncapi/.asyncapi-tool-${index + 1}` + })) + } + }; + + const mockNextPageResponse = { + data: { + items: Array.from({ length: 50 }, (_, index) => ({ + name: `.asyncapi-tool-${index + 51}`, + path: `asyncapi/.asyncapi-tool-${index + 51}` + })) + } + }; + + const apiBaseUrl = 'https://api.github.com/search/code?q=filename:.asyncapi-tool&per_page=50&page='; + const headers = { + accept: 'application/vnd.github.text-match+json', + authorization: `token ${process.env.GITHUB_TOKEN}`, + }; + + axios.get + .mockResolvedValueOnce(mockInitialResponse) + .mockResolvedValueOnce(mockNextPageResponse); + + const result = await getData(); + + // Check if the logger was called with the correct page numbers + expect(logger.info).toHaveBeenCalledWith('Fetching page: 2'); + + // Check if axios.get was called with the correct URLs + expect(axios.get).toHaveBeenCalledWith( + `${apiBaseUrl}1`, + { headers } + ); + expect(axios.get).toHaveBeenCalledWith( + `${apiBaseUrl}2`, + { headers } + ); + + // Check if the result contains all the items from both pages + expect(result.items).toHaveLength(150); + + }); it('should throw an error when API call fails', async () => { const mockError = new Error('Error'); From 8939a79c445fa98534f6ef7e584a77d9ffb05ac7 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 16 Jan 2025 15:08:11 +0530 Subject: [PATCH 178/183] test(tools): add test for createToolObject with single parameter --- tests/tools/tools-object.test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/tools/tools-object.test.js b/tests/tools/tools-object.test.js index f3517aaf5897..f64220c544d7 100644 --- a/tests/tools/tools-object.test.js +++ b/tests/tools/tools-object.test.js @@ -58,6 +58,26 @@ describe('Tools Object', () => { expect(result).toEqual(expected); }); + it('should create a tool object one parameters', async () => { + // We will pass only the first parameter in the createToolObject + const toolFile = createToolFileContent({ + title: 'Test Tool', + description: 'Test Description', + hasCommercial: true, + additionalLinks: { docsUrl: 'https://docs.example.com' } + }); + + const expected = createExpectedToolObject({ + title: 'Test Tool', + description: 'Test Description', + hasCommercial: true, + additionalLinks: { docsUrl: 'https://docs.example.com' } + }); + expected.filters.isAsyncAPIOwner = "" + const result = await createToolObject(toolFile); + expect(result).toEqual(expected); + + }); it('should convert tools data correctly', async () => { const toolContent = createToolFileContent({ title: 'Valid Tool', categories: ['Category1'] }); From f7ffdc3c74d67c1277c600f5a492e7d55fe46a2c Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Thu, 16 Jan 2025 15:52:16 +0530 Subject: [PATCH 179/183] fix(tools): add istanbul ignore comments to enhance test coverage --- scripts/tools/combine-tools.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index a883f10f16a5..a44f35362c1d 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -89,6 +89,7 @@ async function getFinalTool(toolObject: AsyncAPITool): Promise Date: Thu, 16 Jan 2025 17:06:39 +0530 Subject: [PATCH 180/183] fix(tools): simplify language and technology filter checks in getFinalTool function --- scripts/tools/combine-tools.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index a44f35362c1d..73889f354a23 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -67,7 +67,7 @@ async function getFinalTool(toolObject: AsyncAPITool): Promise 0) { @@ -115,8 +114,7 @@ async function getFinalTool(toolObject: AsyncAPITool): Promise 0) { @@ -185,7 +183,6 @@ const combineTools = async ( try { // eslint-disable-next-line no-restricted-syntax for (const key in automatedTools) { - /* istanbul ignore next */ if (Object.prototype.hasOwnProperty.call(automatedTools, key)) { const automatedResults = await Promise.all(automatedTools[key].toolsList.map(getFinalTool)); const manualResults = manualTools[key]?.toolsList?.length From a879d00b34e7124a32889813c3e6779c3ed1e108 Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 17 Jan 2025 13:38:47 +0530 Subject: [PATCH 181/183] feat(tools): export getFinalTool function and enhance test for handling tools with missing data --- scripts/tools/combine-tools.ts | 3 +- tests/fixtures/combineToolsData.js | 117 ++++++++++++++++------------- tests/tools/combine-tools.test.js | 15 +++- 3 files changed, 80 insertions(+), 55 deletions(-) diff --git a/scripts/tools/combine-tools.ts b/scripts/tools/combine-tools.ts index 73889f354a23..4e29a4dc4272 100644 --- a/scripts/tools/combine-tools.ts +++ b/scripts/tools/combine-tools.ts @@ -55,7 +55,7 @@ let technologyFuse = new Fuse(technologyList, options); * @param {AsyncAPITool} toolObject - The tool object to process. * @returns {Promise} - The processed tool object with additional properties. */ -async function getFinalTool(toolObject: AsyncAPITool): Promise { +export async function getFinalTool(toolObject: AsyncAPITool): Promise { const finalObject: FinalAsyncAPITool = { ...toolObject, filters: { @@ -183,6 +183,7 @@ const combineTools = async ( try { // eslint-disable-next-line no-restricted-syntax for (const key in automatedTools) { + /* istanbul ignore next */ if (Object.prototype.hasOwnProperty.call(automatedTools, key)) { const automatedResults = await Promise.all(automatedTools[key].toolsList.map(getFinalTool)); const manualResults = manualTools[key]?.toolsList?.length diff --git a/tests/fixtures/combineToolsData.js b/tests/fixtures/combineToolsData.js index 452764ac9192..e395c3677908 100644 --- a/tests/fixtures/combineToolsData.js +++ b/tests/fixtures/combineToolsData.js @@ -3,34 +3,34 @@ const expectedDataT1 = { { name: 'JavaScript', color: 'bg-[#57f281]', - borderColor: 'border-[#37f069]', + borderColor: 'border-[#37f069]' }, { name: 'Python', color: 'bg-[#3572A5]', - borderColor: 'border-[#3572A5]', - }, + borderColor: 'border-[#3572A5]' + } ], technologies: [ { name: 'Node.js', color: 'bg-[#61d0f2]', - borderColor: 'border-[#40ccf7]', + borderColor: 'border-[#40ccf7]' }, { name: 'Flask', color: 'bg-[#000000]', - borderColor: 'border-[#FFFFFF]', - }, - ], + borderColor: 'border-[#FFFFFF]' + } + ] }; const manualToolsWithMissingData = [ { title: 'Tool C', filters: {}, - links: { repoUrl: 'https://github.com/asyncapi/tool-c' }, - }, + links: { repoUrl: 'https://github.com/asyncapi/tool-c' } + } ]; const manualToolsToSort = { @@ -40,31 +40,31 @@ const manualToolsToSort = { { title: 'Tool Z', filters: { language: 'JavaScript' }, - links: { repoUrl: 'https://github.com/asyncapi/tool-z' }, + links: { repoUrl: 'https://github.com/asyncapi/tool-z' } }, { title: 'Tool A', filters: { language: 'Python' }, - links: { repoUrl: 'https://github.com/asyncapi/tool-a' }, - }, - ], - }, + links: { repoUrl: 'https://github.com/asyncapi/tool-a' } + } + ] + } }; const toolWithMultipleLanguages = { title: 'Multi-Language Tool', filters: { language: ['JavaScript', 'Python', 'NewLanguage'], - technology: ['Node.js'], + technology: ['Node.js'] }, - links: { repoUrl: 'https://github.com/example/multi-language-tool' }, + links: { repoUrl: 'https://github.com/example/multi-language-tool' } }; const automatedToolsT5 = { category1: { description: 'Category 1 Description', - toolsList: [toolWithMultipleLanguages], - }, + toolsList: [toolWithMultipleLanguages] + } }; const invalidToolT4 = { title: 'Invalid Tool' }; @@ -72,96 +72,96 @@ const invalidToolT4 = { title: 'Invalid Tool' }; const automatedToolsT4 = { category1: { description: 'Category 1 Description', - toolsList: [], - }, + toolsList: [] + } }; const manualToolsT4 = { category1: { - toolsList: [invalidToolT4], - }, + toolsList: [invalidToolT4] + } }; const toolWithNewTagsT6 = { title: 'New Tags Tool', filters: { language: 'NewLanguage', - technology: ['NewTechnology'], + technology: ['NewTechnology'] }, - links: { repoUrl: 'https://github.com/example/new-tags-tool' }, + links: { repoUrl: 'https://github.com/example/new-tags-tool' } }; const automatedToolsT6 = { category1: { description: 'Category 1 Description', - toolsList: [toolWithNewTagsT6], - }, + toolsList: [toolWithNewTagsT6] + } }; const toolWithNewLanguageT7 = { title: 'New Language Tool', filters: { language: 'Go', - technology: ['Node.js'], + technology: ['Node.js'] }, - links: { repoUrl: 'https://github.com/example/new-language-tool' }, + links: { repoUrl: 'https://github.com/example/new-language-tool' } }; const automatedToolsT7 = { category1: { description: 'Category 1 Description', - toolsList: [toolWithNewLanguageT7], - }, + toolsList: [toolWithNewLanguageT7] + } }; const validToolT8 = { title: 'Valid Tool', filters: { language: 'JavaScript', - technology: ['Node.js'], + technology: ['Node.js'] }, - links: { repoUrl: 'https://github.com/asyncapi/valid-tool' }, + links: { repoUrl: 'https://github.com/asyncapi/valid-tool' } }; const automatedToolsT8 = { category1: { description: 'Category 1 Description', - toolsList: [], - }, + toolsList: [] + } }; const manualToolsT8 = { category1: { - toolsList: [validToolT8], - }, + toolsList: [validToolT8] + } }; const toolWithoutRepoUrlT9 = { title: 'Tool Without Repo', filters: { language: 'Python', - technology: ['Flask'], + technology: ['Flask'] }, - links: {}, + links: {} }; const automatedToolsT9 = { category1: { description: 'Category 1 Description', - toolsList: [], - }, + toolsList: [] + } }; const manualToolsT9 = { category1: { - toolsList: [toolWithoutRepoUrlT9], - }, + toolsList: [toolWithoutRepoUrlT9] + } }; const invalidAutomatedToolsT10 = { invalidCategory: { description: 'Invalid Category Description', - toolsList: [], - }, + toolsList: [] + } }; const manualToolsWithInvalidURLT11 = { @@ -170,26 +170,40 @@ const manualToolsWithInvalidURLT11 = { { title: 'Tool with Invalid URL', filters: { language: 'JavaScript' }, - links: { repoUrl: 'invalid-url' }, - }, - ], - }, + links: { repoUrl: 'invalid-url' } + } + ] + } }; const circularTool = { title: 'Circular Tool', filters: { language: 'JavaScript', - technology: ['Node.js'], + technology: ['Node.js'] }, - links: { repoUrl: 'https://github.com/asyncapi/circular-tool' }, + links: { repoUrl: 'https://github.com/asyncapi/circular-tool' } }; const automatedToolsT12 = { category1: { description: 'Category 1', - toolsList: [circularTool], + toolsList: [circularTool] + } +}; + +const finalToolWithMissingData = { + 0: { + title: 'Tool C', + filters: {}, + links: { repoUrl: 'https://github.com/asyncapi/tool-c' } }, + filters: { + language: [], + technology: [], + categories: [], + hasCommercial: false + } }; module.exports = { @@ -209,4 +223,5 @@ module.exports = { automatedToolsT12, invalidAutomatedToolsT10, manualToolsWithInvalidURLT11, + finalToolWithMissingData }; diff --git a/tests/tools/combine-tools.test.js b/tests/tools/combine-tools.test.js index bb69df5df514..7470bd614a62 100644 --- a/tests/tools/combine-tools.test.js +++ b/tests/tools/combine-tools.test.js @@ -1,6 +1,6 @@ const fs = require('fs'); const path = require('path'); -const { combineTools } = require('../../scripts/tools/combine-tools'); +const { combineTools, getFinalTool } = require('../../scripts/tools/combine-tools'); const { expectedDataT1, manualToolsWithMissingData, @@ -17,12 +17,13 @@ const { automatedToolsT12, invalidAutomatedToolsT10, manualToolsWithInvalidURLT11, - circularTool + circularTool, + finalToolWithMissingData } = require('../fixtures/combineToolsData'); const { logger } = require('../../scripts/utils/logger'); jest.mock('../../scripts/utils/logger', () => ({ - logger: { error: jest.fn() } + logger: { error: jest.fn() } })) jest.mock('ajv', () => { @@ -232,5 +233,13 @@ describe('combineTools function', () => { await expect(combineTools(automatedToolsT12, {}, toolsPath, tagsPath)) .rejects.toThrow('Converting circular structure to JSON'); }); + it('should handle tools with missing data and filters', async () => { + manualToolsWithMissingData.filters = { + categories: [], + hasCommercial: false, + }; + const result = await getFinalTool(manualToolsWithMissingData); + expect(result).toEqual(finalToolWithMissingData); + }); }); From a4132d04dd458585fb685872459c1d6ba8f1b3ff Mon Sep 17 00:00:00 2001 From: JeelRajodiya Date: Fri, 17 Jan 2025 13:45:03 +0530 Subject: [PATCH 182/183] test(tools): remove unnecessary blank line in combineTools test suite --- tests/tools/combine-tools.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/tools/combine-tools.test.js b/tests/tools/combine-tools.test.js index 7470bd614a62..8c6fa8e9e315 100644 --- a/tests/tools/combine-tools.test.js +++ b/tests/tools/combine-tools.test.js @@ -241,5 +241,4 @@ describe('combineTools function', () => { const result = await getFinalTool(manualToolsWithMissingData); expect(result).toEqual(finalToolWithMissingData); }); - }); From d365f5d51ff95b803f2ba48e6832672562ac47c8 Mon Sep 17 00:00:00 2001 From: akshatnema Date: Fri, 17 Jan 2025 23:33:28 +0530 Subject: [PATCH 183/183] fixed lint errors --- tests/adopters/index.test.js | 4 +- tests/build-meetings.test.js | 230 +++++++++--------- tests/build-newsroom-videos.test.js | 2 +- tests/build-pages.test.js | 3 +- tests/build-rss.test.js | 60 +++-- tests/casestudies/index.test.js | 13 +- tests/dashboard/build-dashboard.test.js | 33 +-- tests/finance/index.test.js | 4 +- tests/fixtures/dashboardData.js | 114 +++++---- tests/index.test.js | 12 +- tests/markdown/check-markdown.test.js | 297 +++++++++++------------ tests/readAndWriteJson.test.js | 11 +- tests/tools/combine-tools.test.js | 39 ++- tests/tools/extract-tools-github.test.js | 36 +-- tests/tools/tools-object.test.js | 6 +- 15 files changed, 415 insertions(+), 449 deletions(-) diff --git a/tests/adopters/index.test.js b/tests/adopters/index.test.js index eb788b137368..d0f1cc40788f 100644 --- a/tests/adopters/index.test.js +++ b/tests/adopters/index.test.js @@ -1,6 +1,6 @@ const { resolve } = require('path'); -const { writeJSON } = require('../../scripts/utils/readAndWriteJson'); -const { buildAdoptersList } = require('../../scripts/adopters/index'); +const { writeJSON } = require('../../scripts/utils/readAndWriteJson.ts'); +const { buildAdoptersList } = require('../../scripts/adopters/index.ts'); jest.mock('../../scripts/utils/readAndWriteJson.ts'); diff --git a/tests/build-meetings.test.js b/tests/build-meetings.test.js index c6e774686734..9d35f75123ec 100644 --- a/tests/build-meetings.test.js +++ b/tests/build-meetings.test.js @@ -1,147 +1,147 @@ const { google } = require('googleapis'); -const path = require("path"); +const path = require('path'); const { readFileSync, mkdirSync, rmSync } = require('fs'); -const { buildMeetings } = require('../scripts/build-meetings'); -const { mockEvents, expectedContent } = require("./fixtures/meetingsData"); +const { buildMeetings } = require('../scripts/build-meetings.ts'); +const { mockEvents, expectedContent } = require('./fixtures/meetingsData'); jest.mock('googleapis', () => { - const events = { - list: jest.fn(), - }; - const calendar = { - events, - }; - const google = { - calendar: jest.fn(() => calendar), - auth: { - GoogleAuth: jest.fn(() => ({ - getClient: jest.fn(), - })), - }, - }; - return { google }; + const events = { + list: jest.fn() + }; + const calendar = { + events + }; + const google = { + calendar: jest.fn(() => calendar), + auth: { + GoogleAuth: jest.fn(() => ({ + getClient: jest.fn() + })) + } + }; + return { google }; }); describe('buildMeetings', () => { - const testDir = path.join(__dirname, 'testCache'); - const outputFilePath = path.join(testDir, 'meetings.json'); + const testDir = path.join(__dirname, 'testCache'); + const outputFilePath = path.join(testDir, 'meetings.json'); - beforeEach(() => { - jest.clearAllMocks(); - process.env.CALENDAR_SERVICE_ACCOUNT = JSON.stringify({ key: 'test_key' }); - process.env.CALENDAR_ID = 'test_calendar_id'; + beforeEach(() => { + jest.clearAllMocks(); + process.env.CALENDAR_SERVICE_ACCOUNT = JSON.stringify({ key: 'test_key' }); + process.env.CALENDAR_ID = 'test_calendar_id'; - mkdirSync(testDir, { recursive: true }); - }); - - afterEach(() => { - rmSync(testDir, { recursive: true, force: true }); - }); + mkdirSync(testDir, { recursive: true }); + }); - it('should fetch events, process them, and write to a file', async () => { - google.calendar().events.list.mockResolvedValue({ data: { items: mockEvents } }); + afterEach(() => { + rmSync(testDir, { recursive: true, force: true }); + }); - await buildMeetings(outputFilePath); + it('should fetch events, process them, and write to a file', async () => { + google.calendar().events.list.mockResolvedValue({ data: { items: mockEvents } }); - expect(google.auth.GoogleAuth).toHaveBeenCalledWith({ - scopes: ['https://www.googleapis.com/auth/calendar'], - credentials: { key: 'test_key' }, - }); - expect(google.calendar).toHaveBeenCalled(); - expect(google.calendar().events.list).toHaveBeenCalledWith({ - calendarId: 'test_calendar_id', - timeMax: expect.any(String), - timeMin: expect.any(String), - }); + await buildMeetings(outputFilePath); - const fileContent = readFileSync(outputFilePath, 'utf8'); - const parsedContent = JSON.parse(fileContent); - - expect(parsedContent).toEqual(expectedContent); + expect(google.auth.GoogleAuth).toHaveBeenCalledWith({ + scopes: ['https://www.googleapis.com/auth/calendar'], + credentials: { key: 'test_key' } }); - - it('should throw an error if the Google API call fails', async () => { - google.calendar().events.list.mockRejectedValue(new Error('Google API error')); - - try { - await buildMeetings(outputFilePath) - } catch (err) { - expect(err.message).toContain('Google API error'); - } + expect(google.calendar).toHaveBeenCalled(); + expect(google.calendar().events.list).toHaveBeenCalledWith({ + calendarId: 'test_calendar_id', + timeMax: expect.any(String), + timeMin: expect.any(String) }); - it('should handle undefined CALENDAR_SERVICE_ACCOUNT', async () => { - delete process.env.CALENDAR_SERVICE_ACCOUNT; + const fileContent = readFileSync(outputFilePath, 'utf8'); + const parsedContent = JSON.parse(fileContent); - google.calendar().events.list.mockResolvedValue({ data: { items: [] } }); + expect(parsedContent).toEqual(expectedContent); + }); - await buildMeetings(outputFilePath); + it('should throw an error if the Google API call fails', async () => { + google.calendar().events.list.mockRejectedValue(new Error('Google API error')); - expect(google.auth.GoogleAuth).toHaveBeenCalledWith({ - scopes: ['https://www.googleapis.com/auth/calendar'], - credentials: undefined, - }); + try { + await buildMeetings(outputFilePath); + } catch (err) { + expect(err.message).toContain('Google API error'); + } + }); - const fileContent = readFileSync(outputFilePath, 'utf8'); - expect(fileContent).toBe('[]'); - }); - - it('should throw an error if authentication fails', async () => { - google.auth.GoogleAuth.mockImplementation(() => { - throw new Error('Authentication failed'); - }); - - try { - await buildMeetings(outputFilePath) - } catch (err) { - expect(err.message).toContain('Authentication failed') - } - }); - - it('should handle file write errors', async () => { - google.auth.GoogleAuth.mockImplementation(() => ({ - getClient: jest.fn(), - })); + it('should handle undefined CALENDAR_SERVICE_ACCOUNT', async () => { + delete process.env.CALENDAR_SERVICE_ACCOUNT; - google.calendar().events.list.mockResolvedValue({ data: { items: mockEvents } }); + google.calendar().events.list.mockResolvedValue({ data: { items: [] } }); - const invalidPath = '/root/invalid_dir/meetings.json'; + await buildMeetings(outputFilePath); - try { - await buildMeetings(invalidPath); - } catch (err) { - expect(err.message).toMatch(/ENOENT|EACCES/); - } + expect(google.auth.GoogleAuth).toHaveBeenCalledWith({ + scopes: ['https://www.googleapis.com/auth/calendar'], + credentials: undefined }); - it('should throw an error if the data structure received from Google Calendar API is invalid', async () => { - const mockCalendar = google.calendar().events.list; - mockCalendar.mockResolvedValueOnce({ - data: { - items: null // or {} or any non-array value to trigger the error - } - }); + const fileContent = readFileSync(outputFilePath, 'utf8'); + expect(fileContent).toBe('[]'); + }); - await expect(buildMeetings('/path/to/write')).rejects.toThrow('Invalid data structure received from Google Calendar API'); + it('should throw an error if authentication fails', async () => { + google.auth.GoogleAuth.mockImplementation(() => { + throw new Error('Authentication failed'); }); - it('should throw an error if start.dateTime is missing in the event', async () => { - const mockCalendar = google.calendar().events.list; - mockCalendar.mockResolvedValueOnce({ - data: { - items: [ - { - summary: 'Test Event', - htmlLink: 'http://example.com/event', - // start.dateTime is intentionally missing to trigger the error - start: {} - } - ] - } - }); - - await expect(buildMeetings('/path/to/write')).rejects.toThrow('start.dateTime is missing in the event'); + try { + await buildMeetings(outputFilePath); + } catch (err) { + expect(err.message).toContain('Authentication failed'); + } + }); + + it('should handle file write errors', async () => { + google.auth.GoogleAuth.mockImplementation(() => ({ + getClient: jest.fn() + })); + + google.calendar().events.list.mockResolvedValue({ data: { items: mockEvents } }); + + const invalidPath = '/root/invalid_dir/meetings.json'; + + try { + await buildMeetings(invalidPath); + } catch (err) { + expect(err.message).toMatch(/ENOENT|EACCES/); + } + }); + + it('should throw an error if the data structure received from Google Calendar API is invalid', async () => { + const mockCalendar = google.calendar().events.list; + mockCalendar.mockResolvedValueOnce({ + data: { + items: null // or {} or any non-array value to trigger the error + } }); + await expect(buildMeetings('/path/to/write')).rejects.toThrow( + 'Invalid data structure received from Google Calendar API' + ); + }); + + it('should throw an error if start.dateTime is missing in the event', async () => { + const mockCalendar = google.calendar().events.list; + mockCalendar.mockResolvedValueOnce({ + data: { + items: [ + { + summary: 'Test Event', + htmlLink: 'http://example.com/event', + // start.dateTime is intentionally missing to trigger the error + start: {} + } + ] + } + }); + await expect(buildMeetings('/path/to/write')).rejects.toThrow('start.dateTime is missing in the event'); + }); }); diff --git a/tests/build-newsroom-videos.test.js b/tests/build-newsroom-videos.test.js index 3baaab30327c..b32d5ef45612 100644 --- a/tests/build-newsroom-videos.test.js +++ b/tests/build-newsroom-videos.test.js @@ -2,7 +2,7 @@ const { readFileSync, removeSync, mkdirpSync, outputFileSync } = require('fs-ext const { resolve, join } = require('path'); const fetch = require('node-fetch-2'); const os = require('os'); -const { buildNewsroomVideos } = require('../scripts/build-newsroom-videos'); +const { buildNewsroomVideos } = require('../scripts/build-newsroom-videos.ts'); const { mockApiResponse, expectedResult } = require('./fixtures/newsroomData'); jest.mock('node-fetch-2', () => jest.fn()); diff --git a/tests/build-pages.test.js b/tests/build-pages.test.js index 15b559fc03ff..a6fc8d2ec523 100644 --- a/tests/build-pages.test.js +++ b/tests/build-pages.test.js @@ -55,5 +55,4 @@ describe('copyAndRenameFiles', () => { // delete the test directory after the test fs.rmSync(NEW_TEST_DIR, { recursive: true, force: true }); }); - -}); \ No newline at end of file +}); diff --git a/tests/build-rss.test.js b/tests/build-rss.test.js index b091756b618a..08b88de54efa 100644 --- a/tests/build-rss.test.js +++ b/tests/build-rss.test.js @@ -1,7 +1,7 @@ const fs = require('fs'); const path = require('path'); const { XMLParser } = require('fast-xml-parser'); -const { rssFeed } = require('../scripts/build-rss'); +const { rssFeed } = require('../scripts/build-rss.ts'); const parser = new XMLParser({ ignoreAttributes: false }); const { mockRssData, title, type, desc, missingDateMockData, incompletePostMockData } = require('./fixtures/rssData'); @@ -21,7 +21,7 @@ describe('rssFeed', () => { afterAll(async () => { try { const files = await fs.promises.readdir(testOutputDir); - await Promise.all(files.map(file => fs.promises.unlink(path.join(testOutputDir, file)))); + await Promise.all(files.map((file) => fs.promises.unlink(path.join(testOutputDir, file)))); await fs.promises.rmdir(testOutputDir); } catch (err) { throw new Error(`Error while deleting temp dir: ${err.message}`); @@ -33,10 +33,9 @@ describe('rssFeed', () => { }); it('should generate RSS feed and write to file', async () => { - jest.doMock('../config/posts.json', () => mockRssData, { virtual: true }); - await expect(rssFeed(type, title, desc, outputPath)).resolves.toBeUndefined() + await expect(rssFeed(type, title, desc, outputPath)).resolves.toBeUndefined(); const filePath = path.join(__dirname, '..', 'public', outputPath); expect(fs.existsSync(filePath)).toBe(true); @@ -46,37 +45,37 @@ describe('rssFeed', () => { it('should prioritize featured posts over non-featured ones', async () => { jest.doMock('../config/posts.json', () => mockRssData, { virtual: true }); - + await expect(rssFeed(type, title, desc, outputPath)).resolves.toBeUndefined(); - + const filePath = path.join(__dirname, '..', 'public', outputPath); const fileContent = fs.readFileSync(filePath, 'utf8'); - + const parsedContent = parser.parse(fileContent); - const itemTitles = parsedContent.rss.channel.item.map(item => item.title); - + const itemTitles = parsedContent.rss.channel.item.map((item) => item.title); + expect(itemTitles[0]).toBe('Test Post 1'); expect(itemTitles[1]).toBe('Another Featured Post'); - + expect(itemTitles[2]).toBe('Post with Special Characters: & < > "'); expect(itemTitles[3]).toBe('Post with UTC Date Format'); expect(itemTitles[4]).toBe('Non-Featured Post 1'); expect(itemTitles[5]).toBe('Non-Featured Post 3'); }); - + it('should sort posts by date in descending order', async () => { jest.doMock('../config/posts.json', () => mockRssData, { virtual: true }); - + await expect(rssFeed(type, title, desc, outputPath)).resolves.toBeUndefined(); - + const filePath = path.join(__dirname, '..', 'public', outputPath); const fileContent = fs.readFileSync(filePath, 'utf8'); - + const parsedContent = parser.parse(fileContent); - const itemTitles = parsedContent.rss.channel.item.map(item => item.title); - + const itemTitles = parsedContent.rss.channel.item.map((item) => item.title); + expect(itemTitles[0]).toBe('Test Post 1'); - expect(itemTitles[1]).toBe('Another Featured Post') + expect(itemTitles[1]).toBe('Another Featured Post'); expect(itemTitles[2]).toBe('Post with Special Characters: & < > "'); expect(itemTitles[3]).toBe('Post with UTC Date Format'); expect(itemTitles[4]).toBe('Non-Featured Post 1'); @@ -86,7 +85,7 @@ describe('rssFeed', () => { it('should set correct enclosure type based on image extension', async () => { jest.doMock('../config/posts.json', () => mockRssData, { virtual: true }); - await expect(rssFeed(type, title, desc, outputPath)).resolves.toBeUndefined() + await expect(rssFeed(type, title, desc, outputPath)).resolves.toBeUndefined(); const filePath = path.join(__dirname, '..', 'public', outputPath); const fileContent = fs.readFileSync(filePath, 'utf8'); @@ -102,26 +101,28 @@ describe('rssFeed', () => { it('should catch and handle errors when write operation fails', async () => { jest.doMock('../config/posts.json', () => mockRssData, { virtual: true }); - const invalidOutputPath = "invalid/path"; + const invalidOutputPath = 'invalid/path'; await expect(rssFeed(type, title, desc, invalidOutputPath)).rejects.toThrow(/ENOENT|EACCES/); - }); it('should throw an error when posts.json is malformed', async () => { - jest.doMock('../config/posts.json', () => { - return { invalidKey: [] }; - }, { virtual: true }); + jest.doMock( + '../config/posts.json', + () => { + return { invalidKey: [] }; + }, + { virtual: true } + ); await expect(rssFeed(type, title, desc, outputPath)).rejects.toThrow('Failed to generate RSS feed'); - }); it('should handle empty posts array', async () => { const emptyMockData = { blog: [] }; jest.doMock('../config/posts.json', () => emptyMockData, { virtual: true }); - await expect(rssFeed(type, title, desc, outputPath)).resolves.toBeUndefined() + await expect(rssFeed(type, title, desc, outputPath)).resolves.toBeUndefined(); const filePath = path.join(__dirname, '..', 'public', outputPath); const fileContent = fs.readFileSync(filePath, 'utf8'); @@ -130,19 +131,16 @@ describe('rssFeed', () => { }); it('should throw an error when post is missing required fields', async () => { - jest.doMock('../config/posts.json', () => incompletePostMockData, { virtual: true }); await expect(rssFeed(type, title, desc, outputPath)).rejects.toThrow('Missing required fields'); - }); it('should throw an error when a post is missing a date field during sorting', async () => { - jest.doMock('../config/posts.json', () => missingDateMockData, { virtual: true }); - await expect(rssFeed(type, title, desc, outputPath)).rejects.toThrow('Failed to generate RSS feed: Missing date in posts: Post without Date'); - + await expect(rssFeed(type, title, desc, outputPath)).rejects.toThrow( + 'Failed to generate RSS feed: Missing date in posts: Post without Date' + ); }); - }); diff --git a/tests/casestudies/index.test.js b/tests/casestudies/index.test.js index 84181ec27c91..c25a25bdce62 100644 --- a/tests/casestudies/index.test.js +++ b/tests/casestudies/index.test.js @@ -1,7 +1,7 @@ const fs = require('fs').promises; const path = require('path'); -const { buildCaseStudiesList } = require('../../scripts/casestudies/index'); -const { yaml1,yaml2,json1,json2 } = require("../fixtures/caseStudyData"); +const { buildCaseStudiesList } = require('../../scripts/casestudies/index.ts'); +const { yaml1, yaml2, json1, json2 } = require('../fixtures/caseStudyData'); describe('buildCaseStudiesList', () => { const tempDir = path.join(__dirname, 'temp-test-dir'); @@ -21,7 +21,7 @@ describe('buildCaseStudiesList', () => { beforeEach(async () => { // Clear the config directory before each test const files = await fs.readdir(tempConfigDir); - await Promise.all(files.map(file => fs.unlink(path.join(tempConfigDir, file)))); + await Promise.all(files.map((file) => fs.unlink(path.join(tempConfigDir, file)))); }); it('should read YAML files and create a JSON file with case studies', async () => { @@ -42,7 +42,6 @@ describe('buildCaseStudiesList', () => { expect(outputJson[1]).toEqual(json2); }); - it('should throw an error with incorrect parameters', async () => { try { await buildCaseStudiesList('invalid-dir', tempOutputFile); @@ -72,9 +71,7 @@ describe('buildCaseStudiesList', () => { await buildCaseStudiesList(tempConfigDir, tempOutputFile); } catch (error) { expect(error).toBeInstanceOf(Error); - expect(error.message).toContain("Invalid content format"); // Error for invalid YAML content + expect(error.message).toContain('Invalid content format'); // Error for invalid YAML content } }); - - -}); \ No newline at end of file +}); diff --git a/tests/dashboard/build-dashboard.test.js b/tests/dashboard/build-dashboard.test.js index 5f22a00fa180..1af4f0f0cb32 100644 --- a/tests/dashboard/build-dashboard.test.js +++ b/tests/dashboard/build-dashboard.test.js @@ -11,7 +11,7 @@ const { writeToFile, getDiscussions, start -} = require('../../scripts/dashboard/build-dashboard'); +} = require('../../scripts/dashboard/build-dashboard.ts'); const { issues, @@ -19,12 +19,12 @@ const { discussionWithMoreComments, fullDiscussionDetails, mockRateLimitResponse -} = require("../fixtures/dashboardData") -const { logger } = require('../../scripts/utils/logger'); +} = require('../fixtures/dashboardData'); +const { logger } = require('../../scripts/utils/logger.ts'); jest.mock('../../scripts/utils/logger', () => ({ - logger: { error: jest.fn(), warn: jest.fn() } -})) + logger: { error: jest.fn(), warn: jest.fn() } +})); jest.mock('@octokit/graphql'); @@ -44,8 +44,8 @@ describe('GitHub Discussions Processing', () => { beforeEach(() => { jest.clearAllMocks(); - consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => { }); - consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => { }); + consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => {}); }); afterEach(() => { @@ -82,9 +82,7 @@ describe('GitHub Discussions Processing', () => { await getDiscussions('test-query', 10); expect(logger.warn).toHaveBeenCalledWith( - expect.stringContaining( - `GitHub GraphQL rateLimit \ncost = 1\nlimit = 5000\nremaining = 50` - ) + expect.stringContaining(`GitHub GraphQL rateLimit \ncost = 1\nlimit = 5000\nremaining = 50`) ); }); @@ -105,9 +103,7 @@ describe('GitHub Discussions Processing', () => { rateLimit: { remaining: 1000 } }; - graphql - .mockResolvedValueOnce(mockFirstResponse) - .mockResolvedValueOnce(mockSecondResponse); + graphql.mockResolvedValueOnce(mockFirstResponse).mockResolvedValueOnce(mockSecondResponse); const result = await getDiscussions('test-query', 10); expect(result).toHaveLength(2); @@ -120,7 +116,7 @@ describe('GitHub Discussions Processing', () => { await start(filePath); // expect(consoleLogSpy).toHaveBeenCalledWith('There were some issues parsing data from github.'); - expect(logger.error).toHaveBeenCalledWith('There were some issues parsing data from github.'); + expect(logger.error).toHaveBeenCalledWith('There were some issues parsing data from github.'); }); it('should successfully process and write data', async () => { @@ -149,7 +145,6 @@ describe('GitHub Discussions Processing', () => { }); it('should map good first issues', async () => { - const result = await mapGoodFirstIssues(issues); expect(result[0]).toMatchObject({ id: '1', @@ -192,16 +187,12 @@ describe('GitHub Discussions Processing', () => { await expect(getHotDiscussions([undefined])).rejects.toThrow(); - expect(logger.error).toHaveBeenCalledWith( - 'there were some issues while parsing this item: undefined' - ); + expect(logger.error).toHaveBeenCalledWith('there were some issues while parsing this item: undefined'); localConsoleErrorSpy.mockRestore(); }); it('should handle write failures gracefully', async () => { - await expect(writeToFile()).rejects.toThrow(); - }); - + }); }); diff --git a/tests/finance/index.test.js b/tests/finance/index.test.js index ecfca46454d8..0c22468aa330 100644 --- a/tests/finance/index.test.js +++ b/tests/finance/index.test.js @@ -1,6 +1,6 @@ const fs = require('fs'); const path = require('path'); -const { buildFinanceInfoList } = require('../../scripts/finance/index'); +const { buildFinanceInfoList } = require('../../scripts/finance/index.ts'); const { expensesYaml, expensesLinkYaml, expensesjson, expensesLinkjson } = require('../fixtures/financeData'); describe('buildFinanceInfoList', () => { @@ -102,4 +102,4 @@ describe('buildFinanceInfoList', () => { expect(error.message).toMatch(/YAMLException/); // Expecting a YAML parsing error } }); -}); \ No newline at end of file +}); diff --git a/tests/fixtures/dashboardData.js b/tests/fixtures/dashboardData.js index fa0618c299a9..60db2e11a575 100644 --- a/tests/fixtures/dashboardData.js +++ b/tests/fixtures/dashboardData.js @@ -1,68 +1,65 @@ const mockDiscussion = { - id: 'test-id', - __typename: 'Issue', - title: 'Test', - author: { login: 'author' }, - resourcePath: '/path', - repository: { name: 'repo' }, - assignees: { totalCount: 0 }, - reactions: { totalCount: 5 }, - comments: { - totalCount: 2, - nodes: [{ reactions: { totalCount: 1 } }], - pageInfo: { hasNextPage: false } - }, - labels: { nodes: [] }, - timelineItems: { updatedAt: new Date().toISOString() } + id: 'test-id', + __typename: 'Issue', + title: 'Test', + author: { login: 'author' }, + resourcePath: '/path', + repository: { name: 'repo' }, + assignees: { totalCount: 0 }, + reactions: { totalCount: 5 }, + comments: { + totalCount: 2, + nodes: [{ reactions: { totalCount: 1 } }], + pageInfo: { hasNextPage: false } + }, + labels: { nodes: [] }, + timelineItems: { updatedAt: new Date().toISOString() } }; const discussionWithMoreComments = { - id: 'paginated-discussion', - __typename: 'Issue', - title: 'Test with Pagination', - author: { login: 'author' }, - resourcePath: '/path', - repository: { name: 'repo' }, - assignees: { totalCount: 0 }, - reactions: { totalCount: 5 }, - comments: { - totalCount: 5, - nodes: [{ reactions: { totalCount: 1 } }], - pageInfo: { hasNextPage: true } - }, - labels: { nodes: [] }, - timelineItems: { updatedAt: new Date().toISOString() } + id: 'paginated-discussion', + __typename: 'Issue', + title: 'Test with Pagination', + author: { login: 'author' }, + resourcePath: '/path', + repository: { name: 'repo' }, + assignees: { totalCount: 0 }, + reactions: { totalCount: 5 }, + comments: { + totalCount: 5, + nodes: [{ reactions: { totalCount: 1 } }], + pageInfo: { hasNextPage: true } + }, + labels: { nodes: [] }, + timelineItems: { updatedAt: new Date().toISOString() } }; const fullDiscussionDetails = { - node: { - ...discussionWithMoreComments, - comments: { - totalCount: 5, - nodes: [ - { reactions: { totalCount: 1 } }, - { reactions: { totalCount: 2 } }, - { reactions: { totalCount: 3 } } - ], - pageInfo: { hasNextPage: false } - } + node: { + ...discussionWithMoreComments, + comments: { + totalCount: 5, + nodes: [{ reactions: { totalCount: 1 } }, { reactions: { totalCount: 2 } }, { reactions: { totalCount: 3 } }], + pageInfo: { hasNextPage: false } } + } }; const mockRateLimitResponse = { - search: { - nodes: [mockDiscussion], - pageInfo: { hasNextPage: false } - }, - rateLimit: { - cost: 1, - limit: 5000, - remaining: 50, - resetAt: new Date().toISOString() - } + search: { + nodes: [mockDiscussion], + pageInfo: { hasNextPage: false } + }, + rateLimit: { + cost: 1, + limit: 5000, + remaining: 50, + resetAt: new Date().toISOString() + } }; -const issues = [{ +const issues = [ + { id: '1', title: 'Test', assignees: { totalCount: 1 }, @@ -70,12 +67,13 @@ const issues = [{ repository: { name: 'repo' }, author: { login: 'author' }, labels: { nodes: [{ name: 'area/docs' }] } -}]; + } +]; module.exports = { - issues, - mockDiscussion, - discussionWithMoreComments, - fullDiscussionDetails, - mockRateLimitResponse + issues, + mockDiscussion, + discussionWithMoreComments, + fullDiscussionDetails, + mockRateLimitResponse }; diff --git a/tests/index.test.js b/tests/index.test.js index 936d10d141e7..d78ba273ffd6 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -1,10 +1,10 @@ const fs = require('fs'); -const { rssFeed } = require('../scripts/build-rss'); -const { buildPostList } = require('../scripts/build-post-list'); -const { buildCaseStudiesList } = require('../scripts/casestudies'); -const { buildAdoptersList } = require('../scripts/adopters'); -const { buildFinanceInfoList } = require('../scripts/finance'); -const { start } = require('../scripts/index'); +const { rssFeed } = require('../scripts/build-rss.ts'); +const { buildPostList } = require('../scripts/build-post-list.ts'); +const { buildCaseStudiesList } = require('../scripts/casestudies/index.ts'); +const { buildAdoptersList } = require('../scripts/adopters/index.ts'); +const { buildFinanceInfoList } = require('../scripts/finance/index.ts'); +const { start } = require('../scripts/index.ts'); jest.mock('../scripts/build-rss'); jest.mock('../scripts/build-post-list'); diff --git a/tests/markdown/check-markdown.test.js b/tests/markdown/check-markdown.test.js index bbb1c8f3604b..8c64b02879f7 100644 --- a/tests/markdown/check-markdown.test.js +++ b/tests/markdown/check-markdown.test.js @@ -2,158 +2,155 @@ const fs = require('fs').promises; const path = require('path'); const os = require('os'); const { - isValidURL, - main, - validateBlogs, - validateDocs, - checkMarkdownFiles -} = require('../../scripts/markdown/check-markdown'); -const { logger } = require('../../scripts/utils/logger'); + isValidURL, + main, + validateBlogs, + validateDocs, + checkMarkdownFiles +} = require('../../scripts/markdown/check-markdown.ts'); +const { logger } = require('../../scripts/utils/logger.ts'); jest.mock('../../scripts/utils/logger', () => ({ - logger: { error: jest.fn(), warn: jest.fn() } -})) + logger: { error: jest.fn(), warn: jest.fn() } +})); describe('Frontmatter Validator', () => { - let tempDir; - let mockConsoleError; - let mockProcessExit; - - beforeEach(async () => { - mockConsoleError = jest.spyOn(console, 'error').mockImplementation(); - mockProcessExit = jest.spyOn(process, 'exit').mockImplementation(); - tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'test-config')); - }); - - afterEach(async () => { - mockConsoleError.mockRestore(); - mockProcessExit.mockRestore(); - await fs.rm(tempDir, { recursive: true, force: true }); - }); - - it('validates authors array and returns specific errors', async () => { - const frontmatter = { - title: 'Test Blog', - date: '2024-01-01', - type: 'blog', - tags: ['test'], - cover: 'cover.jpg', - authors: [{ name: 'John' }, { photo: 'jane.jpg' }, { name: 'Bob', photo: 'bob.jpg', link: 'not-a-url' }] - }; - - const errors = validateBlogs(frontmatter); - expect(errors).toEqual(expect.arrayContaining([ - 'Author at index 0 is missing a photo', - 'Author at index 1 is missing a name', - 'Invalid URL for author at index 2: not-a-url' - ])); - }); - - it('validates docs frontmatter for required fields', async () => { - const frontmatter = { title: 123, weight: 'not-a-number' }; - const errors = validateDocs(frontmatter); - expect(errors).toEqual(expect.arrayContaining([ - 'Title is missing or not a string', - 'Weight is missing or not a number' - ])); - }); - - it('checks for errors in markdown files in a directory', async () => { - await fs.writeFile(path.join(tempDir, 'invalid.md'), `---\ntitle: Invalid Blog\n---`); - const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(); - - await checkMarkdownFiles(tempDir, validateBlogs); - - expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('Errors in file invalid.md:')); - mockConsoleLog.mockRestore(); - }); - - it('returns multiple validation errors for invalid blog frontmatter', async () => { - const frontmatter = { - title: 123, - date: 'invalid-date', - type: 'blog', - tags: 'not-an-array', - cover: ['not-a-string'], - authors: { name: 'John Doe' } - }; - const errors = validateBlogs(frontmatter); - - expect(errors).toEqual([ - 'Invalid date format: invalid-date', - 'Tags should be an array', - 'Cover must be a string', - 'Authors should be an array']); - }); - - it('logs error to console when an error occurs in checkMarkdownFiles', async () => { - const invalidFolderPath = path.join(tempDir, 'non-existent-folder'); - - await expect(checkMarkdownFiles(invalidFolderPath, validateBlogs)) - .rejects.toThrow('ENOENT'); - - expect(logger.error.mock.calls[0][0]).toContain('Error in directory'); - }); - - it('skips the "reference/specification" folder during validation', async () => { - const referenceSpecDir = path.join(tempDir, 'reference', 'specification'); - await fs.mkdir(referenceSpecDir, { recursive: true }); - await fs.writeFile(path.join(referenceSpecDir, 'skipped.md'), `---\ntitle: Skipped File\n---`); - - const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(); - - await checkMarkdownFiles(tempDir, validateDocs); - - expect(mockConsoleLog).not.toHaveBeenCalledWith(expect.stringContaining('Errors in file reference/specification/skipped.md')); - mockConsoleLog.mockRestore(); - }); - - it('logs and rejects when an exception occurs while processing a file', async () => { - const filePath = path.join(tempDir, 'invalid.md'); - await fs.writeFile(filePath, `---\ntitle: Valid Title\n---`); - - const mockReadFile = jest.spyOn(fs, 'readFile').mockRejectedValue(new Error('Test readFile error')); - - await expect(checkMarkdownFiles(tempDir, validateBlogs)).rejects.toThrow('Test readFile error'); - expect(logger.error).toHaveBeenCalledWith( - expect.stringContaining(`Error in directory`), - expect.any(Error) - ); - // expect(logger.error).toHaveBeenCalledWith('Error in directory', expect.any(Error)); - - mockReadFile.mockRestore(); - }); - - it('should handle main function errors and exit with status 1', async () => { - jest.spyOn(fs, 'readdir').mockRejectedValue(new Error('Test error')); - - await main(); - - expect(mockProcessExit).toHaveBeenCalledWith(1); - - expect(logger.error).toHaveBeenCalledWith('Failed to validate markdown files:', expect.any(Error)); - }); - - it('should handle successful main function execution', async () => { - - await main(); - - expect(mockConsoleError).not.toHaveBeenCalledWith(); - }); - - it('should return true or false for URLs', () => { - expect(isValidURL('http://example.com')).toBe(true); - expect(isValidURL('https://www.example.com')).toBe(true); - expect(isValidURL('ftp://ftp.example.com')).toBe(true); - expect(isValidURL('invalid-url')).toBe(false); - expect(isValidURL('/path/to/file')).toBe(false); - expect(isValidURL('www.example.com')).toBe(false); - }); - - it('should throw an error if frontmatter is missing', ()=>{ - const errors = validateBlogs(undefined) - expect(errors).toEqual( - ['Frontmatter is missing'] - ); - }) + let tempDir; + let mockConsoleError; + let mockProcessExit; + + beforeEach(async () => { + mockConsoleError = jest.spyOn(console, 'error').mockImplementation(); + mockProcessExit = jest.spyOn(process, 'exit').mockImplementation(); + tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'test-config')); + }); + + afterEach(async () => { + mockConsoleError.mockRestore(); + mockProcessExit.mockRestore(); + await fs.rm(tempDir, { recursive: true, force: true }); + }); + + it('validates authors array and returns specific errors', async () => { + const frontmatter = { + title: 'Test Blog', + date: '2024-01-01', + type: 'blog', + tags: ['test'], + cover: 'cover.jpg', + authors: [{ name: 'John' }, { photo: 'jane.jpg' }, { name: 'Bob', photo: 'bob.jpg', link: 'not-a-url' }] + }; + + const errors = validateBlogs(frontmatter); + expect(errors).toEqual( + expect.arrayContaining([ + 'Author at index 0 is missing a photo', + 'Author at index 1 is missing a name', + 'Invalid URL for author at index 2: not-a-url' + ]) + ); + }); + + it('validates docs frontmatter for required fields', async () => { + const frontmatter = { title: 123, weight: 'not-a-number' }; + const errors = validateDocs(frontmatter); + expect(errors).toEqual( + expect.arrayContaining(['Title is missing or not a string', 'Weight is missing or not a number']) + ); + }); + + it('checks for errors in markdown files in a directory', async () => { + await fs.writeFile(path.join(tempDir, 'invalid.md'), `---\ntitle: Invalid Blog\n---`); + const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(); + + await checkMarkdownFiles(tempDir, validateBlogs); + + expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('Errors in file invalid.md:')); + mockConsoleLog.mockRestore(); + }); + + it('returns multiple validation errors for invalid blog frontmatter', async () => { + const frontmatter = { + title: 123, + date: 'invalid-date', + type: 'blog', + tags: 'not-an-array', + cover: ['not-a-string'], + authors: { name: 'John Doe' } + }; + const errors = validateBlogs(frontmatter); + + expect(errors).toEqual([ + 'Invalid date format: invalid-date', + 'Tags should be an array', + 'Cover must be a string', + 'Authors should be an array' + ]); + }); + + it('logs error to console when an error occurs in checkMarkdownFiles', async () => { + const invalidFolderPath = path.join(tempDir, 'non-existent-folder'); + + await expect(checkMarkdownFiles(invalidFolderPath, validateBlogs)).rejects.toThrow('ENOENT'); + + expect(logger.error.mock.calls[0][0]).toContain('Error in directory'); + }); + + it('skips the "reference/specification" folder during validation', async () => { + const referenceSpecDir = path.join(tempDir, 'reference', 'specification'); + await fs.mkdir(referenceSpecDir, { recursive: true }); + await fs.writeFile(path.join(referenceSpecDir, 'skipped.md'), `---\ntitle: Skipped File\n---`); + + const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(); + + await checkMarkdownFiles(tempDir, validateDocs); + + expect(mockConsoleLog).not.toHaveBeenCalledWith( + expect.stringContaining('Errors in file reference/specification/skipped.md') + ); + mockConsoleLog.mockRestore(); + }); + + it('logs and rejects when an exception occurs while processing a file', async () => { + const filePath = path.join(tempDir, 'invalid.md'); + await fs.writeFile(filePath, `---\ntitle: Valid Title\n---`); + + const mockReadFile = jest.spyOn(fs, 'readFile').mockRejectedValue(new Error('Test readFile error')); + + await expect(checkMarkdownFiles(tempDir, validateBlogs)).rejects.toThrow('Test readFile error'); + expect(logger.error).toHaveBeenCalledWith(expect.stringContaining(`Error in directory`), expect.any(Error)); + // expect(logger.error).toHaveBeenCalledWith('Error in directory', expect.any(Error)); + + mockReadFile.mockRestore(); + }); + + it('should handle main function errors and exit with status 1', async () => { + jest.spyOn(fs, 'readdir').mockRejectedValue(new Error('Test error')); + + await main(); + + expect(mockProcessExit).toHaveBeenCalledWith(1); + + expect(logger.error).toHaveBeenCalledWith('Failed to validate markdown files:', expect.any(Error)); + }); + + it('should handle successful main function execution', async () => { + await main(); + + expect(mockConsoleError).not.toHaveBeenCalledWith(); + }); + + it('should return true or false for URLs', () => { + expect(isValidURL('http://example.com')).toBe(true); + expect(isValidURL('https://www.example.com')).toBe(true); + expect(isValidURL('ftp://ftp.example.com')).toBe(true); + expect(isValidURL('invalid-url')).toBe(false); + expect(isValidURL('/path/to/file')).toBe(false); + expect(isValidURL('www.example.com')).toBe(false); + }); + + it('should throw an error if frontmatter is missing', () => { + const errors = validateBlogs(undefined); + expect(errors).toEqual(['Frontmatter is missing']); + }); }); diff --git a/tests/readAndWriteJson.test.js b/tests/readAndWriteJson.test.js index dddaa2bd979e..bcdae70a2fd5 100644 --- a/tests/readAndWriteJson.test.js +++ b/tests/readAndWriteJson.test.js @@ -1,15 +1,15 @@ const fs = require('fs/promises'); -const { convertToJson } = require('../scripts/utils'); -const { writeJSON } = require("../scripts/utils/readAndWriteJson"); -const { yamlString, jsonObject } = require("./fixtures/utilsData"); +const { convertToJson } = require('../scripts/utils.ts'); +const { writeJSON } = require('../scripts/utils/readAndWriteJson.ts'); +const { yamlString, jsonObject } = require('./fixtures/utilsData'); jest.mock('fs/promises', () => ({ readFile: jest.fn(), - writeFile: jest.fn(), + writeFile: jest.fn() })); jest.mock('../scripts/utils', () => ({ - convertToJson: jest.fn(), + convertToJson: jest.fn() })); describe('writeJSON', () => { @@ -72,5 +72,4 @@ describe('writeJSON', () => { expect(fs.writeFile).toHaveBeenCalledWith(writePath, JSON.stringify(jsonObject)); }); - }); diff --git a/tests/tools/combine-tools.test.js b/tests/tools/combine-tools.test.js index 8c6fa8e9e315..0b14b4362a2f 100644 --- a/tests/tools/combine-tools.test.js +++ b/tests/tools/combine-tools.test.js @@ -1,6 +1,6 @@ const fs = require('fs'); const path = require('path'); -const { combineTools, getFinalTool } = require('../../scripts/tools/combine-tools'); +const { combineTools, getFinalTool } = require('../../scripts/tools/combine-tools.ts'); const { expectedDataT1, manualToolsWithMissingData, @@ -20,19 +20,18 @@ const { circularTool, finalToolWithMissingData } = require('../fixtures/combineToolsData'); -const { logger } = require('../../scripts/utils/logger'); +const { logger } = require('../../scripts/utils/logger.ts'); jest.mock('../../scripts/utils/logger', () => ({ logger: { error: jest.fn() } -})) +})); jest.mock('ajv', () => { return jest.fn().mockImplementation(() => ({ - compile: jest.fn().mockImplementation(() => (data) => data.title !== 'Invalid Tool'), + compile: jest.fn().mockImplementation(() => (data) => data.title !== 'Invalid Tool') })); }); - jest.mock('ajv-formats', () => { return jest.fn(); }); @@ -80,7 +79,7 @@ describe('combineTools function', () => { }); beforeEach(() => { - consoleErrorMock = jest.spyOn(console, 'error').mockImplementation(() => { }); + consoleErrorMock = jest.spyOn(console, 'error').mockImplementation(() => {}); }); afterEach(() => { @@ -96,7 +95,7 @@ describe('combineTools function', () => { const tagsData = readJSON(tagsPath); expect(tagsData).toHaveProperty('languages'); expect(tagsData).toHaveProperty('technologies'); - expect(tagsData).toEqual(expectedDataT1) + expect(tagsData).toEqual(expectedDataT1); }); it('should handle tools with missing language or technology', async () => { @@ -110,16 +109,14 @@ describe('combineTools function', () => { await combineTools(manualToolsToSort, {}, toolsPath, tagsPath); const combinedTools = readJSON(toolsPath); - const toolTitles = combinedTools.category1.toolsList.map(tool => tool.title); + const toolTitles = combinedTools.category1.toolsList.map((tool) => tool.title); expect(toolTitles).toEqual(['Tool A', 'Tool Z']); }); it('should log validation errors to console.error', async () => { await combineTools(automatedToolsT4, manualToolsT4, toolsPath, tagsPath); - const { message, tool, source, note } = JSON.parse(logger.error.mock.calls[0][0]); - // console.log(a); - // const { message, tool, source, note } = console.error.mock.calls[0][0]; + const { message, tool, source, note } = JSON.parse(logger.error.mock.calls[0][0]); expect(message).toBe('Tool validation failed'); expect(tool).toBe('Invalid Tool'); @@ -214,29 +211,31 @@ describe('combineTools function', () => { it('should throw an error when fs.writeFileSync fails', async () => { const invalidPath = 'this/is/not/valid'; - await expect(combineTools(automatedTools, manualTools, invalidPath, invalidPath)) - .rejects.toThrow(/ENOENT|EACCES/); + await expect(combineTools(automatedTools, manualTools, invalidPath, invalidPath)).rejects.toThrow(/ENOENT|EACCES/); }); it('should throw an error when there is an invalid category', async () => { - await expect(combineTools(invalidAutomatedToolsT10, manualTools, toolsPath, tagsPath)) - .rejects.toThrow('Error combining tools'); + await expect(combineTools(invalidAutomatedToolsT10, manualTools, toolsPath, tagsPath)).rejects.toThrow( + 'Error combining tools' + ); }); it('should throw an error when URL parsing fails', async () => { - await expect(combineTools(automatedTools, manualToolsWithInvalidURLT11, toolsPath, tagsPath)) - .rejects.toThrow('Invalid URL'); + await expect(combineTools(automatedTools, manualToolsWithInvalidURLT11, toolsPath, tagsPath)).rejects.toThrow( + 'Invalid URL' + ); }); it('should handle errors when processing tools with circular references', async () => { circularTool.circular = circularTool; - await expect(combineTools(automatedToolsT12, {}, toolsPath, tagsPath)) - .rejects.toThrow('Converting circular structure to JSON'); + await expect(combineTools(automatedToolsT12, {}, toolsPath, tagsPath)).rejects.toThrow( + 'Converting circular structure to JSON' + ); }); it('should handle tools with missing data and filters', async () => { manualToolsWithMissingData.filters = { categories: [], - hasCommercial: false, + hasCommercial: false }; const result = await getFinalTool(manualToolsWithMissingData); expect(result).toEqual(finalToolWithMissingData); diff --git a/tests/tools/extract-tools-github.test.js b/tests/tools/extract-tools-github.test.js index f707bb59e729..b81824204140 100644 --- a/tests/tools/extract-tools-github.test.js +++ b/tests/tools/extract-tools-github.test.js @@ -1,32 +1,31 @@ const axios = require('axios'); -const { getData } = require('../../scripts/tools/extract-tools-github'); -const { logger } = require('../../scripts/utils/logger'); +const { getData } = require('../../scripts/tools/extract-tools-github.ts'); +const { logger } = require('../../scripts/utils/logger.ts'); jest.mock('../../scripts/utils/logger', () => ({ logger: { info: jest.fn() } -})) +})); jest.mock('axios'); describe('getData', () => { it('should return data when API call is successful', async () => { - const mockData = { data: { items: [ { name: '.asyncapi-tool', - path: 'asyncapi/.asyncapi-tool', + path: 'asyncapi/.asyncapi-tool' } ], - total_count: 1, - }, + total_count: 1 + } }; const apiBaseUrl = 'https://api.github.com/search/code?q=filename:.asyncapi-tool&per_page=50&page=1'; const headers = { accept: 'application/vnd.github.text-match+json', - authorization: `token ${process.env.GITHUB_TOKEN}`, + authorization: `token ${process.env.GITHUB_TOKEN}` }; axios.get.mockResolvedValue(mockData); @@ -34,9 +33,7 @@ describe('getData', () => { const result = await getData(); expect(result).toEqual(mockData.data); - expect(axios.get).toHaveBeenCalledWith( - apiBaseUrl, { headers } - ); + expect(axios.get).toHaveBeenCalledWith(apiBaseUrl, { headers }); }); it('should return data when API call is successful, when items are more then one page', async () => { @@ -62,12 +59,10 @@ describe('getData', () => { const apiBaseUrl = 'https://api.github.com/search/code?q=filename:.asyncapi-tool&per_page=50&page='; const headers = { accept: 'application/vnd.github.text-match+json', - authorization: `token ${process.env.GITHUB_TOKEN}`, + authorization: `token ${process.env.GITHUB_TOKEN}` }; - axios.get - .mockResolvedValueOnce(mockInitialResponse) - .mockResolvedValueOnce(mockNextPageResponse); + axios.get.mockResolvedValueOnce(mockInitialResponse).mockResolvedValueOnce(mockNextPageResponse); const result = await getData(); @@ -75,18 +70,11 @@ describe('getData', () => { expect(logger.info).toHaveBeenCalledWith('Fetching page: 2'); // Check if axios.get was called with the correct URLs - expect(axios.get).toHaveBeenCalledWith( - `${apiBaseUrl}1`, - { headers } - ); - expect(axios.get).toHaveBeenCalledWith( - `${apiBaseUrl}2`, - { headers } - ); + expect(axios.get).toHaveBeenCalledWith(`${apiBaseUrl}1`, { headers }); + expect(axios.get).toHaveBeenCalledWith(`${apiBaseUrl}2`, { headers }); // Check if the result contains all the items from both pages expect(result.items).toHaveLength(150); - }); it('should throw an error when API call fails', async () => { diff --git a/tests/tools/tools-object.test.js b/tests/tools/tools-object.test.js index f64220c544d7..b2ce98909e7c 100644 --- a/tests/tools/tools-object.test.js +++ b/tests/tools/tools-object.test.js @@ -1,5 +1,5 @@ const axios = require('axios'); -const { convertTools, createToolObject } = require('../../scripts/tools/tools-object'); +const { convertTools, createToolObject } = require('../../scripts/tools/tools-object.ts'); const { createToolFileContent, createExpectedToolObject, @@ -7,7 +7,7 @@ const { createMalformedYAML } = require('../helper/toolsObjectData'); -const { logger } = require('../../scripts/utils/logger'); +const { logger } = require('../../scripts/utils/logger.ts'); jest.mock('../../scripts/utils/logger', () => ({ logger: { warn: jest.fn(), error: jest.fn() } @@ -76,7 +76,7 @@ describe('Tools Object', () => { expected.filters.isAsyncAPIOwner = "" const result = await createToolObject(toolFile); expect(result).toEqual(expected); - + }); it('should convert tools data correctly', async () => {