lib/deploy/bundle-lambdas-step.js
function archiveDependencies(cwd, pkg) {
    let result = [];

    if (pkg.path) {
        result.push({
            data: pkg.path,
            type: 'directory',
            name: path.relative(cwd, pkg.path)
        });
    }

    pkg.dependencies.forEach(function(dep) {
        if (dep.path) {
            result.push({
                data: dep.path,
                type: 'directory',
                name: path.relative(cwd, dep.path)
            });
        }

        if (dep.dependencies) {
            result = result.concat(archiveDependencies(cwd, dep));
        }
    });

    return result;
}
function archiveDependencies(cwd, pkg) {
    let result = [];

    if (pkg.path) {
        result.push({
            data: pkg.path,
            type: 'directory',
            name: path.relative(cwd, pkg.path)
        });
    }

    pkg.dependencies.forEach(function(dep) {
        if (dep.path) {
            result.push({
                data: dep.path,
                type: 'directory',
                name: path.relative(cwd, dep.path)
            });
        }

        if (dep.dependencies) {
            result = result.concat(archiveDependencies(cwd, dep));
        }
    });

    return result;
}
function archiveDependencies ( cwd , pkg ) { let result = [ ] ; if ( pkg . path ) { result . push ( { data : pkg . path , type : 'directory' , name : path . relative ( cwd , pkg . path ) } ) ; } pkg . dependencies . forEach ( function ( dep ) { if ( dep . path ) { result . push ( { data : dep . path , type : 'directory' , name : path . relative ( cwd , dep . path ) } ) ; } if ( dep . dependencies ) { result = result . concat ( archiveDependencies ( cwd , dep ) ) ; } } ) ; return result ; }
Helper for recursively adding all dependencies to an archive
Helper for recursively adding all dependencies to an archive