Skip to content

Commit

Permalink
Changes for review change comment.
Browse files Browse the repository at this point in the history
Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
  • Loading branch information
Piyush3079 committed Jul 8, 2018
1 parent 39244e3 commit 1bf67fa
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ build:
command: './vendor/bin/phpcs --standard=PMAStandard ./ --report=checkstyle --report-file=cs-data --ignore=*/vendor/*,*/build/*'
analysis:
file: 'cs-data' # The reporter filename
format: 'php-cs-checkstyle' # The supported format by Scrutinizer
format: 'php-cs-checkstyle' # The supported format by Scrutinizer
10 changes: 7 additions & 3 deletions config.sample.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@
$cfg['environment'] = 'production';

/**
* Port number for running development sever of webpack while you
* are in development environment
* Webppack host for running development server of webpack
*/
$cfg['webpack_port'] = 3307;
$cfg['webpack_host'] = 'http://localhost:3307';

/**
* Additional string to allow in CSP headers in development for webpack files.
*/
$cfg['CSPAllow'] = 'http://localhost:3307 ws://localhost:3307';

/**
* Servers configuration
Expand Down
6 changes: 3 additions & 3 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3409,10 +3409,10 @@ Developer

Enable you to set the working environment for loading js files

.. config:option:: $cfg['webpack_port']
.. config:option:: $cfg['webpack_host']
:type: integer
:default: 3307
:type: string
:default: `'http://localhost:3307'`

Enable you to start webpack development server for serving js files
when woking in the development environment
Expand Down
4 changes: 2 additions & 2 deletions js/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,9 @@ var AJAX = {
*/
var check = name.split('_');
if (check[check.length - 1] === 'new.js') {
var script_src = '';
var script_src;
if (PMA_commonParams.get('environment') === 'development') {
script_src += 'http://localhost:' + PMA_commonParams.get('webpack_port') + '/js/dist/';
script_src = PMA_commonParams.get('webpack_host') + '/js/dist/';
} else if (PMA_commonParams.get('environment') === 'production') {
script_src = 'js/dist/';
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function getJsParams(): array

$params = [
'environment' => $GLOBALS['cfg']['environment'],
'webpack_port' => $GLOBALS['cfg']['webpack_port'],
'webpack_host' => $GLOBALS['cfg']['webpack_host'],
'common_query' => Url::getCommonRaw(),
'opendb_url' => Util::getScriptNameForOption(
$GLOBALS['cfg']['DefaultTabDatabase'],
Expand Down
5 changes: 2 additions & 3 deletions libraries/classes/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ private function _includeFiles(array $files)
* DOM so that both new and old files can be used simultaneously
* It checks whether the file contains new in its name or not
*/
$src = "";
if ($GLOBALS['cfg']['environment'] === 'development') {
$src = "http://localhost:" . $GLOBALS['cfg']['webpack_port'] . "/";
} else if ($GLOBALS['cfg']['environment'] === 'production'){
$src = "";
$src = $GLOBALS['cfg']['webpack_host'] . "/";
}
$result .= '<script data-cfasync="false" type="text/javascript" src="' . $src . 'js/dist/'
. $value['filename'] . '?' . Header::getVersionParameter() . '"></script>' . "\n";
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default [{
db_search_new: './js/src/db_search.js',
},
output: {
filename: 'js/sql.js',
filename: 'db_search_new.js',
path: path.resolve(__dirname, 'dist'),
publicPath: 'http://localhost:3007/dist'
publicPath: 'http://localhost:3307/js/dist'
},
module: module,
// devtool: 'source-map',
Expand Down

0 comments on commit 1bf67fa

Please sign in to comment.