mirror of
https://github.com/simple-icons/simple-icons.git
synced 2024-12-16 01:10:30 +02:00
Allow to use the function getThirdPartyExtensions
at other locations (#7361)
This commit is contained in:
parent
98953e3463
commit
8f4e65ce28
@ -128,14 +128,10 @@ export const normalizeNewlines = (text) => {
|
||||
|
||||
/**
|
||||
* Get information about third party extensions.
|
||||
* @param {String} readmePath Path to the README file
|
||||
*/
|
||||
export const getThirdPartyExtensions = async () => {
|
||||
const __dirname = getDirnameFromImportMeta(import.meta.url);
|
||||
const readmePath = path.resolve(__dirname, '..', 'README.md');
|
||||
const readmeContent = normalizeNewlines(
|
||||
await fs.readFile(readmePath, 'utf8'),
|
||||
);
|
||||
return readmeContent
|
||||
export const getThirdPartyExtensions = async (readmePath) =>
|
||||
normalizeNewlines(await fs.readFile(readmePath, 'utf8'))
|
||||
.split('## Third-Party Extensions\n\n')[1]
|
||||
.split('\n\n')[0]
|
||||
.split('\n')
|
||||
@ -153,4 +149,3 @@ export const getThirdPartyExtensions = async () => {
|
||||
},
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -48,7 +48,8 @@ describe('README icons assets must be consistent with Github themes', () => {
|
||||
});
|
||||
|
||||
test('README third party extensions must be alphabetically sorted', async () => {
|
||||
const thirdPartyExtensions = await getThirdPartyExtensions();
|
||||
const readmePath = path.join(root, 'README.md');
|
||||
const thirdPartyExtensions = await getThirdPartyExtensions(readmePath);
|
||||
assert.ok(thirdPartyExtensions.length > 0);
|
||||
|
||||
const thirdPartyExtensionsNames = thirdPartyExtensions.map(
|
||||
|
Loading…
Reference in New Issue
Block a user