UNPKG

@gameroom/cli

Version:

A command line tool for Gameroom

26 lines (23 loc) 1.13 kB
const cosmetic = require('cosmetic'), { models: { Address, Container, Store } } = require('@gameroom/kit'), { pushPrices, pushProducts, pushUnits } = require('./helpers'), { grGreen, timeout } = require('../../helpers'), { ShopifyV2 } = require('../../models'), { config, spinner } = require('../../refs') module.exports = async (options) => { // catch all errors that arent 429 (too many requests) or 404 (not found) try { // config.exit_gracefully = true const dev = process.env.NODE_ENV === 'development' const SHOPIFY_STORE_URL = dev ? process.env.SHOPIFY_DEV_STORE_URL : process.env.SHOPIFY_STORE_URL if (!SHOPIFY_STORE_URL) throw new Error('missing shopify env keys') spinner.info(`updating ${cosmetic.green(SHOPIFY_STORE_URL)} @ ${new Date().toLocaleString()}`) // sync await pushProducts(options) // await pushPrices(options) // await pushUnits(options) spinner.succeed(`completed push to ${cosmetic.green('shopify')} @ ${new Date().toLocaleString()}`).stop() } catch(err) { spinner.fail(`error pushing to ${cosmetic.green('shopify')}: ${err}`).stop() } }