function filesToDeploy()

in scripts/deploy.js [117:178]


function filesToDeploy(atomName) {
    const pathForFile = (fileName) => {
        return path.join(buildPath, atomName, fileName)
    }
    
    const versionedKeyForFile = (fileName) => {
        return path.join(s3Path, atomName, version, fileName)
    }
    
    const keyForFile = (fileName) => {
        return path.join(s3Path, atomName, fileName)
    }

    const mainJS = `
        var el = document.createElement('script');
        el.src = '${cdnUrl}/${s3Path}/${atomName}/${version}/app.js';
        document.body.appendChild(el);
    `;
    
    const files = [{
        path: pathForFile('app.js'),
        key: versionedKeyForFile('app.js')
    }, 
    {
        body: mainJS,
        key: versionedKeyForFile('main.js')
    },
    {
        path: pathForFile('style.css'),
        key: versionedKeyForFile('main.css')
    }, 
    {
        path: pathForFile('main.html'),
        key: versionedKeyForFile('main.html')
    },
    {
        body: version,
        key: keyForFile('preview'),
        params: {
            CacheControl: 'max-age=30'
        },
    },
    {
        body: JSON.stringify(config),
        key: keyForFile('config.json'),
        params: {
            CacheControl: 'max-age=30'
        },
    }];

    if (live) {
        files.push({
            body: version,
            key: keyForFile('live'),
            params: {
                CacheControl: 'max-age=30'
            },
        })
    }

    return files;
}