|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2024 The Stdlib Authors. |
| 6 | +
|
| 7 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +you may not use this file except in compliance with the License. |
| 9 | +You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +
|
| 13 | +Unless required by applicable law or agreed to in writing, software |
| 14 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +See the License for the specific language governing permissions and |
| 17 | +limitations under the License. |
| 18 | +
|
| 19 | +--> |
| 20 | + |
| 21 | +# Generate Changelog |
| 22 | + |
| 23 | +> Generate a changelog for a specified stdlib package. |
| 24 | +
|
| 25 | +<section class="usage"> |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +```javascript |
| 30 | +var generate = require( '@stdlib/_tools/changelog/generate' ); |
| 31 | +``` |
| 32 | + |
| 33 | +#### generate( pkg\[, releaseType] ) |
| 34 | + |
| 35 | +Generates a Markdown formatted changelog for a specified package. |
| 36 | + |
| 37 | +```javascript |
| 38 | +var changelog = generate( '@stdlib/assert/contains' ); |
| 39 | +// returns {...} |
| 40 | +``` |
| 41 | + |
| 42 | +The function returns an object with the following properties: |
| 43 | + |
| 44 | +- **content**: Markdown formatted changelog. |
| 45 | +- **releaseType**: release type (`null` if changelog is for a non-release). |
| 46 | + |
| 47 | +To generate a changelog for an upcoming release, provide a valid release type as the second argument. |
| 48 | + |
| 49 | +```javascript |
| 50 | +var changelog = generate( '@stdlib/assert/contains', 'patch' ); |
| 51 | +// returns {...} |
| 52 | + |
| 53 | +changelog = generate( '@stdlib/assert/contains', 'minor' ); |
| 54 | +// returns {...} |
| 55 | +``` |
| 56 | + |
| 57 | +The following release types are supported: |
| 58 | + |
| 59 | +- `patch`: a patch release (e.g., bug fixes). |
| 60 | +- `minor`: a minor release (e.g., new features which do not break backward compatibility). |
| 61 | +- `major`: a major release (e.g., breaking changes). |
| 62 | +- `prerelease`: a prerelease (e.g., a release candidate). |
| 63 | +- `prepatch`: a prepatch release. |
| 64 | +- `preminor`: a preminor release. |
| 65 | +- `premajor`: a premajor release. |
| 66 | +- `auto`: automatically determine the release type based on parsed commit messages. |
| 67 | + |
| 68 | +</section> |
| 69 | + |
| 70 | +<!-- /.usage --> |
| 71 | + |
| 72 | +<section class="notes"> |
| 73 | + |
| 74 | +</section> |
| 75 | + |
| 76 | +<!-- /.notes --> |
| 77 | + |
| 78 | +<section class="examples"> |
| 79 | + |
| 80 | +## Examples |
| 81 | + |
| 82 | +```javascript |
| 83 | +var generate = require( '@stdlib/_tools/changelog/generate' ); |
| 84 | + |
| 85 | +// Generate a changelog for a non-namespace package: |
| 86 | +var changelog = generate( '@stdlib/utils/curry' ); |
| 87 | +var content = changelog.content; |
| 88 | +// returns '...' |
| 89 | + |
| 90 | +var releaseType = changelog.releaseType; |
| 91 | +// returns null |
| 92 | + |
| 93 | +// Generate a changelog for a new release: |
| 94 | +changelog = generate( '@stdlib/utils/curry', 'patch' ); |
| 95 | +content = changelog.content; |
| 96 | +// returns '...' |
| 97 | + |
| 98 | +releaseType = changelog.releaseType; |
| 99 | +// returns 'patch' |
| 100 | + |
| 101 | +// Generate a changelog for a namespace package: |
| 102 | +changelog = generate( '@stdlib/string/base' ); |
| 103 | +content = changelog.content; |
| 104 | +// returns '...' |
| 105 | +``` |
| 106 | + |
| 107 | +</section> |
| 108 | + |
| 109 | +<!-- /.examples --> |
| 110 | + |
| 111 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 112 | + |
| 113 | +<section class="related"> |
| 114 | + |
| 115 | +</section> |
| 116 | + |
| 117 | +<!-- /.related --> |
| 118 | + |
| 119 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 120 | + |
| 121 | +<section class="links"> |
| 122 | + |
| 123 | +</section> |
| 124 | + |
| 125 | +<!-- /.links --> |
0 commit comments