How to use the @auto-it/core.determineNextVersion function in @auto-it/core

To help you get started, we’ve selected a few @auto-it/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github intuit / auto / plugins / npm / src / index.ts View on Github external
auto.logger.verbose.info('Set CI NPM_TOKEN');
      }

      const lastRelease = await auto.git!.getLatestRelease();
      const latestTag =
        (await auto.git?.getLastTagNotInBaseBranch(prereleaseBranch)) ||
        (await getPreviousVersion(auto, prereleaseBranch));

      if (isMonorepo()) {
        auto.logger.verbose.info('Detected monorepo, using lerna');
        const isIndependent = getLernaJson().version === 'independent';
        // It's hard to accurately predict how we should bump independent versions.
        // So we just prerelease most of the time. (independent only)
        const next = isIndependent
          ? 'prerelease'
          : determineNextVersion(
              lastRelease,
              latestTag,
              bump,
              prereleaseBranch
            );

        auto.logger.verbose.info({
          lastRelease,
          latestTag,
          bump,
          prereleaseBranch,
          next
        });

        await execPromise('npx', [
          'lerna',
github intuit / auto / plugins / npm / src / index.ts View on Github external
);
        // Move branch back one commit
        await execPromise('git', ['reset', '--hard', 'HEAD~1']);

        auto.logger.verbose.info('Successfully published next version');

        preReleaseVersions = [
          ...preReleaseVersions,
          ...tags.map(auto.prefixRelease)
        ];
      } else {
        auto.logger.verbose.info('Detected single npm package');

        await execPromise('npm', [
          'version',
          determineNextVersion(lastRelease, latestTag, bump, prereleaseBranch),
          // we do not want to commit the next version. this causes
          // merge conflicts when merged into master
          '--no-git-tag-version',
          ...verboseArgs
        ]);

        const { version } = await loadPackageJson();
        await execPromise('git', ['tag', auto.prefixRelease(version!)]);

        await execPromise('npm', [
          'publish',
          '--tag',
          prereleaseBranch,
          ...verboseArgs
        ]);
github intuit / auto / plugins / npm / src / index.ts View on Github external
return this.canaryScope
          ? makeDetail(
              `Published under canary scope @${sanitizeScope(
                this.canaryScope
              )}`,
              packageList
            )
          : version;
      }

      auto.logger.verbose.info('Detected single npm package');
      const { private: isPrivate, name } = await loadPackageJson();
      const isScopedPackage = name.match(/@\S+\/\S+/);
      const current = await auto.getCurrentVersion(lastRelease);
      const canaryVersion = determineNextVersion(
        lastRelease,
        current,
        bump,
        `canary${postFix}`
      );

      if (this.canaryScope) {
        await setCanaryScope(this.canaryScope, ['./']);
      }

      await execPromise('npm', [
        'version',
        canaryVersion,
        '--no-git-tag-version',
        ...verboseArgs
      ]);
github intuit / auto / plugins / git-tag / src / index.ts View on Github external
auto.hooks.next.tapPromise(this.name, async (preReleaseVersions, bump) => {
      if (!auto.git) {
        return preReleaseVersions;
      }

      const prereleaseBranches = auto.config?.prereleaseBranches!;
      const branch = getCurrentBranch() || '';
      const prereleaseBranch = prereleaseBranches.includes(branch)
        ? branch
        : prereleaseBranches[0];
      const lastRelease = await auto.git.getLatestRelease();
      const current =
        (await auto.git.getLastTagNotInBaseBranch(prereleaseBranch)) ||
        (await auto.getCurrentVersion(lastRelease));
      const prerelease = determineNextVersion(
        lastRelease,
        current,
        bump,
        prereleaseBranch
      );

      await execPromise('git', ['tag', prerelease]);
      await execPromise('git', ['push', '--tags']);

      return preReleaseVersions;
    });
  }
github intuit / auto / plugins / npm / src / index.ts View on Github external
const lastRelease = await auto.git!.getLatestRelease();
      const latestTag = (await auto.git?.getLatestTagInBranch()) || lastRelease;
      const inPrerelease = prereleaseBranches.some(b =>
        latestTag.includes(`-${b}.`)
      );

      if (isMonorepo()) {
        const isIndependent = getLernaJson().version === 'independent';
        auto.logger.verbose.info('Detected monorepo, using lerna');

        const packagesBefore = await getLernaPackages();
        const preid = `canary${postFix}`;
        const next =
          (isIndependent && `pre${bump}`) ||
          determineNextVersion(
            lastRelease,
            inPrerelease ? latestTag : packagesBefore[0].version,
            bump,
            preid
          );

        if (this.canaryScope) {
          await setCanaryScope(
            this.canaryScope,
            packagesBefore.map(p => p.path)
          );
        }

        await execPromise('npx', [
          'lerna',
          'publish',