5.0.0 • Published 1 year ago

conventional-commits-filter v5.0.0

Weekly downloads
2,026,877
License
MIT
Repository
github
Last release
1 year ago

conventional-commits-filter

ESM-only package NPM version Node version Dependencies status Install size Build status Coverage status

Filter out reverted commits parsed by conventional-commits-parser.

Install

# pnpm
pnpm add conventional-commits-filter
# yarn
yarn add conventional-commits-filter
# npm
npm i conventional-commits-filter

Usage

import {
  filterRevertedCommitsSync,
  filterRevertedCommits,
  filterRevertedCommitsStream
} from 'conventional-commits-filter'
import { pipeline } from 'stream/promises'
import { Readable } from 'stream'

const commits = [{
  type: 'revert',
  scope: null,
  subject: 'feat(): amazing new module',
  header: 'revert: feat(): amazing new module\n',
  body: 'This reverts commit 56185b7356766d2b30cfa2406b257080272e0b7a.\n',
  footer: null,
  notes: [],
  references: [],
  revert: {
    header: 'feat(): amazing new module',
    hash: '56185b7356766d2b30cfa2406b257080272e0b7a',
    body: null
  },
  hash: '789d898b5f8422d7f65cc25135af2c1a95a125ac\n',
  raw: {
    type: 'revert',
    scope: null,
    subject: 'feat(): amazing new module',
    header: 'revert: feat(): amazing new module\n',
    body: 'This reverts commit 56185b7356766d2b30cfa2406b257080272e0b7a.\n',
    footer: null,
    notes: [],
    references: [],
    revert: {
      header: 'feat(): amazing new module',
      hash: '56185b7356766d2b30cfa2406b257080272e0b7a',
      body: null
    },
    hash: '789d898b5f8422d7f65cc25135af2c1a95a125ac\n'
  }
}, {
  type: 'Features',
  scope: null,
  subject: 'wow',
  header: 'amazing new module\n',
  body: null,
  footer: 'BREAKING CHANGE: Not backward compatible.\n',
  notes: [],
  references: [],
  revert: null,
  hash: '56185b',
  raw: {
    type: 'feat',
    scope: null,
    subject: 'amazing new module',
    header: 'feat(): amazing new module\n',
    body: null,
    footer: 'BREAKING CHANGE: Not backward compatible.\n',
    notes: [],
    references: [],
    revert: null,
    hash: '56185b7356766d2b30cfa2406b257080272e0b7a\n'
  }
}, {
  type: 'What',
  scope: null,
  subject: 'new feature',
  header: 'feat(): new feature\n',
  body: null,
  footer: null,
  notes: [],
  references: [],
  revert: null,
  hash: '815a3f0',
  raw: {
    type: 'feat',
    scope: null,
    subject: 'new feature',
    header: 'feat(): new feature\n',
    body: null,
    footer: null,
    notes: [],
    references: [],
    revert: null,
    hash: '815a3f0717bf1dfce007bd076420c609504edcf3\n'
  }
}, {
  type: 'Chores',
  scope: null,
  subject: 'first commit',
  header: 'chore: first commit\n',
  body: null,
  footer: null,
  notes: [],
  references: [],
  revert: null,
  hash: '74a3e4d6d25',
  raw: {
    type: 'chore',
    scope: null,
    subject: 'first commit',
    header: 'chore: first commit\n',
    body: null,
    footer: null,
    notes: [],
    references: [],
    revert: null,
    hash: '74a3e4d6d25dee2c0d6483a0a3887417728cbe0a\n'
  }
}];

// to filter reverted commits syncronously:
for (const commit of filterRevertedCommitsSync(commits)) {
  console.log(commit)
}

// to filter reverted commits in async iterables:
await pipeline(
  commits,
  filterRevertedCommits,
  async function* (filteredCommits) {
    for await (const commit of filteredCommits) {
      console.log(commit)
    }
  }
)

// to filter reverted commits in streams:
Readable.from(commits)
  .pipe(filterRevertedCommitsStream())
  .on('data', commit => console.log(commit))

