semver#gt TypeScript Examples

The following examples show how to use semver#gt. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: configErrors.ts    From cli with Apache License 2.0 6 votes vote down vote up
private computeMessageForString(version: string) {
    const coercedSemver = coerce(version);
    if (coercedSemver === null) {
      return `Version found in config '${version}' is not parsable to a valid semantic version.`;
    }
    if (gt(coercedSemver, CurrentSchemaVersion)) {
      return `Version found in config '${version}' is greater than the one accepted by this version of the CLI.`;
    }
    if (lt(coercedSemver, CurrentSchemaVersion)) {
      return `Version found in config '${version}' is less than the one accepted by this version of the CLI.`;
    }
    return dedent`
    Unknown config version error:
      - configVersion: ${version}
      - compatibleVersion: ${CurrentSchemaVersion}
    Please report this issue to Coveo.`;
  }
Example #2
Source File: checkUpdate.ts    From THUInfo with MIT License 5 votes vote down vote up
checkUpdate = (force: boolean = false) => {
	console.log("Current version: " + VersionNumber.appVersion);
	getUpdateInfo()
		.then((r) => r.filter((it) => gt(it.versionName, VersionNumber.appVersion)))
		.then((r) => {
			if (
				r.length &&
				(force ||
					lt(currState().config.doNotRemindSemver ?? "0.0.0", r[0].versionName))
			) {
				Alert.alert(
					getStr("newVersionAvailable"),
					r[0].versionName + "\n" + r[0].description,
					[
						{
							text: getStr("doNotRemind"),
							onPress: () =>
								store.dispatch(
									configSet("doNotRemindSemver", r[0].versionName),
								),
						},
						{text: getStr("nextTimeMust")},
						{
							text: getStr("download"),
							onPress: async () => {
								try {
									const {status} = await fetch(
										TUNA_BASE_URL + r[0].versionName,
									);
									await Linking.openURL(
										Platform.OS === "ios" || status === 404
											? r[0].url
											: TUNA_LATEST_URL,
									);
								} catch (e) {
									NetworkRetry();
								}
							},
						},
					],
					{cancelable: true},
				);
			}
			if (force && r.length === 0) {
				Snackbar.show({
					text: getStr("alreadyLatest"),
					duration: Snackbar.LENGTH_SHORT,
				});
			}
		});
}
Example #3
Source File: configErrors.spec.ts    From cli with Apache License 2.0 5 votes vote down vote up
mockedGt = jest.mocked(gt)