lib/functions/downloadDependencies.js
async function downloadDependencies(rootFolder, dependencyList) {
    const includeFolder = path.join(rootFolder, constants.INCLUDE_DIR);
    fs.removeSync(includeFolder);
    const contentPath = path.join(includeFolder, 'content.json');

    // Create new content.json
    createFile({
        name: contentPath,
        source: JSON.stringify(dependencyList),
    });

    // Extensions
    const extensions = eaft.getCodeExtensions();

    // Download new dependencies
    for (const dependency of Reflect.ownKeys(dependencyList)) {
        const dependencies = dependencyList[dependency].dependencies;
        const package = dependencyList[dependency].packageName;
        const version = dependencyList[dependency].version;
        const isRootDependency = dependencyList[dependency].isRootDependency;

        // Use package name as dependency if it is a root dependency
        let dependencyName;
        if (isRootDependency) {
            dependencyName = package;
        } else {
            dependencyName = dependency;
        }
        const packagePath = path.join(includeFolder, dependencyName);

        // Get library code
        url = `${constants.FIREBASE_DATABASE_URL}/package/${package}/version/${version}/code.json`;
        const library = await request({
            url,
            method: "GET",
            json: true,
            headers: {
                "content-type": "application/json",
            },
        });

        // Write library files
        for (const file of library.files) {
            const extension = eaft.getExtensionFromFiletype(file.type, extensions);
            const fileName = `${file.name}${extension}`;
            const source = processSource(file.source, dependencyList, dependency);
            createFile({
                name: path.join(packagePath, fileName),
                source,
            });
        }
    }
}
async function downloadDependencies(rootFolder, dependencyList) {
    const includeFolder = path.join(rootFolder, constants.INCLUDE_DIR);
    fs.removeSync(includeFolder);
    const contentPath = path.join(includeFolder, 'content.json');

    // Create new content.json
    createFile({
        name: contentPath,
        source: JSON.stringify(dependencyList),
    });

    // Extensions
    const extensions = eaft.getCodeExtensions();

    // Download new dependencies
    for (const dependency of Reflect.ownKeys(dependencyList)) {
        const dependencies = dependencyList[dependency].dependencies;
        const package = dependencyList[dependency].packageName;
        const version = dependencyList[dependency].version;
        const isRootDependency = dependencyList[dependency].isRootDependency;

        // Use package name as dependency if it is a root dependency
        let dependencyName;
        if (isRootDependency) {
            dependencyName = package;
        } else {
            dependencyName = dependency;
        }
        const packagePath = path.join(includeFolder, dependencyName);

        // Get library code
        url = `${constants.FIREBASE_DATABASE_URL}/package/${package}/version/${version}/code.json`;
        const library = await request({
            url,
            method: "GET",
            json: true,
            headers: {
                "content-type": "application/json",
            },
        });

        // Write library files
        for (const file of library.files) {
            const extension = eaft.getExtensionFromFiletype(file.type, extensions);
            const fileName = `${file.name}${extension}`;
            const source = processSource(file.source, dependencyList, dependency);
            createFile({
                name: path.join(packagePath, fileName),
                source,
            });
        }
    }
}
async function downloadDependencies ( rootFolder , dependencyList ) { const includeFolder = path . join ( rootFolder , constants . INCLUDE_DIR ) ; fs . removeSync ( includeFolder ) ; const contentPath = path . join ( includeFolder , 'content.json' ) ; // Create new content.json createFile ( { name : contentPath , source : JSON . stringify ( dependencyList ) , } ) ; // Extensions const extensions = eaft . getCodeExtensions ( ) ; // Download new dependencies for ( const dependency of Reflect . ownKeys ( dependencyList ) ) { const dependencies = dependencyList [ dependency ] . dependencies ; const package = dependencyList [ dependency ] . packageName ; const version = dependencyList [ dependency ] . version ; const isRootDependency = dependencyList [ dependency ] . isRootDependency ; // Use package name as dependency if it is a root dependency let dependencyName ; if ( isRootDependency ) { dependencyName = package ; } else { dependencyName = dependency ; } const packagePath = path . join ( includeFolder , dependencyName ) ; // Get library code url = ` ${ constants . FIREBASE_DATABASE_URL } ${ package } ${ version } ` ; const library = await request ( { url , method : "GET" , json : true , headers : { "content-type" : "application/json" , } , } ) ; // Write library files for ( const file of library . files ) { const extension = eaft . getExtensionFromFiletype ( file . type , extensions ) ; const fileName = ` ${ file . name } ${ extension } ` ; const source = processSource ( file . source , dependencyList , dependency ) ; createFile ( { name : path . join ( packagePath , fileName ) , source , } ) ; } } }
Download all necessary dependencies

@param {String} rootFolder - Folder where we will create the gas-include folder
@param {Object} dependencyList - List of exact dependencies that we need to download
@returns {void}
Download all necessary dependencies