tools/functions.js
function findScripts(indexPath) {
    const scriptRegEx = /<script.+src="(.+)".*?>/g;

    const contents = fs.readFileSync(indexPath).toString();

    /** @type {string[]} */
    const scripts = [];
    let scriptMatch;
    while ((scriptMatch = scriptRegEx.exec(contents)) !== null) { // eslint-disable-line no-cond-assign
        const scriptPath = scriptMatch[1];
        scripts.push(scriptPath);
    }

    return scripts;
}
function findScripts(indexPath) {
    const scriptRegEx = /<script.+src="(.+)".*?>/g;

    const contents = fs.readFileSync(indexPath).toString();

    /** @type {string[]} */
    const scripts = [];
    let scriptMatch;
    while ((scriptMatch = scriptRegEx.exec(contents)) !== null) { // eslint-disable-line no-cond-assign
        const scriptPath = scriptMatch[1];
        scripts.push(scriptPath);
    }

    return scripts;
}
function findScripts ( indexPath ) { const scriptRegEx = / <script.+src="(.+)".*?> / g ; const contents = fs . readFileSync ( indexPath ) . toString ( ) ; /** @type {string[]} */ const scripts = [ ] ; let scriptMatch ; while ( ( scriptMatch = scriptRegEx . exec ( contents ) ) !== null ) { // eslint-disable-line no-cond-assign const scriptPath = scriptMatch [ 1 ] ; scripts . push ( scriptPath ) ; } return scripts ; }
Retrieve all script pathes from an HTML file

@param {string} indexPath
@returns {string[]}
Retrieve all script pathes from an HTML file