• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript semver.gte函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中semver.gte函数的典型用法代码示例。如果您正苦于以下问题:TypeScript gte函数的具体用法?TypeScript gte怎么用?TypeScript gte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了gte函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: usesServiceWorker

export function usesServiceWorker(projectRoot: string): boolean {
  let swPackageJsonPath;

  try {
    swPackageJsonPath = resolveProjectModule(projectRoot, '@angular/service-worker/package.json');
  } catch (_) {
    // @angular/service-worker is not installed
    throw new Error(tags.stripIndent`
    Your project is configured with serviceWorker = true, but @angular/service-worker
    is not installed. Run \`npm install --save-dev @angular/service-worker\`
    and try again, or run \`ng set apps.0.serviceWorker=false\` in your .angular-cli.json.
  `);
  }

  const swPackageJson = fs.readFileSync(swPackageJsonPath).toString();
  const swVersion = JSON.parse(swPackageJson)['version'];

  if (!semver.gte(swVersion, NEW_SW_VERSION)) {
    throw new Error(tags.stripIndent`
    The installed version of @angular/service-worker is ${swVersion}. This version of the CLI
    requires the @angular/service-worker version to satisfy ${NEW_SW_VERSION}. Please upgrade
    your service worker version.
  `);
  }

  return true;
}
开发者ID:fmalcher,项目名称:angular-cli,代码行数:27,代码来源:index.ts


示例2: processMatches

function processMatches(matches: KnownProps, version: string) {
  // Set indent_size to 'tab' if indent_size is unspecified and
  // indent_style is set to 'tab'.
  if (
    'indent_style' in matches
    && matches.indent_style === 'tab'
    && !('indent_size' in matches)
    && semver.gte(version, '0.10.0')
  ) {
    matches.indent_size = 'tab'
  }

  // Set tab_width to indent_size if indent_size is specified and
  // tab_width is unspecified
  if (
    'indent_size' in matches
    && !('tab_width' in matches)
    && matches.indent_size !== 'tab'
  ) {
    matches.tab_width = matches.indent_size
  }

  // Set indent_size to tab_width if indent_size is 'tab'
  if (
    'indent_size' in matches
    && 'tab_width' in matches
    && matches.indent_size === 'tab'
  ) {
    matches.indent_size = matches.tab_width
  }

  return matches
}
开发者ID:editorconfig,项目名称:editorconfig-core-js,代码行数:33,代码来源:index.ts


示例3: match

export function match(range: string, versions: string[], tags: Dictionary<string> = {}): string {
    if (Semver.validRange(range)) {
        versions = versions.sort(Semver.rcompare);

        let latest = tags['latest'] || versions[0];

        for (let version of versions) {
            if (Semver.gte(latest, version) && Semver.satisfies(version, range)) {
                return version;
            }
        }

        for (let version of versions) {
            if (Semver.satisfies(version, range)) {
                return version;
            }
        }

        if (range === '*') {
            return latest;
        }

        return undefined;
    } else {
        // Otherwise, treat it as a tag (according to NPM source code).
        return hasOwnProperty.call(tags, range) ? tags[range] : undefined;
    }
}
开发者ID:vilic,项目名称:semver-match,代码行数:28,代码来源:index.ts


示例4: RangeError

 return this.getReactNativeVersion().then(version => {
     if (semver.gte(version, "0.19.0")) {
         return Q.resolve<void>(void 0);
     } else {
         return Q.reject<void>(new RangeError(`Project version = ${version}`));
     }
 });
开发者ID:CarlosVV,项目名称:vscode-react-native,代码行数:7,代码来源:reactNativeProjectHelper.ts


示例5: getCompiler

export function getCompiler(
    loaderOptions: LoaderOptions,
    log: logger.Logger
) {
    let compiler: typeof typescript | undefined;
    let errorMessage: string | undefined;
    let compilerDetailsLogMessage: string | undefined;
    let compilerCompatible = false;

    try {
        compiler = require(loaderOptions.compiler);
    } catch (e) {
        errorMessage = loaderOptions.compiler === 'typescript'
            ? 'Could not load TypeScript. Try installing with `yarn add typescript` or `npm install typescript`. If TypeScript is installed globally, try using `yarn link typescript` or `npm link typescript`.'
            : `Could not load TypeScript compiler with NPM package name \`${loaderOptions.compiler}\`. Are you sure it is correctly installed?`;
    }

    if (errorMessage === undefined) {
        compilerDetailsLogMessage = `ts-loader: Using ${loaderOptions.compiler}@${compiler!.version}`;
        compilerCompatible = false;
        if (loaderOptions.compiler === 'typescript') {
            if (compiler!.version && semver.gte(compiler!.version, '2.4.1')) {
                // don't log yet in this case, if a tsconfig.json exists we want to combine the message
                compilerCompatible = true;
            } else {
                log.logError(`${compilerDetailsLogMessage}. This version is incompatible with ts-loader. Please upgrade to the latest version of TypeScript.`);
            }
        } else {
            log.logWarning(`${compilerDetailsLogMessage}. This version may or may not be compatible with ts-loader.`);
        }
    }

    return { compiler, compilerCompatible, compilerDetailsLogMessage, errorMessage };
}
开发者ID:bjohnso5,项目名称:ts-loader,代码行数:34,代码来源:compilerSetup.ts


