How to use the getPortPromise function from portfinder
Find comprehensive JavaScript portfinder.getPortPromise code examples handpicked from public code repositorys.
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124return true; } async _reservePorts() { const [wsPort, ...workerPorts] = await Promise.all([ portfinder.getPortPromise({ host: "127.0.0.1", port: 9944 }), ...this.workers.map((w, i) => portfinder.getPortPromise({ host: "127.0.0.1", port: 8100 + i * 10 })) ]); this.wsPort = wsPort; this.workers.forEach((w, i) => w.port = workerPorts[i]);
+ 5 other calls in file
GitHub: HowToRun/wxdemo
85 86 87 88 89 90 91 92 93 94 95// _resolve() // }) module.exports = new Promise((resolve, reject) => { portfinder.basePort = port portfinder.getPortPromise() .then(newPort => { if (port !== newPort) { console.log(`${port}端口被占用,开启新端口${newPort}`) }
GitHub: uptonking/nocobase-apache
47 48 49 50 51 52 53 54 55await postCheck(opts); if (server) { serverPort = APP_PORT; } else if (!server && !client) { serverPort = await getPortPromise({ port: 1 * clientPort + 1, }); }
+ 6 other calls in file
34 35 36 37 38 39 40 41 42 43var isProd = false; if (environment === 'production') { isProd = true; } portfinder.basePort = (env && env.port) || 1962 return portfinder.getPortPromise().then(port => { const plugins = [ new HtmlWebpackPlugin({ template: "index.html", hash: true, inject: "body" }), new BaseHrefWebpackPlugin({ baseHref: basehref }), new ExtWebpackPlugin({
+ 2 other calls in file
8 9 10 11 12 13 14 15 16 17 18 19 20const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = async function webpackConfig() { portfinder.basePort = (process.env.PORT && Number(process.env.PORT)) || config.port; const port = await portfinder.getPortPromise(); const host = process.env.HOST || config.host; return merge(baseWebpackConfig, { mode: 'development',
4 5 6 7 8 9 10 11 12 13 14 15 16let server = null let port = null beforeEach(async () => { port = await portfinder.getPortPromise() server = app.listen(port) }) afterEach(() => {
portfinder.getPort is the most popular function in portfinder (613 examples)