1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2025-07-02 22:16:54 +02:00

Add types to source code (#10637)

This commit is contained in:
Álvaro Mondéjar Rubio
2024-06-06 14:40:35 +02:00
committed by GitHub
parent 1224e341d7
commit 236f5fc715
25 changed files with 619 additions and 205 deletions

View File

@ -1,12 +1,24 @@
/**
* @file Internal utilities.
*
* Here resides all the functionality that does not qualifies to reside
* in the SDK because is not publicly exposed.
*/
import fs from 'node:fs/promises';
import path from 'node:path';
import {getDirnameFromImportMeta, getIconDataPath} from '../sdk.mjs';
const __dirname = getDirnameFromImportMeta(import.meta.url);
/**
* @typedef {import("../sdk.js").IconData} IconData
*/
/**
* Get JSON schema data.
* @param {String} rootDirectory Path to the root directory of the project.
* @param {string} rootDirectory Path to the root directory of the project.
* @returns {Promise<any>} JSON schema data.
*/
export const getJsonSchemaData = async (
rootDirectory = path.resolve(__dirname, '..'),
@ -18,8 +30,8 @@ export const getJsonSchemaData = async (
/**
* Write icons data to _data/simple-icons.json.
* @param {Object} iconsData Icons data object.
* @param {String} rootDirectory Path to the root directory of the project.
* @param {{icons: IconData[]}} iconsData Icons data object.
* @param {string} rootDirectory Path to the root directory of the project.
*/
export const writeIconsData = async (
iconsData,