{"id":12951,"library":"changelog-parser","title":"Changelog Parser","description":"The `changelog-parser` package provides a utility to parse and structure content from CHANGELOG.md files within Node.js environments. It extracts key information such as the changelog's title, a general description, and a list of versions, each containing its version number, title, date, raw body, and a parsed body. The current stable version is 3.0.1. The package maintains an irregular release cadence, driven by bug fixes, dependency updates, and new features. It offers flexible input options, allowing parsing from either a file path or a raw text string. A key differentiator is its ability to automatically remove Markdown formatting from entries by default, configurable via an option. It also supports both callback-based and Promise-based APIs, catering to different asynchronous programming styles. The module is primarily focused on adhering to common Markdown changelog formats, supporting various date formats and header levels (H1 or H2) for version sections.","status":"active","version":"3.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/ungoldman/changelog-parser","tags":["javascript","CHANGELOG.md","changelog","parser","semantic","semver","versioning"],"install":[{"cmd":"npm install changelog-parser","lang":"bash","label":"npm"},{"cmd":"yarn add changelog-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add changelog-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is a CommonJS module (`\"type\": \"commonjs\"`) and should be imported with `require()`.","wrong":"import { parseChangelog } from 'changelog-parser'","symbol":"parseChangelog","correct":"const parseChangelog = require('changelog-parser')"},{"note":"The module exports a single function as its default, but it's a CommonJS module. ESM default imports won't work without a transpiler or specific Node.js configuration.","wrong":"import parseChangelog from 'changelog-parser'","symbol":"parseChangelog","correct":"const parseChangelog = require('changelog-parser')"},{"note":"The package exports a single function as its module.exports, not an object with a named export.","wrong":"const { parseChangelog } = require('changelog-parser')","symbol":"parseChangelog","correct":"const parseChangelog = require('changelog-parser')"}],"quickstart":{"code":"const fs = require('fs');\nconst path = require('path');\nconst parseChangelog = require('changelog-parser');\n\nconst changelogContent = `# My Awesome Project\\n\\nA brief description of the project.\\n\\n## 1.0.1 - 2023-10-26\\n### Fixed\\n- Resolved issue with data serialization.\\n\\n## 1.0.0 - 2023-10-20\\n### Added\\n- Initial release with core features.\\n\\n### Changed\\n- Updated dependency versions.`;\n\nconst tempChangelogPath = path.join(__dirname, 'temp-CHANGELOG.md');\nfs.writeFileSync(tempChangelogPath, changelogContent);\n\nasync function runParser() {\n  try {\n    // Parse from file path\n    const resultFromFile = await parseChangelog({ filePath: tempChangelogPath });\n    console.log('Parsed from file title:', resultFromFile.title);\n    console.log('First version:', resultFromFile.versions[0].version);\n\n    // Parse from text directly, keeping markdown\n    const resultFromText = await parseChangelog({\n      text: changelogContent,\n      removeMarkdown: false\n    });\n    console.log('\\nParsed from text description:', resultFromText.description);\n    console.log('First version body (with markdown):', resultFromText.versions[0].body);\n\n  } catch (err) {\n    console.error('Error parsing changelog:', err);\n  } finally {\n    fs.unlinkSync(tempChangelogPath); // Clean up temp file\n  }\n}\n\nrunParser();","lang":"javascript","description":"This quickstart demonstrates parsing a changelog from both a temporary file and a direct text string, showcasing the promise-based API and the `removeMarkdown` option. It also includes cleanup for the temporary file."},"warnings":[{"fix":"Upgrade Node.js to version 14 or higher (`nvm install 14 && nvm use 14` or similar).","message":"Version 3.0.0 of `changelog-parser` dropped support for Node.js 12, which reached its End-of-Life. Users on Node.js 12 or older must upgrade their Node.js environment to version 14 or higher.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"To preserve markdown, pass `{ removeMarkdown: false }` in the options object: `parseChangelog({ filePath: 'CHANGELOG.md', removeMarkdown: false })`.","message":"The `removeMarkdown` option defaults to `true`. This means markdown markup like `*`, `-`, `##`, etc., will be stripped from the changelog entry bodies by default. If you need to retain the original markdown, explicitly set `removeMarkdown: false` in the options object.","severity":"gotcha","affected_versions":">=2.7.0"},{"fix":"Ensure your options object includes either `filePath: '/path/to/CHANGELOG.md'` or `text: 'your changelog content string'`.","message":"When using the `parseChangelog` function, you must provide either the `filePath` option (path to the changelog file) or the `text` option (the raw changelog content as a string). Failing to provide either will result in an error.","severity":"gotcha","affected_versions":">=2.8.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Provide an options object with either a `filePath` string or a `text` string. Example: `parseChangelog({ filePath: 'path/to/CHANGELOG.md' })` or `parseChangelog({ text: '...' })`.","cause":"The `parseChangelog` function was called without specifying either a `filePath` or `text` option.","error":"Error: You must provide either 'filePath' or 'text' option."},{"fix":"Use the CommonJS `require` syntax: `const parseChangelog = require('changelog-parser')`.","cause":"Attempting to import `changelog-parser` using ESM `import` syntax (`import { parseChangelog } from 'changelog-parser'`) in a pure ESM context, while the package is a CommonJS module.","error":"TypeError: parseChangelog is not a function"},{"fix":"Verify that the `filePath` provided is correct and that the Node.js process has read permissions for the file. Use an absolute path or ensure the relative path is correct from `process.cwd()`.","cause":"The `filePath` option pointed to a file that does not exist or is inaccessible.","error":"Error: ENOENT: no such file or directory, open 'non-existent-path/CHANGELOG.md'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}