Skip to content

Commit

Permalink
feat: migrate script to typescript (asyncapi#3423) (asyncapi#3761)
Browse files Browse the repository at this point in the history
* refactor: migrate build script to typescript  (asyncapi#3423)

* fix eslint error

* rename

* rename

* fix eslint error

* add error type

* add new types

* add types

* refactor and fix eslint errors

* use google apis and add types

* remove console log

* add specific rules for the script folder

* refactor dir variables

* add types and refactor it

* refactor: update eslint rules

* reformat document

* update include paths

* use dynamic import

* reformat eslintrc

* update rules

* change tabs to spaces

* update ts node config

* migrate tools scripts

* refactor __dirname variable

* refactor function in build-rss

* add new package type

* Added error handling for undefined types

* add types

* refactor adopter/index.ts

* use tsx instead of ts-node

* add types for build RSS

* revert name

* fix name

* fix name

* fix name

* Original name

* Rename next-i18next.config.js to next-i18next.config.cjs

* migrate build-post-list.ts

* use old package-lock file

* No code changes made

* migrate check-markdown.ts

* feat: add TypeScript types for tools and categories

* update type

* feat: enhance type safety in combine-tools script with TypeScript types

* chore: disable eslint rule for no-await-in-loop in combine-tools script

* feat: improve type safety and refactor dashboard script functions

* feat: add TypeScript types for dashboard script and enhance type safety

* No code changes detected.

* update package json

* refactor: remove console log from buildPostList function

* fix: update workflow to conditionally install dependencies based on package.json existence

* chore: remove unused PowerShell script and TypeScript type definitions

* refactor: add type annotations to capitalizeJsxTags function parameters

* refactor: migrate build-docs

* refactor: remove unused URL validation function from check-markdown.ts

* chore: update Jest configuration and dependencies for TypeScript support

* chore: enable ES module support in Jest configuration

* chore: update Jest configuration for TypeScript file handling and coverage

* chore: update Jest configuration to set test environment to Node

* chore: enable ES module support in ts-jest transformer

* refactor: update case studies import to default export and improve type imports

* refactor: update Jest configuration for improved TypeScript support

* refactor: change imports to default exports for consistency

* refactor: update test imports to remove file extensions for consistency

* refactor: simplify Jest transform configuration for TypeScript files

* refactor: update dynamic import for manual tools and mock axios in tests

* refactor: update path resolution to use fileURLToPath for better compatibility

* refactor: update path resolution to use fileURLToPath for improved compatibility

* refactor: improve optional chaining usage and enhance tool validation logging

* refactor: enable ESM support in ts-jest transform configuration

* refactor: update ts-jest configuration to use ESNext module in tsconfig

* refactor: add support for ESM by updating Jest configuration and TypeScript target

* refactor: enhance Jest configuration for ESM support and improve module resolution

* refactor: update Jest configuration to use ES2022 module and target

* refactor: simplify JSON import in build-rss and remove debug log in combine-tools

* Revert "refactor: improve optional chaining usage and enhance tool validation logging"

This reverts commit d6b0e2a.

* refactor: update type definitions for discussions and improve null handling

* refactor: improve optional chaining for language filter in getFinalTool function

* refactor: clean up code formatting and improve consistency across utility functions

* refactor: change getData to an exported function and update TypeScript target version

* refactor: remove unused slugify function declaration from markdown-toc module

* refactor: update guid type in RSSItemType to include isPermaLink property

* refactor: replace manual path joining with path.join for better compatibility

* refactor: change parameter type of convertToJson function to unknown for better type safety

* refactor: add return type Promise<void> to buildFinanceInfoList function for better clarity

* refactor: use optional chaining for safer access to video properties in buildNewsroomVideos function

* refactor: simplify interfaces by introducing BasicIssueOrPR for shared properties

* refactor: enhance MarkdownToken interface with optional properties for better flexibility

* refactor: update tool handling by replacing dynamic import with JSON parsing and enhancing type definitions for better clarity and safety

* test: update mock path for readAndWriteJson to include file extension

* refactor: simplify Jest configuration by removing unnecessary options and streamlining transform settings

* refactor: update imports to use named exports for consistency and clarity

* refactor: simplify Jest configuration by utilizing ts-jest preset and removing unnecessary transform settings

* refactor: enhance type safety by casting imported JSON as 'any' in getAllPosts function

* refactor: enhance Jest configuration by integrating ts-jest preset with ESM support for JSON transformation

* refactor: enhance Jest configuration by enabling JSON module resolution in ts-jest preset

* refactor: simplify Jest configuration by removing JSON transform settings and adjusting transformIgnorePatterns

* refactor: update Jest configuration to specify tsconfig for ts-jest preset

* refactor: clean up test files by removing test directory after execution and updating fs module import

* refactor: update import statement for pathExists from fs-extra to improve compatibility

* refactor: remove assert statements and export utility functions for better error handling and reusability

* feat: add TypeScript declaration for JSON module to improve type safety

* feat: add Babel configuration and TypeScript presets for improved compatibility

* refactor: remove assert statements and improve error handling in build scripts

* feat: replace Google APIs client with node-fetch for YouTube data retrieval and improve error handling

* feat: update Jest and Babel configuration for TypeScript support and improve test script transformation

* fix: correct filename for automated tools configuration in build script

* chore: remove ts-jest from package.json and package-lock.json

* refactor: replace assert statements with error handling in scripts

* ci: replace npm install with npm ci for dependency installation in workflow

* feat: add JSDoc comments for improved documentation across various scripts

* chore: remove unnecessary roots configuration from Jest config

* chore: clean up tsconfig.json by removing unused ts-node configuration

* test: remove redundant axios.get mock initialization in tools-object tests

* test: fix indentation in cleanup comment for build-pages tests

* fix: correct typo in comment for additional check in build-docs script

* fix: update type annotation for validateFunction parameter in checkMarkdownFiles

* fix: add error handling for missing CALENDAR_SERVICE_ACCOUNT environment variable

* fix: add error handling for missing YOUTUBE_TOKEN and validate video data structure in buildNewsroomVideos function

* fix: remove redundant error handling for missing CALENDAR_SERVICE_ACCOUNT environment variable in buildMeetings function

* fix: add file existence checks for Expenses.yml and ExpensesLink.yml in buildFinanceInfoList function

* fix: await rssFeed call and add error handling in start function

* fix: add error handling for missing GITHUB_TOKEN environment variable in getData function

* fix: enhance error handling for GitHub API responses in getData function

* refactor: remove file existence checks and simplify start function error handling

* fix: remove GITHUB_TOKEN check from getData function

* fix: add validation for missing frontmatter in validateBlogs function

* feat: implement pagination for GitHub API data retrieval in getData function

* fix: format mockData structure in getData tests for consistency

* refactor: move pause function to utils and remove redundant definition from build-dashboard

* feat: add processManualTool function to validate and process manual tools in combine-tools script

* refactor: remove max-depth eslint rule from combine-tools script

* refactor: remove duplicate Scala color configuration from tags-color script

* feat(logging): integrate Winston logger for improved error handling and logging

* feat(logging): replace console log with Winston logger for GitHub rate limit warnings

* test(logging): update tests to use Winston logger for warnings and errors

* fix: use optional chaining for comments pageInfo in processHotDiscussions function

* refactor: improve type definitions for tools in combine-tools.ts

* refactor(jest): remove 'node' from moduleFileExtensions in jest.config.js

* refactor(logging): replace console.log with logger in scripts

* fix(docs): simplify error handling in buildNavTree function

* fix(errors): simplify error handling in buildMeetings and convertTools functions

* fix(errors): simplify error handling in buildFinanceInfoList function

* fix(validation): return errors when frontmatter is missing in validateBlogs function

* test(validation): update frontmatter validation test for consistency

* test(meetings): add error handling tests for invalid data structure and missing start.dateTime

* fix(videos): improve error handling for missing video properties and add test for YOUTUBE_TOKEN

* test(videos): remove unnecessary whitespace in buildNewsroomVideos test

* test(github): add pagination test for getData function and mock logger

* test(tools): add test for createToolObject with single parameter

* fix(tools): add istanbul ignore comments to enhance test coverage

* fix(tools): simplify language and technology filter checks in getFinalTool function

* feat(tools): export getFinalTool function and enhance test for handling tools with missing data

* test(tools): remove unnecessary blank line in combineTools test suite

* fixed lint errors

* test(markdown): replace console.log with logger.warn in checkMarkdown tests

* test(markdown): refactor checkMarkdown tests for improved readability and consistency

* test: improve test readability and consistency by refactoring whitespace and formatting

* fixed variable naming issue

* fix: update import paths to include .ts extension for build-docs and build-pages tests

* fix: update import paths in utils tests to include .ts extension

* test(markdown): improve test clarity by removing commented-out code

* fix: add istanbul ignore comments to exclude specific lines from coverage

* fix: add istanbul ignore comment to exclude directory check from coverage

* fix: add istanbul ignore comments to improve test coverage exclusions

* test(dashboard): remove commented-out expectation for error logging

* fix: add istanbul ignore comment to exclude title validation from coverage

* refactor: migrate check-edit-links script to TypeScript and update related tests

* fix: add istanbul ignore comments for code coverage in check-edit-links script

* chore: update workflow to trigger on push instead of pull request

* Revert "chore: update workflow to trigger on push instead of pull request"

This reverts commit cc194a6.

* fix(docs): handle undefined document object in convertDocPosts function

* fix: disable eslint rule for no-await-in-loop in combine-tools.ts

* fix: require GITHUB_TOKEN environment variable in getData function

* fix: update getData function to return specific ToolsData type

* test: change link checker workflow trigger to run on push

* fix: remove GITHUB_TOKEN requirement in getData function

* chore: update link checker workflow to run weekly and allow manual triggers

* fix: update i18next config import to use .cjs extension

* Update scripts/adopters/index.ts

Co-authored-by: Akshat Nema <[email protected]>

* fix: require GITHUB_TOKEN environment variable in extract-tools-github script

* fix: validate YOUTUBE_TOKEN and GITHUB_TOKEN environment variables in scripts

* refactor: remove redundant YOUTUBE_TOKEN error test in build-newsroom-videos

* fix: improve type safety in build-rss script by updating post types

* refactor: simplify category extraction logic in getUniqueCategories function

* fix: handle errors while walking directories in build-post-list script

* fix: add error handling and logging in build-tools script

* fix: improve error handling in build-tools script

* refactor: remove unnecessary comment from ensureDirectoryExists function

* Add ts types in return type of functions

* Moved ts to a stable version

---------

Co-authored-by: asyncapi-bot <[email protected]>
Co-authored-by: akshatnema <[email protected]>
Co-authored-by: Akshat Nema <[email protected]>

* refactor: remove unused monthsSince test in dashboard scripts (asyncapi#3763)


"Co-authored-by: JeelRajodiya <[email protected]>"

---------

Co-authored-by: Zeel Rajodiya <[email protected]>
Co-authored-by: asyncapi-bot <[email protected]>
  • Loading branch information
3 people authored Mar 5, 2025
1 parent 9687130 commit da6e5b4
Show file tree
Hide file tree
Showing 91 changed files with 4,876 additions and 3,062 deletions.
2 changes: 1 addition & 1 deletion components/languageSelector/LanguageSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { twMerge } from 'tailwind-merge';

import i18nextConfig from '@/next-i18next.config';
import i18nextConfig from '@/next-i18next.config.cjs';

import type { SelectProps } from '../form/Select';
import IconLanguage from '../icons/Language';
Expand Down
2 changes: 1 addition & 1 deletion components/navigation/MobileNavMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Link from 'next/link';
import React, { useState } from 'react';

import i18nextConfig from '@/next-i18next.config';
import i18nextConfig from '@/next-i18next.config.cjs';

import { SearchButton } from '../AlgoliaSearch';
import IconLanguage from '../icons/Language';
Expand Down
15 changes: 10 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
module.exports = {
const config = {
transform: {
'^.+\\.[t|j]sx?$': ['babel-jest', { configFile: './tests/babel.test.config.cjs' }]
},
verbose: true,
collectCoverage: true,
coverageReporters: ['text', 'lcov', 'json-summary'],
coverageDirectory: 'coverage',
collectCoverageFrom: ['scripts/**/*.js'],
coveragePathIgnorePatterns: ['scripts/compose.js', 'scripts/tools/categorylist.js', 'scripts/tools/tags-color.js'],
// To disallow netlify edge function tests from running
testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*']
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']
};

export default config;
17 changes: 17 additions & 0 deletions next-i18next.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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',
namespaces: ['landing-page', 'common', 'tools'],
defaultNamespace: 'landing-page',
react: { useSuspense: false } // this line
},
langMap: {
en: 'English',
de: 'Deutsch'
}
};
13 changes: 0 additions & 13 deletions next-i18next.config.js

This file was deleted.

Loading

0 comments on commit da6e5b4

Please sign in to comment.