master d70752c46399 cached
44 files
133.5 KB
37.5k tokens
39 symbols
1 requests
Download .txt
Repository: conventional-changelog/standard-version
Branch: master
Commit: d70752c46399
Files: 44
Total size: 133.5 KB

Directory structure:
gitextract_6nfb7b3g/

├── .editorconfig
├── .eslintrc
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── ask-a-question.md
│   │   └── bug-report.md
│   └── workflows/
│       ├── ci.yaml
│       └── release-please.yml
├── .gitignore
├── .versionrc
├── CHANGELOG.md
├── LICENSE.txt
├── README.md
├── bin/
│   └── cli.js
├── command.js
├── defaults.js
├── index.js
├── lib/
│   ├── checkpoint.js
│   ├── configuration.js
│   ├── format-commit-message.js
│   ├── latest-semver-tag.js
│   ├── lifecycles/
│   │   ├── bump.js
│   │   ├── changelog.js
│   │   ├── commit.js
│   │   └── tag.js
│   ├── preset-loader.js
│   ├── print-error.js
│   ├── run-exec.js
│   ├── run-execFile.js
│   ├── run-lifecycle-script.js
│   ├── updaters/
│   │   ├── index.js
│   │   └── types/
│   │       ├── json.js
│   │       └── plain-text.js
│   └── write-file.js
├── package.json
├── renovate.json
└── test/
    ├── config-files.spec.js
    ├── core.spec.js
    ├── git.spec.js
    ├── mocks/
    │   ├── VERSION-1.0.0.txt
    │   ├── VERSION-6.3.1.txt
    │   ├── manifest-6.3.1.json
    │   ├── mix.exs
    │   ├── updater/
    │   │   └── customer-updater.js
    │   └── version.txt
    └── preset.spec.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
trim_trailing_whitespace=true
indent_style = space
indent_size = 2
insert_final_newline = true


================================================
FILE: .eslintrc
================================================
{
  "extends": "standard",
  "rules": {
    "no-var": "error"
  }
}

================================================
FILE: .github/ISSUE_TEMPLATE/ask-a-question.md
================================================
---
name: Ask a Question
about: '"How can I X?" – ask a question about how to use standard-version.'
title: ''
labels: question
assignees: ''

---




================================================
FILE: .github/ISSUE_TEMPLATE/bug-report.md
================================================
---
name: Bug Report
about: Use this template if something isn't working as expected.
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**Current behavior**
A clear and concise description of the behavior.


**Expected behavior**
A clear and concise description of what you expected to happen.



**Environment**
- `standard-version` version(s): [e.g. v6.0.0, v8.0.0, master]
- Node/npm version: [e.g. Node 10/npm 6]
- OS: [e.g. OSX 10.13.4, Windows 10]

**Possible Solution**
<!--- If you have suggestions on a fix for the bug -->

**Additional context**
Add any other context about the problem here. Or a screenshot if applicable


================================================
FILE: .github/workflows/ci.yaml
================================================
on:
  push:
    branches:
      - master
  pull_request:
    types: [ assigned, opened, synchronize, reopened, labeled ]
name: ci
jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node: [10, 12, 14]
        os: [ubuntu-latest, windows-latest]
    env:
        OS: ${{ matrix.os }}
        NODE_VERSION: ${{ matrix.node }}
    steps:
      - uses: actions/checkout@v4
      - run: git fetch --prune --unshallow
      - run: git config --global user.name 'Actions'
      - run: git config --global user.email 'dummy@example.org'
      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node }}
      - run: node --version
      - run: npm install --engine-strict
      - run: npm test
      - run: npm run coverage
      - name: Codecov
        uses: codecov/codecov-action@v2
        with:
          env_vars: OS, NODE_VERSION


================================================
FILE: .github/workflows/release-please.yml
================================================
on:
  push:
    branches:
      - master
name: release-please
jobs:
  release-please:
    runs-on: ubuntu-latest
    steps:
      - uses: GoogleCloudPlatform/release-please-action@v3
        id: release
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          release-type: node
          package-name: standard-version
      # The logic below handles the npm publication:
      - uses: actions/checkout@v4
        # these if statements ensure that a publication only occurs when
        # a new release is created:
        if: ${{ steps.release.outputs.release_created }}
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: 'https://external-dot-oss-automation.appspot.com'
        if: ${{ steps.release.outputs.release_created }}
      - run: npm ci
        if: ${{ steps.release.outputs.release_created }}
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
        if: ${{ steps.release.outputs.release_created }}


================================================
FILE: .gitignore
================================================
# OS
.DS_Store

# node.js & npm
node_modules
.nyc_output
npm-debug.log

# Editor files
/.project
/.settings
/.idea
/.vscode

# coverage
coverage
package-lock.json

================================================
FILE: .versionrc
================================================
{
  "types": [
    {"type":"feat","section":"Features"},
    {"type":"fix","section":"Bug Fixes"},
    {"type":"test","section":"Tests", "hidden": true},
    {"type":"build","section":"Build System", "hidden": true},
    {"type":"ci","hidden":true}
  ]
}



