Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable tools view regeneration on a build time #2264

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
31 changes: 29 additions & 2 deletions scripts/build-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ const manualTools = require('../config/tools-manual.json')
const fs = require('fs');
const { resolve } = require('path');

const combineAutomatedAndManualTools = async (automatedTools) => {
try {
await combineTools(automatedTools, manualTools);
} catch (err) {
console.log("Error while combining tools:", err);
throw err;
}
};

const buildTools = async () => {
try {
let githubExtractData = await getData();
Expand All @@ -14,11 +23,29 @@ const buildTools = async () => {
resolve(__dirname, '../config', 'tools-automated.json'),
JSON.stringify(automatedTools, null, ' ')
);
await combineTools(automatedTools, manualTools);
await combineAutomatedAndManualTools(automatedTools);
} catch (err) {
console.log(err);
throw err
}
};

buildTools();
const buildToolsManual = async () => {
try {
const automatedTools = require('../config/tools-automated.json');
await combineAutomatedAndManualTools(automatedTools);
} catch (err) {
console.log(err);
throw err;
}
};

// Default action when triggered from package.json or run standalone.
derberg marked this conversation as resolved.
Show resolved Hide resolved
if (require.main === module) {
buildTools();
}

module.exports = {
buildTools,
buildToolsManual
Comment on lines +48 to +51
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Potential issue with unused export

The buildTools function is exported but not imported anywhere in the codebase. Only buildToolsManual is being used (in scripts/index.js).

  • scripts/index.js: Only imports and uses buildToolsManual
  • buildTools function is defined and exported but appears to be unused

Consider either:

  • Removing the unused buildTools export if it's no longer needed
  • Or documenting why it's exported if it's intended for future/external use
🔗 Analysis chain

LGTM! Verify usage in dependent files.

The exports are correctly updated to include both functions.

Let's verify the usage of these exports in dependent files:


Let me gather more information to verify if there are any other files that might be using these exports.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for imports and usage of buildTools and buildToolsManual
rg -l "require.*build-tools" | xargs rg "buildTools(Manual)?"

Length of output: 146


Script:

#!/bin/bash
# Search for any potential usage of buildTools function
rg "buildTools[^M]" -A 2

# Also check for dynamic requires or imports
rg "require.*['\"].*build-tools" -A 2

Length of output: 626

};
2 changes: 2 additions & 0 deletions scripts/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const rssFeed = require('./build-rss');
const buildPostList = require('./build-post-list');
const buildCaseStudiesList = require('./casestudies');
const { buildToolsManual } = require('./build-tools');
const buildAdoptersList = require('./adopters')
const buildFinanceInfoList = require('./finance')

Expand All @@ -19,6 +20,7 @@ async function start() {
'jobs/rss.xml'
);
await buildCaseStudiesList();
await buildToolsManual();
await buildAdoptersList();
await buildFinanceInfoList();
}
Expand Down
Loading