refactor(@embark/embark-utils): move findNextPort to embark-utils

refactor(@embark/embark-utils): move findNextPort to embark-utils

refactor(@embark/embark-utils): move findNextPort to embark-utils

refactor(@embark/embark-utils): move findNextPort to embark-utils

fix linting issue

fix lint

fix lint
This commit is contained in:
Iuri Matias 2019-03-27 15:12:46 -04:00
parent 246715cd6b
commit bb55ae120e
5 changed files with 9 additions and 10 deletions

View File

@ -31,13 +31,13 @@
"clean": "npm run reset",
"lint": "npm-run-all lint:*",
"lint:js": "eslint src/",
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
"// lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
"package": "npm pack",
"// qa": "npm-run-all lint typecheck build package",
"qa": "npm-run-all lint build package",
"reset": "npx rimraf dist embark-*.tgz package",
"start": "npm run watch",
"typecheck": "tsc",
"// typecheck": "tsc",
"watch": "run-p watch:*",
"watch:build": "npm run build -- --verbose --watch",
"// watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"

View File

@ -2,6 +2,7 @@ const http = require('follow-redirects').http;
const https = require('follow-redirects').https;
const {canonicalHost, defaultCorsHost, defaultHost, dockerHostSwap, isDocker} = require('./host');
const {findNextPort} = require('./network');
function checkIsAvailable(url, callback) {
const protocol = url.split(':')[0];
@ -24,7 +25,8 @@ const Utils = {
defaultHost,
dockerHostSwap,
isDocker,
checkIsAvailable
checkIsAvailable,
findNextPort
};
module.exports = Utils;

View File

@ -1,9 +1,8 @@
import {Embark} from "embark";
import {checkIsAvailable, dockerHostSwap, findNextPort} from "embark-utils";
import {__} from "i18n";
import {findNextPort} from "../../utils/network";
import Server from "./server";
import {dockerHostSwap, checkIsAvailable} from "embark-utils";
import Server from "./server";
const DEFAULT_PORT = 55555;
const DEFAULT_HOSTNAME = "localhost";
@ -15,7 +14,7 @@ export default class Api {
constructor(private embark: Embark, private options: any) {
this.embark.events.emit("status", __("Starting API & Cockpit UI"));
findNextPort(DEFAULT_PORT).then((port) => {
findNextPort(DEFAULT_PORT).then((port: any) => {
this.port = port;
this.apiUrl = `http://${DEFAULT_HOSTNAME}:${this.port}`;

View File

@ -1,6 +1,4 @@
import {findNextPort} from "../../utils/network";
import {joinPath, canonicalHost, checkIsAvailable} from 'embark-utils';
import {joinPath, canonicalHost, checkIsAvailable, findNextPort} from 'embark-utils';
var Server = require('./server.js');
const opn = require('opn');