cli/serve.js
function getPort(config, skyPagesConfig) {
  return new Promise((resolve, reject) => {
    const configPort = skyPagesConfig &&
      skyPagesConfig.skyux &&
      skyPagesConfig.skyux.app &&
      skyPagesConfig.skyux.app.port;

    if (configPort) {
      resolve(configPort);
    } else if (config.devServer && config.devServer.port) {
      resolve(config.devServer.port);
    } else {
      portfinder.getPortPromise()
        .then(port => resolve(port))
        .catch(err => reject(err));
    }
  });
}
function getPort(config, skyPagesConfig) {
  return new Promise((resolve, reject) => {
    const configPort = skyPagesConfig &&
      skyPagesConfig.skyux &&
      skyPagesConfig.skyux.app &&
      skyPagesConfig.skyux.app.port;

    if (configPort) {
      resolve(configPort);
    } else if (config.devServer && config.devServer.port) {
      resolve(config.devServer.port);
    } else {
      portfinder.getPortPromise()
        .then(port => resolve(port))
        .catch(err => reject(err));
    }
  });
}
function getPort ( config , skyPagesConfig ) { return new Promise ( ( resolve , reject ) => { const configPort = skyPagesConfig && skyPagesConfig . skyux && skyPagesConfig . skyux . app && skyPagesConfig . skyux . app . port ; if ( configPort ) { resolve ( configPort ) ; } else if ( config . devServer && config . devServer . port ) { resolve ( config . devServer . port ) ; } else { portfinder . getPortPromise ( ) . then ( port => resolve ( port ) ) . catch ( err => reject ( err ) ) ; } } ) ; }
Let users configure port via skyuxconfig.json first.
Else another plugin has specified devServer.port, use it.
Else, find us an available port.
@name getPort
@returns {Number} port
Let users configure port via skyuxconfig . json first . Else another plugin has specified devServer . port use it . Else find us an available port .