Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Added port support on devServerConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
alansouzati committed Mar 23, 2017
1 parent 11d9bce commit 15564f2
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grommet-cli",
"version": "3.0.0",
"version": "3.0.1",
"main": "src/grommet.js",
"description": "Command line interface for Grommet.",
"authors": [
12 changes: 7 additions & 5 deletions src/commands/pack.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ import WebpackDevServer from 'webpack-dev-server';
const delimiter = chalk.magenta('[grommet:pack]');

const ENV = process.env.NODE_ENV || 'production';
const PORT = process.env.PORT || 3000;
let port = process.env.PORT || 3000;

function deleteDistributionFolder() {
if (ENV === 'production') {
@@ -40,8 +40,10 @@ function runDevServer(compiler, devServerConfig) {
`${delimiter}: Starting dev server...`
);
const devServer = new WebpackDevServer(compiler, devServerConfig);

devServer.listen(PORT, (err, result) => {
if (!process.env.PORT && devServerConfig.port) {
port = devServerConfig.port;
}
devServer.listen(port, (err, result) => {
if (err) {
throw err;
}
@@ -99,10 +101,10 @@ function build(config) {
// be truthy when it is turned on
const protocol = devServerConfig.https ? 'https' : 'http';
console.log(
`${delimiter}: Opening the browser at ${protocol}://localhost:${PORT}`
`${delimiter}: Opening the browser at ${protocol}://localhost:${port}`
);

opener(`${protocol}://localhost:${PORT}`);
opener(`${protocol}://localhost:${port}`);
}

firstCompilation = false;

0 comments on commit 15564f2

Please sign in to comment.