Skip to content
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
5e57996
created npm folder and modularized scripts
sagarkori143 Jun 17, 2025
6ed3594
resolved prod fail issues
sagarkori143 Jun 17, 2025
5f27ad2
resolved prod fail issues
sagarkori143 Jun 17, 2025
2f4f22f
resolved prod fail issues
sagarkori143 Jun 17, 2025
2d499cc
moved the logger to utils
sagarkori143 Jun 18, 2025
388dfda
moved the logger to utils
sagarkori143 Jun 18, 2025
b382cf6
solving logger imports after refactoring
sagarkori143 Jun 18, 2025
075cead
refactored the index.ts file for parallel execution of the scripts
sagarkori143 Jun 18, 2025
728ad2b
Merge branch 'master' into modules
asyncapi-bot Jun 18, 2025
9ab9cc3
added more modualarized scripts and runners
sagarkori143 Jun 18, 2025
91e952f
Merge branch 'modules' of github.com:sagarkori143/website into modules
sagarkori143 Jun 18, 2025
1402f9b
removed extra changes
sagarkori143 Jun 18, 2025
b40ab1e
removed extra changes
sagarkori143 Jun 18, 2025
5a83f3f
improved error handling
sagarkori143 Jun 18, 2025
e10c132
made sure to float the errors to the top level and all files are now …
sagarkori143 Jun 19, 2025
dc99fc0
all the scripts are modularized now and are perfectly working
sagarkori143 Jun 19, 2025
9d0fc09
minor changes
sagarkori143 Jun 19, 2025
241396c
added setup for integration testing and added a few tests for the bui…
sagarkori143 Jun 19, 2025
7f34ffa
Merge branch 'master' into modules
sagarkori143 Jun 20, 2025
b4c0184
resolving coderabbit reviews on integration tests file
sagarkori143 Jun 20, 2025
48c9b20
Merge branch 'master' into modules
sagarkori143 Jun 21, 2025
cf0fddd
enhanced error handling of build newsroom videos script to test with …
sagarkori143 Jun 21, 2025
e1b44fc
Merge branch 'master' into modules
sagarkori143 Jun 22, 2025
e239484
removed the scripts copied in the npm directory and shifted the Int t…
sagarkori143 Jun 22, 2025
db991db
updated conflicting path
sagarkori143 Jun 22, 2025
0a79ab8
trying to maintain pages as it is and check if build makes up
sagarkori143 Jun 22, 2025
4db1a6f
reconfigured the build pages page
sagarkori143 Jun 22, 2025
77baacd
reconfigured the build pages page
sagarkori143 Jun 22, 2025
6c2c115
reconfigured the build pages page
sagarkori143 Jun 22, 2025
6d9872f
started building pages with runners
sagarkori143 Jun 22, 2025
3789564
changes suggested by coderabbitAi
sagarkori143 Jun 22, 2025
0145bda
reverted the pages changes
sagarkori143 Jun 22, 2025
cff3857
reverting the pages script changes to check if everything goes right
sagarkori143 Jun 22, 2025
7bfd418
updated build post list according to coderabbit suggestions
sagarkori143 Jun 23, 2025
f025abc
retrying the build pages script runners from cli
sagarkori143 Jun 23, 2025
d06e25a
did some changes to case study card
sagarkori143 Jun 23, 2025
47eeb0b
reverted the case studies changes
sagarkori143 Jun 23, 2025
a8335dc
reverted the case studies changes
sagarkori143 Jun 23, 2025
ce9fc7c
posts reverted
sagarkori143 Jun 23, 2025
96cec2a
separated the unit and integration tests running
sagarkori143 Jun 23, 2025
c48f1fd
added more context to the error in blog compose
sagarkori143 Jun 23, 2025
f7d9a43
Merge branch 'master' into modules
asyncapi-bot Jun 23, 2025
f1192e5
tests fixed
sagarkori143 Jun 23, 2025
b206429
Merge branch 'modules' of github.com:sagarkori143/website into modules
sagarkori143 Jun 23, 2025
98486af
reverted: tests fixed
sagarkori143 Jun 23, 2025
85add6f
minor changes
sagarkori143 Jun 23, 2025
800f03d
Merge branch 'master' into modules
sagarkori143 Jun 27, 2025
f1b3dc6
made a temp change
sagarkori143 Jun 27, 2025
8d2bf22
reverted: made a temp change
sagarkori143 Jun 27, 2025
60cf2f9
Merge branch 'master' into modules
sagarkori143 Jun 28, 2025
2b13160
tried enhancing the error handling and logging
sagarkori143 Jun 28, 2025
e8c2279
fixed the failing tests
sagarkori143 Jun 29, 2025
79da91f
reverted integration test change
sagarkori143 Jun 29, 2025
8767b93
Merge branch 'master' into modules
asyncapi-bot Jun 29, 2025
0b20bf4
solving the failing tests and changed the integration tests logic to …
sagarkori143 Jun 29, 2025
cb4a589
Merge branch 'modules' of github.com:sagarkori143/website into modules
sagarkori143 Jun 29, 2025
ce2a5b7
fixed linting errors
sagarkori143 Jun 29, 2025
27cf32b
improved code coverage
sagarkori143 Jun 29, 2025
592dd9a
Merge branch 'master' into modules
sagarkori143 Jun 30, 2025
f836a26
Merge branch 'master' into modules
sagarkori143 Jul 5, 2025
8ee27a7
shifted the integration tests out of main tests into a temp folder
sagarkori143 Jul 6, 2025
9e68f76
removed index.ts file and removed the linting errors of build dashboa…
sagarkori143 Jul 9, 2025
833008f
Merge branch 'master' into modules
sagarkori143 Jul 9, 2025
8b501e2
did npm binding of dashboard and case studies runner and improved err…
sagarkori143 Jul 10, 2025
1669b3c
reverted the build-pages script in the package.json
sagarkori143 Jul 10, 2025
82442c4
building pages with the runners
sagarkori143 Jul 10, 2025
a1e8b82
binding of build pages and error handling done
sagarkori143 Jul 10, 2025
a65c553
done binding build post list
sagarkori143 Jul 10, 2025
d8f51e0
binding of adopters list module
sagarkori143 Jul 10, 2025
75599a7
binding done of finance info list builders
sagarkori143 Jul 10, 2025
7109472
binding done of meetings.json
sagarkori143 Jul 10, 2025
8363ce3
done binding newsroom
sagarkori143 Jul 10, 2025
d0ad117
binding tools and error handling improved
sagarkori143 Jul 10, 2025
5fea48b
major changes: Refactored all runners, bind them to cli and improved …
sagarkori143 Jul 10, 2025
0176ece
rethrew error after logging for surfacing the errror
sagarkori143 Jul 10, 2025
1f39b40
removed test file
sagarkori143 Jul 12, 2025
c5c0b61
added error classes
akshatnema Jul 13, 2025
b043ffd
refactor scripts files
akshatnema Aug 3, 2025
f688215
Merge branch 'master' into modules
akshatnema Aug 3, 2025
dd9d6e6
empty commit to trigger codecov
akshatnema Aug 3, 2025
11502cc
empty commit to trigger codecov
akshatnema Aug 4, 2025
748c003
added tests to cover 100% test coverage
akshatnema Aug 4, 2025
34637bd
added tests to cover 100% test coverage
akshatnema Aug 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules/
.next/
out/
public/
*.config.js
*.config.mjs
.storybook/
coverage/
netlify/
cypress/
dist/
build/
next-env.d.ts
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"react-hooks/rules-of-hooks": "error",
"import/no-extraneous-dependencies": [
"error",
{ "devDependencies": ["**/*.test.js", "**/*.spec.js", "**/setupTests.js"] }
{ "devDependencies": ["**/*.test.js", "**/*.test.ts", "**/*.spec.js", "**/setupTests.js", "tests/**/*"] }
],
"no-console": "error",
"no-debugger": "error",
Expand Down
18 changes: 15 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,21 @@ const config = {
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.*'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json']
coveragePathIgnorePatterns: [
'scripts/compose.ts',
'scripts/tools/categorylist.ts',
'scripts/tools/tags-color.ts'
],
// Default: all tests
testMatch: [
'**/tests/**/*.test.*',
'**/npm/integrationTests/**/*.test.*',
'!**/netlify/**/*.test.*'
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1'
}
};

