UNPKG

mashr

Version:

Simple data pipeline framework for GCP's BigQuery

45 lines (36 loc) 1.11 kB
const path = require('path'); const ora = require('ora'); const { copyFile } = require('./fileUtils'); const { mashrLogger } = require('./mashrLogger'); const copyMashrConfigTemplate = async(template) => { const spinner = ora(); const configTemplate = templatePath(template); const workingDir = path.resolve('./'); const destination = `${workingDir}/mashr_config.yml`; await copyFile(configTemplate, destination); mashrLogger( spinner, 'succeed', '"mashr_config.yml" template file created.\n\n' + 'Please fill out the empty fields in the `mashr_config.yml` ' + 'file before running `mashr deploy`.\n' ); }; const templatePath = (template) => { const basePath = `${__dirname}/../../templates/mashrTemplates`; const templates = { default: 'default_config.yml', random: 'rand_config.yml', psql: 'psql_config.yml', http: 'http_config.yml', }; if (templates[template]) { return `${basePath}/${templates[template]}`; } else { return `${basePath}/${templates.default}`; } }; module.exports = { copyMashrConfigTemplate, templatePath, };