Sha256: d581f7580c17e0915c4612a4beca19dbe67457b7622c57686174bfb02f382d95

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

import { execaSync } from 'execa';
import message from '@commitlint/message';
import toLines from '@commitlint/to-lines';
export const trailerExists = (parsed, when = 'always', value = '') => {
    const trailers = execaSync('git', ['interpret-trailers', '--parse'], {
        input: parsed.raw || '',
    }).stdout;
    const matches = toLines(trailers).filter((ln) => ln.startsWith(value)).length;
    const negated = when === 'never';
    const hasTrailer = matches > 0;
    return [
        negated ? !hasTrailer : hasTrailer,
        message([
            'message',
            negated ? 'must not' : 'must',
            'have `' + value + '` trailer',
        ]),
    ];
};
//# sourceMappingURL=trailer-exists.js.map

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pcp-server-ruby-sdk-0.0.6 node_modules/@commitlint/rules/lib/trailer-exists.js
pcp-server-ruby-sdk-0.1.0 node_modules/@commitlint/rules/lib/trailer-exists.js