export default config;
7 changes: 7 additions & 0 deletions mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import { mdxComponents } from '@/components/MDX/MDX';
// React component you want, including inline styles,
// components from other libraries, and more.

/**
* Customizes MDX components by merging default components with any provided overrides.
* This function is used by the MDX provider to determine which React components should be used to render MDX content.
*
* @param components - Custom MDX components to override the defaults
* @returns A merged object of default and custom MDX components
*/
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
// Allows customizing built-in components, e.g. to add styling.
Expand Down
35 changes: 35 additions & 0 deletions npm/runners/build-adopters-list-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { buildAdoptersList } from '@/scripts/adopters';
import { logger } from '@/scripts/helpers/logger';
import { CustomError } from '@/types/errors/CustomError';

/**
* Runs the build adopters list process.
*
* This function invokes the buildAdoptersList script and handles errors,
* logging them with context and letting the top-level .catch handle process exit.
* @throws {CustomError} When the build process fails
*/
async function runBuildAdoptersList(): Promise<void> {
try {
await buildAdoptersList();
} catch (error) {
const customError = CustomError.fromError(error, {
category: 'script',
operation: 'runBuildAdoptersList',
detail: 'Build adopters list runner failed'
});

logger.error('Build adopters list runner failed', customError);

throw customError;
}
}

