scripts/lib/utils.js
function createIndex(dirPath) {
    const dirName = path.basename(dirPath)
    return format(`/** DON'T EDIT THIS FILE; was created by scripts. */
    "use strict"

    module.exports = {
        ${fs
            .readdirSync(dirPath)
            .map(file => path.basename(file, ".js"))
            .map(id => `"${id}": require("./${dirName}/${id}"),`)
            .join("\n    ")}
    }
    `)
}
function createIndex(dirPath) {
    const dirName = path.basename(dirPath)
    return format(`/** DON'T EDIT THIS FILE; was created by scripts. */
    "use strict"

    module.exports = {
        ${fs
            .readdirSync(dirPath)
            .map(file => path.basename(file, ".js"))
            .map(id => `"${id}": require("./${dirName}/${id}"),`)
            .join("\n    ")}
    }
    `)
}
function createIndex ( dirPath ) { const dirName = path . basename ( dirPath ) return format ( ` ${ fs . readdirSync ( dirPath ) . map ( file => path . basename ( file , ".js" ) ) . map ( id => ` ${ id } ${ dirName } ${ id } ` ) . join ( "\n    " ) } ` ) }
Create the index file content of a given directory.
@param {string} dirPath The path to the directory to create index.
@returns {string} The index file content.
Create the index file content of a given directory .