mirror of
https://github.com/Mibew/simple-icons.git
synced 2025-04-07 21:30:16 +03: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.
|
* Get information about third party extensions.
|
||||||
|
* @param {String} readmePath Path to the README file
|
||||||
*/
|
*/
|
||||||
export const getThirdPartyExtensions = async () => {
|
export const getThirdPartyExtensions = async (readmePath) =>
|
||||||
const __dirname = getDirnameFromImportMeta(import.meta.url);
|
normalizeNewlines(await fs.readFile(readmePath, 'utf8'))
|
||||||
const readmePath = path.resolve(__dirname, '..', 'README.md');
|
|
||||||
const readmeContent = normalizeNewlines(
|
|
||||||
await fs.readFile(readmePath, 'utf8'),
|
|
||||||
);
|
|
||||||
return readmeContent
|
|
||||||
.split('## Third-Party Extensions\n\n')[1]
|
.split('## Third-Party Extensions\n\n')[1]
|
||||||
.split('\n\n')[0]
|
.split('\n\n')[0]
|
||||||
.split('\n')
|
.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 () => {
|
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);
|
assert.ok(thirdPartyExtensions.length > 0);
|
||||||
|
|
||||||
const thirdPartyExtensionsNames = thirdPartyExtensions.map(
|
const thirdPartyExtensionsNames = thirdPartyExtensions.map(
|
||||||
|
Loading…
Reference in New Issue
Block a user