How to use address - 10 common examples

To help you get started, we’ve selected a few address examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / rax / packages / rax-scripts / src / config / webpack.config.dev.js View on Github external
'use strict';

/* eslint no-console: 0 */
const address = require('address');
const qrcode = require('qrcode-terminal');
const webpack = require('webpack');
const pathConfig = require('./path.config');
const webpackConfigBase = require('./webpack.config.base');
const envConfig = require('./env.config');

const webpackConfigDev = Object.assign({}, webpackConfigBase);
const ipv4 = address.ip();
const port = envConfig.port;
const webUrl = 'http://' + ipv4 + ':' + port;
const bundleUrl = 'http://' + ipv4 + ':' + port + '/js/index.bundle.js';
const weexBundleUrl = `${bundleUrl}?_wx_tpl=${bundleUrl}`;

qrcode.generate(webUrl, { small: true });
console.log('Web: scan above QRCode ' + webUrl + ' or direct open in browser.\n');

qrcode.generate(weexBundleUrl, { small: true });
console.log('Weex: scan above QRCode ' + weexBundleUrl + ' use weex playground.\n');

// enable source map
webpackConfigDev.devtool = 'inline-module-source-map';
webpackConfigDev.entry = {
  'index.bundle': [pathConfig.appIndexJs]
};
github jdf2e / yep-react / scripts / webpack.demo.config.dev.js View on Github external
/* eslint-disable */
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const autoprefixer = require('autoprefixer');
const pxtorem = require('postcss-pxtorem');
const OpenBrowserPlugin = require('open-browser-webpack-plugin');
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
const address = require('address');
const ip = address.ip();
function resolve(dir) {
  return path.join(__dirname, '..', dir);
}

const createLintingRule = () => ({});

// common function to get css loaders
const getStyleLoaders = (cssOptions, preProcessor, preProcessorOptions) => {
  const loaders = [
    require.resolve('style-loader'),
    {
      loader: require.resolve('css-loader'),
      options: cssOptions,
    },
    {
      // Options for PostCSS as we reference these options twice
github facebook / create-react-app / packages / react-dev-utils / WebpackDevServerUtils.js View on Github external
}
  // Unfortunately, many languages (unlike node) do not yet support IPv6.
  // This means even though localhost resolves to ::1, the application
  // must fall back to IPv4 (on 127.0.0.1).
  // We can re-enable this in a few years.
  /*try {
    o.hostname = address.ipv6() ? '::1' : '127.0.0.1';
  } catch (_ignored) {
    o.hostname = '127.0.0.1';
  }*/

  try {
    // Check if we're on a network; if we are, chances are we can resolve
    // localhost. Otherwise, we can just be safe and assume localhost is
    // IPv4 for maximum compatibility.
    if (!address.ip()) {
      o.hostname = '127.0.0.1';
    }
  } catch (_ignored) {
    o.hostname = '127.0.0.1';
  }
  return url.format(o);
}
github wangweianger / zanePerfor / config / config.default.js View on Github external
config.middleware = [];

    // 线上环境此处替换为项目根域名 例如:blog.seosiwei.com (这里不需要填写http|https和斜杠等字符)
    // 用于安全校验和回调域名根路径 开发路径域名
    config.host = '127.0.0.1';

    config.port = 7001;

    config.origin = `http://${config.host}:${config.port}`;

    // 集群配置(一般默认即可)
    config.cluster = {
        listen: {
            port: config.port,
            hostname: '127.0.0.1',
            ip: address.ip(),
        },
    };

    // 用户密码加盐随机值
    config.user_pwd_salt_addition = 'ZANEHELLOBEAUTIFUL';

    // 用户登录态持续时间 1 天
    config.user_login_timeout = 86400;

    // web浏览器端定时任务是否执行
    config.is_web_task_run = true;

    // wx小程序端定时任务是否执行
    config.is_wx_task_run = true;

    // 执行pvuvip定时任务的时间间隔 每2分钟定时执行一次 (可更改)
github wmonk / create-react-app-typescript / packages / react-dev-utils / WebpackDevServerUtils.js View on Github external
}
  // Unfortunately, many languages (unlike node) do not yet support IPv6.
  // This means even though localhost resolves to ::1, the application
  // must fall back to IPv4 (on 127.0.0.1).
  // We can re-enable this in a few years.
  /*try {
    o.hostname = address.ipv6() ? '::1' : '127.0.0.1';
  } catch (_ignored) {
    o.hostname = '127.0.0.1';
  }*/

  try {
    // Check if we're on a network; if we are, chances are we can resolve
    // localhost. Otherwise, we can just be safe and assume localhost is
    // IPv4 for maximum compatibility.
    if (!address.ip()) {
      o.hostname = '127.0.0.1';
    }
  } catch (_ignored) {
    o.hostname = '127.0.0.1';
  }
  return url.format(o);
}
github zubairghori / Ultimate_todo_list / node_modules / detect-port-alt / lib / detect-port.js View on Github external
listen(port, 'localhost', err => {
        if (err) {
          return handleError(err);
        }

        // 4. check current ip
        let ip;
        try {
          ip = address.ip();
        } catch (err) {
          // Skip the `ip` check if `address.ip()` fails
          return callback(null, realPort);
        }

        listen(port, ip, (err, realPort) => {
          if (err) {
            return handleError(err);
          }

          callback(null, realPort);
        });
      });
    });
