Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('webpack-dev-server', function () {
// modify some webpack config options
var myConfig = webpackConfig;
myConfig.devtool = 'eval';
myConfig.debug = true;
myConfig.output.path = '/';
myConfig.entry.jQuery = './node_modules/jquery/dist/jquery.js';
myConfig.entry.utils = ['webpack-dev-server/client?http://localhost:8080', 'es5-shim', 'es5-shim/es5-sham.js'];
myConfig.plugins = [new AnyBarWebpackPlugin()];
var serverPort = argv.port || '8080';
// Start a webpack-dev-server
new WebpackDevServer(webpack(myConfig), {
contentBase: pkgConfig.src,
stats: {
colors: true
}
}).listen(serverPort, function (err) {
if (err) {
throw new gutil.PluginError('webpack-dev-server', err);
}
gutil.log('[webpack-dev-server]', 'http://localhost:' + serverPort);
});
});
gulp.task('compilation-server', function (done) {
'use strict';
if (!verifyRun()) {
done();
return;
}
var srcServerName = argv.server;
if (!fs.existsSync(path.join(serversSrcDir, srcServerName, 'server.json'))) {
console.log('ERROR: source server ' + srcServerName + ' does not exist');
done();
return;
};
var port = argv.port || '8087';
process.env['CEC_TOOLKIT_COMPILATION_PORT'] = port;
process.env['CEC_TOOLKIT_COMPILATION_SERVER'] = srcServerName;
process.env['CEC_TOOLKIT_PROJECTDIR'] = projectDir;
process.env['CEC_TOOLKIT_COMPILATION_HTTPS_KEY'] = '';
process.env['CEC_TOOLKIT_COMPILATION_HTTPS_CERTIFICATE'] = '';
var keyPath = argv.key;
if (keyPath) {
if (!path.isAbsolute(keyPath)) {
keyPath = path.join(projectDir, keyPath);
}
keyPath = path.resolve(keyPath);
if (!fs.existsSync(keyPath)) {
console.log('ERROR: file ' + keyPath + ' does not exist');
done();
return;
;(async () => {
if (require.main === module) {
let opts = require('yargs').argv;
try {
await module.exports(opts);
console.log('OneDB listening on port ' + opts.port);
} catch (e) {
console.log(e.message);
console.log(e.stack);
throw e;
}
}
})();
app.listen(argv.port || 80, () => {
console.log("Running Tommy WebServer on port: " + (argv.port || 80));
});
} else {
var argv = require('yargs').argv;
var _ = require('lodash');
var path = require('path');
var prettyjson = require('prettyjson');
var config = require('./config');
var daemonize = require('./daemonize');
var signals = require('./signals');
var staticproxy = require('./static-proxy');
var socket = require('./socket');
var serveIndex = require('./serve-index');
var utils = require('./utils');
var blankline = console.log;
var defaultProject = config.get('projects.default');
var port = argv.port || config.get('app.port');
var host = argv.host || config.get('app.host');
if (defaultProject === 'cwd') {
defaultProject = process.cwd();
}
var url = 'http://' + host + ':' + port + '/' + defaultProject;
var shouldOpen = _.has(argv, 'open') ? argv.open : config.get('app.open');
var run = function() {
var app = require('http').createServer(handler);
app.listen(port);
if (shouldOpen) {
require("open")(url);
#!/usr/bin/env node
var http = require('http');
var mockserver = require('./../mockserver');
var argv = require('yargs').argv;
var colors = require('colors')
var info = require('./../package.json');
var mocks = argv.m || argv.mocks;
var port = argv.p || argv.port;
var verbose = !(argv.q || argv.quiet);
if (!mocks || !port) {
console.log([
"Mockserver v" + info.version,
"",
"Usage:",
" mockserver [-q] -p PORT -m PATH",
"",
"Options:",
" -p, --port=PORT - Port to listen on",
" -m, --mocks=PATH - Path to mock files",
" -q, --quiet - Do not output anything",
"",
"Example:",
" mockserver -p 8080 -m './mocks'"
exit,
exec,
find,
ls,
cd,
cp,
mv,
cat,
rm,
which
} = require('shelljs')
const tick = green(tickEmoji)
const cross = red(crossEmoji)
const DEFAULT_PORT = argv.port
const IS_DEBUGGING = process.env.DEBUG
const TEMPLATE_PATH = resolve(__dirname, '../template')
const DEPENDENCIES = [
'react',
'react-dom',
'react-router@^3.0.1',
'react-redux',
'react-router-redux',
'redux'
]
const DEV_DEPENDENCIES = [
'postcss-cssnext',
...IS_DEBUGGING ? [] : ['shazamjs']
]
'use strict';
const gulp = require('gulp');
const colors = require('colors');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const buildUtilities = require('../gulpTasks/buildUtilities.js');
const _ = require('underscore');
const path = require('path');
const fs = require('fs');
const glob = require('glob');
const args = require('yargs').argv;
const port = args.port || 8080;
const unitTestsPort = args.port || 8081;
const accessibilityTestsPort = args.port || 8082;
const webpackConfig = require('../webpack.config.js');
webpackConfig.entry['CoveoJsSearch.Lazy'].unshift(`webpack-dev-server/client?http://localhost:${port}/`);
const compiler = webpack(webpackConfig);
const webpackConfigUnitTest = require('../webpack.unit.test.config.js');
webpackConfigUnitTest.entry['unitTests'].unshift(`webpack-dev-server/client?http://localhost:${unitTestsPort}/`);
const compilerUnitTest = webpack(webpackConfigUnitTest);
const webpackConfigAccessibilityTest = require('../webpack.accessibility.test.config.js');
webpackConfigAccessibilityTest.entry['accessibilityTests'].unshift(`webpack-dev-server/client?http://localhost:${accessibilityTestsPort}/`);
const compilerAccessibilityTest = webpack(webpackConfigAccessibilityTest);
let server;
const debouncedLinkToExternal = _.debounce(() => {
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
alias: {
'src': paths.appSrc
},
modules: [
paths.appNodeModules,
paths.appSrc,
],
},
plugins,
devServer: {
contentBase: isProduction ? paths.appPublic : path.join(paths.appSrcStatic, '..'),
historyApiFallback: true,
port: parseInt(argv.port || '8080'),
compress: isProduction,
inline: !isProduction,
hot: !isProduction,
host: '0.0.0.0',
stats: {
assets: true,
children: false,
chunks: false,
hash: false,
modules: false,
publicPath: false,
timings: true,
version: false,
warnings: false,
colors: {
green: '\u001b[32m',