当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript semver.gte函数代码示例

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


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


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