Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Auto, IPlugin, SEMVER } from '@auto-it/core';
import endent from 'endent';
import { diff, ReleaseType } from 'semver';
import twitter from 'tweet-tweet';
import tweetValidation from 'twitter-text';
import { promisify } from 'util';
interface ITwitterPluginOptions {
/** The message template to use to post to Twitter */
message: string;
/** A threshold the semver has to pass to be posted to Twitter */
threshold: SEMVER;
}
const defaults: ITwitterPluginOptions = {
threshold: SEMVER.minor,
message: endent`
A new %release version of %package was released!
%notes
%link
`
};
const RELEASE_PRECEDENCE: ReleaseType[] = ['patch', 'minor', 'major'];
/** Determine the release with the biggest semver change */
const isGreaterThan = (a: ReleaseType, b: ReleaseType) =>
RELEASE_PRECEDENCE.indexOf(a) > RELEASE_PRECEDENCE.indexOf(b);
/** Remove the last line of text from a multiline string */