// Self-executing async function to handle top-level await
(async () => {
try {
await runBuildAdoptersList();
} catch {
process.exit(1);
}
})();
67 changes: 67 additions & 0 deletions npm/runners/build-dashboard-runner.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains improper eslint formatting with tab width 4. Fix eslint errors in the file.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';

import { start as buildDashboard } from '@/scripts/dashboard/build-dashboard';
import { logger } from '@/scripts/helpers/logger';
import { CustomError } from '@/types/errors/CustomError';

const currentFilePath = fileURLToPath(import.meta.url);
const currentDirPath = dirname(currentFilePath);

interface BuildDashboardOptions {
outputPath?: string;
}

/**
* Runs the dashboard generation process with configurable options.
*
* This function resolves the path to the dashboard.json output file,
* then invokes the buildDashboard script. It handles errors, logging them with context
* and letting the top-level .catch handle process exit.
*
* @param options - Optional configuration for output path
* @throws {CustomError} If the build process fails or an error occurs in the runner
*/
async function runBuildDashboard(options: BuildDashboardOptions = {}): Promise<void> {
try {
const outputPath = options.outputPath || resolve(currentDirPath, '../../dashboard.json');

await buildDashboard(outputPath);
} catch (error) {
// Create or enhance the error with full context
const customError =
error instanceof CustomError
? error.updateContext({
operation: 'runBuildDashboard',
detail: `Runner failed with output path: ${options.outputPath}`
})
: CustomError.fromError(error, {
category: 'script',
operation: 'runBuildDashboard',
detail: `Build dashboard runner failed with output path: ${options.outputPath}`
});

// Log error with full context
logger.error('Build dashboard runner failed', customError);

throw customError;
}
}

// Run only in non-test environments
if (process.env.NODE_ENV === 'test') {
logger.info('Skipping dashboard build in test environment');
} else {
// Self-executing async function to handle top-level await
(async () => {
try {
await runBuildDashboard();
} catch (error) {
// Ensure we exit with error code
process.exit(1);
}
})();
}

// Export for testing purposes
export { runBuildDashboard };
99 changes: 99 additions & 0 deletions npm/runners/build-finance-info-list-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import fs from 'fs';
import { resolve } from 'path';

import { buildFinanceInfoList } from '@/scripts/finance';
import { logger } from '@/scripts/helpers/logger';
import { CustomError } from '@/types/errors/CustomError';

interface BuildFinanceInfoOptions {
currentDir?: string;
configDir?: string;
financeDir?: string;
jsonDataDir?: string;
year?: string;
}

const DEFAULT_OPTIONS = {
currentDir: '.',
configDir: 'config',
financeDir: 'finance',
jsonDataDir: 'json-data'
};

/**
* Runs the build finance info list process with configurable options.
*
* This function locates the latest year in the finance directory,
* then invokes the buildFinanceInfoList script for that year.
* It handles errors, logging them with context and letting the top-level .catch handle process exit.
*
* @param options - Optional configuration for directories and year
* @throws {CustomError} If the build process fails or an error occurs in the runner
*/
async function runBuildFinanceInfoList(options: BuildFinanceInfoOptions = {}): Promise<void> {
const config = { ...DEFAULT_OPTIONS, ...options };

const financeDir = resolve(config.currentDir, config.configDir, config.financeDir);

try {
// If year is not provided, find the latest year
let targetYear = config.year;

if (!targetYear) {
const yearsList = fs
.readdirSync(financeDir)
// Filter out any files that are not numbers
.filter((file) => !Number.isNaN(parseFloat(file)))
// Sort the years in descending order
.sort((a, b) => parseFloat(b) - parseFloat(a));

if (yearsList.length === 0) {
throw new CustomError('No finance data found in the finance directory', {
category: 'script',
operation: 'findLatestYear',
detail: `Finance directory: ${financeDir}, Available years: ${yearsList.join(', ')}`
});
}

const [latestYear] = yearsList;

targetYear = latestYear;
}

await buildFinanceInfoList({
currentDir: config.currentDir,
configDir: config.configDir,
financeDir: config.financeDir,
year: targetYear,
jsonDataDir: config.jsonDataDir
});
} catch (error) {
const customError = CustomError.fromError(error, {
category: 'script',
operation: 'runBuildFinanceInfoList',
detail: `Build finance info failed for year: ${config.year}, financeDir: ${financeDir}`
});

logger.error('Build finance info list runner failed', customError);

throw customError;
}
}