================================================
FILE: CHANGELOG.md
================================================
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [9.5.0](https://github.com/conventional-changelog/standard-version/compare/v9.4.0...v9.5.0) (2022-05-15)


### Features

* **deprecated:** add deprecation message ([#907](https://github.com/conventional-changelog/standard-version/issues/907)) ([61b41fa](https://github.com/conventional-changelog/standard-version/commit/61b41fa47ef690f55b92e2edb82fe554e3c1e13a))


### Bug Fixes

* **deps:** update dependency conventional-changelog to v3.1.25 ([#865](https://github.com/conventional-changelog/standard-version/issues/865)) ([4c938a2](https://github.com/conventional-changelog/standard-version/commit/4c938a2baac11385d655144429bc73b2199bb027))
* **deps:** update dependency conventional-changelog-conventionalcommits to v4.6.3 ([#866](https://github.com/conventional-changelog/standard-version/issues/866)) ([6c75ed0](https://github.com/conventional-changelog/standard-version/commit/6c75ed0b1456913ae7e4d6fe8532fb4106df1bdf))

## [9.4.0](https://github.com/conventional-changelog/standard-version/compare/v9.3.2...v9.4.0) (2021-12-31)


### Features

* add .cjs config file ([#717](https://github.com/conventional-changelog/standard-version/issues/717)) ([eceaedf](https://github.com/conventional-changelog/standard-version/commit/eceaedf8b3cdeb282ee06bfa9c65503f42404858))


### Bug Fixes

* Ensures provided `packageFiles` arguments are merged with `bumpFiles` when no `bumpFiles` argument is specified (default). ([#534](https://github.com/conventional-changelog/standard-version/issues/534)) ([2785023](https://github.com/conventional-changelog/standard-version/commit/2785023c91668e7300e6a22e55d31b6bd9dae59b)), closes [#533](https://github.com/conventional-changelog/standard-version/issues/533)

### [9.3.2](https://www.github.com/conventional-changelog/standard-version/compare/v9.3.1...v9.3.2) (2021-10-17)


### Bug Fixes

* **deps:** update dependency conventional-changelog-conventionalcommits to v4.6.1 ([#752](https://www.github.com/conventional-changelog/standard-version/issues/752)) ([bb8869d](https://www.github.com/conventional-changelog/standard-version/commit/bb8869de7d8bcace1ec92f29e389e7fab506d64e))

### [9.3.1](https://www.github.com/conventional-changelog/standard-version/compare/v9.3.0...v9.3.1) (2021-07-14)


### Bug Fixes

* **updater:** npm7 package lock's inner version not being updated ([#713](https://www.github.com/conventional-changelog/standard-version/issues/713)) ([a316dd0](https://www.github.com/conventional-changelog/standard-version/commit/a316dd02f5a7d8dee33d99370afda8738985bc10))

## [9.3.0](https://www.github.com/conventional-changelog/standard-version/compare/v9.2.0...v9.3.0) (2021-05-04)


### Features

* add --lerna-package flag used to extract tags in case of lerna repo ([#503](https://www.github.com/conventional-changelog/standard-version/issues/503)) ([f579ff0](https://www.github.com/conventional-changelog/standard-version/commit/f579ff08f386aaae022a395ed0dbec9af77a5d49))

## [9.2.0](https://www.github.com/conventional-changelog/standard-version/compare/v9.1.1...v9.2.0) (2021-04-06)


### Features

* allows seperate prefixTag version sequences ([#573](https://www.github.com/conventional-changelog/standard-version/issues/573)) ([3bbba02](https://www.github.com/conventional-changelog/standard-version/commit/3bbba025057ba40c3e15880fede2af851841165b))

### [9.1.1](https://www.github.com/conventional-changelog/standard-version/compare/v9.1.0...v9.1.1) (2021-02-06)


### Bug Fixes

* **deps:** update dependency conventional-recommended-bump to v6.1.0 ([#695](https://www.github.com/conventional-changelog/standard-version/issues/695)) ([65dd070](https://www.github.com/conventional-changelog/standard-version/commit/65dd070b9f01ffe1764e64ba739bc064b84f4129))
* **deps:** update dependency yargs to v16 ([#660](https://www.github.com/conventional-changelog/standard-version/issues/660)) ([f6a7430](https://www.github.com/conventional-changelog/standard-version/commit/f6a7430329919874e1e744ac5dca2f83bba355df))

## [9.1.0](https://www.github.com/conventional-changelog/standard-version/compare/v9.0.0...v9.1.0) (2020-12-01)


### Features

* support custom updater as object as well as path ([#630](https://www.github.com/conventional-changelog/standard-version/issues/630)) ([55bbde8](https://www.github.com/conventional-changelog/standard-version/commit/55bbde8476013de7a2f24bf29c7c12cb07f96e3f))


### Bug Fixes

* **deps:** update dependency conventional-changelog to v3.1.24 ([#677](https://www.github.com/conventional-changelog/standard-version/issues/677)) ([cc45036](https://www.github.com/conventional-changelog/standard-version/commit/cc45036d9960b6d83e0e850ccbbe8e8098d36ae6))
* **deps:** update dependency conventional-changelog-conventionalcommits to v4.5.0 ([#678](https://www.github.com/conventional-changelog/standard-version/issues/678)) ([6317d36](https://www.github.com/conventional-changelog/standard-version/commit/6317d36130767cfd85114ab9033a6f1ef110388d))
* **deps:** update dependency conventional-recommended-bump to v6.0.11 ([#679](https://www.github.com/conventional-changelog/standard-version/issues/679)) ([360789a](https://www.github.com/conventional-changelog/standard-version/commit/360789ab84957a67d3919cb28db1882cb68296fc))
* **deps:** update dependency find-up to v5 ([#651](https://www.github.com/conventional-changelog/standard-version/issues/651)) ([df8db83](https://www.github.com/conventional-changelog/standard-version/commit/df8db832327a751d5c62fe361b6ac2d2b5f66bf6))

## [9.0.0](https://www.github.com/conventional-changelog/standard-version/compare/v8.0.2...v9.0.0) (2020-08-15)


### ⚠ BREAKING CHANGES

* NodeJS@8 is no longer supported. (#612)

### Bug Fixes

* **deps:** update dependency conventional-changelog to v3.1.23 ([#652](https://www.github.com/conventional-changelog/standard-version/issues/652)) ([00dd3c0](https://www.github.com/conventional-changelog/standard-version/commit/00dd3c01aab20d28a8bbd1e174e416d6c2b34d90))
* **deps:** update dependency conventional-changelog-conventionalcommits to v4.4.0 ([#650](https://www.github.com/conventional-changelog/standard-version/issues/650)) ([9f201a6](https://www.github.com/conventional-changelog/standard-version/commit/9f201a61bb50ec12053a04faccfaea20e44d6ff2))
* **deps:** update dependency conventional-recommended-bump to v6.0.10 ([#653](https://www.github.com/conventional-changelog/standard-version/issues/653)) ([c360d6a](https://www.github.com/conventional-changelog/standard-version/commit/c360d6a307909c6e571b29d4a329fd786b4d4543))


### Build System

* NodeJS@8 is no longer supported. ([#612](https://www.github.com/conventional-changelog/standard-version/issues/612)) ([05edef2](https://www.github.com/conventional-changelog/standard-version/commit/05edef2de79d8d4939a6e699ce0979ff8da12de9))

### [8.0.2](https://www.github.com/conventional-changelog/standard-version/compare/v8.0.1...v8.0.2) (2020-07-14)


### Bug Fixes

* Commit message and tag name is no longer enclosed in quotes. ([#619](https://www.github.com/conventional-changelog/standard-version/issues/619)) ([ae032bf](https://www.github.com/conventional-changelog/standard-version/commit/ae032bfa9268a0a14351b0d78b6deedee7891e3a)), closes [#621](https://www.github.com/conventional-changelog/standard-version/issues/621) [#620](https://www.github.com/conventional-changelog/standard-version/issues/620)

### [8.0.1](https://www.github.com/conventional-changelog/standard-version/compare/v8.0.0...v8.0.1) (2020-07-12)


### Bug Fixes

* **deps:** update dependency conventional-changelog to v3.1.21 ([#586](https://www.github.com/conventional-changelog/standard-version/issues/586)) ([fd456c9](https://www.github.com/conventional-changelog/standard-version/commit/fd456c995f3f88497fbb912fb8aabb8a42d97dbb))
* **deps:** update dependency conventional-changelog-conventionalcommits to v4.3.0 ([#587](https://www.github.com/conventional-changelog/standard-version/issues/587)) ([b3b5eed](https://www.github.com/conventional-changelog/standard-version/commit/b3b5eedea3eaf062d74d1004a55a0a6b1e3ca6c6))
* **deps:** update dependency conventional-recommended-bump to v6.0.9 ([#588](https://www.github.com/conventional-changelog/standard-version/issues/588)) ([d4d2ac2](https://www.github.com/conventional-changelog/standard-version/commit/d4d2ac2a99c095227118da795e1c9e19d06c9a0a))
* **deps:** update dependency git-semver-tags to v4 ([#589](https://www.github.com/conventional-changelog/standard-version/issues/589)) ([a0f0e81](https://www.github.com/conventional-changelog/standard-version/commit/a0f0e813b2be4a2065600a19075fda4d6f331ef8))
* Vulnerability Report GHSL-2020-11101 ([9d978ac](https://www.github.com/conventional-changelog/standard-version/commit/9d978ac9d4f64be4c7b9d514712ab3757732d561))

## [8.0.0](https://www.github.com/conventional-changelog/standard-version/compare/v7.1.0...v8.0.0) (2020-05-06)


### ⚠ BREAKING CHANGES

* `composer.json` and `composer.lock` will no longer be read from or bumped by default. If you need to obtain a version or write a version to these files, please use `bumpFiles` and/or `packageFiles` options accordingly.

### Bug Fixes

* composer.json and composer.lock have been removed from default package and bump files. ([c934f3a](https://www.github.com/conventional-changelog/standard-version/commit/c934f3a38da4e7234d9dba3b2405f3b7e4dc5aa8)), closes [#495](https://www.github.com/conventional-changelog/standard-version/issues/495) [#394](https://www.github.com/conventional-changelog/standard-version/issues/394)
* **deps:** update dependency conventional-changelog to v3.1.18 ([#510](https://www.github.com/conventional-changelog/standard-version/issues/510)) ([e6aeb77](https://www.github.com/conventional-changelog/standard-version/commit/e6aeb779fe53ffed2a252e6cfd69cfcb786b9ef9))
* **deps:** update dependency yargs to v15.1.0 ([#518](https://www.github.com/conventional-changelog/standard-version/issues/518)) ([8f36f9e](https://www.github.com/conventional-changelog/standard-version/commit/8f36f9e073119fcbf5ad843237fb06a4ca42a0f9))
* **deps:** update dependency yargs to v15.3.1 ([#559](https://www.github.com/conventional-changelog/standard-version/issues/559)) ([d98cd46](https://www.github.com/conventional-changelog/standard-version/commit/d98cd4674b4d074c0b7f4d50d052ae618cf494c6))

## [7.1.0](https://github.com/conventional-changelog/standard-version/compare/v7.0.1...v7.1.0) (2019-12-08)


### Features

* Adds support for `header` (--header) configuration based on the spec. ([#364](https://github.com/conventional-changelog/standard-version/issues/364)) ([ba80a0c](https://github.com/conventional-changelog/standard-version/commit/ba80a0c27029f54c751fe845560504925b45eab8))
* custom 'bumpFiles' and 'packageFiles' support ([#372](https://github.com/conventional-changelog/standard-version/issues/372)) ([564d948](https://github.com/conventional-changelog/standard-version/commit/564d9482a459d5d7a2020c2972b4d39167ded4bf))


### Bug Fixes

* **deps:** update dependency conventional-changelog to v3.1.15 ([#479](https://github.com/conventional-changelog/standard-version/issues/479)) ([492e721](https://github.com/conventional-changelog/standard-version/commit/492e72192ebf35d7c58c00526b1e6bd2abac7f13))
* **deps:** update dependency conventional-changelog-conventionalcommits to v4.2.3 ([#496](https://github.com/conventional-changelog/standard-version/issues/496)) ([bc606f8](https://github.com/conventional-changelog/standard-version/commit/bc606f8e96bcef1d46b28305622fc76dfbf306cf))
* **deps:** update dependency conventional-recommended-bump to v6.0.5 ([#480](https://github.com/conventional-changelog/standard-version/issues/480)) ([1e1e215](https://github.com/conventional-changelog/standard-version/commit/1e1e215a633963188cdb02be1316b5506e3b99b7))
* **deps:** update dependency yargs to v15 ([#484](https://github.com/conventional-changelog/standard-version/issues/484)) ([35b90c3](https://github.com/conventional-changelog/standard-version/commit/35b90c3f24cfb8237e94482fd20997900569193e))
* use require.resolve for the default preset ([#465](https://github.com/conventional-changelog/standard-version/issues/465)) ([d557372](https://github.com/conventional-changelog/standard-version/commit/d55737239530f5eee684e9cbf959f7238d609fd4))
* **deps:** update dependency detect-newline to v3.1.0 ([#482](https://github.com/conventional-changelog/standard-version/issues/482)) ([04ab36a](https://github.com/conventional-changelog/standard-version/commit/04ab36a12be58915cfa9c60771890e074d1f5685))
* **deps:** update dependency figures to v3.1.0 ([#468](https://github.com/conventional-changelog/standard-version/issues/468)) ([63300a9](https://github.com/conventional-changelog/standard-version/commit/63300a935c0079fd03e8e1acc55fd5b1dcea677f))
* **deps:** update dependency git-semver-tags to v3.0.1 ([#485](https://github.com/conventional-changelog/standard-version/issues/485)) ([9cc188c](https://github.com/conventional-changelog/standard-version/commit/9cc188cbb84ee3ae80d5e66f5c54727877313b14))
* **deps:** update dependency yargs to v14.2.1 ([#483](https://github.com/conventional-changelog/standard-version/issues/483)) ([dc1fa61](https://github.com/conventional-changelog/standard-version/commit/dc1fa6170ffe12d4f8b44b70d23688a64d2ad0fb))
* **deps:** update dependency yargs to v14.2.2 ([#488](https://github.com/conventional-changelog/standard-version/issues/488)) ([ecf26b6](https://github.com/conventional-changelog/standard-version/commit/ecf26b6fc9421a78fb81793c4a932f579f7e9d4a))

### [7.0.1](https://github.com/conventional-changelog/standard-version/compare/v7.0.0...v7.0.1) (2019-11-07)


### Bug Fixes

* **deps:** update dependency conventional-changelog to v3.1.12 ([#463](https://github.com/conventional-changelog/standard-version/issues/463)) ([f04161a](https://github.com/conventional-changelog/standard-version/commit/f04161ae624705e68f9018d563e9f3c09ccf6f30))
* **deps:** update dependency conventional-changelog-config-spec to v2.1.0 ([#442](https://github.com/conventional-changelog/standard-version/issues/442)) ([a2c5747](https://github.com/conventional-changelog/standard-version/commit/a2c574735ac5a165a190661b7735ea284bdc7dda))
* **deps:** update dependency conventional-recommended-bump to v6.0.2 ([#462](https://github.com/conventional-changelog/standard-version/issues/462)) ([84bb581](https://github.com/conventional-changelog/standard-version/commit/84bb581209b50357761cbec45bb8253f6a182801))
* **deps:** update dependency stringify-package to v1.0.1 ([#459](https://github.com/conventional-changelog/standard-version/issues/459)) ([e06a835](https://github.com/conventional-changelog/standard-version/commit/e06a835c8296a92f4fa7c07f98057d765c1a91e5))
* **deps:** update dependency yargs to v14 ([#440](https://github.com/conventional-changelog/standard-version/issues/440)) ([fe37e73](https://github.com/conventional-changelog/standard-version/commit/fe37e7390760d8d16d1b94ca58d8123e292c46a8))
* **deps:** update dependency yargs to v14.2.0 ([#461](https://github.com/conventional-changelog/standard-version/issues/461)) ([fb21851](https://github.com/conventional-changelog/standard-version/commit/fb2185107a90ba4b9dc7c9c1d873ed1283706ac1))

## [7.0.0](https://github.com/conventional-changelog/standard-version/compare/v6.0.1...v7.0.0) (2019-07-30)


### ⚠ BREAKING CHANGES

* we were accepting .version.json as a config file, rather than .versionrc.json

### Bug Fixes

* **bump:** transmit tag prefix argument to conventionalRecommendedBump ([#393](https://github.com/conventional-changelog/standard-version/issues/393)) ([8205222](https://github.com/conventional-changelog/standard-version/commit/8205222))
* **cli:** display only one, correct default for --preset flag ([#377](https://github.com/conventional-changelog/standard-version/issues/377)) ([d17fc81](https://github.com/conventional-changelog/standard-version/commit/d17fc81))
* **commit:** don't try to process and add changelog if skipped ([#318](https://github.com/conventional-changelog/standard-version/issues/318)) ([3e4fdec](https://github.com/conventional-changelog/standard-version/commit/3e4fdec))
* **deps:** update dependency conventional-changelog-config-spec to v2 ([#352](https://github.com/conventional-changelog/standard-version/issues/352)) ([f586844](https://github.com/conventional-changelog/standard-version/commit/f586844))
* **deps:** update dependency conventional-recommended-bump to v6 ([#417](https://github.com/conventional-changelog/standard-version/issues/417)) ([4c5cad1](https://github.com/conventional-changelog/standard-version/commit/4c5cad1))
* **deps:** update dependency find-up to v4 ([#355](https://github.com/conventional-changelog/standard-version/issues/355)) ([73b35f8](https://github.com/conventional-changelog/standard-version/commit/73b35f8))
* **deps:** update dependency find-up to v4.1.0 ([#383](https://github.com/conventional-changelog/standard-version/issues/383)) ([b621a4a](https://github.com/conventional-changelog/standard-version/commit/b621a4a))
* **deps:** update dependency git-semver-tags to v3 ([#418](https://github.com/conventional-changelog/standard-version/issues/418)) ([1ce3f4a](https://github.com/conventional-changelog/standard-version/commit/1ce3f4a))
* **deps:** update dependency semver to v6.3.0 ([#366](https://github.com/conventional-changelog/standard-version/issues/366)) ([cd866c7](https://github.com/conventional-changelog/standard-version/commit/cd866c7))
* **deps:** update dependency yargs to v13.3.0 ([#401](https://github.com/conventional-changelog/standard-version/issues/401)) ([3d0e8c7](https://github.com/conventional-changelog/standard-version/commit/3d0e8c7))
* adds support for `releaseCommitMessageFormat` ([#351](https://github.com/conventional-changelog/standard-version/issues/351)) ([a7133cc](https://github.com/conventional-changelog/standard-version/commit/a7133cc))
* stop suggesting npm publish if package.json was not updated ([#319](https://github.com/conventional-changelog/standard-version/issues/319)) ([a5ac845](https://github.com/conventional-changelog/standard-version/commit/a5ac845))
* Updates package.json to _actual_ supported (tested) NodeJS versions. ([#379](https://github.com/conventional-changelog/standard-version/issues/379)) ([15eec8a](https://github.com/conventional-changelog/standard-version/commit/15eec8a))
* **deps:** update dependency yargs to v13.2.4 ([#356](https://github.com/conventional-changelog/standard-version/issues/356)) ([00b2ce6](https://github.com/conventional-changelog/standard-version/commit/00b2ce6))
* update config file name in command based on README.md ([#357](https://github.com/conventional-changelog/standard-version/issues/357)) ([ce44dd2](https://github.com/conventional-changelog/standard-version/commit/ce44dd2))

### [6.0.1](https://github.com/conventional-changelog/standard-version/compare/v6.0.0...v6.0.1) (2019-05-05)


### Bug Fixes

* don't pass args to git rev-parse ([1ac72f7](https://github.com/conventional-changelog/standard-version/commit/1ac72f7))



## [6.0.0](https://github.com/conventional-changelog/standard-version/compare/v5.0.2...v6.0.0) (2019-05-05)


### Bug Fixes

* always pass version to changelog context ([#327](https://github.com/conventional-changelog/standard-version/issues/327)) ([00e3381](https://github.com/conventional-changelog/standard-version/commit/00e3381))
* **deps:** update dependency detect-indent to v6 ([#341](https://github.com/conventional-changelog/standard-version/issues/341)) ([234d9dd](https://github.com/conventional-changelog/standard-version/commit/234d9dd))
* **deps:** update dependency detect-newline to v3 ([#342](https://github.com/conventional-changelog/standard-version/issues/342)) ([02a6093](https://github.com/conventional-changelog/standard-version/commit/02a6093))
* **deps:** update dependency figures to v3 ([#343](https://github.com/conventional-changelog/standard-version/issues/343)) ([7208ded](https://github.com/conventional-changelog/standard-version/commit/7208ded))
* **deps:** update dependency semver to v6 ([#344](https://github.com/conventional-changelog/standard-version/issues/344)) ([c40487a](https://github.com/conventional-changelog/standard-version/commit/c40487a))
* **deps:** update dependency yargs to v13 ([#345](https://github.com/conventional-changelog/standard-version/issues/345)) ([b2c8e59](https://github.com/conventional-changelog/standard-version/commit/b2c8e59))
* prevent duplicate headers from being added ([#305](https://github.com/conventional-changelog/standard-version/issues/305)) ([#307](https://github.com/conventional-changelog/standard-version/issues/307)) ([db2c6e5](https://github.com/conventional-changelog/standard-version/commit/db2c6e5))


### Build System

* add renovate.json ([#273](https://github.com/conventional-changelog/standard-version/issues/273)) ([bf41474](https://github.com/conventional-changelog/standard-version/commit/bf41474))
* drop Node 6 from testing matrix ([#346](https://github.com/conventional-changelog/standard-version/issues/346)) ([6718428](https://github.com/conventional-changelog/standard-version/commit/6718428))


### Features

* adds configurable conventionalcommits preset ([#323](https://github.com/conventional-changelog/standard-version/issues/323)) ([4fcd4a7](https://github.com/conventional-changelog/standard-version/commit/4fcd4a7))
* allow a user to provide a custom changelog header ([#335](https://github.com/conventional-changelog/standard-version/issues/335)) ([1c51064](https://github.com/conventional-changelog/standard-version/commit/1c51064))
* bump minor rather than major, if release is < 1.0.0 ([#347](https://github.com/conventional-changelog/standard-version/issues/347)) ([5d972cf](https://github.com/conventional-changelog/standard-version/commit/5d972cf))
* suggest branch name other than master ([#331](https://github.com/conventional-changelog/standard-version/issues/331)) ([304b49a](https://github.com/conventional-changelog/standard-version/commit/304b49a))
* update commit msg for when using commitAll ([#320](https://github.com/conventional-changelog/standard-version/issues/320)) ([74a040a](https://github.com/conventional-changelog/standard-version/commit/74a040a))


### Tests

* disable gpg signing in temporary test repositories. ([#311](https://github.com/conventional-changelog/standard-version/issues/311)) ([bd0fcdf](https://github.com/conventional-changelog/standard-version/commit/bd0fcdf))
* use const based on new eslint rules ([#329](https://github.com/conventional-changelog/standard-version/issues/329)) ([b6d3d13](https://github.com/conventional-changelog/standard-version/commit/b6d3d13))


### BREAKING CHANGES

* we now bump the minor rather than major if version < 1.0.0; --release-as can be used to bump to 1.0.0.
* tests are no longer run for Node 6
* we now use the conventionalcommits preset by default, which directly tracks conventionalcommits.org.



## [5.0.2](https://github.com/conventional-changelog/standard-version/compare/v5.0.1...v5.0.2) (2019-03-16)



## [5.0.1](https://github.com/conventional-changelog/standard-version/compare/v5.0.0...v5.0.1) (2019-02-28)


### Bug Fixes

* make pattern for finding CHANGELOG sections work for non anchors ([#292](https://github.com/conventional-changelog/standard-version/issues/292)) ([b684c78](https://github.com/conventional-changelog/standard-version/commit/b684c78))



# [5.0.0](https://github.com/conventional-changelog/standard-version/compare/v4.4.0...v5.0.0) (2019-02-14)


### Bug Fixes

* bin now enforces Node.js > 4 ([#274](https://github.com/conventional-changelog/standard-version/issues/274)) ([e1b5780](https://github.com/conventional-changelog/standard-version/commit/e1b5780))
* no --tag prerelease for private module ([#296](https://github.com/conventional-changelog/standard-version/issues/296)) ([27e2ab4](https://github.com/conventional-changelog/standard-version/commit/27e2ab4)), closes [#294](https://github.com/conventional-changelog/standard-version/issues/294)
* show correct pre-release tag in help output ([#259](https://github.com/conventional-changelog/standard-version/issues/259)) ([d90154a](https://github.com/conventional-changelog/standard-version/commit/d90154a))


### chore

* update testing matrix ([1d46627](https://github.com/conventional-changelog/standard-version/commit/1d46627))


### Features

* adds support for bumping for composer versions ([#262](https://github.com/conventional-changelog/standard-version/issues/262)) ([fee872f](https://github.com/conventional-changelog/standard-version/commit/fee872f))
* cli application accept path/preset option ([#279](https://github.com/conventional-changelog/standard-version/issues/279)) ([69c62cf](https://github.com/conventional-changelog/standard-version/commit/69c62cf))
* fallback to tags if no meta-information file found ([#275](https://github.com/conventional-changelog/standard-version/issues/275)) ([844cde6](https://github.com/conventional-changelog/standard-version/commit/844cde6))
* preserve formatting when writing to package.json ([#282](https://github.com/conventional-changelog/standard-version/issues/282)) ([96216da](https://github.com/conventional-changelog/standard-version/commit/96216da))


### BREAKING CHANGES

* if no package.json, bower.json, etc., is found, we now fallback to git tags
* removed Node 4/5 from testing matrix



<a name="4.4.0"></a>
# [4.4.0](https://github.com/conventional-changelog/standard-version/compare/v4.3.0...v4.4.0) (2018-05-21)


### Bug Fixes

* show full tag name in checkpoint ([#241](https://github.com/conventional-changelog/standard-version/issues/241)) ([b4ed4f9](https://github.com/conventional-changelog/standard-version/commit/b4ed4f9))
* use tagPrefix in CHANGELOG lifecycle step ([#243](https://github.com/conventional-changelog/standard-version/issues/243)) ([a56c7ac](https://github.com/conventional-changelog/standard-version/commit/a56c7ac))


### Features

* add prerelease lifecycle script hook (closes [#217](https://github.com/conventional-changelog/standard-version/issues/217)) ([#234](https://github.com/conventional-changelog/standard-version/issues/234)) ([ba4e7f6](https://github.com/conventional-changelog/standard-version/commit/ba4e7f6))
* manifest.json support ([#236](https://github.com/conventional-changelog/standard-version/issues/236)) ([371d992](https://github.com/conventional-changelog/standard-version/commit/371d992))



<a name="4.3.0"></a>
# [4.3.0](https://github.com/conventional-changelog/standard-version/compare/v4.2.0...v4.3.0) (2018-01-03)


### Bug Fixes

* recommend `--tag` prerelease for npm publish of prereleases ([#196](https://github.com/conventional-changelog/standard-version/issues/196)) ([709dae1](https://github.com/conventional-changelog/standard-version/commit/709dae1)), closes [#183](https://github.com/conventional-changelog/standard-version/issues/183)
* use the `skip` default value for skip cli arg ([#211](https://github.com/conventional-changelog/standard-version/issues/211)) ([3fdd7fa](https://github.com/conventional-changelog/standard-version/commit/3fdd7fa))


### Features

* **format-commit-message:** support multiple %s in the message ([45fcad5](https://github.com/conventional-changelog/standard-version/commit/45fcad5))
* do not update/commit files in .gitignore ([#230](https://github.com/conventional-changelog/standard-version/issues/230)) ([4fd3bc2](https://github.com/conventional-changelog/standard-version/commit/4fd3bc2))
* publish only if commit+push succeed ([#229](https://github.com/conventional-changelog/standard-version/issues/229)) ([c5e1ee2](https://github.com/conventional-changelog/standard-version/commit/c5e1ee2))



<a name="4.2.0"></a>
# [4.2.0](https://github.com/conventional-changelog/standard-version/compare/v4.1.0...v4.2.0) (2017-06-12)


### Features

* add support for `package-lock.json` ([#190](https://github.com/conventional-changelog/standard-version/issues/190)) ([bc0fc53](https://github.com/conventional-changelog/standard-version/commit/bc0fc53))



<a name="4.1.0"></a>
# [4.1.0](https://github.com/conventional-changelog/standard-version/compare/v4.0.0...v4.1.0) (2017-06-06)


### Features

* **cli:** print error and don't run with node <4, closes [#124](https://github.com/conventional-changelog/standard-version/issues/124) ([d0d71a5](https://github.com/conventional-changelog/standard-version/commit/d0d71a5))
* add dry-run mode ([#187](https://github.com/conventional-changelog/standard-version/issues/187)) ([d073353](https://github.com/conventional-changelog/standard-version/commit/d073353))
* add prebump, postbump, precommit, lifecycle scripts ([#186](https://github.com/conventional-changelog/standard-version/issues/186)) ([dfd1d12](https://github.com/conventional-changelog/standard-version/commit/dfd1d12))
* add support for `npm-shrinkwrap.json` ([#185](https://github.com/conventional-changelog/standard-version/issues/185)) ([86af7fc](https://github.com/conventional-changelog/standard-version/commit/86af7fc))
* add support for skipping lifecycle steps, polish lifecycle work ([#188](https://github.com/conventional-changelog/standard-version/issues/188)) ([d31dcdb](https://github.com/conventional-changelog/standard-version/commit/d31dcdb))
* allow a version # to be provided for release-as, rather than just major, minor, patch. ([13eb9cd](https://github.com/conventional-changelog/standard-version/commit/13eb9cd))



<a name="4.0.0"></a>
# [4.0.0](https://github.com/conventional-changelog/standard-version/compare/v4.0.0-1...v4.0.0) (2016-12-02)


### Bug Fixes

* include merge commits in the changelog ([#139](https://github.com/conventional-changelog/standard-version/issues/139)) ([b6e1562](https://github.com/conventional-changelog/standard-version/commit/b6e1562))
* should print message before we bump version ([2894bbc](https://github.com/conventional-changelog/standard-version/commit/2894bbc))
* support a wording change made to git status in git v2.9.1 ([#140](https://github.com/conventional-changelog/standard-version/issues/140)) ([80004ec](https://github.com/conventional-changelog/standard-version/commit/80004ec))


### Features

* add support for bumping version # in bower.json ([#148](https://github.com/conventional-changelog/standard-version/issues/148)) ([b788c5f](https://github.com/conventional-changelog/standard-version/commit/b788c5f))
* make tag prefix configurable ([#143](https://github.com/conventional-changelog/standard-version/issues/143)) ([70b20c8](https://github.com/conventional-changelog/standard-version/commit/70b20c8))
* support releasing a custom version, including pre-releases ([#129](https://github.com/conventional-changelog/standard-version/issues/129)) ([068008d](https://github.com/conventional-changelog/standard-version/commit/068008d))


### BREAKING CHANGES

* merge commits are now included in the CHANGELOG.


<a name="3.0.0"></a>
# [3.0.0](https://github.com/conventional-changelog/standard-version/compare/v2.3.0...v3.0.0) (2016-10-06)


### Bug Fixes

* check the private field in package.json([#102](https://github.com/conventional-changelog/standard-version/issues/102)) ([#103](https://github.com/conventional-changelog/standard-version/issues/103)) ([2ce4160](https://github.com/conventional-changelog/standard-version/commit/2ce4160))
* **err:** don't fail on stderr output, but print the output to stderr ([#110](https://github.com/conventional-changelog/standard-version/issues/110)) ([f7a4915](https://github.com/conventional-changelog/standard-version/commit/f7a4915)), closes [#91](https://github.com/conventional-changelog/standard-version/issues/91)


### Chores

* package.json engines field >=4.0, drop Node 0.10 and 0.12 ([28ff65a](https://github.com/conventional-changelog/standard-version/commit/28ff65a))


### Features

* **options:** add --silent flag and option for squelching output ([2a3fa61](https://github.com/conventional-changelog/standard-version/commit/2a3fa61))
* added support for commitAll option in CLI ([#121](https://github.com/conventional-changelog/standard-version/issues/121)) ([a903f4d](https://github.com/conventional-changelog/standard-version/commit/a903f4d))
* separate cli and defaults from base functionality ([34a6a4e](https://github.com/conventional-changelog/standard-version/commit/34a6a4e))


### BREAKING CHANGES

* drop support for Node < 4.0 to enable usage of
new tools and packages.



<a name="2.4.0"></a>
# [2.4.0](https://github.com/conventional-changelog/standard-version/compare/v2.3.1...v2.4.0) (2016-07-13)


### Bug Fixes

* **index.js:** use blue figures.info for last checkpoint ([#64](https://github.com/conventional-changelog/standard-version/issues/64)) ([e600b42](https://github.com/conventional-changelog/standard-version/commit/e600b42))


### Features

* **changelogStream:** use more default opts ([#67](https://github.com/conventional-changelog/standard-version/issues/67)) ([3e0aa84](https://github.com/conventional-changelog/standard-version/commit/3e0aa84))



<a name="2.3.1"></a>
## [2.3.1](https://github.com/conventional-changelog/standard-version/compare/v2.3.0...v2.3.1) (2016-06-15)


### Bug Fixes

* **commit:** fix windows by separating add and commit exec ([#55](https://github.com/conventional-changelog/standard-version/issues/55)) ([f361c46](https://github.com/conventional-changelog/standard-version/commit/f361c46)), closes [#55](https://github.com/conventional-changelog/standard-version/issues/55) [#49](https://github.com/conventional-changelog/standard-version/issues/49)



<a name="2.3.0"></a>
# [2.3.0](https://github.com/conventional-changelog/standard-version/compare/v2.2.1...v2.3.0) (2016-06-02)


### Bug Fixes

* append line feed to end of package.json ([#42](https://github.com/conventional-changelog/standard-version/issues/42))([178e001](https://github.com/conventional-changelog/standard-version/commit/178e001))


### Features

* **index.js:** add checkpoint for publish script after tag successfully ([#47](https://github.com/conventional-changelog/standard-version/issues/47))([e414ed7](https://github.com/conventional-changelog/standard-version/commit/e414ed7))
* add a --no-verify option to prevent git hooks from being verified ([#44](https://github.com/conventional-changelog/standard-version/issues/44))([026d844](https://github.com/conventional-changelog/standard-version/commit/026d844))



<a name="2.2.1"></a>
## [2.2.1](https://github.com/conventional-changelog/standard-version/compare/v2.2.0...v2.2.1) (2016-05-02)


### Bug Fixes

* upgrade to version of nyc that works with new shelljs([c7ac6e2](https://github.com/conventional-changelog/standard-version/commit/c7ac6e2))



<a name="2.2.0"></a>
# [2.2.0](https://github.com/conventional-changelog/standard-version/compare/v2.1.2...v2.2.0) (2016-05-01)


### Bug Fixes

* format the annotated tag message ([#28](https://github.com/conventional-changelog/standard-version/issues/28))([8f02736](https://github.com/conventional-changelog/standard-version/commit/8f02736))
* upgraded dependencies, switched back to angular format (fixes [#27](https://github.com/conventional-changelog/standard-version/issues/27)), pinned shelljs to version that works with nyc ([#30](https://github.com/conventional-changelog/standard-version/issues/30))([3f51e94](https://github.com/conventional-changelog/standard-version/commit/3f51e94))


### Features

* add --sign flag to sign git commit and tag ([#29](https://github.com/conventional-changelog/standard-version/issues/29))([de758bc](https://github.com/conventional-changelog/standard-version/commit/de758bc))



<a name="2.1.2"></a>
## [2.1.2](https://github.com/conventional-changelog/standard-version/compare/v2.1.1...v2.1.2) (2016-04-11)


### Bug Fixes

* we had too many \n characters ([#17](https://github.com/conventional-changelog/standard-version/issues/17)) ([67a01cd](https://github.com/conventional-changelog/standard-version/commit/67a01cd))



<a name="2.1.1"></a>
## [2.1.1](https://github.com/conventional-changelog/standard-version/compare/v2.1.0...v2.1.1) (2016-04-10)


### Bug Fixes

* **docs:** had a bad URL in package.json, which was breaking all of our links ([caa6359](https://github.com/conventional-changelog/standard-version/commit/caa6359))



<a name="2.1.0"></a>
# [2.1.0](https://github.com/conventional-changelog/standard-version/compare/v2.0.0...v2.1.0) (2016-04-10)


### Features

* adds support for GitHub links (see [#13](https://github.com/conventional-changelog/standard-version/issues/13)), great idea [@bcoe](https://github.com/bcoe)! ([7bf6597](https://github.com/conventional-changelog/standard-version/commit/7bf6597))



<a name="2.0.0"></a>
# [2.0.0](https://github.com/conventional-changelog/standard-version/compare/v1.1.0...v2.0.0) (2016-04-09)


* feat(conventional-changelog-standard): Move to conventional-changelog-standard style. This style lifts the character limit on commit messages, and puts us in a position to make more opinionated decisions in the future. ([c7ccadb](https://github.com/conventional-changelog/standard-version/commit/c7ccadb))


### BREAKING CHANGES

* we no longer accept the preset configuration option.


<a name="1.1.0"></a>
# [1.1.0](https://github.com/conventional-changelog/standard-version/compare/v1.0.0...v1.1.0) (2016-04-08)


### Features

* **cli:** use conventional default commit message with version ([9fadc5f](https://github.com/conventional-changelog/standard-version/commit/9fadc5f))
* **rebrand:** rebrand recommended-workflow to standard-version (#9) ([1f673c0](https://github.com/conventional-changelog/standard-version/commit/1f673c0))
* **tests:** adds test suite, fixed several Node 0.10 issues along the way ([03bd86c](https://github.com/conventional-changelog/standard-version/commit/03bd86c))



<a name="1.0.0"></a>
# 1.0.0 (2016-04-04)


### Features

* **initial-release:** adds flag for generating CHANGELOG.md on the first release. ([b812b44](https://github.com/bcoe/conventional-recommended-workflow/commit/b812b44))


================================================
FILE: LICENSE.txt
================================================
ISC License

Copyright (c) 2016, Contributors

Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice
appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


================================================
FILE: README.md
================================================
# Standard Version

> **`standard-version` is deprecated**. If you're a GitHub user, I recommend [release-please](https://github.com/googleapis/release-please) as an alternative. If you're unable to use GitHub Actions, or if you need to stick with `standard-version` for some other reason, you can use the [commit-and-tag-version]( https://github.com/absolute-version/commit-and-tag-version) fork of `standard-version`.

A utility for versioning using [semver](https://semver.org/) and CHANGELOG generation powered by [Conventional Commits](https://conventionalcommits.org).

![ci](https://github.com/conventional-changelog/standard-version/workflows/ci/badge.svg)
[![NPM version](https://img.shields.io/npm/v/standard-version.svg)](https://www.npmjs.com/package/standard-version)
[![codecov](https://codecov.io/gh/conventional-changelog/standard-version/branch/master/graph/badge.svg?token=J7zMN7vTTd)](https://codecov.io/gh/conventional-changelog/standard-version)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Community slack](http://devtoolscommunity.herokuapp.com/badge.svg)](http://devtoolscommunity.herokuapp.com)

_Having problems? Want to contribute? Join us on the [node-tooling community Slack](http://devtoolscommunity.herokuapp.com)_.


_How It Works:_

1. Follow the [Conventional Commits Specification](https://conventionalcommits.org) in your repository.
2. When you're ready to release, run `standard-version`.

`standard-version` will then do the following:

1. Retrieve the current version of your repository by looking at `packageFiles`[[1]](#bumpfiles-packagefiles-and-updaters), falling back to the last `git tag`.
2. `bump` the version in `bumpFiles`[[1]](#bumpfiles-packagefiles-and-updaters) based on your commits.
4. Generates a `changelog` based on your commits (uses [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) under the hood).
5. Creates a new `commit` including your `bumpFiles`[[1]](#bumpfiles-packagefiles-and-updaters) and updated CHANGELOG.
6. Creates a new `tag` with the new version number.


### `bumpFiles`, `packageFiles` and `updaters`

`standard-version` uses a few key concepts for handling version bumping in your project.

- **`packageFiles`** – User-defined files where versions can be read from _and_ be "bumped".
  - Examples: `package.json`, `manifest.json`
  - In most cases (including the default), `packageFiles` are a subset of `bumpFiles`.
- **`bumpFiles`** – User-defined files where versions should be "bumped", but not explicitly read from.
  - Examples: `package-lock.json`, `npm-shrinkwrap.json`
- **`updaters`** – Simple modules used for reading `packageFiles` and writing to `bumpFiles`.

By default, `standard-version` assumes you're working in a NodeJS based project... because of this, for the majority of projects you might never need to interact with these options.

That said, if you find your self asking [How can I use standard-version for additional metadata files, languages or version files?](#can-i-use-standard-version-for-additional-metadata-files-languages-or-version-files) – these configuration options will help!

## Installing `standard-version`

### As a local `npm run` script

Install and add to `devDependencies`:

```
npm i --save-dev standard-version
```

Add an [`npm run` script](https://docs.npmjs.com/cli/run-script) to your `package.json`:

```json
{
  "scripts": {
    "release": "standard-version"
  }
}
```

Now you can use `npm run release` in place of `npm version`.

This has the benefit of making your repo/package more portable, so that other developers can cut releases without having to globally install `standard-version` on their machine.

### As global `bin`

Install globally (add to your `PATH`):

```
npm i -g standard-version
```

Now you can use `standard-version` in place of `npm version`.

This has the benefit of allowing you to use `standard-version` on any repo/package without adding a dev dependency to each one.

### Using `npx`

As of `npm@5.2.0`, `npx` is installed alongside `npm`. Using `npx` you can use `standard-version` without having to keep a `package.json` file by running: `npx standard-version`.

This method is especially useful when using `standard-version` in non-JavaScript projects.

## Configuration

You can configure `standard-version` either by:

1. Placing a `standard-version` stanza in your `package.json` (assuming
   your project is JavaScript).
2. Creating a `.versionrc`, `.versionrc.json` or `.versionrc.js`.
  - If you are using a `.versionrc.js` your default export must be a configuration object, or a function returning a configuration object.

Any of the command line parameters accepted by `standard-version` can instead
be provided via configuration. Please refer to the [conventional-changelog-config-spec](https://github.com/conventional-changelog/conventional-changelog-config-spec/) for details on available configuration options.


### Customizing CHANGELOG Generation

By default (as of `6.0.0`), `standard-version` uses the [conventionalcommits preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits).

This preset:

* Adheres closely to the [conventionalcommits.org](https://www.conventionalcommits.org)
  specification.
* Is highly configurable, following the configuration specification
  [maintained here](https://github.com/conventional-changelog/conventional-changelog-config-spec).
  * _We've documented these config settings as a recommendation to other tooling makers._

There are a variety of dials and knobs you can turn related to CHANGELOG generation.

As an example, suppose you're using GitLab, rather than GitHub, you might modify the following variables:

* `commitUrlFormat`: the URL format of commit SHAs detected in commit messages.
* `compareUrlFormat`: the URL format used to compare two tags.
* `issueUrlFormat`: the URL format used to link to issues.

Making these URLs match GitLab's format, rather than GitHub's.

## CLI Usage

> **NOTE:** To pass nested configurations to the CLI without defining them in the `package.json` use dot notation as the parameters `e.g. --skip.changelog`.

### First Release

To generate your changelog for your first release, simply do:

```sh
# npm run script
npm run release -- --first-release
# global bin
standard-version --first-release
# npx
npx standard-version --first-release
```

This will tag a release **without bumping the version `bumpFiles`[1]()**.

When you are ready, push the git tag and `npm publish` your first release. \o/

### Cutting Releases

If you typically use `npm version` to cut a new release, do this instead:

```sh
# npm run script
npm run release
# or global bin
standard-version
```

As long as your git commit messages are conventional and accurate, you no longer need to specify the semver type - and you get CHANGELOG generation for free! \o/

After you cut a release, you can push the new git tag and `npm publish` (or `npm publish --tag next`) when you're ready.

### Release as a Pre-Release

Use the flag `--prerelease` to generate pre-releases:

Suppose the last version of your code is `1.0.0`, and your code to be committed has patched changes. Run:

```bash
# npm run script
npm run release -- --prerelease
```
This will tag your version as: `1.0.1-0`.

If you want to name the pre-release, you specify the name via `--prerelease <name>`.

For example, suppose your pre-release should contain the `alpha` prefix:

```bash
# npm run script
npm run release -- --prerelease alpha
```

This will tag the version as: `1.0.1-alpha.0`

### Release as a Target Type Imperatively (`npm version`-like)

To forgo the automated version bump use `--release-as` with the argument `major`, `minor` or `patch`.

Suppose the last version of your code is `1.0.0`, you've only landed `fix:` commits, but
you would like your next release to be a `minor`. Simply run the following:

```bash
# npm run script
npm run release -- --release-as minor
# Or
npm run release -- --release-as 1.1.0
```

You will get version `1.1.0` rather than what would be the auto-generated version `1.0.1`.

> **NOTE:** you can combine `--release-as` and `--prerelease` to generate a release. This is useful when publishing experimental feature(s).

### Prevent Git Hooks

If you use git hooks, like pre-commit, to test your code before committing, you can prevent hooks from being verified during the commit step by passing the `--no-verify` option:

```sh
# npm run script
npm run release -- --no-verify
# or global bin
standard-version --no-verify
```

### Signing Commits and Tags

If you have your GPG key set up, add the `--sign` or `-s` flag to your `standard-version` command.

### Lifecycle Scripts

`standard-version` supports lifecycle scripts. These allow you to execute your
own supplementary commands during the release. The following
hooks are available and execute in the order documented:

* `prerelease`: executed before anything happens. If the `prerelease` script returns a
  non-zero exit code, versioning will be aborted, but it has no other effect on the
  process.
* `prebump`/`postbump`: executed before and after the version is bumped. If the `prebump`
  script returns a version #, it will be used rather than
  the version calculated by `standard-version`.
* `prechangelog`/`postchangelog`: executes before and after the CHANGELOG is generated.
* `precommit`/`postcommit`: called before and after the commit step.
* `pretag`/`posttag`: called before and after the tagging step.

Simply add the following to your package.json to configure lifecycle scripts:

```json
{
  "standard-version": {
    "scripts": {
      "prebump": "echo 9.9.9"
    }
  }
}
```

As an example to change from using GitHub to track your items to using your projects Jira use a
`postchangelog` script to replace the url fragment containing 'https://github.com/`myproject`/issues/'
with a link to your Jira - assuming you have already installed [replace](https://www.npmjs.com/package/replace)
```json
{
  "standard-version": {
    "scripts": {
      "postchangelog": "replace 'https://github.com/myproject/issues/' 'https://myjira/browse/' CHANGELOG.md"
    }
  }
}
```

### Skipping Lifecycle Steps

You can skip any of the lifecycle steps (`bump`, `changelog`, `commit`, `tag`),
by adding the following to your package.json:

```json
{
  "standard-version": {
    "skip": {
      "changelog": true
    }
  }
}
```

### Committing Generated Artifacts in the Release Commit

If you want to commit generated artifacts in the release commit, you can use the `--commit-all` or `-a` flag. You will need to stage the artifacts you want to commit, so your `release` command could look like this:

```json
{
  "standard-version": {
    "scripts": {
      "prerelease": "webpack -p --bail && git add <file(s) to commit>"
    }
  }
}
```

```json
{
  "scripts": {
    "release": "standard-version -a"
  }
}
```

### Dry Run Mode

running `standard-version` with the flag `--dry-run` allows you to see what
commands would be run, without committing to git or updating files.

```sh
# npm run script
npm run release -- --dry-run
# or global bin
standard-version --dry-run
```

### Prefix Tags

Tags are prefixed with `v` by default. If you would like to prefix your tags with something else, you can do so with the `-t` flag.

```sh
standard-version -t @scope/package\@
```

This will prefix your tags to look something like `@scope/package@2.0.0`

If you do not want to have any tag prefix you can use the `-t` flag and provide it with an **empty string** as value.

> Note: simply -t or --tag-prefix without any value will fallback to the default 'v'

### CLI Help

```sh
# npm run script
npm run release -- --help
# or global bin
standard-version --help
```

## Code Usage

```js
const standardVersion = require('standard-version')

// Options are the same as command line, except camelCase
// standardVersion returns a Promise
standardVersion({
  noVerify: true,
  infile: 'docs/CHANGELOG.md',
  silent: true
}).then(() => {
  // standard-version is done
}).catch(err => {
    console.error(`standard-version failed with message: ${err.message}`)
})
```

_TIP: Use the `silent` option to prevent `standard-version` from printing to the `console`._

## FAQ

### How is `standard-version` different from `semantic-release`?

[`semantic-release`](https://github.com/semantic-release/semantic-release) is described as:

> semantic-release automates the whole package release workflow including: determining the next version number, generating the release notes and publishing the package.

While both are based on the same foundation of structured commit messages, `standard-version`  takes a different approach by handling versioning, changelog generation, and git tagging for you **without** automatic pushing (to GitHub) or publishing (to an npm registry). Use of `standard-version` only affects your local git repo - it doesn't affect remote resources at all. After you run `standard-version`, you can review your release state, correct mistakes and follow the release strategy that makes the most sense for your codebase.

We think they are both fantastic tools, and we encourage folks to use `semantic-release` instead of `standard-version` if it makes sense for their use-case.

### Should I always squash commits when merging PRs?

The instructions to squash commits when merging pull requests assumes that **one PR equals, at most, one feature or fix**.

If you have multiple features or fixes landing in a single PR and each commit uses a structured message, then you can do a standard merge when accepting the PR. This will preserve the commit history from your branch after the merge.

Although this will allow each commit to be included as separate entries in your CHANGELOG, the entries will **not** be able to reference the PR that pulled the changes in because the preserved commit messages do not include the PR number.

For this reason, we recommend keeping the scope of each PR to one general feature or fix. In practice, this allows you to use unstructured commit messages when committing each little change and then squash them into a single commit with a structured message (referencing the PR number) once they have been reviewed and accepted.

### Can I use `standard-version` for additional metadata files, languages or version files?

As of version `7.1.0` you can configure multiple `bumpFiles` and `packageFiles`.

1. Specify a custom `bumpFile` "`filename`", this is the path to the file you want to "bump"
2. Specify the `bumpFile` "`updater`", this is _how_ the file will be bumped.
    a. If you're using a common type, you can use one of  `standard-version`'s built-in `updaters` by specifying a `type`.
    b. If your using an less-common version file, you can create your own `updater`.

```js
// .versionrc
{
  "bumpFiles": [
    {
      "filename": "MY_VERSION_TRACKER.txt",
      // The `plain-text` updater assumes the file contents represents the version.
      "type": "plain-text"
    },
    {
      "filename": "a/deep/package/dot/json/file/package.json",
      // The `json` updater assumes the version is available under a `version` key in the provided JSON document.
      "type": "json"
    },
    {
      "filename": "VERSION_TRACKER.json",
      //  See "Custom `updater`s" for more details.
      "updater": "standard-version-updater.js"
    }
  ]
}
```

If using `.versionrc.js` as your configuration file, the `updater` may also be set as an object, rather than a path:

```js
// .versionrc.js
const tracker = {
  filename: 'VERSION_TRACKER.json',
  updater: require('./path/to/custom-version-updater')
}

module.exports = {
  bumpFiles: [tracker],
  packageFiles: [tracker]
}
```

#### Custom `updater`s

An `updater` is expected to be a Javascript module with _atleast_ two methods exposed: `readVersion` and `writeVersion`.

##### `readVersion(contents = string): string`

This method is used to read the version from the provided file contents.

The return value is expected to be a semantic version string.

##### `writeVersion(contents = string, version: string): string`

This method is used to write the version to the provided contents.

The return value will be written directly (overwrite) to the provided file.

---

Let's assume our `VERSION_TRACKER.json` has the following contents:

```json
{
  "tracker": {
    "package": {
      "version": "1.0.0"
    }
  }
}

```

An acceptable `standard-version-updater.js` would be:

```js
// standard-version-updater.js
const stringifyPackage = require('stringify-package')
const detectIndent = require('detect-indent')
const detectNewline = require('detect-newline')

module.exports.readVersion = function (contents) {
  return JSON.parse(contents).tracker.package.version;
}

module.exports.writeVersion = function (contents, version) {
  const json = JSON.parse(contents)
  let indent = detectIndent(contents).indent
  let newline = detectNewline(contents)
  json.tracker.package.version = version
  return stringifyPackage(json, indent, newline)
}
```

## License

ISC


================================================
FILE: bin/cli.js
================================================
#!/usr/bin/env node

/* istanbul ignore if */
if (process.version.match(/v(\d+)\./)[1] < 6) {
  console.error('standard-version: Node v6 or greater is required. `standard-version` did not run.')
} else {
  const standardVersion = require('../index')
  const cmdParser = require('../command')
  standardVersion(cmdParser.argv)
    .catch(() => {
      process.exit(1)
    })
}


================================================
FILE: command.js
================================================
const spec = require('conventional-changelog-config-spec')
const { getConfiguration } = require('./lib/configuration')
const defaults = require('./defaults')

const yargs = require('yargs')
  .usage('Usage: $0 [options]')
  .option('packageFiles', {
    default: defaults.packageFiles,
    array: true
  })
  .option('bumpFiles', {
    default: defaults.bumpFiles,
    array: true
  })
  .option('release-as', {
    alias: 'r',
    describe: 'Specify the release type manually (like npm version <major|minor|patch>)',
    requiresArg: true,
    string: true
  })
  .option('prerelease', {
    alias: 'p',
    describe: 'make a pre-release with optional option value to specify a tag id',
    string: true
  })
  .option('infile', {
    alias: 'i',
    describe: 'Read the CHANGELOG from this file',
    default: defaults.infile
  })
  .option('message', {
    alias: ['m'],
    describe: '[DEPRECATED] Commit message, replaces %s with new version.\nThis option will be removed in the next major version, please use --releaseCommitMessageFormat.',
    type: 'string'
  })
  .option('first-release', {
    alias: 'f',
    describe: 'Is this the first release?',
    type: 'boolean',
    default: defaults.firstRelease
  })
  .option('sign', {
    alias: 's',
    describe: 'Should the git commit and tag be signed?',
    type: 'boolean',
    default: defaults.sign
  })
  .option('no-verify', {
    alias: 'n',
    describe: 'Bypass pre-commit or commit-msg git hooks during the commit phase',
    type: 'boolean',
    default: defaults.noVerify
  })
  .option('commit-all', {
    alias: 'a',
    describe: 'Commit all staged changes, not just files affected by standard-version',
    type: 'boolean',
    default: defaults.commitAll
  })
  .option('silent', {
    describe: 'Don\'t print logs and errors',
    type: 'boolean',
    default: defaults.silent
  })
  .option('tag-prefix', {
    alias: 't',
    describe: 'Set a custom prefix for the git tag to be created',
    type: 'string',
    default: defaults.tagPrefix
  })
  .option('scripts', {
    describe: 'Provide scripts to execute for lifecycle events (prebump, precommit, etc.,)',
    default: defaults.scripts
  })
  .option('skip', {
    describe: 'Map of steps in the release process that should be skipped',
    default: defaults.skip
  })
  .option('dry-run', {
    type: 'boolean',
    default: defaults.dryRun,
    describe: 'See the commands that running standard-version would run'
  })
  .option('git-tag-fallback', {
    type: 'boolean',
    default: defaults.gitTagFallback,
    describe: 'fallback to git tags for version, if no meta-information file is found (e.g., package.json)'
  })
  .option('path', {
    type: 'string',
    describe: 'Only populate commits made under this path'
  })
  .option('changelogHeader', {
    type: 'string',
    describe: '[DEPRECATED] Use a custom header when generating and updating changelog.\nThis option will be removed in the next major version, please use --header.'
  })
  .option('preset', {
    type: 'string',
    default: defaults.preset,
    describe: 'Commit message guideline preset'
  })
  .option('lerna-package', {
    type: 'string',
    describe: 'Name of the package from which the tags will be extracted'
  })
  .check((argv) => {
    if (typeof argv.scripts !== 'object' || Array.isArray(argv.scripts)) {
      throw Error('scripts must be an object')
    } else if (typeof argv.skip !== 'object' || Array.isArray(argv.skip)) {
      throw Error('skip must be an object')
    } else {
      return true
    }
  })
  .alias('version', 'v')
  .alias('help', 'h')
  .example('$0', 'Update changelog and tag release')
  .example('$0 -m "%s: see changelog for details"', 'Update changelog and tag release with custom commit message')
  .pkgConf('standard-version')
  .config(getConfiguration())
  .wrap(97)

Object.keys(spec.properties).forEach(propertyKey => {
  const property = spec.properties[propertyKey]
  yargs.option(propertyKey, {
    type: property.type,
    describe: property.description,
    default: defaults[propertyKey] ? defaults[propertyKey] : property.default,
    group: 'Preset Configuration:'
  })
})

module.exports = yargs


================================================
FILE: defaults.js
================================================
const spec = require('conventional-changelog-config-spec')

const defaults = {
  infile: 'CHANGELOG.md',
  firstRelease: false,
  sign: false,
  noVerify: false,
  commitAll: false,
  silent: false,
  tagPrefix: 'v',
  scripts: {},
  skip: {},
  dryRun: false,
  gitTagFallback: true,
  preset: require.resolve('conventional-changelog-conventionalcommits')
}

/**
 * Merge in defaults provided by the spec
 */
Object.keys(spec.properties).forEach(propertyKey => {
  const property = spec.properties[propertyKey]
  defaults[propertyKey] = property.default
})

/**
 * Sets the default for `header` (provided by the spec) for backwards
 * compatibility. This should be removed in the next major version.
 */
defaults.header = '# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n'

defaults.packageFiles = [
  'package.json',
  'bower.json',
  'manifest.json'
]

defaults.bumpFiles = defaults.packageFiles.concat([
  'package-lock.json',
  'npm-shrinkwrap.json'
])

module.exports = defaults


================================================
FILE: index.js
================================================
const bump = require('./lib/lifecycles/bump')
const changelog = require('./lib/lifecycles/changelog')
const commit = require('./lib/lifecycles/commit')
const fs = require('fs')
const latestSemverTag = require('./lib/latest-semver-tag')
const path = require('path')
const printError = require('./lib/print-error')
const tag = require('./lib/lifecycles/tag')
const { resolveUpdaterObjectFromArgument } = require('./lib/updaters')

module.exports = async function standardVersion (argv) {
  const defaults = require('./defaults')
  /**
   * `--message` (`-m`) support will be removed in the next major version.
   */
  const message = argv.m || argv.message
  if (message) {
    /**
     * The `--message` flag uses `%s` for version substitutions, we swap this
     * for the substitution defined in the config-spec for future-proofing upstream
     * handling.
     */
    argv.releaseCommitMessageFormat = message.replace(/%s/g, '{{currentTag}}')
    if (!argv.silent) {
      console.warn('[standard-version]: --message (-m) will be removed in the next major release. Use --releaseCommitMessageFormat.')
    }
  }

  if (argv.changelogHeader) {
    argv.header = argv.changelogHeader
    if (!argv.silent) {
      console.warn('[standard-version]: --changelogHeader will be removed in the next major release. Use --header.')
    }
  }

  if (argv.header && argv.header.search(changelog.START_OF_LAST_RELEASE_PATTERN) !== -1) {
    throw Error(`custom changelog header must not match ${changelog.START_OF_LAST_RELEASE_PATTERN}`)
  }

  /**
   * If an argument for `packageFiles` provided, we include it as a "default" `bumpFile`.
   */
  if (argv.packageFiles) {
    defaults.bumpFiles = defaults.bumpFiles.concat(argv.packageFiles)
  }

  const args = Object.assign({}, defaults, argv)
  let pkg
  for (const packageFile of args.packageFiles) {
    const updater = resolveUpdaterObjectFromArgument(packageFile)
    if (!updater) return
    const pkgPath = path.resolve(process.cwd(), updater.filename)
    try {
      const contents = fs.readFileSync(pkgPath, 'utf8')
      pkg = {
        version: updater.updater.readVersion(contents),
        private: typeof updater.updater.isPrivate === 'function' ? updater.updater.isPrivate(contents) : false
      }
      break
    } catch (err) {}
  }
  try {
    let version
    if (pkg) {
      version = pkg.version
    } else if (args.gitTagFallback) {
      version = await latestSemverTag(args.tagPrefix)
    } else {
      throw new Error('no package file found')
    }

    const newVersion = await bump(args, version)
    await changelog(args, newVersion)
    await commit(args, newVersion)
    await tag(newVersion, pkg ? pkg.private : false, args)
  } catch (err) {
    printError(args, err.message)
    throw err
  }
}


================================================
FILE: lib/checkpoint.js
================================================
const chalk = require('chalk')
const figures = require('figures')
const util = require('util')

module.exports = function (argv, msg, args, figure) {
  const defaultFigure = args.dryRun ? chalk.yellow(figures.tick) : chalk.green(figures.tick)
  if (!argv.silent) {
    console.info((figure || defaultFigure) + ' ' + util.format.apply(util, [msg].concat(args.map(function (arg) {
      return chalk.bold(arg)
    }))))
  }
}


================================================
FILE: lib/configuration.js
================================================
const path = require('path')
const findUp = require('find-up')
const { readFileSync } = require('fs')

const CONFIGURATION_FILES = [
  '.versionrc',
  '.versionrc.cjs',
  '.versionrc.json',
  '.versionrc.js'
]

module.exports.getConfiguration = function () {
  let config = {}
  const configPath = findUp.sync(CONFIGURATION_FILES)
  if (!configPath) {
    return config
  }
  const ext = path.extname(configPath)
  if (ext === '.js' || ext === '.cjs') {
    const jsConfiguration = require(configPath)
    if (typeof jsConfiguration === 'function') {
      config = jsConfiguration()
    } else {
      config = jsConfiguration
    }
  } else {
    config = JSON.parse(readFileSync(configPath))
  }

  /**
   * @todo we could eventually have deeper validation of the configuration (using `ajv`) and
   * provide a more helpful error.
   */
  if (typeof config !== 'object') {
    throw Error(
      `[standard-version] Invalid configuration in ${configPath} provided. Expected an object but found ${typeof config}.`
    )
  }

  return config
}


================================================
FILE: lib/format-commit-message.js
================================================
module.exports = function (rawMsg, newVersion) {
  const message = String(rawMsg)
  return message.replace(/{{currentTag}}/g, newVersion)
}


================================================
FILE: lib/latest-semver-tag.js
================================================
const gitSemverTags = require('git-semver-tags')
const semver = require('semver')

module.exports = function (tagPrefix = undefined) {
  return new Promise((resolve, reject) => {
    gitSemverTags({ tagPrefix }, function (err, tags) {
      if (err) return reject(err)
      else if (!tags.length) return resolve('1.0.0')
      // Respect tagPrefix
      tags = tags.map(tag => tag.replace(new RegExp('^' + tagPrefix), ''))
      // ensure that the largest semver tag is at the head.
      tags = tags.map(tag => { return semver.clean(tag) })
      tags.sort(semver.rcompare)
      return resolve(tags[0])
    })
  })
}


================================================
FILE: lib/lifecycles/bump.js
================================================
'use strict'

const chalk = require('chalk')
const checkpoint = require('../checkpoint')
const conventionalRecommendedBump = require('conventional-recommended-bump')
const figures = require('figures')
const fs = require('fs')
const DotGitignore = require('dotgitignore')
const path = require('path')
const presetLoader = require('../preset-loader')
const runLifecycleScript = require('../run-lifecycle-script')
const semver = require('semver')
const writeFile = require('../write-file')
const { resolveUpdaterObjectFromArgument } = require('../updaters')
let configsToUpdate = {}

async function Bump (args, version) {
  // reset the cache of updated config files each
  // time we perform the version bump step.
  configsToUpdate = {}

  if (args.skip.bump) return version
  let newVersion = version
  await runLifecycleScript(args, 'prerelease')
  const stdout = await runLifecycleScript(args, 'prebump')
  if (stdout && stdout.trim().length) args.releaseAs = stdout.trim()
  const release = await bumpVersion(args.releaseAs, version, args)
  if (!args.firstRelease) {
    const releaseType = getReleaseType(args.prerelease, release.releaseType, version)
    newVersion = semver.valid(releaseType) || semver.inc(version, releaseType, args.prerelease)
    updateConfigs(args, newVersion)
  } else {
    checkpoint(args, 'skip version bump on first release', [], chalk.red(figures.cross))
  }
  await runLifecycleScript(args, 'postbump')
  return newVersion
}

Bump.getUpdatedConfigs = function () {
  return configsToUpdate
}

function getReleaseType (prerelease, expectedReleaseType, currentVersion) {
  if (isString(prerelease)) {
    if (isInPrerelease(currentVersion)) {
      if (shouldContinuePrerelease(currentVersion, expectedReleaseType) ||
        getTypePriority(getCurrentActiveType(currentVersion)) > getTypePriority(expectedReleaseType)
      ) {
        return 'prerelease'
      }
    }

    return 'pre' + expectedReleaseType
  } else {
    return expectedReleaseType
  }
}

function isString (val) {
  return typeof val === 'string'
}

/**
 * if a version is currently in pre-release state,
 * and if it current in-pre-release type is same as expect type,
 * it should continue the pre-release with the same type
 *
 * @param version
 * @param expectType
 * @return {boolean}
 */
function shouldContinuePrerelease (version, expectType) {
  return getCurrentActiveType(version) === expectType
}

function isInPrerelease (version) {
  return Array.isArray(semver.prerelease(version))
}

const TypeList = ['major', 'minor', 'patch'].reverse()

/**
 * extract the in-pre-release type in target version
 *
 * @param version
 * @return {string}
 */
function getCurrentActiveType (version) {
  const typelist = TypeList
  for (let i = 0; i < typelist.length; i++) {
    if (semver[typelist[i]](version)) {
      return typelist[i]
    }
  }
}

/**
 * calculate the priority of release type,
 * major - 2, minor - 1, patch - 0
 *
 * @param type
 * @return {number}
 */
function getTypePriority (type) {
  return TypeList.indexOf(type)
}

function bumpVersion (releaseAs, currentVersion, args) {
  return new Promise((resolve, reject) => {
    if (releaseAs) {
      return resolve({
        releaseType: releaseAs
      })
    } else {
      const presetOptions = presetLoader(args)
      if (typeof presetOptions === 'object') {
        if (semver.lt(currentVersion, '1.0.0')) presetOptions.preMajor = true
      }
      conventionalRecommendedBump({
        debug: args.verbose && console.info.bind(console, 'conventional-recommended-bump'),
        preset: presetOptions,
        path: args.path,
        tagPrefix: args.tagPrefix,
        lernaPackage: args.lernaPackage
      }, function (err, release) {
        if (err) return reject(err)
        else return resolve(release)
      })
    }
  })
}

/**
 * attempt to update the version number in provided `bumpFiles`
 * @param args config object
 * @param newVersion version number to update to.
 * @return void
 */
function updateConfigs (args, newVersion) {
  const dotgit = DotGitignore()
  args.bumpFiles.forEach(function (bumpFile) {
    const updater = resolveUpdaterObjectFromArgument(bumpFile)
    if (!updater) {
      return
    }
    const configPath = path.resolve(process.cwd(), updater.filename)
    try {
      if (dotgit.ignore(configPath)) return
      const stat = fs.lstatSync(configPath)

      if (!stat.isFile()) return
      const contents = fs.readFileSync(configPath, 'utf8')
      checkpoint(
        args,
        'bumping version in ' + updater.filename + ' from %s to %s',
        [updater.updater.readVersion(contents), newVersion]
      )
      writeFile(
        args,
        configPath,
        updater.updater.writeVersion(contents, newVersion)
      )
      // flag any config files that we modify the version # for
      // as having been updated.
      configsToUpdate[updater.filename] = true
    } catch (err) {
      if (err.code !== 'ENOENT') console.warn(err.message)
    }
  })
}

module.exports = Bump


================================================
FILE: lib/lifecycles/changelog.js
================================================
const chalk = require('chalk')
const checkpoint = require('../checkpoint')
const conventionalChangelog = require('conventional-changelog')
const fs = require('fs')
const presetLoader = require('../preset-loader')
const runLifecycleScript = require('../run-lifecycle-script')
const writeFile = require('../write-file')
const START_OF_LAST_RELEASE_PATTERN = /(^#+ \[?[0-9]+\.[0-9]+\.[0-9]+|<a name=)/m

async function Changelog (args, newVersion) {
  if (args.skip.changelog) return
  await runLifecycleScript(args, 'prechangelog')
  await outputChangelog(args, newVersion)
  await runLifecycleScript(args, 'postchangelog')
}

Changelog.START_OF_LAST_RELEASE_PATTERN = START_OF_LAST_RELEASE_PATTERN

module.exports = Changelog

function outputChangelog (args, newVersion) {
  return new Promise((resolve, reject) => {
    createIfMissing(args)
    const header = args.header

    let oldContent = args.dryRun ? '' : fs.readFileSync(args.infile, 'utf-8')
    const oldContentStart = oldContent.search(START_OF_LAST_RELEASE_PATTERN)
    // find the position of the last release and remove header:
    if (oldContentStart !== -1) {
      oldContent = oldContent.substring(oldContentStart)
    }
    let content = ''
    const context = { version: newVersion }
    const changelogStream = conventionalChangelog({
      debug: args.verbose && console.info.bind(console, 'conventional-changelog'),
      preset: presetLoader(args),
      tagPrefix: args.tagPrefix
    }, context, { merges: null, path: args.path })
      .on('error', function (err) {
        return reject(err)
      })

    changelogStream.on('data', function (buffer) {
      content += buffer.toString()
    })

    changelogStream.on('end', function () {
      checkpoint(args, 'outputting changes to %s', [args.infile])
      if (args.dryRun) console.info(`\n---\n${chalk.gray(content.trim())}\n---\n`)
      else writeFile(args, args.infile, header + '\n' + (content + oldContent).replace(/\n+$/, '\n'))
      return resolve()
    })
  })
}

function createIfMissing (args) {
  try {
    fs.accessSync(args.infile, fs.F_OK)
  } catch (err) {
    if (err.code === 'ENOENT') {
      checkpoint(args, 'created %s', [args.infile])
      args.outputUnreleased = true
      writeFile(args, args.infile, '\n')
    }
  }
}


================================================
FILE: lib/lifecycles/commit.js
================================================
const bump = require('../lifecycles/bump')
const checkpoint = require('../checkpoint')
const formatCommitMessage = require('../format-commit-message')
const path = require('path')
const runExecFile = require('../run-execFile')
const runLifecycleScript = require('../run-lifecycle-script')

module.exports = async function (args, newVersion) {
  if (args.skip.commit) return
  const message = await runLifecycleScript(args, 'precommit')
  if (message && message.length) args.releaseCommitMessageFormat = message
  await execCommit(args, newVersion)
  await runLifecycleScript(args, 'postcommit')
}

async function execCommit (args, newVersion) {
  let msg = 'committing %s'
  let paths = []
  const verify = args.verify === false || args.n ? ['--no-verify'] : []
  const sign = args.sign ? ['-S'] : []
  const toAdd = []

  // only start with a pre-populated paths list when CHANGELOG processing is not skipped
  if (!args.skip.changelog) {
    paths = [args.infile]
    toAdd.push(args.infile)
  }

  // commit any of the config files that we've updated
  // the version # for.
  Object.keys(bump.getUpdatedConfigs()).forEach(function (p) {
    paths.unshift(p)
    toAdd.push(path.relative(process.cwd(), p))

    // account for multiple files in the output message
    if (paths.length > 1) {
      msg += ' and %s'
    }
  })

  if (args.commitAll) {
    msg += ' and %s'
    paths.push('all staged files')
  }

  checkpoint(args, msg, paths)

  // nothing to do, exit without commit anything
  if (args.skip.changelog && args.skip.bump && toAdd.length === 0) {
    return
  }

  await runExecFile(args, 'git', ['add'].concat(toAdd))
  await runExecFile(
    args,
    'git',
    [
      'commit'
    ].concat(
      verify,
      sign,
      args.commitAll ? [] : toAdd,
      [
        '-m',
        `${formatCommitMessage(args.releaseCommitMessageFormat, newVersion)}`
      ]
    )
  )
}


================================================
FILE: lib/lifecycles/tag.js
================================================
const bump = require('../lifecycles/bump')
const chalk = require('chalk')
const checkpoint = require('../checkpoint')
const figures = require('figures')
const formatCommitMessage = require('../format-commit-message')
const runExecFile = require('../run-execFile')
const runLifecycleScript = require('../run-lifecycle-script')

module.exports = async function (newVersion, pkgPrivate, args) {
  if (args.skip.tag) return
  await runLifecycleScript(args, 'pretag')
  await execTag(newVersion, pkgPrivate, args)
  await runLifecycleScript(args, 'posttag')
}

async function execTag (newVersion, pkgPrivate, args) {
  let tagOption
  if (args.sign) {
    tagOption = '-s'
  } else {
    tagOption = '-a'
  }
  checkpoint(args, 'tagging release %s%s', [args.tagPrefix, newVersion])
  await runExecFile(args, 'git', ['tag', tagOption, args.tagPrefix + newVersion, '-m', `${formatCommitMessage(args.releaseCommitMessageFormat, newVersion)}`])
  const currentBranch = await runExecFile('', 'git', ['rev-parse', '--abbrev-ref', 'HEAD'])
  let message = 'git push --follow-tags origin ' + currentBranch.trim()
  if (pkgPrivate !== true && bump.getUpdatedConfigs()['package.json']) {
    message += ' && npm publish'
    if (args.prerelease !== undefined) {
      if (args.prerelease === '') {
        message += ' --tag prerelease'
      } else {
        message += ' --tag ' + args.prerelease
      }
    }
  }

  checkpoint(args, 'Run `%s` to publish', [message], chalk.blue(figures.info))
}


================================================
FILE: lib/preset-loader.js
================================================
// TODO: this should be replaced with an object we maintain and
// describe in: https://github.com/conventional-changelog/conventional-changelog-config-spec
const spec = require('conventional-changelog-config-spec')

module.exports = (args) => {
  const defaultPreset = require.resolve('conventional-changelog-conventionalcommits')
  let preset = args.preset || defaultPreset
  if (preset === defaultPreset) {
    preset = {
      name: defaultPreset
    }
    Object.keys(spec.properties).forEach(key => {
      if (args[key] !== undefined) preset[key] = args[key]
    })
  }
  return preset
}


================================================
FILE: lib/print-error.js
================================================
const chalk = require('chalk')

module.exports = function (args, msg, opts) {
  if (!args.silent) {
    opts = Object.assign({
      level: 'error',
      color: 'red'
    }, opts)

    console[opts.level](chalk[opts.color](msg))
  }
}


================================================
FILE: lib/run-exec.js
================================================
const { promisify } = require('util')
const printError = require('./print-error')

const exec = promisify(require('child_process').exec)

module.exports = async function (args, cmd) {
  if (args.dryRun) return
  try {
    const { stderr, stdout } = await exec(cmd)
    // If exec returns content in stderr, but no error, print it as a warning
    if (stderr) printError(args, stderr, { level: 'warn', color: 'yellow' })
    return stdout
  } catch (error) {
    // If exec returns an error, print it and exit with return code 1
    printError(args, error.stderr || error.message)
    throw error
  }
}


================================================
FILE: lib/run-execFile.js
================================================
const { promisify } = require('util')
const printError = require('./print-error')

const execFile = promisify(require('child_process').execFile)

module.exports = async function (args, cmd, cmdArgs) {
  if (args.dryRun) return
  try {
    const { stderr, stdout } = await execFile(cmd, cmdArgs)
    // If execFile returns content in stderr, but no error, print it as a warning
    if (stderr) printError(args, stderr, { level: 'warn', color: 'yellow' })
    return stdout
  } catch (error) {
    // If execFile returns an error, print it and exit with return code 1
    printError(args, error.stderr || error.message)
    throw error
  }
}


================================================
FILE: lib/run-lifecycle-script.js
================================================
const chalk = require('chalk')
const checkpoint = require('./checkpoint')
const figures = require('figures')
const runExec = require('./run-exec')

module.exports = function (args, hookName) {
  const scripts = args.scripts
  if (!scripts || !scripts[hookName]) return Promise.resolve()
  const command = scripts[hookName]
  checkpoint(args, 'Running lifecycle script "%s"', [hookName])
  checkpoint(args, '- execute command: "%s"', [command], chalk.blue(figures.info))
  return runExec(args, command)
}


================================================
FILE: lib/updaters/index.js
================================================
const path = require('path')
const JSON_BUMP_FILES = require('../../defaults').bumpFiles
const updatersByType = {
  json: require('./types/json'),
  'plain-text': require('./types/plain-text')
}
const PLAIN_TEXT_BUMP_FILES = ['VERSION.txt', 'version.txt']

function getUpdaterByType (type) {
  const updater = updatersByType[type]
  if (!updater) {
    throw Error(`Unable to locate updater for provided type (${type}).`)
  }
  return updater
}

function getUpdaterByFilename (filename) {
  if (JSON_BUMP_FILES.includes(path.basename(filename))) {
    return getUpdaterByType('json')
  }
  if (PLAIN_TEXT_BUMP_FILES.includes(filename)) {
    return getUpdaterByType('plain-text')
  }
  throw Error(
    `Unsupported file (${filename}) provided for bumping.\n Please specify the updater \`type\` or use a custom \`updater\`.`
  )
}

function getCustomUpdaterFromPath (updater) {
  if (typeof updater === 'string') {
    return require(path.resolve(process.cwd(), updater))
  }
  if (
    typeof updater.readVersion === 'function' &&
    typeof updater.writeVersion === 'function'
  ) {
    return updater
  }
  throw new Error('Updater must be a string path or an object with readVersion and writeVersion methods')
}

/**
 * Simple check to determine if the object provided is a compatible updater.
 */
function isValidUpdater (obj) {
  return (
    typeof obj.readVersion === 'function' &&
    typeof obj.writeVersion === 'function'
  )
}

module.exports.resolveUpdaterObjectFromArgument = function (arg) {
  /**
   * If an Object was not provided, we assume it's the path/filename
   * of the updater.
   */
  let updater = arg
  if (isValidUpdater(updater)) {
    return updater
  }
  if (typeof updater !== 'object') {
    updater = {
      filename: arg
    }
  }
  try {
    if (typeof updater.updater === 'string') {
      updater.updater = getCustomUpdaterFromPath(updater.updater)
    } else if (updater.type) {
      updater.updater = getUpdaterByType(updater.type)
    } else {
      updater.updater = getUpdaterByFilename(updater.filename)
    }
  } catch (err) {
    if (err.code !== 'ENOENT') console.warn(`Unable to obtain updater for: ${JSON.stringify(arg)}\n - Error: ${err.message}\n - Skipping...`)
  }
  /**
   * We weren't able to resolve an updater for the argument.
   */
  if (!isValidUpdater(updater.updater)) {
    return false
  }

  return updater
}


================================================
FILE: lib/updaters/types/json.js
================================================
const stringifyPackage = require('stringify-package')
const detectIndent = require('detect-indent')
const detectNewline = require('detect-newline')

module.exports.readVersion = function (contents) {
  return JSON.parse(contents).version
}

module.exports.writeVersion = function (contents, version) {
  const json = JSON.parse(contents)
  const indent = detectIndent(contents).indent
  const newline = detectNewline(contents)
  json.version = version

  if (json.packages && json.packages['']) {
    // package-lock v2 stores version there too
    json.packages[''].version = version
  }

  return stringifyPackage(json, indent, newline)
}

module.exports.isPrivate = function (contents) {
  return JSON.parse(contents).private
}


================================================
FILE: lib/updaters/types/plain-text.js
================================================
module.exports.readVersion = function (contents) {
  return contents
}

module.exports.writeVersion = function (_contents, version) {
  return version
}


================================================
FILE: lib/write-file.js
================================================
const fs = require('fs')

module.exports = function (args, filePath, content) {
  if (args.dryRun) return
  fs.writeFileSync(filePath, content, 'utf8')
}


================================================
FILE: package.json
================================================
{
  "name": "standard-version",
  "version": "9.5.0",
  "description": "replacement for `npm version` with automatic CHANGELOG generation",
  "bin": "bin/cli.js",
  "scripts": {
    "fix": "eslint . --fix",
    "posttest": "eslint .",
    "test": "nyc mocha --timeout=30000",
    "test:unit": "mocha --exclude test/git.spec.js",
    "coverage": "nyc report --reporter=lcov",
    "release": "bin/cli.js"
  },
  "nyc": {
    "exclude": [
      "tmp/**"
    ]
  },
  "repository": "conventional-changelog/standard-version",
  "engines": {
    "node": ">=10"
  },
  "keywords": [
    "conventional-changelog",
    "recommended",
    "changelog",
    "automatic",
    "workflow",
    "version",
    "angular",
    "standard"
  ],
  "author": "Ben Coe <ben@npmjs.com>",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/conventional-changelog/standard-version/issues"
  },
  "homepage": "https://github.com/conventional-changelog/standard-version#readme",
  "dependencies": {
    "chalk": "^2.4.2",
    "conventional-changelog": "3.1.25",
    "conventional-changelog-config-spec": "2.1.0",
    "conventional-changelog-conventionalcommits": "4.6.3",
    "conventional-recommended-bump": "6.1.0",
    "detect-indent": "^6.0.0",
    "detect-newline": "^3.1.0",
    "dotgitignore": "^2.1.0",
    "figures": "^3.1.0",
    "find-up": "^5.0.0",
    "git-semver-tags": "^4.0.0",
    "semver": "^7.1.1",
    "stringify-package": "^1.0.1",
    "yargs": "^16.0.0"
  },
  "devDependencies": {
    "chai": "^4.2.0",
    "eslint": "^7.14.0",
    "eslint-config-standard": "^16.0.2",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^5.0.0",
    "mocha": "^8.2.1",
    "mock-fs": "^4.13.0",
    "mockery": "^2.1.0",
    "nyc": "^15.1.0",
    "shelljs": "^0.8.4",
    "std-mocks": "^1.0.1"
  }
}


================================================
FILE: renovate.json
================================================
{
  "extends": [
    "config:base"
  ],
  "pinVersions": false,
  "rebaseStalePrs": true,
  "gitAuthor": null,
  "ignoreDeps": ["decamelize"]
}


================================================
FILE: test/config-files.spec.js
================================================
/* global describe it beforeEach afterEach */

'use strict'

const shell = require('shelljs')
const fs = require('fs')
const { Readable } = require('stream')
const mockery = require('mockery')
const stdMocks = require('std-mocks')

require('chai').should()

function exec () {
  const cli = require('../command')
  const opt = cli.parse('standard-version')
  opt.skip = { commit: true, tag: true }
  return require('../index')(opt)
}

/**
 * Mock external conventional-changelog modules
 *
 * Mocks should be unregistered in test cleanup by calling unmock()
 *
 * bump?: 'major' | 'minor' | 'patch' | Error | (opt, cb) => { cb(err) | cb(null, { releaseType }) }
 * changelog?: string | Error | Array<string | Error | (opt) => string | null>
 * tags?: string[] | Error
 */
function mock ({ bump, changelog, tags } = {}) {
  mockery.enable({ warnOnUnregistered: false, useCleanCache: true })

  mockery.registerMock('conventional-recommended-bump', function (opt, cb) {
    if (typeof bump === 'function') bump(opt, cb)
    else if (bump instanceof Error) cb(bump)
    else cb(null, bump ? { releaseType: bump } : {})
  })

  if (!Array.isArray(changelog)) changelog = [changelog]
  mockery.registerMock(
    'conventional-changelog',
    (opt) =>
      new Readable({
        read (_size) {
          const next = changelog.shift()
          if (next instanceof Error) {
            this.destroy(next)
          } else if (typeof next === 'function') {
            this.push(next(opt))
          } else {
            this.push(next ? Buffer.from(next, 'utf8') : null)
          }
        }
      })
  )

  mockery.registerMock('git-semver-tags', function (cb) {
    if (tags instanceof Error) cb(tags)
    else cb(null, tags | [])
  })

  stdMocks.use()
  return () => stdMocks.flush()
}

describe('config files', () => {
  beforeEach(function () {
    shell.rm('-rf', 'tmp')
    shell.config.silent = true
    shell.mkdir('tmp')
    shell.cd('tmp')
    fs.writeFileSync(
      'package.json',
      JSON.stringify({ version: '1.0.0' }),
      'utf-8'
    )
  })

  afterEach(function () {
    shell.cd('../')
    shell.rm('-rf', 'tmp')

    mockery.deregisterAll()
    mockery.disable()
    stdMocks.restore()

    // push out prints from the Mocha reporter
    const { stdout } = stdMocks.flush()
    for (const str of stdout) {
      if (str.startsWith(' ')) process.stdout.write(str)
    }
  })

  it('reads config from package.json', async function () {
    const issueUrlFormat = 'https://standard-version.company.net/browse/{{id}}'
    mock({
      bump: 'minor',
      changelog: ({ preset }) => preset.issueUrlFormat
    })
    const pkg = {
      version: '1.0.0',
      repository: { url: 'git+https://company@scm.org/office/app.git' },
      'standard-version': { issueUrlFormat }
    }
    fs.writeFileSync('package.json', JSON.stringify(pkg), 'utf-8')

    await exec()
    const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
    content.should.include(issueUrlFormat)
  })

  it('reads config from .versionrc', async function () {
    const issueUrlFormat = 'http://www.foo.com/{{id}}'
    const changelog = ({ preset }) => preset.issueUrlFormat
    mock({ bump: 'minor', changelog })
    fs.writeFileSync('.versionrc', JSON.stringify({ issueUrlFormat }), 'utf-8')

    await exec()
    const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
    content.should.include(issueUrlFormat)
  })

  it('reads config from .versionrc.json', async function () {
    const issueUrlFormat = 'http://www.foo.com/{{id}}'
    const changelog = ({ preset }) => preset.issueUrlFormat
    mock({ bump: 'minor', changelog })
    fs.writeFileSync(
      '.versionrc.json',
      JSON.stringify({ issueUrlFormat }),
      'utf-8'
    )

    await exec()
    const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
    content.should.include(issueUrlFormat)
  })

  it('evaluates a config-function from .versionrc.js', async function () {
    const issueUrlFormat = 'http://www.foo.com/{{id}}'
    const src = `module.exports = function() { return ${JSON.stringify({
      issueUrlFormat
    })} }`
    const changelog = ({ preset }) => preset.issueUrlFormat
    mock({ bump: 'minor', changelog })
    fs.writeFileSync('.versionrc.js', src, 'utf-8')

    await exec()
    const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
    content.should.include(issueUrlFormat)
  })

  it('evaluates a config-object from .versionrc.js', async function () {
    const issueUrlFormat = 'http://www.foo.com/{{id}}'
    const src = `module.exports = ${JSON.stringify({ issueUrlFormat })}`
    const changelog = ({ preset }) => preset.issueUrlFormat
    mock({ bump: 'minor', changelog })
    fs.writeFileSync('.versionrc.js', src, 'utf-8')

    await exec()
    const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
    content.should.include(issueUrlFormat)
  })

  it('throws an error when a non-object is returned from .versionrc.js', async function () {
    mock({ bump: 'minor' })
    fs.writeFileSync('.versionrc.js', 'module.exports = 3', 'utf-8')
    try {
      await exec()
      /* istanbul ignore next */
      throw new Error('Unexpected success')
    } catch (error) {
      error.message.should.match(/Invalid configuration/)
    }
  })
})


================================================
FILE: test/core.spec.js
================================================
/* global describe it afterEach */

'use strict'

const shell = require('shelljs')
const fs = require('fs')
const { resolve } = require('path')
const { Readable } = require('stream')
const mockFS = require('mock-fs')
const mockery = require('mockery')
const stdMocks = require('std-mocks')

const cli = require('../command')
const formatCommitMessage = require('../lib/format-commit-message')

require('chai').should()

// set by mock()
let standardVersion

function exec (opt = '', git) {
  if (typeof opt === 'string') {
    opt = cli.parse(`standard-version ${opt}`)
  }
  if (!git) opt.skip = Object.assign({}, opt.skip, { commit: true, tag: true })
  return standardVersion(opt)
}

function getPackageVersion () {
  return JSON.parse(fs.readFileSync('package.json', 'utf-8')).version
}

/**
 * Mock external conventional-changelog modules
 *
 * Mocks should be unregistered in test cleanup by calling unmock()
 *
 * bump?: 'major' | 'minor' | 'patch' | Error | (opt, cb) => { cb(err) | cb(null, { releaseType }) }
 * changelog?: string | Error | Array<string | Error | (opt) => string | null>
 * execFile?: ({ dryRun, silent }, cmd, cmdArgs) => Promise<string>
 * fs?: { [string]: string | Buffer | any }
 * pkg?: { [string]: any }
 * tags?: string[] | Error
 */
function mock ({ bump, changelog, execFile, fs, pkg, tags } = {}) {
  mockery.enable({ warnOnUnregistered: false, useCleanCache: true })

  mockery.registerMock('conventional-recommended-bump', function (opt, cb) {
    if (typeof bump === 'function') bump(opt, cb)
    else if (bump instanceof Error) cb(bump)
    else cb(null, bump ? { releaseType: bump } : {})
  })

  if (!Array.isArray(changelog)) changelog = [changelog]
  mockery.registerMock(
    'conventional-changelog',
    (opt) =>
      new Readable({
        read (_size) {
          const next = changelog.shift()
          if (next instanceof Error) {
            this.destroy(next)
          } else if (typeof next === 'function') {
            this.push(next(opt))
          } else {
            this.push(next ? Buffer.from(next, 'utf8') : null)
          }
        }
      })
  )

  mockery.registerMock('git-semver-tags', function (cb) {
    if (tags instanceof Error) cb(tags)
    else cb(null, tags | [])
  })

  if (typeof execFile === 'function') {
    // called from commit & tag lifecycle methods
    mockery.registerMock('../run-execFile', execFile)
  }

  // needs to be set after mockery, but before mock-fs
  standardVersion = require('../index')

  fs = Object.assign({}, fs)
  if (pkg) {
    fs['package.json'] = JSON.stringify(pkg)
  } else if (pkg === undefined && !fs['package.json']) {
    fs['package.json'] = JSON.stringify({ version: '1.0.0' })
  }
  mockFS(fs)

  stdMocks.use()
  return () => stdMocks.flush()
}

function unmock () {
  mockery.deregisterAll()
  mockery.disable()
  mockFS.restore()
  stdMocks.restore()
  standardVersion = null

  // push out prints from the Mocha reporter
  const { stdout } = stdMocks.flush()
  for (const str of stdout) {
    if (str.startsWith(' ')) process.stdout.write(str)
  }
}

describe('format-commit-message', function () {
  it('works for no {{currentTag}}', function () {
    formatCommitMessage('chore(release): 1.0.0', '1.0.0').should.equal(
      'chore(release): 1.0.0'
    )
  })
  it('works for one {{currentTag}}', function () {
    formatCommitMessage('chore(release): {{currentTag}}', '1.0.0').should.equal(
      'chore(release): 1.0.0'
    )
  })
  it('works for two {{currentTag}}', function () {
    formatCommitMessage(
      'chore(release): {{currentTag}} \n\n* CHANGELOG: https://github.com/conventional-changelog/standard-version/blob/v{{currentTag}}/CHANGELOG.md',
      '1.0.0'
    ).should.equal(
      'chore(release): 1.0.0 \n\n* CHANGELOG: https://github.com/conventional-changelog/standard-version/blob/v1.0.0/CHANGELOG.md'
    )
  })
})

describe('cli', function () {
  afterEach(unmock)

  describe('CHANGELOG.md does not exist', function () {
    it('populates changelog with commits since last tag by default', async function () {
      mock({ bump: 'patch', changelog: 'patch release\n', tags: ['v1.0.0'] })
      await exec()
      const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
      content.should.match(/patch release/)
    })

    it('includes all commits if --first-release is true', async function () {
      mock({
        bump: 'minor',
        changelog: 'first commit\npatch release\n',
        pkg: { version: '1.0.1' }
      })
      await exec('--first-release')
      const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
      content.should.match(/patch release/)
      content.should.match(/first commit/)
    })

    it('skipping changelog will not create a changelog file', async function () {
      mock({ bump: 'minor', changelog: 'foo\n' })
      await exec('--skip.changelog true')
      getPackageVersion().should.equal('1.1.0')
      try {
        fs.readFileSync('CHANGELOG.md', 'utf-8')
        throw new Error('File should not exist')
      } catch (err) {
        err.code.should.equal('ENOENT')
      }
    })
  })

  describe('CHANGELOG.md exists', function () {
    it('appends the new release above the last release, removing the old header (legacy format)', async function () {
      mock({
        bump: 'patch',
        changelog: 'release 1.0.1\n',
        fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' },
        tags: ['v1.0.0']
      })
      await exec()
      const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
      content.should.match(/1\.0\.1/)
      content.should.not.match(/legacy header format/)
    })

    it('appends the new release above the last release, removing the old header (new format)', async function () {
      const { header } = require('../defaults')
      const changelog1 =
        '### [1.0.1](/compare/v1.0.0...v1.0.1) (YYYY-MM-DD)\n\n\n### Bug Fixes\n\n* patch release ABCDEFXY\n'
      mock({ bump: 'patch', changelog: changelog1, tags: ['v1.0.0'] })
      await exec()
      let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
      content.should.equal(header + '\n' + changelog1)

      const changelog2 =
        '### [1.0.2](/compare/v1.0.1...v1.0.2) (YYYY-MM-DD)\n\n\n### Bug Fixes\n\n* another patch release ABCDEFXY\n'
      unmock()
      mock({
        bump: 'patch',
        changelog: changelog2,
        fs: { 'CHANGELOG.md': content },
        tags: ['v1.0.0', 'v1.0.1']
      })
      await exec()
      content = fs.readFileSync('CHANGELOG.md', 'utf-8')
      content.should.equal(header + '\n' + changelog2 + changelog1)
    })

    it('[DEPRECATED] (--changelogHeader) allows for a custom changelog header', async function () {
      const header = '# Pork Chop Log'
      mock({
        bump: 'minor',
        changelog: header + '\n',
        fs: { 'CHANGELOG.md': '' }
      })
      await exec(`--changelogHeader="${header}"`)
      const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
      content.should.match(new RegExp(header))
    })

    it('[DEPRECATED] (--changelogHeader) exits with error if changelog header matches last version search regex', async function () {
      mock({ bump: 'minor', fs: { 'CHANGELOG.md': '' } })
      try {
        await exec('--changelogHeader="## 3.0.2"')
        throw new Error('That should not have worked')
      } catch (error) {
        error.message.should.match(/custom changelog header must not match/)
      }
    })
  })

  describe('lifecycle scripts', () => {
    describe('prerelease hook', function () {
      it('should run the prerelease hook when provided', async function () {
        const flush = mock({
          bump: 'minor',
          fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
        })

        await exec({
          scripts: { prerelease: 'node -e "console.error(\'prerelease\' + \' ran\')"' }
        })
        const { stderr } = flush()
        stderr.join('\n').should.match(/prerelease ran/)
      })

      it('should abort if the hook returns a non-zero exit code', async function () {
        mock({
          bump: 'minor',
          fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
        })

        try {
          await exec({
            scripts: {
              prerelease: 'node -e "throw new Error(\'prerelease\' + \' fail\')"'
            }
          })
          /* istanbul ignore next */
          throw new Error('Unexpected success')
        } catch (error) {
          error.message.should.match(/prerelease fail/)
        }
      })
    })

    describe('prebump hook', function () {
      it('should allow prebump hook to return an alternate version #', async function () {
        const flush = mock({
          bump: 'minor',
          fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
        })

        await exec({ scripts: { prebump: 'node -e "console.log(Array.of(9, 9, 9).join(\'.\'))"' } })
        const { stdout } = flush()
        stdout.join('').should.match(/9\.9\.9/)
      })
    })

    describe('postbump hook', function () {
      it('should run the postbump hook when provided', async function () {
        const flush = mock({
          bump: 'minor',
          fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
        })

        await exec({
          scripts: { postbump: 'node -e "console.error(\'postbump\' + \' ran\')"' }
        })
        const { stderr } = flush()
        stderr.join('\n').should.match(/postbump ran/)
      })

      it('should run the postbump and exit with error when postbump fails', async function () {
        mock({
          bump: 'minor',
          fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
        })

        try {
          await exec({
            scripts: { postbump: 'node -e "throw new Error(\'postbump\' + \' fail\')"' }
          })
          await exec('--patch')
          /* istanbul ignore next */
          throw new Error('Unexpected success')
        } catch (error) {
          error.message.should.match(/postbump fail/)
        }
      })
    })
  })

  describe('manual-release', function () {
    describe('release-types', function () {
      const regularTypes = ['major', 'minor', 'patch']
      const nextVersion = { major: '2.0.0', minor: '1.1.0', patch: '1.0.1' }

      regularTypes.forEach(function (type) {
        it('creates a ' + type + ' release', async function () {
          mock({
            bump: 'patch',
            fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
          })
          await exec('--release-as ' + type)
          getPackageVersion().should.equal(nextVersion[type])
        })
      })

      // this is for pre-releases
      regularTypes.forEach(function (type) {
        it('creates a pre' + type + ' release', async function () {
          mock({
            bump: 'patch',
            fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
          })
          await exec('--release-as ' + type + ' --prerelease ' + type)
          getPackageVersion().should.equal(`${nextVersion[type]}-${type}.0`)
        })
      })
    })

    describe('release-as-exact', function () {
      it('releases as v100.0.0', async function () {
        mock({
          bump: 'patch',
          fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
        })
        await exec('--release-as v100.0.0')
        getPackageVersion().should.equal('100.0.0')
      })

      it('releases as 200.0.0-amazing', async function () {
        mock({
          bump: 'patch',
          fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
        })
        await exec('--release-as 200.0.0-amazing')
        getPackageVersion().should.equal('200.0.0-amazing')
      })
    })

    it('creates a prerelease with a new minor version after two prerelease patches', async function () {
      let releaseType = 'patch'
      const bump = (_, cb) => cb(null, { releaseType })
      mock({
        bump,
        fs: { 'CHANGELOG.md': 'legacy header format<a name="1.0.0">\n' }
      })

      await exec('--release-as patch --prerelease dev')
      getPackageVersion().should.equal('1.0.1-dev.0')

      await exec('--prerelease dev')
      getPackageVersion().should.equal('1.0.1-dev.1')

      releaseType = 'minor'
      await exec('--release-as minor --prerelease dev')
      getPackageVersion().should.equal('1.1.0-dev.0')

      await exec('--release-as minor --prerelease dev')
      getPackageVersion().should.equal('1.1.0-dev.1')

      await exec('--prerelease dev')
      getPackageVersion().should.equal('1.1.0-dev.2')
    })
  })

  it('appends line feed at end of package.json', async function () {
    mock({ bump: 'patch' })
    await exec()
    const pkgJson = fs.readFileSync('package.json', 'utf-8')
    pkgJson.should.equal('{\n  "version": "1.0.1"\n}\n')
  })

  it('preserves indentation of tabs in package.json', async function () {
    mock({
      bump: 'patch',
      fs: { 'package.json': '{\n\t"version": "1.0.0"\n}\n' }
    })
    await exec()
    const pkgJson = fs.readFileSync('package.json', 'utf-8')
    pkgJson.should.equal('{\n\t"version": "1.0.1"\n}\n')
  })

  it('preserves indentation of spaces in package.json', async function () {
    mock({
      bump: 'patch',
      fs: { 'package.json': '{\n    "version": "1.0.0"\n}\n' }
    })
    await exec()
    const pkgJson = fs.readFileSync('package.json', 'utf-8')
    pkgJson.should.equal('{\n    "version": "1.0.1"\n}\n')
  })

  it('preserves carriage return + line feed in package.json', async function () {
    mock({
      bump: 'patch',
      fs: { 'package.json': '{\r\n  "version": "1.0.0"\r\n}\r\n' }
    })
    await exec()
    const pkgJson = fs.readFileSync('package.json', 'utf-8')
    pkgJson.should.equal('{\r\n  "version": "1.0.1"\r\n}\r\n')
  })

  it('does not print output when the --silent flag is passed', async function () {
    const flush = mock()
    await exec('--silent')
    flush().should.eql({ stdout: [], stderr: [] })
  })
})

describe('standard-version', function () {
  afterEach(unmock)

  it('should exit on bump error', async function () {
    mock({ bump: new Error('bump err') })
    try {
      await exec()
      /* istanbul ignore next */
      throw new Error('Unexpected success')
    } catch (err) {
      err.message.should.match(/bump err/)
    }
  })

  it('should exit on changelog error', async function () {
    mock({ bump: 'minor', changelog: new Error('changelog err') })
    try {
      await exec()
      /* istanbul ignore next */
      throw new Error('Unexpected success')
    } catch (err) {
      err.message.should.match(/changelog err/)
    }
  })

  it('should exit with error without a package file to bump', async function () {
    mock({ bump: 'patch', pkg: false })
    try {
      await exec({ gitTagFallback: false })
      /* istanbul ignore next */
      throw new Error('Unexpected success')
    } catch (err) {
      err.message.should.equal('no package file found')
    }
  })

  it('bumps version # in bower.json', async function () {
    mock({
      bump: 'minor',
      fs: { 'bower.json': JSON.stringify({ version: '1.0.0' }) },
      tags: ['v1.0.0']
    })
    await exec()
    JSON.parse(fs.readFileSync('bower.json', 'utf-8')).version.should.equal(
      '1.1.0'
    )
    getPackageVersion().should.equal('1.1.0')
  })

  it('bumps version # in manifest.json', async function () {
    mock({
      bump: 'minor',
      fs: { 'manifest.json': JSON.stringify({ version: '1.0.0' }) },
      tags: ['v1.0.0']
    })
    await exec()
    JSON.parse(fs.readFileSync('manifest.json', 'utf-8')).version.should.equal(
      '1.1.0'
    )
    getPackageVersion().should.equal('1.1.0')
  })

  describe('custom `bumpFiles` support', function () {
    it('mix.exs + version.txt', async function () {
      const updater = 'custom-updater.js'
      const updaterModule = require('./mocks/updater/customer-updater')
      mock({
        bump: 'minor',
        fs: {
          'mix.exs': fs.readFileSync('./test/mocks/mix.exs'),
          'version.txt': fs.readFileSync('./test/mocks/version.txt')
        },
        tags: ['v1.0.0']
      })
      mockery.registerMock(resolve(process.cwd(), updater), updaterModule)

      await exec({
        bumpFiles: [
          'version.txt',
          { filename: 'mix.exs', updater: 'custom-updater.js' }
        ]
      })
      fs.readFileSync('mix.exs', 'utf-8').should.contain('version: "1.1.0"')
      fs.readFileSync('version.txt', 'utf-8').should.equal('1.1.0')
    })

    it('bumps a custom `plain-text` file', async function () {
      mock({
        bump: 'minor',
        fs: {
          'VERSION_TRACKER.txt': fs.readFileSync(
            './test/mocks/VERSION-1.0.0.txt'
          )
        }
      })
      await exec({
        bumpFiles: [{ filename: 'VERSION_TRACKER.txt', type: 'plain-text' }]
      })
      fs.readFileSync('VERSION_TRACKER.txt', 'utf-8').should.equal('1.1.0')
    })
  })

  describe('custom `packageFiles` support', function () {
    it('reads and writes to a custom `plain-text` file', async function () {
      mock({
        bump: 'minor',
        fs: {
          'VERSION_TRACKER.txt': fs.readFileSync(
            './test/mocks/VERSION-6.3.1.txt'
          )
        }
      })
      await exec({
        packageFiles: [{ filename: 'VERSION_TRACKER.txt', type: 'plain-text' }],
        bumpFiles: [{ filename: 'VERSION_TRACKER.txt', type: 'plain-text' }]
      })
      fs.readFileSync('VERSION_TRACKER.txt', 'utf-8').should.equal('6.4.0')
    })

    it('allows same object to be used in packageFiles and bumpFiles', async function () {
      mock({
        bump: 'minor',
        fs: {
          'VERSION_TRACKER.txt': fs.readFileSync(
            './test/mocks/VERSION-6.3.1.txt'
          )
        }
      })
      const origWarn = console.warn
      console.warn = () => {
        throw new Error('console.warn should not be called')
      }
      const filedesc = { filename: 'VERSION_TRACKER.txt', type: 'plain-text' }
      try {
        await exec({ packageFiles: [filedesc], bumpFiles: [filedesc] })
        fs.readFileSync('VERSION_TRACKER.txt', 'utf-8').should.equal('6.4.0')
      } finally {
        console.warn = origWarn
      }
    })
  })

  it('`packageFiles` are bumped along with `bumpFiles` defaults [standard-version#533]', async function () {
    mock({
      bump: 'minor',
      fs: {
        '.gitignore': '',
        'package-lock.json': JSON.stringify({ version: '1.0.0' }),
        'manifest.json': fs.readFileSync('./test/mocks/manifest-6.3.1.json')
      },
      tags: ['v1.0.0']
    })

    await exec({
      silent: true,
      packageFiles: [
        {
          filename: 'manifest.json',
          type: 'json'
        }
      ]
    })

    JSON.parse(fs.readFileSync('manifest.json', 'utf-8')).version.should.equal('6.4.0')
    JSON.parse(fs.readFileSync('package.json', 'utf-8')).version.should.equal('6.4.0')
    JSON.parse(fs.readFileSync('package-lock.json', 'utf-8')).version.should.equal('6.4.0')
  })

  it('bumps version # in npm-shrinkwrap.json', async function () {
    mock({
      bump: 'minor',
      fs: {
        'npm-shrinkwrap.json': JSON.stringify({ version: '1.0.0' })
      },
      tags: ['v1.0.0']
    })
    await exec()
    JSON.parse(
      fs.readFileSync('npm-shrinkwrap.json', 'utf-8')
    ).version.should.equal('1.1.0')
    getPackageVersion().should.equal('1.1.0')
  })

  it('bumps version # in package-lock.json', async function () {
    mock({
      bump: 'minor',
      fs: {
        '.gitignore': '',
        'package-lock.json': JSON.stringify({ version: '1.0.0' })
      },
      tags: ['v1.0.0']
    })
    await exec()
    JSON.parse(
      fs.readFileSync('package-lock.json', 'utf-8')
    ).version.should.equal('1.1.0')
    getPackageVersion().should.equal('1.1.0')
  })

  describe('skip', () => {
    it('allows bump and changelog generation to be skipped', async function () {
      const changelogContent = 'legacy header format<a name="1.0.0">\n'
      mock({
        bump: 'minor',
        changelog: 'foo\n',
        fs: { 'CHANGELOG.md': changelogContent }
      })

      await exec('--skip.bump true --skip.changelog true')
      getPackageVersion().should.equal('1.0.0')
      const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
      content.should.equal(changelogContent)
    })
  })

  it('does not update files present in .gitignore', async () => {
    mock({
      bump: 'minor',
      fs: {
        '.gitignore': 'package-lock.json\nbower.json',
        // test a defaults.packageFiles
        'bower.json': JSON.stringify({ version: '1.0.0' }),
        // test a defaults.bumpFiles
        'package-lock.json': JSON.stringify({
          name: '@org/package',
          version: '1.0.0',
          lockfileVersion: 1
        })
      },
      tags: ['v1.0.0']
    })
    await exec()
    JSON.parse(fs.readFileSync('package-lock.json', 'utf-8')).version.should.equal(
      '1.0.0'
    )
    JSON.parse(fs.readFileSync('bower.json', 'utf-8')).version.should.equal(
      '1.0.0'
    )
    getPackageVersion().should.equal('1.1.0')
  })

  describe('configuration', () => {
    it('--header', async function () {
      mock({ bump: 'minor', fs: { 'CHANGELOG.md': '' } })
      await exec('--header="# Welcome to our CHANGELOG.md"')
      const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
      content.should.match(/# Welcome to our CHANGELOG.md/)
    })

    it('--issuePrefixes and --issueUrlFormat', async function () {
      const format = 'http://www.foo.com/{{prefix}}{{id}}'
      const prefix = 'ABC-'
      const changelog = ({ preset }) =>
        preset.issueUrlFormat + ':' + preset.issuePrefixes
      mock({ bump: 'minor', changelog })
      await exec(`--issuePrefixes="${prefix}" --issueUrlFormat="${format}"`)
      const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
      content.should.include(`${format}:${prefix}`)
    })
  })

  describe('pre-major', () => {
    it('bumps the minor rather than major, if version < 1.0.0', async function () {
      mock({
        bump: 'minor',
        pkg: {
          version: '0.5.0',
          repository: { url: 'https://github.com/yargs/yargs.git' }
        }
      })
      await exec()
      getPackageVersion().should.equal('0.6.0')
    })

    it('bumps major if --release-as=major specified, if version < 1.0.0', async function () {
      mock({
        bump: 'major',
        pkg: {
          version: '0.5.0',
          repository: { url: 'https://github.com/yargs/yargs.git' }
        }
      })
      await exec('-r major')
      getPackageVersion().should.equal('1.0.0')
    })
  })
})

describe('GHSL-2020-111', function () {
  afterEach(unmock)

  it('does not allow command injection via basic configuration', async function () {
    mock({ bump: 'patch' })
    await exec({
      noVerify: true,
      infile: 'foo.txt',
      releaseCommitMessageFormat: 'bla `touch exploit`'
    })
    const stat = shell.test('-f', './exploit')
    stat.should.equal(false)
  })
})

describe('with mocked git', function () {
  afterEach(unmock)

  it('--sign signs the commit and tag', async function () {
    const gitArgs = [
      ['add', 'CHANGELOG.md', 'package.json'],
      ['commit', '-S', 'CHANGELOG.md', 'package.json', '-m', 'chore(release): 1.0.1'],
      ['tag', '-s', 'v1.0.1', '-m', 'chore(release): 1.0.1'],
      ['rev-parse', '--abbrev-ref', 'HEAD']
    ]
    const execFile = (_args, cmd, cmdArgs) => {
      cmd.should.equal('git')
      const expected = gitArgs.shift()
      cmdArgs.should.deep.equal(expected)
      if (expected[0] === 'rev-parse') return Promise.resolve('master')
      return Promise.resolve('')
    }
    mock({ bump: 'patch', changelog: 'foo\n', execFile })

    await exec('--sign', true)
    gitArgs.should.have.lengthOf(0)
  })

  it('fails if git add fails', async function () {
    const gitArgs = [
      ['add', 'CHANGELOG.md', 'package.json']
    ]
    const execFile = (_args, cmd, cmdArgs) => {
      cmd.should.equal('git')
      const expected = gitArgs.shift()
      cmdArgs.should.deep.equal(expected)
      if (expected[0] === 'add') {
        return Promise.reject(new Error('Command failed: git\nfailed add'))
      }
      return Promise.resolve('')
    }
    mock({ bump: 'patch', changelog: 'foo\n', execFile })

    try {
      await exec({}, true)
      /* istanbul ignore next */
      throw new Error('Unexpected success')
    } catch (error) {
      error.message.should.match(/failed add/)
    }
  })

  it('fails if git commit fails', async function () {
    const gitArgs = [
      ['add', 'CHANGELOG.md', 'package.json'],
      ['commit', 'CHANGELOG.md', 'package.json', '-m', 'chore(release): 1.0.1']
    ]
    const execFile = (_args, cmd, cmdArgs) => {
      cmd.should.equal('git')
      const expected = gitArgs.shift()
      cmdArgs.should.deep.equal(expected)
      if (expected[0] === 'commit') {
        return Promise.reject(new Error('Command failed: git\nfailed commit'))
      }
      return Promise.resolve('')
    }
    mock({ bump: 'patch', changelog: 'foo\n', execFile })

    try {
      await exec({}, true)
      /* istanbul ignore next */
      throw new Error('Unexpected success')
    } catch (error) {
      error.message.should.match(/failed commit/)
    }
  })

  it('fails if git tag fails', async function () {
    const gitArgs = [
      ['add', 'CHANGELOG.md', 'package.json'],
      ['commit', 'CHANGELOG.md', 'package.json', '-m', 'chore(release): 1.0.1'],
      ['tag', '-a', 'v1.0.1', '-m', 'chore(release): 1.0.1']
    ]
    const execFile = (_args, cmd, cmdArgs) => {
      cmd.should.equal('git')
      const expected = gitArgs.shift()
      cmdArgs.should.deep.equal(expected)
      if (expected[0] === 'tag') {
        return Promise.reject(new Error('Command failed: git\nfailed tag'))
      }
      return Promise.resolve('')
    }
    mock({ bump: 'patch', changelog: 'foo\n', execFile })

    try {
      await exec({}, true)
      /* istanbul ignore next */
      throw new Error('Unexpected success')
    } catch (error) {
      error.message.should.match(/failed tag/)
    }
  })
})


================================================
FILE: test/git.spec.js
================================================
/* global describe it beforeEach afterEach */

'use strict'

const shell = require('shelljs')
const fs = require('fs')
const { Readable } = require('stream')
const mockery = require('mockery')
const stdMocks = require('std-mocks')

require('chai').should()

function exec (opt = '') {
  if (typeof opt === 'string') {
    const cli = require('../command')
    opt = cli.parse(`standard-version ${opt}`)
  }
  return require('../index')(opt)
}

function writePackageJson (version, option) {
  const pkg = Object.assign({}, option, { version })
  fs.writeFileSync('package.json', JSON.stringify(pkg), 'utf-8')
}

function writeHook (hookName, causeError, script) {
  shell.mkdir('-p', 'scripts')
  let content = script || 'console.error("' + hookName + ' ran")'
  content += causeError ? '\nthrow new Error("' + hookName + '-failure")' : ''
  fs.writeFileSync('scripts/' + hookName + '.js', content, 'utf-8')
  fs.chmodSync('scripts/' + hookName + '.js', '755')
}

function getPackageVersion () {
  return JSON.parse(fs.readFileSync('package.json', 'utf-8')).version
}

/**
 * Mock external conventional-changelog modules
 *
 * bump: 'major' | 'minor' | 'patch' | Error | (opt, cb) => { cb(err) | cb(null, { releaseType }) }
 * changelog?: string | Error | Array<string | Error | (opt) => string | null>
 * tags?: string[] | Error
 */
function mock ({ bump, changelog, tags }) {
  if (bump === undefined) throw new Error('bump must be defined for mock()')
  mockery.enable({ warnOnUnregistered: false, useCleanCache: true })

  mockery.registerMock('conventional-recommended-bump', function (opt, cb) {
    if (typeof bump === 'function') bump(opt, cb)
    else if (bump instanceof Error) cb(bump)
    else cb(null, { releaseType: bump })
  })

  if (!Array.isArray(changelog)) changelog = [changelog]
  mockery.registerMock('conventional-changelog', (opt) => new Readable({
    read (_size) {
      const next = changelog.shift()
      if (next instanceof Error) {
        this.destroy(next)
      } else if (typeof next === 'function') {
        this.push(next(opt))
      } else {
        this.push(next ? Buffer.from(next, 'utf8') : null)
      }
    }
  }))

  mockery.registerMock('git-semver-tags', function (_, cb) {
    if (tags instanceof Error) cb(tags)
    else cb(null, tags || [])
  })

  stdMocks.use()
  return () => stdMocks.flush()
}

describe('git', function () {
  beforeEach(function () {
    shell.rm('-rf', 'tmp')
    shell.config.silent = true
    shell.mkdir('tmp')
    shell.cd('tmp')
    shell.exec('git init')
    shell.exec('git config commit.gpgSign false')
    shell.exec('git config core.autocrlf false')
    shell.exec('git commit --allow-empty -m"root-commit"')
    writePackageJson('1.0.0')
  })

  afterEach(function () {
    shell.cd('../')
    shell.rm('-rf', 'tmp')

    mockery.deregisterAll()
    mockery.disable()
    stdMocks.restore()

    // push out prints from the Mocha reporter
    const { stdout } = stdMocks.flush()
    for (const str of stdout) {
      if (str.startsWith(' ')) process.stdout.write(str)
    }
  })

  describe('tagPrefix', () => {
    // TODO: Use unmocked git-semver-tags and stage a git environment
    it('will add prefix onto tag based on version from package', async function () {
      writePackageJson('1.2.0')
      mock({ bump: 'minor', tags: ['p-v1.2.0'] })
      await exec('--tag-prefix p-v')
      shell.exec('git tag').stdout.should.match(/p-v1\.3\.0/)
    })

    it('will add prefix onto tag via when gitTagFallback is true and no package [cli]', async function () {
      shell.rm('package.json')
      mock({ bump: 'minor', tags: ['android/production/v1.2.0', 'android/production/v1.0.0'] })
      await exec('--tag-prefix android/production/v')
      shell.exec('git tag').stdout.should.match(/android\/production\/v1\.3\.0/)
    })

    it('will add prefix onto tag via when gitTagFallback is true and no package [options]', async function () {
      mock({ bump: 'minor', tags: ['android/production/v1.2.0', 'android/production/v1.0.0'] })
      await exec({ tagPrefix: 'android/production/v', packageFiles: [] })
      shell.exec('git tag').stdout.should.match(/android\/production\/v1\.3\.0/)
    })
  })

  it('formats the commit and tag messages appropriately', async function () {
    mock({ bump: 'minor', tags: ['v1.0.0'] })
    await exec({})
    // check last commit message
    shell.exec('git log --oneline -n1').stdout.should.match(/chore\(release\): 1\.1\.0/)
    // check annotated tag message
    shell.exec('git tag -l -n1 v1.1.0').stdout.should.match(/chore\(release\): 1\.1\.0/)
  })

  it('formats the tag if --first-release is true', async function () {
    writePackageJson('1.0.1')
    mock({ bump: 'minor' })
    await exec('--first-release')
    shell.exec('git tag').stdout.should.match(/1\.0\.1/)
  })

  it('commits all staged files', async function () {
    fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')
    fs.writeFileSync('STUFF.md', 'stuff\n', 'utf-8')
    shell.exec('git add STUFF.md')

    mock({ bump: 'patch', changelog: 'release 1.0.1\n', tags: ['v1.0.0'] })
    await exec('--commit-all')
    const status = shell.exec('git status --porcelain') // see http://unix.stackexchange.com/questions/155046/determine-if-git-working-directory-is-clean-from-a-script
    status.should.equal('')
    status.should.not.match(/STUFF.md/)

    const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
    content.should.match(/1\.0\.1/)
    content.should.not.match(/legacy header format/)
  })

  it('does not run git hooks if the --no-verify flag is passed', async function () {
    fs.writeFileSync('.git/hooks/pre-commit', '#!/bin/sh\necho "precommit ran"\nexit 1', 'utf-8')
    fs.chmodSync('.git/hooks/pre-commit', '755')

    mock({ bump: 'minor' })
    await exec('--no-verify')
    await exec('-n')
  })

  it('allows the commit phase to be skipped', async function () {
    const changelogContent = 'legacy header format<a name="1.0.0">\n'
    writePackageJson('1.0.0')
    fs.writeFileSync('CHANGELOG.md', changelogContent, 'utf-8')

    mock({ bump: 'minor', changelog: 'new feature\n' })
    await exec('--skip.commit true')
    getPackageVersion().should.equal('1.1.0')
    const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
    content.should.match(/new feature/)
    shell.exec('git log --oneline -n1').stdout.should.match(/root-commit/)
  })

  it('dry-run skips all non-idempotent steps', async function () {
    shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
    const flush = mock({ bump: 'minor', changelog: '### Features\n', tags: ['v1.0.0'] })
    await exec('--dry-run')
    const { stdout } = flush()
    stdout.join('').should.match(/### Features/)
    shell.exec('git log --oneline -n1').stdout.should.match(/root-commit/)
    shell.exec('git tag').stdout.should.match(/1\.0\.0/)
    getPackageVersion().should.equal('1.0.0')
  })

  it('works fine without specifying a tag id when prereleasing', async function () {
    writePackageJson('1.0.0')
    fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')
    mock({ bump: 'minor' })
    await exec('--prerelease')
    getPackageVersion().should.equal('1.1.0-0')
  })

  describe('gitTagFallback', () => {
    it('defaults to 1.0.0 if no tags in git history', async () => {
      shell.rm('package.json')
      mock({ bump: 'minor' })
      await exec({})
      const output = shell.exec('git tag')
      output.stdout.should.include('v1.1.0')
    })

    it('bases version on greatest version tag, if tags are found', async () => {
      shell.rm('package.json')
      mock({ bump: 'minor', tags: ['v3.9.0', 'v5.0.0', 'v3.0.0'] })
      await exec({})
      const output = shell.exec('git tag')
      output.stdout.should.include('v5.1.0')
    })
  })

  describe('configuration', () => {
    it('.versionrc : releaseCommitMessageFormat', async function () {
      fs.writeFileSync('.versionrc', JSON.stringify({
        releaseCommitMessageFormat: 'This commit represents release: {{currentTag}}'
      }), 'utf-8')
      mock({ bump: 'minor' })
      await exec('')
      shell.exec('git log --oneline -n1').should.include('This commit represents release: 1.1.0')
    })

    it('--releaseCommitMessageFormat', async function () {
      mock({ bump: 'minor' })
      await exec('--releaseCommitMessageFormat="{{currentTag}} is the version."')
      shell.exec('git log --oneline -n1').should.include('1.1.0 is the version.')
    })

    it('[LEGACY] supports --message (and single %s replacement)', async function () {
      mock({ bump: 'minor' })
      await exec('--message="V:%s"')
      shell.exec('git log --oneline -n1').should.include('V:1.1.0')
    })

    it('[LEGACY] supports -m (and multiple %s replacements)', async function () {
      mock({ bump: 'minor' })
      await exec('--message="V:%s is the %s."')
      shell.exec('git log --oneline -n1').should.include('V:1.1.0 is the 1.1.0.')
    })
  })

  describe('precommit hook', function () {
    it('should run the precommit hook when provided via .versionrc.json (#371)', async function () {
      fs.writeFileSync('.versionrc.json', JSON.stringify({
        scripts: { precommit: 'node scripts/precommit' }
      }), 'utf-8')

      writeHook('precommit')
      fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')
      const flush = mock({ bump: 'minor' })
      await exec('')
      const { stderr } = flush()
      stderr[0].should.match(/precommit ran/)
    })

    it('should run the precommit hook when provided', async function () {
      writePackageJson('1.0.0', {
        'standard-version': {
          scripts: { precommit: 'node scripts/precommit' }
        }
      })
      writeHook('precommit')
      fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

      const flush = mock({ bump: 'minor' })
      await exec('--patch')
      const { stderr } = flush()
      stderr[0].should.match(/precommit ran/)
    })

    it('should run the precommit hook and exit with error when precommit fails', async function () {
      writePackageJson('1.0.0', {
        'standard-version': {
          scripts: { precommit: 'node scripts/precommit' }
        }
      })
      writeHook('precommit', true)
      fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

      mock({ bump: 'minor' })
      try {
        await exec('--patch')
        /* istanbul ignore next */
        throw new Error('Unexpected success')
      } catch (error) {
        error.message.should.match(/precommit-failure/)
      }
    })

    it('should allow an alternate commit message to be provided by precommit script', async function () {
      writePackageJson('1.0.0', {
        'standard-version': {
          scripts: { precommit: 'node scripts/precommit' }
        }
      })
      writeHook('precommit', false, 'console.log("releasing %s delivers #222")')
      fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

      mock({ bump: 'minor' })
      await exec('--patch')
      shell.exec('git log --oneline -n1').should.match(/delivers #222/)
    })
  })

  describe('Run ... to publish', function () {
    it('does normally display `npm publish`', async function () {
      const flush = mock({ bump: 'patch' })
      await exec('')
      flush().stdout.join('').should.match(/npm publish/)
    })

    it('does not display `npm publish` if the package is private', async function () {
      writePackageJson('1.0.0', { private: true })
      const flush = mock({ bump: 'patch' })
      await exec('')
      flush().stdout.join('').should.not.match(/npm publish/)
    })

    it('does not display `npm publish` if there is no package.json', async function () {
      shell.rm('package.json')
      const flush = mock({ bump: 'patch' })
      await exec('')
      flush().stdout.join('').should.not.match(/npm publish/)
    })

    it('does not display `all staged files` without the --commit-all flag', async function () {
      const flush = mock({ bump: 'patch' })
      await exec('')
      flush().stdout.join('').should.not.match(/all staged files/)
    })

    it('does display `all staged files` if the --commit-all flag is passed', async function () {
      const flush = mock({ bump: 'patch' })
      await exec('--commit-all')
      flush().stdout.join('').should.match(/all staged files/)
    })

    it('advises use of --tag prerelease for publishing to npm', async function () {
      writePackageJson('1.0.0')
      fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

      const flush = mock({ bump: 'patch' })
      await exec('--prerelease')
      const { stdout } = flush()
      stdout.join('').should.include('--tag prerelease')
    })

    it('advises use of --tag alpha for publishing to npm when tagging alpha', async function () {
      writePackageJson('1.0.0')
      fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

      const flush = mock({ bump: 'patch' })
      await exec('--prerelease alpha')
      const { stdout } = flush()
      stdout.join('').should.include('--tag alpha')
    })

    it('does not advise use of --tag prerelease for private modules', async function () {
      writePackageJson('1.0.0', { private: true })
      fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

      const flush = mock({ bump: 'minor' })
      await exec('--prerelease')
      const { stdout } = flush()
      stdout.join('').should.not.include('--tag prerelease')
    })
  })
})


================================================
FILE: test/mocks/VERSION-1.0.0.txt
================================================
1.0.0

================================================
FILE: test/mocks/VERSION-6.3.1.txt
================================================
6.3.1

================================================
FILE: test/mocks/manifest-6.3.1.json
================================================
{
  "version": "6.3.1"
}

================================================
FILE: test/mocks/mix.exs
================================================
defmodule StandardVersion.MixProject do
  use Mix.Project

  def project do
    [
      app: :standard_version,
      version: "0.1.0",
      elixir: "~> 1.9",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      # {:dep_from_hexpm, "~> 0.3.0"},
      # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
    ]
  end
end


================================================
FILE: test/mocks/updater/customer-updater.js
================================================
const REPLACER = /version: "(.*)"/

module.exports.readVersion = function (contents) {
  return REPLACER.exec(contents)[1]
}

module.exports.writeVersion = function (contents, version) {
  return contents.replace(
    REPLACER.exec(contents)[0],
    `version: "${version}"`
  )
}


================================================
FILE: test/mocks/version.txt
================================================


================================================
FILE: test/preset.spec.js
================================================
/* global describe it beforeEach, afterEach */

const shell = require('shelljs')
const fs = require('fs')

require('chai').should()

function exec (opt) {
  const cli = require('../command')
  opt = cli.parse(`standard-version ${opt} --silent`)
  opt.skip = { commit: true, tag: true }
  return require('../index')(opt)
}

describe('presets', () => {
  beforeEach(function () {
    shell.rm('-rf', 'tmp')
    shell.config.silent = true
    shell.mkdir('tmp')
    shell.cd('tmp')
    shell.exec('git init')
    shell.exec('git config commit.gpgSign false')
    shell.exec('git config core.autocrlf false')
    shell.exec('git commit --allow-empty -m "initial commit"')
    shell.exec('git commit --allow-empty -m "feat: A feature commit."')
    shell.exec('git commit --allow-empty -m "perf: A performance change."')
    shell.exec('git commit --allow-empty -m "chore: A chore commit."')
    shell.exec('git commit --allow-empty -m "ci: A ci commit."')
    shell.exec('git commit --allow-empty -m "custom: A custom commit."')
  })

  afterEach(function () {
    shell.cd('../')
    shell.rm('-rf', 'tmp')
  })

  it('Conventional Commits (default)', async function () {
    await exec()
    const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
    content.should.contain('### Features')
    content.should.not.contain('### Performance Improvements')
    content.should.not.contain('### Custom')
  })

  it('Angular', async function () {
    await exec('--preset angular')
    const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
    content.should.contain('### Features')
    content.should.contain('### Performance Improvements')
    content.should.not.contain('### Custom')
  })
})
Download .txt
gitextract_6nfb7b3g/

├── .editorconfig
├── .eslintrc
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── ask-a-question.md
│   │   └── bug-report.md
│   └── workflows/
│       ├── ci.yaml
│       └── release-please.yml
├── .gitignore
├── .versionrc
├── CHANGELOG.md
├── LICENSE.txt
├── README.md
├── bin/
│   └── cli.js
├── command.js
├── defaults.js
├── index.js
├── lib/
│   ├── checkpoint.js
│   ├── configuration.js
│   ├── format-commit-message.js
│   ├── latest-semver-tag.js
│   ├── lifecycles/
│   │   ├── bump.js
│   │   ├── changelog.js
│   │   ├── commit.js
│   │   └── tag.js
│   ├── preset-loader.js
│   ├── print-error.js
│   ├── run-exec.js
│   ├── run-execFile.js
│   ├── run-lifecycle-script.js
│   ├── updaters/
│   │   ├── index.js
│   │   └── types/
│   │       ├── json.js
│   │       └── plain-text.js
│   └── write-file.js
├── package.json
├── renovate.json
└── test/
    ├── config-files.spec.js
    ├── core.spec.js
    ├── git.spec.js
    ├── mocks/
    │   ├── VERSION-1.0.0.txt
    │   ├── VERSION-6.3.1.txt
    │   ├── manifest-6.3.1.json
    │   ├── mix.exs
    │   ├── updater/
    │   │   └── customer-updater.js
    │   └── version.txt
    └── preset.spec.js
Download .txt
SYMBOL INDEX (39 symbols across 12 files)

FILE: lib/configuration.js
  constant CONFIGURATION_FILES (line 5) | const CONFIGURATION_FILES = [

FILE: lib/lifecycles/bump.js
  function Bump (line 17) | async function Bump (args, version) {
  function getReleaseType (line 43) | function getReleaseType (prerelease, expectedReleaseType, currentVersion) {
  function isString (line 59) | function isString (val) {
  function shouldContinuePrerelease (line 72) | function shouldContinuePrerelease (version, expectType) {
  function isInPrerelease (line 76) | function isInPrerelease (version) {
  function getCurrentActiveType (line 88) | function getCurrentActiveType (version) {
  function getTypePriority (line 104) | function getTypePriority (type) {
  function bumpVersion (line 108) | function bumpVersion (releaseAs, currentVersion, args) {
  function updateConfigs (line 139) | function updateConfigs (args, newVersion) {

FILE: lib/lifecycles/changelog.js
  constant START_OF_LAST_RELEASE_PATTERN (line 8) | const START_OF_LAST_RELEASE_PATTERN = /(^#+ \[?[0-9]+\.[0-9]+\.[0-9]+|<a...
  function Changelog (line 10) | async function Changelog (args, newVersion) {
  function outputChangelog (line 21) | function outputChangelog (args, newVersion) {
  function createIfMissing (line 56) | function createIfMissing (args) {

FILE: lib/lifecycles/commit.js
  function execCommit (line 16) | async function execCommit (args, newVersion) {

FILE: lib/lifecycles/tag.js
  function execTag (line 16) | async function execTag (newVersion, pkgPrivate, args) {

FILE: lib/updaters/index.js
  constant JSON_BUMP_FILES (line 2) | const JSON_BUMP_FILES = require('../../defaults').bumpFiles
  constant PLAIN_TEXT_BUMP_FILES (line 7) | const PLAIN_TEXT_BUMP_FILES = ['VERSION.txt', 'version.txt']
  function getUpdaterByType (line 9) | function getUpdaterByType (type) {
  function getUpdaterByFilename (line 17) | function getUpdaterByFilename (filename) {
  function getCustomUpdaterFromPath (line 29) | function getCustomUpdaterFromPath (updater) {
  function isValidUpdater (line 45) | function isValidUpdater (obj) {

FILE: test/config-files.spec.js
  function exec (line 13) | function exec () {
  function mock (line 29) | function mock ({ bump, changelog, tags } = {}) {

FILE: test/core.spec.js
  function exec (line 21) | function exec (opt = '', git) {
  function getPackageVersion (line 29) | function getPackageVersion () {
  function mock (line 45) | function mock ({ bump, changelog, execFile, fs, pkg, tags } = {}) {
  function unmock (line 97) | function unmock () {

FILE: test/git.spec.js
  function exec (line 13) | function exec (opt = '') {
  function writePackageJson (line 21) | function writePackageJson (version, option) {
  function writeHook (line 26) | function writeHook (hookName, causeError, script) {
  function getPackageVersion (line 34) | function getPackageVersion () {
  function mock (line 45) | function mock ({ bump, changelog, tags }) {

FILE: test/mocks/mix.exs
  class StandardVersion.MixProject (line 1) | defmodule StandardVersion.MixProject
    method project (line 4) | def project do
    method application (line 15) | def application do
    method deps (line 22) | defp deps do

FILE: test/mocks/updater/customer-updater.js
  constant REPLACER (line 1) | const REPLACER = /version: "(.*)"/

FILE: test/preset.spec.js
  function exec (line 8) | function exec (opt) {
Condensed preview — 44 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (143K chars).
[
  {
    "path": ".editorconfig",
    "chars": 164,
    "preview": "# EditorConfig is awesome: http://EditorConfig.org\n\nroot = true\n\n[*]\ntrim_trailing_whitespace=true\nindent_style = space\n"
  },
  {
    "path": ".eslintrc",
    "chars": 67,
    "preview": "{\n  \"extends\": \"standard\",\n  \"rules\": {\n    \"no-var\": \"error\"\n  }\n}"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/ask-a-question.md",
    "chars": 149,
    "preview": "---\nname: Ask a Question\nabout: '\"How can I X?\" – ask a question about how to use standard-version.'\ntitle: ''\nlabels: q"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug-report.md",
    "chars": 698,
    "preview": "---\nname: Bug Report\nabout: Use this template if something isn't working as expected.\ntitle: ''\nlabels: bug\nassignees: '"
  },
  {
    "path": ".github/workflows/ci.yaml",
    "chars": 884,
    "preview": "on:\n  push:\n    branches:\n      - master\n  pull_request:\n    types: [ assigned, opened, synchronize, reopened, labeled ]"
  },
  {
    "path": ".github/workflows/release-please.yml",
    "chars": 1015,
    "preview": "on:\n  push:\n    branches:\n      - master\nname: release-please\njobs:\n  release-please:\n    runs-on: ubuntu-latest\n    ste"
  },
  {
    "path": ".gitignore",
    "chars": 162,
    "preview": "# OS\n.DS_Store\n\n# node.js & npm\nnode_modules\n.nyc_output\nnpm-debug.log\n\n# Editor files\n/.project\n/.settings\n/.idea\n/.vsc"
  },
  {
    "path": ".versionrc",
    "chars": 256,
    "preview": "{\n  \"types\": [\n    {\"type\":\"feat\",\"section\":\"Features\"},\n    {\"type\":\"fix\",\"section\":\"Bug Fixes\"},\n    {\"type\":\"test\",\"s"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 38242,
    "preview": "# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github."
  },
  {
    "path": "LICENSE.txt",
    "chars": 744,
    "preview": "ISC License\n\nCopyright (c) 2016, Contributors\n\nPermission to use, copy, modify, and/or distribute this software\nfor any "
  },
  {
    "path": "README.md",
    "chars": 17206,
    "preview": "# Standard Version\n\n> **`standard-version` is deprecated**. If you're a GitHub user, I recommend [release-please](https:"
  },
  {
    "path": "bin/cli.js",
    "chars": 376,
    "preview": "#!/usr/bin/env node\n\n/* istanbul ignore if */\nif (process.version.match(/v(\\d+)\\./)[1] < 6) {\n  console.error('standard-"
  },
  {
    "path": "command.js",
    "chars": 4173,
    "preview": "const spec = require('conventional-changelog-config-spec')\nconst { getConfiguration } = require('./lib/configuration')\nc"
  },
  {
    "path": "defaults.js",
    "chars": 1128,
    "preview": "const spec = require('conventional-changelog-config-spec')\n\nconst defaults = {\n  infile: 'CHANGELOG.md',\n  firstRelease:"
  },
  {
    "path": "index.js",
    "chars": 2773,
    "preview": "const bump = require('./lib/lifecycles/bump')\nconst changelog = require('./lib/lifecycles/changelog')\nconst commit = req"
  },
  {
    "path": "lib/checkpoint.js",
    "chars": 424,
    "preview": "const chalk = require('chalk')\nconst figures = require('figures')\nconst util = require('util')\n\nmodule.exports = functio"
  },
  {
    "path": "lib/configuration.js",
    "chars": 1045,
    "preview": "const path = require('path')\nconst findUp = require('find-up')\nconst { readFileSync } = require('fs')\n\nconst CONFIGURATI"
  },
  {
    "path": "lib/format-commit-message.js",
    "chars": 140,
    "preview": "module.exports = function (rawMsg, newVersion) {\n  const message = String(rawMsg)\n  return message.replace(/{{currentTag"
  },
  {
    "path": "lib/latest-semver-tag.js",
    "chars": 620,
    "preview": "const gitSemverTags = require('git-semver-tags')\nconst semver = require('semver')\n\nmodule.exports = function (tagPrefix "
  },
  {
    "path": "lib/lifecycles/bump.js",
    "chars": 5015,
    "preview": "'use strict'\n\nconst chalk = require('chalk')\nconst checkpoint = require('../checkpoint')\nconst conventionalRecommendedBu"
  },
  {
    "path": "lib/lifecycles/changelog.js",
    "chars": 2280,
    "preview": "const chalk = require('chalk')\nconst checkpoint = require('../checkpoint')\nconst conventionalChangelog = require('conven"
  },
  {
    "path": "lib/lifecycles/commit.js",
    "chars": 1895,
    "preview": "const bump = require('../lifecycles/bump')\nconst checkpoint = require('../checkpoint')\nconst formatCommitMessage = requi"
  },
  {
    "path": "lib/lifecycles/tag.js",
    "chars": 1484,
    "preview": "const bump = require('../lifecycles/bump')\nconst chalk = require('chalk')\nconst checkpoint = require('../checkpoint')\nco"
  },
  {
    "path": "lib/preset-loader.js",
    "chars": 595,
    "preview": "// TODO: this should be replaced with an object we maintain and\n// describe in: https://github.com/conventional-changelo"
  },
  {
    "path": "lib/print-error.js",
    "chars": 236,
    "preview": "const chalk = require('chalk')\n\nmodule.exports = function (args, msg, opts) {\n  if (!args.silent) {\n    opts = Object.as"
  },
  {
    "path": "lib/run-exec.js",
    "chars": 602,
    "preview": "const { promisify } = require('util')\nconst printError = require('./print-error')\n\nconst exec = promisify(require('child"
  },
  {
    "path": "lib/run-execFile.js",
    "chars": 640,
    "preview": "const { promisify } = require('util')\nconst printError = require('./print-error')\n\nconst execFile = promisify(require('c"
  },
  {
    "path": "lib/run-lifecycle-script.js",
    "chars": 504,
    "preview": "const chalk = require('chalk')\nconst checkpoint = require('./checkpoint')\nconst figures = require('figures')\nconst runEx"
  },
  {
    "path": "lib/updaters/index.js",
    "chars": 2377,
    "preview": "const path = require('path')\nconst JSON_BUMP_FILES = require('../../defaults').bumpFiles\nconst updatersByType = {\n  json"
  },
  {
    "path": "lib/updaters/types/json.js",
    "chars": 731,
    "preview": "const stringifyPackage = require('stringify-package')\nconst detectIndent = require('detect-indent')\nconst detectNewline "
  },
  {
    "path": "lib/updaters/types/plain-text.js",
    "chars": 153,
    "preview": "module.exports.readVersion = function (contents) {\n  return contents\n}\n\nmodule.exports.writeVersion = function (_content"
  },
  {
    "path": "lib/write-file.js",
    "chars": 154,
    "preview": "const fs = require('fs')\n\nmodule.exports = function (args, filePath, content) {\n  if (args.dryRun) return\n  fs.writeFile"
  },
  {
    "path": "package.json",
    "chars": 1844,
    "preview": "{\n  \"name\": \"standard-version\",\n  \"version\": \"9.5.0\",\n  \"description\": \"replacement for `npm version` with automatic CHA"
  },
  {
    "path": "renovate.json",
    "chars": 144,
    "preview": "{\n  \"extends\": [\n    \"config:base\"\n  ],\n  \"pinVersions\": false,\n  \"rebaseStalePrs\": true,\n  \"gitAuthor\": null,\n  \"ignore"
  },
  {
    "path": "test/config-files.spec.js",
    "chars": 5249,
    "preview": "/* global describe it beforeEach afterEach */\n\n'use strict'\n\nconst shell = require('shelljs')\nconst fs = require('fs')\nc"
  },
  {
    "path": "test/core.spec.js",
    "chars": 26232,
    "preview": "/* global describe it afterEach */\n\n'use strict'\n\nconst shell = require('shelljs')\nconst fs = require('fs')\nconst { reso"
  },
  {
    "path": "test/git.spec.js",
    "chars": 13675,
    "preview": "/* global describe it beforeEach afterEach */\n\n'use strict'\n\nconst shell = require('shelljs')\nconst fs = require('fs')\nc"
  },
  {
    "path": "test/mocks/VERSION-1.0.0.txt",
    "chars": 5,
    "preview": "1.0.0"
  },
  {
    "path": "test/mocks/VERSION-6.3.1.txt",
    "chars": 5,
    "preview": "6.3.1"
  },
  {
    "path": "test/mocks/manifest-6.3.1.json",
    "chars": 24,
    "preview": "{\n  \"version\": \"6.3.1\"\n}"
  },
  {
    "path": "test/mocks/mix.exs",
    "chars": 588,
    "preview": "defmodule StandardVersion.MixProject do\n  use Mix.Project\n\n  def project do\n    [\n      app: :standard_version,\n      ve"
  },
  {
    "path": "test/mocks/updater/customer-updater.js",
    "chars": 280,
    "preview": "const REPLACER = /version: \"(.*)\"/\n\nmodule.exports.readVersion = function (contents) {\n  return REPLACER.exec(contents)["
  },
  {
    "path": "test/mocks/version.txt",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "test/preset.spec.js",
    "chars": 1691,
    "preview": "/* global describe it beforeEach, afterEach */\n\nconst shell = require('shelljs')\nconst fs = require('fs')\n\nrequire('chai"
  }
]

About this extraction

This page contains the full source code of the conventional-changelog/standard-version GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 44 files (133.5 KB), approximately 37.5k tokens, and a symbol index with 39 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!