UNPKG

gia-cli

Version:

Guardian US Interactive CLI tool

22 lines (19 loc) 700 B
/*global require */ const chalk = require( 'chalk' ); const get = require( './utils/get.js' ); const gia = require( '../giafile.js' ); function log ( type ) { const url = `https://interactive.guim.co.uk/atoms/${gia.path}/${type}.log?${Date.now()}`; return get( url ) .then( data => { console.log( chalk.cyan( `${type} log:` ) ); // eslint-disable-line no-console console.log( data ); // eslint-disable-line no-console }).catch( err => { if ( err.message === '404' ) { console.log( chalk.yellow( `No ${type} log found. Do you need to deploy the project?` ) ); // eslint-disable-line no-console } else { throw err; } }); } log( 'live' ).then( () => log( 'preview' ) );