// Run only in non-test environments
if (process.env.NODE_ENV === 'test') {
logger.info('Skipping finance info list build in test environment');
} else {
// Self-executing async function to handle top-level await
(async () => {
try {
await runBuildFinanceInfoList();
} catch (error) {
// Ensure we exit with error code
process.exit(1);
}
})();
}

// Export for testing purposes
export { runBuildFinanceInfoList };
59 changes: 59 additions & 0 deletions npm/runners/build-meetings-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';

import { buildMeetings } from '@/scripts/build-meetings';
import { logger } from '@/scripts/helpers/logger';
import { CustomError } from '@/types/errors/CustomError';

const currentFilePath = fileURLToPath(import.meta.url);
const currentDirPath = dirname(currentFilePath);

interface BuildMeetingsOptions {
outputPath?: string;
}

/**
* Runs the build meetings process with configurable options.
*
* This function resolves the path to the meetings.json configuration file,
* then invokes the buildMeetings script. It handles errors, logging them with context
* and letting the top-level .catch handle process exit.
*
* @param options - Optional configuration for output path
* @throws {CustomError} If the build process fails or an error occurs in the runner
*/
async function runBuildMeetings(options: BuildMeetingsOptions = {}): Promise<void> {
try {
const outputPath = options.outputPath || resolve(currentDirPath, '../../config', 'meetings.json');

await buildMeetings(outputPath);
} catch (error) {
const customError = CustomError.fromError(error, {
category: 'script',
operation: 'runBuildMeetings',
detail: `Build meetings failed with output path: ${options.outputPath}`
});

logger.error('Build meetings runner failed', customError);

throw customError;
}
}

// Run only in non-test environments
if (process.env.NODE_ENV === 'test') {
logger.info('Skipping meetings build in test environment');
} else {
// Self-executing async function to handle top-level await
(async () => {
try {
await runBuildMeetings();
} catch (error) {
// Ensure we exit with error code
process.exit(1);
}
})();
}

// Export for testing purposes
export { runBuildMeetings };
59 changes: 59 additions & 0 deletions npm/runners/build-newsroom-videos-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';

import { buildNewsroomVideos } from '@/scripts/build-newsroom-videos';
import { logger } from '@/scripts/helpers/logger';
import { CustomError } from '@/types/errors/CustomError';

const currentFilePath = fileURLToPath(import.meta.url);
const currentDirPath = dirname(currentFilePath);

interface BuildNewsroomVideosOptions {
outputPath?: string;
}

/**
* Runs the build newsroom videos process with configurable options.
*
* This function resolves the path to the newsroom_videos.json configuration file,
* then invokes the buildNewsroomVideos script. It handles errors, logging them with context
* and letting the top-level .catch handle process exit.
*
* @param options - Optional configuration for output path
* @throws {CustomError} If the build process fails or an error occurs in the runner
*/
async function runBuildNewsroomVideos(options: BuildNewsroomVideosOptions = {}): Promise<void> {
try {
const outputPath = options.outputPath || resolve(currentDirPath, '../../config', 'newsroom_videos.json');

await buildNewsroomVideos(outputPath);
} catch (error) {
const customError = CustomError.fromError(error, {
category: 'script',
operation: 'runBuildNewsroomVideos',
detail: `Build newsroom videos failed with output path: ${options.outputPath}`
});

logger.error('Build newsroom videos runner failed', customError);

throw customError;
}
}

// Run only in non-test environments
if (process.env.NODE_ENV === 'test') {
logger.info('Skipping newsroom videos build in test environment');
} else {
// Self-executing async function to handle top-level await
(async () => {
try {
await runBuildNewsroomVideos();
} catch (error) {
// Ensure we exit with error code
process.exit(1);
}
})();
}

// Export for testing purposes
export { runBuildNewsroomVideos };
Loading
Loading