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

TypeScript semver.lt函数代码示例

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

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



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

示例1: setPackageVersions

async function setPackageVersions(packageData: Array<any>) {
  const versions = await getLatestVersions(packageData)
  let publishScript = `#!/usr/bin/env bash
set -e
  
ln -f README.md packages/electron-builder/README.md
`

  for (let i = 0; i < packageData.length; i++) {
    const packageMetadata = packageData[i]
    const packageName = packageMetadata.name
    const versionInfo = versions[i]
    const latestVersion = versionInfo.next || versionInfo.latest
    if (latestVersion == null || packageMetadata.version === latestVersion || semver.lt(latestVersion, packageMetadata.version)) {
      continue
    }

    packageMetadata.version = latestVersion
    console.log(`Set ${packageName} version to ${latestVersion}`)
    await writeJson(path.join(packageDir, packageName, "package.json"), packageMetadata, {spaces: 2})
  }

  for (let i = 0; i < packageData.length; i++) {
    const packageMetadata = packageData[i]
    const versionInfo = versions[i]
    const latestVersion = versionInfo.next || versionInfo.latest
    if (latestVersion != null && semver.gt(packageMetadata.version, latestVersion)) {
      publishScript += `npm publish packages/${packageMetadata.name}\n`
    }
  }

  await writeFile(path.join(rootDir, "__publish.sh"), publishScript)
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:33,代码来源:setVersions.ts


示例2: Error

export const saveInlineSnapshots = (
  snapshots: Array<InlineSnapshot>,
  prettier: any,
  babelTraverse: Function,
) => {
  if (!prettier) {
    throw new Error(
      `Jest: Inline Snapshots requires Prettier.\n` +
        `Please ensure "prettier" is installed in your project.`,
    );
  }

  // Custom parser API was added in 1.5.0
  if (semver.lt(prettier.version, '1.5.0')) {
    throw new Error(
      `Jest: Inline Snapshots require prettier>=1.5.0.\n` +
        `Please upgrade "prettier".`,
    );
  }

  const snapshotsByFile = groupSnapshotsByFile(snapshots);

  for (const sourceFilePath of Object.keys(snapshotsByFile)) {
    saveSnapshotsForFile(
      snapshotsByFile[sourceFilePath],
      sourceFilePath,
      prettier,
      babelTraverse,
    );
  }
};
开发者ID:facebook,项目名称:jest,代码行数:31,代码来源:inline_snapshots.ts


示例3: getXcprojInfo

	public async getXcprojInfo(): Promise<IXcprojInfo> {
		if (!this.xcprojInfoCache) {
			let cocoapodVer = await this.$sysInfo.getCocoaPodsVersion();
			const xcodeVersion = await this.$xcodeSelectService.getXcodeVersion();

			if (cocoapodVer && !semver.valid(cocoapodVer)) {
				// Cocoapods betas have names like 1.0.0.beta.8
				// These 1.0.0 betas are not valid semver versions, but they are working fine with XCode 7.3
				// So get only the major.minor.patch version and consider them as 1.0.0
				cocoapodVer = _.take(cocoapodVer.split("."), 3).join(".");
			}

			xcodeVersion.patch = xcodeVersion.patch || "0";
			// CocoaPods with version lower than 1.0.0 don't support Xcode 7.3 yet
			// https://github.com/CocoaPods/CocoaPods/issues/2530#issuecomment-210470123
			// as a result of this all .pbxprojects touched by CocoaPods get converted to XML plist format
			const shouldUseXcproj = cocoapodVer && !!(semver.lt(cocoapodVer, "1.0.0") && ~helpers.versionCompare(xcodeVersion, "7.3.0"));
			let xcprojAvailable: boolean;

			if (shouldUseXcproj) {
				// if that's the case we can use xcproj gem to convert them back to ASCII plist format
				try {
					await this.$childProcess.exec("xcproj --version");
					xcprojAvailable = true;
				} catch (e) {
					xcprojAvailable = false;
				}
			}

			this.xcprojInfoCache = { cocoapodVer, xcodeVersion, shouldUseXcproj, xcprojAvailable };
		}

		return this.xcprojInfoCache;
	}
开发者ID:NathanaelA,项目名称:nativescript-cli,代码行数:34,代码来源:xcproj-service.ts


示例4: setPackageVersions

async function setPackageVersions(packages: Array<string>, packageData: Array<any>) {
  const versions = await BluebirdPromise.map(packages, it => exec("yarn", ["info", "--json", it, "dist-tags"])
    .then((it: string) => {
      if (it === "") {
        // {"type":"error","data":"Received invalid response from npm."}
        // not yet published to npm
        return "0.0.1"
      }

      try {
        return JSON.parse(it).data
      }
      catch (e) {
        throw new Error(`Cannot parse ${it}: ${e.stack || e}`)
      }
    }))
  for (let i = 0; i < packages.length; i++) {
    const packageName = packages[i]
    const packageJson = packageData[i]
    const versionInfo = versions[i]
    const latestVersion = versionInfo.next || versionInfo.latest
    if (latestVersion == null || packageJson.version == latestVersion || semver.lt(latestVersion, packageJson.version)) {
      continue
    }

    packageJson.version = latestVersion
    console.log(`Set ${packageName} version to ${latestVersion}`)
    await writeJson(path.join(packageDir, packageName, "package.json"), packageJson, {spaces: 2})
  }
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:30,代码来源:setVersions.ts


示例5: preparePlatformCore

	/* Hooks are expected to use "filesToSync" parameter, as to give plugin authors additional information about the sync process.*/
	@performanceLog()
	@helpers.hook('prepare')
	private async preparePlatformCore(platform: string,
		appFilesUpdaterOptions: IAppFilesUpdaterOptions,
		projectData: IProjectData,
		platformSpecificData: IPlatformSpecificData,
		env: Object,
		changesInfo?: IProjectChangesInfo,
		filesToSync?: string[],
		filesToRemove?: string[],
		nativePrepare?: INativePrepare): Promise<void> {

		this.$logger.info("Preparing project...");

		const platformData = this.$platformsData.getPlatformData(platform, projectData);
		const frameworkVersion = this.getCurrentPlatformVersion(platform, projectData);
		if (semver.lt(semver.coerce(frameworkVersion), semver.coerce('5.1.0'))) {
			this.$logger.warn(`Runtime versions lower than 5.1.0 have been deprecated and will not be supported as of v6.0.0 of NativeScript CLI. More info can be found in this issue https://github.com/NativeScript/nativescript-cli/issues/4518.`);
		}

		const projectFilesConfig = helpers.getProjectFilesConfig({ isReleaseBuild: appFilesUpdaterOptions.release });
		await this.$preparePlatformJSService.preparePlatform({
			platform,
			platformData,
			projectFilesConfig,
			appFilesUpdaterOptions,
			projectData,
			platformSpecificData,
			changesInfo,
			filesToSync,
			filesToRemove,
			env
		});

		if (!nativePrepare || !nativePrepare.skipNativePrepare) {
			await this.$preparePlatformNativeService.preparePlatform({
				platform,
				platformData,
				appFilesUpdaterOptions,
				projectData,
				platformSpecificData,
				changesInfo,
				filesToSync,
				filesToRemove,
				projectFilesConfig,
				env
			});
		}

		const directoryPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME);
		const excludedDirs = [constants.APP_RESOURCES_FOLDER_NAME];
		if (!changesInfo || !changesInfo.modulesChanged) {
			excludedDirs.push(constants.TNS_MODULES_FOLDER_NAME);
		}

		this.$projectFilesManager.processPlatformSpecificFiles(directoryPath, platform, projectFilesConfig, excludedDirs);

		this.$logger.info(`Project successfully prepared (${platform})`);
	}
开发者ID:NativeScript,项目名称:nativescript-cli,代码行数:60,代码来源:platform-service.ts


示例6: extensionEquals

			return available.map(extension => {
				const local = installed.filter(local => extensionEquals(local.manifest, extension))[0];
				if (local && semver.lt(local.manifest.version, extension.versions[0].version)) {
					return local;
				} else {
					return null;
				}
			}).filter(e => !!e);
开发者ID:1Hgm,项目名称:vscode,代码行数:8,代码来源:extensionManagementUtil.ts


示例7: if

 return changelogs.sort((a, b) => {
     if (semver.gt(a.version, b.version)) {
         return -1;
     } else if (semver.lt(a.version, b.version)) {
         return 1;
     } else {
         return 0;
     }
 });
开发者ID:suiruiw,项目名称:geeks-diary,代码行数:9,代码来源:changelog.ts


示例8: validateInstall

	public async validateInstall(device: Mobile.IDevice, projectData: IProjectData, release: IRelease, outputPath?: string): Promise<void> {
		const platform = device.deviceInfo.platform;
		const platformData = this.$platformsData.getPlatformData(platform, projectData);
		const localBuildInfo = this.getBuildInfo(device.deviceInfo.platform, platformData, { buildForDevice: !device.isEmulator, release: release.release }, outputPath);
		if (localBuildInfo.deploymentTarget) {
			if (semver.lt(semver.coerce(device.deviceInfo.version), semver.coerce(localBuildInfo.deploymentTarget))) {
				this.$errors.fail(`Unable to install on device with version ${device.deviceInfo.version} as deployment target is ${localBuildInfo.deploymentTarget}`);
			}
		}
	}
开发者ID:NativeScript,项目名称:nativescript-cli,代码行数:10,代码来源:platform-service.ts


示例9: computeIsisElectronUpdater1xCompatibility

function computeIsisElectronUpdater1xCompatibility(updaterCompatibility: string | null, publishConfiguration: PublishConfiguration, packager: Packager) {
  if (updaterCompatibility != null) {
    return semver.satisfies("1.0.0", updaterCompatibility)
  }

  // spaces is a new publish provider, no need to keep backward compatibility
  if (publishConfiguration.provider === "spaces") {
    return false
  }

  const updaterVersion = packager.metadata.dependencies == null ? null : packager.metadata.dependencies["electron-updater"]
  return updaterVersion == null || semver.lt(updaterVersion, "4.0.0")
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:13,代码来源:updateInfoBuilder.ts


示例10: mergeMap

    mergeMap(({version, depName, depVersion, npmPackageJson}) => {
      const updateVersion = _getVersionFromNpmPackage(npmPackageJson, version, loose);
      const npmPackageVersions = Object.keys(npmPackageJson['versions'] as JsonObject);
      const match = semver.maxSatisfying(npmPackageVersions, updateVersion);
      if (!match) {
        return EMPTY;
      }
      if (semver.lt(
        semverIntersect.parseRange(updateVersion).version,
        semverIntersect.parseRange(depVersion).version)
      ) {
        throw new SchematicsException(`Cannot downgrade package ${
          JSON.stringify(depName)} from version "${depVersion}" to "${updateVersion}".`,
        );
      }

      const innerNpmPackageJson = (npmPackageJson['versions'] as JsonObject)[match] as JsonObject;
      const dependencies: { [name: string]: string } = {};

      const deps = innerNpmPackageJson['peerDependencies'] as JsonObject;
      if (deps) {
        for (const depName of Object.keys(deps)) {
          dependencies[depName] = deps[depName] as string;
        }
      }

      logger.debug(`Recording update for ${JSON.stringify(depName)} to version ${updateVersion}.`);

      if (allVersions[depName]) {
        if (!semver.intersects(allVersions[depName], updateVersion)) {
          throw new SchematicsException(
            'Cannot update safely because packages have conflicting dependencies. Package '
            + `${depName} would need to match both versions "${updateVersion}" and `
            + `"${allVersions[depName]}, which are not compatible.`,
          );
        }

        allVersions[depName] = semverIntersect.intersect(allVersions[depName], updateVersion);
      } else {
        allVersions[depName] = updateVersion;
      }

      return _getRecursiveVersions(
        packageJson,
        dependencies,
        allVersions,
        logger,
        loose,
      );
    }),
开发者ID:fmalcher,项目名称:angular-cli,代码行数:50,代码来源:npm.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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