semver#eq TypeScript Examples

The following examples show how to use semver#eq. 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: dependency-version-compare.ts    From eslint-config-kit with MIT License 5 votes vote down vote up
export function equals(version: string, target: string): boolean {
  if (!valid(version)) {
    return false
  }

  return eq(version, target)
}
Example #2
Source File: index.ts    From design-systems-cli with MIT License 5 votes vote down vote up
async run(options: UpdatePluginOptions) {
    const rawVersion = await getCliVersion();
    const { version } = coerce(rawVersion) || { version: '' };
    const notes = await getReleaseNotes(version);
    const latest = execSync('npm view @design-systems/cli version', {
      encoding: 'utf8',
    }).trim();

    if (eq(latest, rawVersion)) {
      logger.info(
        `You're already on the latest version! "@design-systems/cli@${latest}"`
      );
      return;
    }

    if (options.releaseNotes) {
      logger.info('Updates to be installed:\n');
      // eslint-disable-next-line no-console
      console.log(notes);
      return;
    }

    process.chdir(getMonorepoRoot());

    if (fs.existsSync('./packages/babel-preset')) {
      logger.info('Updating babel-plugin in preset...');

      // --no-bootstrap because we let the last yarn handle it so
      // we only run the install once
      try {
        execSync(
          `yarn lerna add @design-systems/babel-plugin-include-styles --exact --no-bootstrap --scope @${monorepoName()}/babel-preset`,
          execOptions
        );
      } catch (error) {
        logger.trace(error);
        logger.note(
          'No update found for @design-systems/babel-plugin-include-styles'
        );
      }
    }

    logger.info('Updating CLI version in root...');
    execSync(`yarn add -DW @design-systems/cli`, {
      ...execOptions,
      stdio: 'inherit',
    });

    logger.success('Updated to latest version of `@design-systems/cli`!');
    logger.success('Updates include:\n');
    // eslint-disable-next-line no-console
    console.log(notes);
  }