示例6: checkNgPackagrVersion

function checkNgPackagrVersion(projectRoot: string): boolean {
  let ngPackagrJsonPath;

  try {
    ngPackagrJsonPath = resolveProjectModule(projectRoot, 'ng-packagr/package.json');
  } catch {
    // ng-packagr is not installed
    throw new Error(tags.stripIndent`
    ng-packagr is not installed. Run \`npm install ng-packagr --save-dev\` and try again.
  `);
  }

  const ngPackagrPackageJson = fs.readFileSync(ngPackagrJsonPath).toString();
  const ngPackagrVersion = JSON.parse(ngPackagrPackageJson)['version'];

  if (!semver.gte(ngPackagrVersion, NEW_NG_PACKAGR_VERSION)) {
    throw new Error(tags.stripIndent`
    The installed version of ng-packagr is ${ngPackagrVersion}. The watch feature
    requires ng-packagr version to satisfy ${NEW_NG_PACKAGR_VERSION}.
    Please upgrade your ng-packagr version.
  `);
  }

  return true;
}
开发者ID:DevIntent,项目名称:angular-cli,代码行数:25,代码来源:index.ts


示例7: it

 it('should report scopes correctly', () => {
     assert.isDefined(localScope, 'Locals');
     assert.isDefined(superglobalsScope, 'Superglobals');
     // support for user defined constants was added in 2.3.0
     if (!process.env.XDEBUG_VERSION || semver.gte(process.env.XDEBUG_VERSION, '2.3.0')) {
         assert.isDefined(constantsScope, 'User defined constants');
     }
 });
开发者ID:Heresiarch88,项目名称:vscode-php-debug,代码行数:8,代码来源:adapter.ts


示例8: function

    function (error, stdout, stderr) {
      if (error !== null) {
        reportError('npm preinstall error: ' + error + stderr);
      }

      if (!semver.gte(stdout, VERSION_NPM)) {
        reportError('NPM is not in required version! Required is ' + VERSION_NPM + ' and you\'re using ' + stdout);
      }
    });
开发者ID:Devvarat,项目名称:angular2-seed,代码行数:9,代码来源:check.versions.ts


示例9: function

    function(error: Error, stdout: NodeBuffer, stderr: NodeBuffer) {
      if (error !== null) {
        reportError('npm preinstall error: ' + error + stderr);
      }

      if (!semver.gte(stdout, Config.VERSION_NODE)) {
    reportError('NODE is not in required version! Required is ' + Config.VERSION_NODE + ' and you\'re using ' + stdout);
      }
    });
开发者ID:GeoscienceAustralia,项目名称:gnss-site-manager,代码行数:9,代码来源:check.versions.ts


示例10: function

      function (error, stdout, stderr) {
        if (error !== null) {
          throw new Error('npm preinstall error: ' + error + stderr);
        }

        if (!semver.gte(stdout, VERSION_NODE)) {
          throw new Error('NODE is not in required version! Required is ' + VERSION_NODE + ' and you\'re using ' + stdout);
        }
      });
开发者ID:A-Kamaee,项目名称:ng2-bootstrap-sbadmin,代码行数:9,代码来源:check.versions.ts


示例11:

export const isWindows = (minVersion?: string) => {
  const osRelease = os.release();

  if (process.platform !== 'win32') {
    return false;
  }

  return is.undefined(minVersion) ? true : semver.gte(osRelease, minVersion);
};
开发者ID:VetoPlayer,项目名称:Signal-Desktop,代码行数:9,代码来源:OS.ts


示例12: isEnvTrue