github GitOfZGT / zero-design / zerod-webpack-conf / build / webpack.dev.conf.js View on Github external
contentBase: false, // since we use CopyWebpackPlugin.
		compress: true,
		host: HOST || config.dev.host,
		port: PORT || config.dev.port,
		open: config.dev.autoOpenBrowser,
		overlay: config.dev.errorOverlay ? { warnings: false, errors: true } : false,
		publicPath: config.dev.assetsPublicPath,
		proxy: config.dev.proxyTable,
		quiet: true, // necessary for FriendlyErrorsPlugin
		watchOptions: {
			poll: config.dev.poll,
			aggregateTimeout: 1000,
			ignored: [config.build.assetsRoot, path.resolve(__dirname, "../config"), __dirname],
		},
		disableHostCheck: true,
		public: address.ip(),
	},
	optimization: {
		minimize: false,
	},
	plugins: [
		new webpack.HotModuleReplacementPlugin(),
		new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
		new webpack.NoEmitOnErrorsPlugin(),
	],
});

module.exports = new Promise((resolve, reject) => {
	portfinder.basePort = process.env.PORT || config.dev.port;
	portfinder.getPort((err, port) => {
		if (err) {
			reject(err);
github egoist / poi / core / dev-utils / prepareProxy.js View on Github external
}
  // Unfortunately, many languages (unlike node) do not yet support IPv6.
  // This means even though localhost resolves to ::1, the application
  // must fall back to IPv4 (on 127.0.0.1).
  // We can re-enable this in a few years.
  /* try {
    o.hostname = address.ipv6() ? '::1' : '127.0.0.1';
  } catch (_ignored) {
    o.hostname = '127.0.0.1';
  } */

  try {
    // Check if we're on a network; if we are, chances are we can resolve
    // localhost. Otherwise, we can just be safe and assume localhost is
    // IPv4 for maximum compatibility.
    if (!address.ip()) {
      o.hostname = '127.0.0.1'
    }
  } catch (_) {
    o.hostname = '127.0.0.1'
  }
  return url.format(o)
}
github shlomiassaf / tdm / src / demo / modules / @forms / tutorials / before-render-event / before-render-event.component.ts View on Github external
beforeRender($event: BeforeRenderEventHandler): void {
    const email = $event.instructions['email'];
    if (email) {
      // CHANGING RENDERING TYPE ON THE FLY
      email.type = 'slideToggle';
    }
    const addressState = $event.instructions['address.state'];
    if (addressState) {
      // ASYNC CALLS THAT BLOCK THE WHOLE FORM FROM RENDERING, GOOD FOR GETTING DATA FROM REMOTE SERVER.
      // E.G.: GETTING GROUPS LISTED UNDER A USER, ETC...
      const p = new Promise( r => setTimeout(r, 1000 ))
        .then( () => {
          addressState.mergeData({
            options: STATES
          });
        });
      // mark this field as async, no render until promise completes.
      $event.async(p);
    }
  }
  /* @tdm-ignore:* */
github EasyERP / EasyERP_open_source / public / js / models / LeadsModel.js View on Github external
validate: function (attrs) {
            var errors = [];

            Validation.checkGroupsNameField(errors, true, attrs.name, 'Subject');
            Validation.checkGroupsNameField(errors, true, attrs.source, 'Source');

            // Validation.checkGroupsNameField(errors, false, attrs.company.name, 'Company'); // commented in hotFix By Liliya
            Validation.checkPhoneField(errors, false, attrs['phones.phone'] || attrs.phones.phone, 'Phone');
            Validation.checkPhoneField(errors, false, attrs['phones.mobile'] || attrs.phones.mobile, 'Mobile');
            Validation.checkCountryCityStateField(errors, false, attrs['address.country'] || attrs.address.country, 'Country');
            Validation.checkCountryCityStateField(errors, false, attrs['address.state'] || attrs.address.state, 'State');
            Validation.checkCountryCityStateField(errors, false, attrs['address.city'] || attrs.address.city, 'City');
            Validation.checkZipField(errors, false, attrs['address.zip'] || attrs.address.zip, 'Zip');
            Validation.checkStreetField(errors, false, attrs['address.street'] || attrs.address.street, 'Street');
            Validation.checkEmailField(errors, false, attrs.email, 'Email');
            Validation.checkNotesField(errors, false, attrs.internalNotes, 'Notes');
            Validation.checkFacebookSocial(errors, false, attrs.social.FB, 'Facebook');
            Validation.checkLinkedinSocial(errors, false, attrs.social.LI, 'LinkedIn');

           /* if (!attrs.tempCompanyField) {
                errors.push('Check company please. ');
            }

            if (!attrs.customer) {
                errors.push('Check person please. ');
            }*/