Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable no-use-before-define */
const prompt = require('react-dev-utils/prompt')
const themekit = require('@shopify/themekit').command
const config = require('../config')
const promptIfMainTheme = require('./prompt-if-main-theme')
const settings = {
env: 'development',
deployRoot: config.paths.dist,
defaultArgs: [
'--no-update-notifier',
'--config', config.paths.userShopifyConfig
]
}
let deploying = false
let filesToDeploy = []
function maybeDeploy() {
process.env.SLATER_HMR = true
const fs = require('fs')
const path = require('path')
const http = require('https')
const watcher = require('node-watch')
const theme = require('@shopify/themekit').command
const io = require('socket.io')(http)
const colors = require('colors')
const app = require('express')()
const queue = require('function-rate-limit')
const ignore = require('gitignore-parser')
const gitignore = ignore.compile(fs.readFileSync(
path.join(process.cwd(), '/.gitignore')
, 'utf8'))
const compiler = require('./webpack.js')
const webpackDevMiddleware = require('webpack-dev-middleware')
const webpackHotMiddleware = require('webpack-hot-middleware')
// @see https://github.com/webpack/webpack-dev-server/tree/master/examples/https
const ssl = {
key: fs.readFileSync(__dirname + '/cert/server.key'),
const colors = require('colors')
const theme = require('@shopify/themekit').command
const config = require('./configure')
const sendToShopify = (action, src, cb) => {
if (~config.get('ignore').indexOf(
src.replace(/\/?dist\//, '')
)) {
console.log(`Ignoring: ${src}`.blue)
return cb()
}
theme({
args: [
action,
'--env', process.env.ENV,
'--config', config.get('configPath'),
src
const colors = require('colors')
const theme = require('@shopify/themekit').command
const compiler = require('./webpack.js')
module.exports = function deploy (program, config) {
console.log('slater compiling javascript...'.grey)
compiler.run((err, stats) => {
if (err) {
console.log(err)
return
}
console.log('successfully compiled javascript...'.green)
theme({
args: [
'replace', '--env', program.env || 'development'
const chalk = require('chalk');
const figures = require('figures');
const https = require('https');
const themekit = require('@shopify/themekit').command;
const slateEnv = require('@shopify/slate-env');
const SlateConfig = require('@shopify/slate-config');
const config = new SlateConfig(require('./slate-sync.schema'));
let deploying = false;
let filesToDeploy = [];
function maybeDeploy() {
if (deploying) {
return Promise.reject(new Error('Deploy already in progress.'));
}
if (filesToDeploy.length) {
const files = [...filesToDeploy];
filesToDeploy = [];
return new Promise((resolve, reject) => {
debug(`themekit cwd to: ${config.dist.root}`);
themekit.command({
args: ['replace', '--env', env],
cwd: config.dist.root,
}, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
}).catch((err) => {
messages.logTransferFailed(err);
return new Promise((resolve, reject) => {
debug(`themekit cwd to: ${config.dist.root}`);
themekit.command({
args: [cmd, '--env', env].concat(files),
cwd: config.dist.root,
}, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
}).then(() => {
activeDeploy = false;