const wineExecutable = new Lazy<ToolInfo>(async () => {
  const isUseSystemWine = isEnvTrue(process.env.USE_SYSTEM_WINE)
  if (isUseSystemWine) {
    log.debug(null, "using system wine is forced")
  }
  else if (process.platform === "darwin") {
    // assume that on travis latest version is used
    const osVersion = await getMacOsVersion()
    let version: string | null = null
    let checksum: string | null = null
    if (semver.gte(osVersion, "10.13.0")) {
      version = "2.0.3-mac-10.13"
      // noinspection SpellCheckingInspection
      checksum = "dlEVCf0YKP5IEiOKPNE48Q8NKXbXVdhuaI9hG2oyDEay2c+93PE5qls7XUbIYq4Xi1gRK8fkWeCtzN2oLpVQtg=="
    }
    else if (semver.gte(osVersion, "10.12.0") || process.env.TRAVIS_OS_NAME === "osx") {
      version = "2.0.1-mac-10.12"
      // noinspection SpellCheckingInspection
      checksum = "IvKwDml/Ob0vKfYVxcu92wxUzHu8lTQSjjb8OlCTQ6bdNpVkqw17OM14TPpzGMIgSxfVIrQZhZdCwpkxLyG3mg=="
    }

    if (version != null) {
      const wineDir = await getBinFromGithub("wine", version, checksum!!)
      return {
        path: path.join(wineDir, "bin/wine"),
        env: {
          ...process.env,
          WINEDEBUG: "-all,err+all",
          WINEDLLOVERRIDES: "winemenubuilder.exe=d",
          WINEPREFIX: path.join(wineDir, "wine-home"),
          DYLD_FALLBACK_LIBRARY_PATH: computeEnv(process.env.DYLD_FALLBACK_LIBRARY_PATH, [path.join(wineDir, "lib")]),
        },
      }
    }
  }

  if (process.env.COMPRESSED_WINE_HOME) {
    await exec(path7za, debug7zArgs("x").concat(process.env.COMPRESSED_WINE_HOME!!, "-aoa", `-o${path.join(os.homedir(), ".wine")}`))
  }
  else {
    await checkWineVersion(exec("wine", ["--version"]))
  }
  return {path: "wine"}
})
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:44,代码来源:wine.ts


示例13: usesServiceWorker

export function usesServiceWorker(projectRoot: string): boolean {
  const nodeModules = path.resolve(projectRoot, 'node_modules');
  const swModule = path.resolve(nodeModules, '@angular/service-worker');
  if (!fs.existsSync(swModule)) {
    return false;
  }

  const swPackageJson = fs.readFileSync(`${swModule}/package.json`).toString();
  const swVersion = JSON.parse(swPackageJson)['version'];

  return semver.gte(swVersion, NEW_SW_VERSION);
}
开发者ID:Serdji,项目名称:angular-cli,代码行数:12,代码来源:index.ts


示例14: getLogcatStream

	private async getLogcatStream(deviceIdentifier: string, pid?: string) {
		const device = await this.$devicesService.getDevice(deviceIdentifier);
		const minAndroidWithLogcatPidSupport = "7.0.0";
		const isLogcatPidSupported = !!device.deviceInfo.version && semver.gte(semver.coerce(device.deviceInfo.version), minAndroidWithLogcatPidSupport);
		const adb: Mobile.IDeviceAndroidDebugBridge = this.$injector.resolve(DeviceAndroidDebugBridge, { identifier: deviceIdentifier });
		const logcatCommand = ["logcat"];

		if (pid && isLogcatPidSupported) {
			logcatCommand.push(`--pid=${pid}`);
		}
		const logcatStream = await adb.executeCommand(logcatCommand, { returnChildProcess: true });
		return logcatStream;
	}
开发者ID:NativeScript,项目名称:nativescript-cli,代码行数:13,代码来源:logcat-helper.ts


示例15: getProdConfig

export function getProdConfig(wco: WebpackConfigOptions) {
  const { projectRoot, buildOptions, appConfig } = wco;

  let extraPlugins: any[] = [];

  if (appConfig.serviceWorker) {
    let swPackageJsonPath;

    try {
      swPackageJsonPath = resolveProjectModule(projectRoot, '@angular/service-worker/package.json');
    } catch (_) {
      // @angular/service-worker is required to be installed when serviceWorker is true.
      throw new Error(stripIndent`
        Your project is configured with serviceWorker = true, but @angular/service-worker
        is not installed. Run \`npm install --save-dev @angular/service-worker\`
        and try again, or run \`ng set apps.0.serviceWorker=false\` in your .angular-cli.json.
      `);
    }

    // Read the version of @angular/service-worker and throw if it doesn't match the
    // expected version.
    const swPackageJson = fs.readFileSync(swPackageJsonPath).toString();
    const swVersion = JSON.parse(swPackageJson)['version'];
    const isModernSw = semver.gte(swVersion, NEW_SW_VERSION);

    if (!isModernSw) {
      throw new Error(stripIndent`
        The installed version of @angular/service-worker is ${swVersion}. This version of the CLI
        requires the @angular/service-worker version to satisfy ${NEW_SW_VERSION}. Please upgrade
        your service worker version.
      `);
    }
  }

  extraPlugins.push(new BundleBudgetPlugin({
    budgets: appConfig.budgets
  }));

  if (buildOptions.extractLicenses) {
    extraPlugins.push(new LicenseWebpackPlugin({
      pattern: /^(MIT|ISC|BSD.*)$/,
      suppressErrors: true,
      perChunkOutput: false,
      outputFilename: `3rdpartylicenses.txt`
    }));
  }

  return {
    plugins: extraPlugins,
  };
}
开发者ID:deebloo,项目名称:angular-cli,代码行数:51,代码来源:production.ts