Output:

{
  type: 'What',
  scope: null,
  subject: 'new feature',
  header: 'feat(): new feature\n',
  body: null,
  footer: null,
  notes: [],
  references: [],
  revert: null,
  hash: '815a3f0',
  raw: {
    type: 'feat',
    scope: null,
    subject: 'new feature',
    header: 'feat(): new feature\n',
    body: null,
    footer: null,
    notes: [],
    references: [],
    revert: null,
    hash: '815a3f0717bf1dfce007bd076420c609504edcf3\n'
  }
}
{
  type: 'Chores',
  scope: null,
  subject: 'first commit',
  header: 'chore: first commit\n',
  body: null,
  footer: null,
  notes: [],
  references: [],
  revert: null,
  hash: '74a3e4d6d25',
  raw: {
    type: 'chore',
    scope: null,
    subject: 'first commit',
    header: 'chore: first commit\n',
    body: null,
    footer: null,
    notes: [],
    references: [],
    revert: null,
    hash: '74a3e4d6d25dee2c0d6483a0a3887417728cbe0a\n'
  }
}

License

MIT © Steve Mao

conventional-changelog-writerconventional-recommended-bumparchetype-libraryeasy-select-rnreact-native-bluetooth2killi8n-react-native-fast-imageairscanairscan-examplereact-native-esc-pos-sahaab@borisovart/atol-kkt-module@frxf/frxfdeneme323112@ntt_app/react-native-custom-notificationreact-native-covid-sdk@jttechnic/interpreterreact-native-printer-brothersreact-native-shekhar-bridge-testcogoportutils@oiti/documentoscopy-react-native@mink-opn/build-tokensquoc-test@infinitebrahmanuniverse/nolb-conv@mestery/release-pleaseluminos-ui-core@everything-registry/sub-chunk-1377jawwy-sdkjawwy_gamification_releasemock-changelogreact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkg@rabailriaz/hisaab-web-portalreact-native-jawwy_samplegriffin-ui-librarytailwind-vector-effecttest-library-123test-haptik-libwinx-form-winxwhatbumpwifi_configuration_packagesportscale-wifi-connecttest-zeo-collectvision-camera-plugin-face-detectorvision-camera-plugin-scan-facesvision-camera-base64-resizedvcloudcam-playkit-js-hlsvantiq-reactvue-dev-clone@dotconf-pro/dotconf-pro@dotconf-pro/dotenv@cloudoki/donderflow@credix/release-notes-generator-filtered@cs6/react-native-test-native-view-library@condenast/commit-analyzer@con-test/react-native-concent-common@damruravihara/react-native-testing-package@corelmax/react-native-my2c2p-sdk@praella/localisationist@pradeepgudipati/kovaad-chat-ui-kit-styles@positionex/position-sdk@that-one-tool/multi-versionjrennsoh88-react-native-scroll-indicatorjesh-calculationjnf-accesscontrol-rnttljordy-frijters-test-libjamuskalimkhaled-salem-custom-componentslazy-bee-uigomantic_releasejawwy_library_newjawy_library_v1gamification-jawwy-libraryframework_test_library_sixdee_new_jawwytest_lib_module_aarquickcapture_react_nativesushi-sdk-ftmrn-agora-ios-mzzzxxxyyy321123web-yii2react-native-omental-frameworkreact-native-sixdee_test_libspigot-ui-inventorytwine-libtwine-library@amiruldev/wajs@amirdiafi/react-native-ios-haptics@apardellass/react-native-audio-stream@aviinash_jha/react-native-test_multiply@ali5049/react-native-buttons@aysea/react-native-ui-library@blazinaj/app-kit@buganto/client@career0.1/my-first-career0.1@career0.1/my-first-career0.2@brantalikp/rn-resize@cdk8s-extensions/argo-rollout@ckeditor/ckeditor5-dev-env@ckeditor/ckeditor5-dev-release-tools@clearcover/commit-analyzer
5.0.0

1 year ago

4.0.0

2 years ago

3.0.0

2 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.2

6 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

9 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago