Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = config => {
logger.start('Starting production build...');
let serverCompiler;
const { clientConfig, serverConfig } = buildConfigs(config, 'production');
// Clean the build directory.
if (shell.rm('-rf', buildPath).code === 0) {
shell.mkdir(buildPath);
logger.task('Cleaned ./build');
}
// Copy public folder into build
if (shell.test('-d', publicSrcPath)) {
// Create build folder if it doesnt exist
if (!shell.test('-d', buildPath)) {
shell.mkdir(buildPath);
let compiler = null;
try {
if (config.debug) logger.debug('Prototype Config', webpackConfig);
compiler = webpack(webpackConfig);
} catch (error) {
logger.error('Webpack config is invalid\n', error);
process.exit();
}
// Creates a webpack dev server at the specified port
server = new WebpackDevServer(compiler, webpackConfig.devServer);
server.listen(prototypeURL.port, prototypeURL.hostname, () => {
logger.end(`webpack-dev-server ${prototypeURL.href}prototype`);
});
};
logger.start('Configuring Prototype...');
if (!shell.test('-f', userPrototypePath)) {
logger.error('Prototype.js entry file does not exist.');
logger.error('See the kyt Readme for details.');
process.exit();
}
ifPortIsFreeDo(prototypeURL.port, startPrototype);
};
module.exports = (config, flags) => {
logger.start('Starting development build...');
// Kill the server on exit.
process.on('SIGINT', process.exit);
let clientCompiler;
let serverCompiler;
const { clientConfig, serverConfig } = buildConfigs(config);
const { clientURL, serverURL, reactHotLoader, hasServer } = config;
const afterClientCompile = once(() => {
if (reactHotLoader) logger.task('Setup React Hot Loader');
if (!hasServer) logger.task(`Starting up server: ${clientCompiler.options.output.publicPath}`);
else logger.task(`Client assets serving from ${clientCompiler.options.output.publicPath}`);
});
// Clean the build directory.
module.exports = (config, flags) => {
logger.start('Starting development build...');
// Kill the server on exit.
process.on('SIGINT', process.exit);
let clientCompiler;
let serverCompiler;
const { clientConfig, serverConfig } = buildConfigs(config);
const { clientURL, serverURL, reactHotLoader, hasServer, additionalServerPaths } = config;
const afterClientCompile = once(() => {
if (reactHotLoader) logger.task('Setup React Hot Loader');
if (!hasServer) logger.task(`Starting up server: ${clientCompiler.options.output.publicPath}`);
else logger.task(`Client assets serving from ${clientCompiler.options.output.publicPath}`);
});
// Clean the build directory.
module.exports = (flags, args) => {
logger.start("Let's set up your new kyt project...");
logger.log('⨠Answer a few questions to get started ⨠\n');
// Selects package manager to use
let ypm;
// Comment the following to see verbose shell ouput.
shell.config.silent = true;
let paths = {};
const date = Date.now();
let tmpStarter;
// For passed starter-kyts the root of the starter-kyt is the root of the repo
let tmpDir;
let repoURL = 'https://github.com/NYTimes/kyt.git';
let { localPath } = args;
let tempPackageJSON;
let oldPackageJSON;
const fakePackageJson = {
name: '',
module.exports = () => {
logger.start('Listing starter-kyts');
logger.task('kyt supported starter-kyts: \n');
Object.keys(starterKyts.supported).forEach((starterName, index) => {
const li = index + 1;
printStarter(li, starterKyts.supported[starterName]);
});
logger.task('Recommended starter-kyts:\n');
Object.keys(starterKyts.recommended).forEach((starterName, index) => {
const li = index + 1;
printStarter(li, starterKyts.recommended[starterName]);
});
logger.end('List complete');
};
const existingProjectSetup = () => {
logger.start('Setting up kyt');
updateUserPackageJSON(true);
createEditorconfigLink();
createESLintFile();
createStylelintFile();
createKytConfig();
createGitignore();
logger.end('Done setting up kyt');
};