示例16: isEnvTrue

const wineExecutable = new Lazy<ToolInfo>(async () => {
  const isUseSystemWine = isEnvTrue(process.env.USE_SYSTEM_WINE)
  if (isUseSystemWine) {
    debug("Using system wine is forced")
  }
  else if (process.platform === "darwin") {
    const osVersion = await getMacOsVersion()
    let version: string | null = null
    let checksum: string | null = null
    if (semver.gte(osVersion, "10.13.0")) {
      version = "2.0.2-mac-10.13"
      // noinspection SpellCheckingInspection
      checksum = "v6r9RSQBAbfvpVQNrEj48X8Cw1181rEGMRatGxSKY5p+7khzzy/0tOdfHGO8cU+GqYvH43FAKMK8p6vUfCqSSA=="
    }
    else if (semver.gte(osVersion, "10.12.0")) {
      version = "2.0.1-mac-10.12"
      // noinspection SpellCheckingInspection
      checksum = "IvKwDml/Ob0vKfYVxcu92wxUzHu8lTQSjjb8OlCTQ6bdNpVkqw17OM14TPpzGMIgSxfVIrQZhZdCwpkxLyG3mg=="
    }

    if (version != null) {
      const wineDir = await getBinFromGithub("wine", version, checksum!!)
      return {
        path: path.join(wineDir, "bin/wine"),
        env: {
          ...process.env,
          WINEDEBUG: "-all,err+all",
          WINEDLLOVERRIDES: "winemenubuilder.exe=d",
          WINEPREFIX: path.join(wineDir, "wine-home"),
          DYLD_FALLBACK_LIBRARY_PATH: computeEnv(process.env.DYLD_FALLBACK_LIBRARY_PATH, [path.join(wineDir, "lib")])
        }
      }
    }
  }

  await checkWineVersion(exec("wine", ["--version"]))
  return {path: "wine"}
})
开发者ID:jwheare,项目名称:electron-builder,代码行数:38,代码来源:wine.ts


示例17: usesServiceWorker

export function usesServiceWorker(projectRoot: string): boolean {
  let swPackageJsonPath;

  try {
    swPackageJsonPath = resolveProjectModule(projectRoot, '@angular/service-worker/package.json');
  } catch (_) {
    // @angular/service-worker is not installed
    return false;
  }

  const swPackageJson = fs.readFileSync(swPackageJsonPath).toString();
  const swVersion = JSON.parse(swPackageJson)['version'];

  return semver.gte(swVersion, NEW_SW_VERSION);
}
开发者ID:deebloo,项目名称:angular-cli,代码行数:15,代码来源:index.ts


示例18: emitTelemetry

export function emitTelemetry(area: string, feature: string, taskSpecificTelemetry: { [key: string]: any; }): void {
    try {
        let agentVersion = tl.getVariable('Agent.Version');
        if (semver.gte(agentVersion, '2.120.0')) {
            console.log("##vso[telemetry.publish area=%s;feature=%s]%s",
                area,
                feature,
                JSON.stringify(taskSpecificTelemetry));
        } else {
            tl.debug(`Agent version is ${agentVersion}. Version 2.120.0 or higher is needed for telemetry.`);
        }
    } catch (err) {
        tl.debug(`Unable to log telemetry. Err:( ${err} )`);
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:15,代码来源:xcodeutils.ts


示例19: emitTelemetry

export function emitTelemetry(area: string, feature: string, taskSpecificTelemetry: any) {
    try {
        let agentVersion = tl.getVariable('Agent.Version');
        if (semver.gte(agentVersion, '2.120.0')) {
            // Common Telemetry VARs that will be concatenated with the supplied telem object.
            let commonTelem = {
                'SYSTEM_TASKINSTANCEID': tl.getVariable('SYSTEM_TASKINSTANCEID'),
                'SYSTEM_JOBID': tl.getVariable('SYSTEM_JOBID'),
                'SYSTEM_PLANID': tl.getVariable('SYSTEM_PLANID'),
                'SYSTEM_COLLECTIONID': tl.getVariable('SYSTEM_COLLECTIONID'),
                'AGENT_ID': tl.getVariable('AGENT_ID'),
                'AGENT_MACHINENAME': tl.getVariable('AGENT_MACHINENAME'),
                'AGENT_NAME': tl.getVariable('AGENT_NAME'),
                'AGENT_JOBSTATUS': tl.getVariable('AGENT_JOBSTATUS'),
                'AGENT_OS': tl.getVariable('AGENT_OS'),
                'AGENT_VERSION': tl.getVariable('AGENT_VERSION'),
                'BUILD_BUILDID': tl.getVariable('BUILD_BUILDID'),
                'BUILD_BUILDNUMBER': tl.getVariable('BUILD_BUILDNUMBER'),
                'BUILD_BUILDURI': tl.getVariable('BUILD_BUILDURI'),
                'BUILD_CONTAINERID': tl.getVariable('BUILD_CONTAINERID'),
                'BUILD_DEFINITIONNAME': tl.getVariable('BUILD_DEFINITIONNAME'),
                'BUILD_DEFINITIONVERSION': tl.getVariable('BUILD_DEFINITIONVERSION'),
                'BUILD_REASON': tl.getVariable('BUILD_REASON'),
                'BUILD_REPOSITORY_CLEAN': tl.getVariable('BUILD_REPOSITORY_CLEAN'),
                'BUILD_REPOSITORY_GIT_SUBMODULECHECKOUT': tl.getVariable('BUILD_REPOSITORY_GIT_SUBMODULECHECKOUT'),
                'BUILD_REPOSITORY_NAME': tl.getVariable('BUILD_REPOSITORY_NAME'),
                'BUILD_REPOSITORY_PROVIDER': tl.getVariable('BUILD_REPOSITORY_PROVIDER'),
                'BUILD_SOURCEVERSION': tl.getVariable('BUILD_SOURCEVERSION')
            };
            let copy = Object.assign(commonTelem, taskSpecificTelemetry);
            console.log("##vso[telemetry.publish area=%s;feature=%s]%s",
                area,
                feature,
                JSON.stringify(copy));
        } else {
            tl.debug(`Agent version of ( ${agentVersion} ) does not meet minimum requirements for telemetry`);
        }
    } catch (err) {
        tl.debug(`Unable to log telemetry. Err:( ${err} )`);
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:41,代码来源:telemetry.ts


示例20: constructor

  /**
   * A class which keeps the context of gRPC and auth for the gRPC.
   *
   * @param {Object=} options - The optional parameters. It will be directly
   *   passed to google-auth-library library, so parameters like keyFile or
   *   credentials will be valid.
   * @param {Object=} options.auth - An instance of google-auth-library.
   *   When specified, this auth instance will be used instead of creating
   *   a new one.
   * @param {Object=} options.grpc - When specified, this will be used
   *   for the 'grpc' module in this context. By default, it will load the grpc
   *   module in the standard way.
   * @param {Function=} options.promise - A constructor for a promise that
   * implements the ES6 specification of promise. If not provided, native
   * promises will be used.
   * @constructor
   */
  constructor(options: GrpcClientOptions = {}) {
    this.auth = options.auth || new GoogleAuth(options);
    this.promise = options.promise || Promise;

    if ('grpc' in options) {
      this.grpc = options.grpc!;
      this.grpcVersion = '';
    } else {
      // EXPERIMENTAL: If GOOGLE_CLOUD_USE_GRPC_JS is set, use the JS-based
      // implementation of the gRPC client instead. Requires http2 (Node 8+).
      if (semver.gte(process.version, '8.13.0') &&
          !!process.env.GOOGLE_CLOUD_USE_GRPC_JS) {
        this.grpc = require('@grpc/grpc-js');
        this.grpc.isLegacy = false;
        this.grpcVersion = require('@grpc/grpc-js/package.json').version;
      } else {
        this.grpc = require('grpc');
        this.grpc.isLegacy = true;
        this.grpcVersion = require('grpc/package.json').version;
      }
    }
    this.grpcProtoLoader = require('@grpc/proto-loader');
  }
开发者ID:googleapis,项目名称:gax-nodejs,代码行数:40,代码来源:grpc.ts



注:本文中的semver.gte函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript sprintf.sprintf函数代码示例发布时间:2022-05-28
下一篇:
TypeScript react.isValidElement函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap