{"_id":"@egiftcard/auto-changelog","name":"@egiftcard/auto-changelog","dist-tags":{"latest":"3.4.4"},"versions":{"3.4.4":{"name":"@egiftcard/auto-changelog","version":"3.4.4","description":"Utilities for validating and updating \"Keep a Changelog\" formatted changelogs","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"main":"dist/index.js","bin":{"auto-changelog":"dist/cli.js"},"engines":{"node":">=14.0.0"},"repository":{"type":"git","url":"git+https://github.com/eGiftCard/auto-changelog.git"},"license":"(MIT OR Apache-2.0)","scripts":{"test":"jest","test:watch":"jest --watch","prepack":"./scripts/prepack.sh","lint:eslint":"eslint . --cache --ext js,ts","lint:misc":"prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore","lint":"yarn lint:eslint && yarn lint:misc --check","lint:fix":"yarn lint:eslint --fix && yarn lint:misc --write","build:clean":"rimraf dist && yarn build","build":"tsc --project tsconfig.build.json","changelog":"node dist/cli.js"},"dependencies":{"diff":"^5.0.0","execa":"^5.1.1","prettier":"^2.8.8","semver":"^7.3.5","yargs":"^17.0.1"},"devDependencies":{"@egiftcard/eslint-config":"^12.2.0","@egiftcard/eslint-config-jest":"^12.1.0","@egiftcard/eslint-config-nodejs":"^12.1.0","@egiftcard/eslint-config-typescript":"^12.1.0","@lavamoat/allow-scripts":"^2.1.0","@types/cross-spawn":"^6.0.2","@types/diff":"^5.0.0","@types/jest":"^26.0.23","@types/semver":"^7.3.6","@types/yargs":"^16.0.1","@typescript-eslint/eslint-plugin":"^5.42.1","@typescript-eslint/parser":"^5.42.1","eslint":"^8.40.0","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.26.0","eslint-plugin-jest":"^27.1.5","eslint-plugin-jsdoc":"^39.6.2","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^4.2.1","jest":"^26.4.2","outdent":"^0.8.0","rimraf":"^3.0.2","ts-jest":"^26.5.6","typescript":"~4.8.4"},"lavamoat":{"allowScripts":{"@lavamoat/preinstall-always-fail":false}},"packageManager":"yarn@3.2.4","_id":"@egiftcard/auto-changelog@3.4.4","gitHead":"51bcc45deac130f6a5ebca5b4ebf99aba12bca6e","types":"./dist/index.d.ts","bugs":{"url":"https://github.com/eGiftCard/auto-changelog/issues"},"homepage":"https://github.com/eGiftCard/auto-changelog#readme","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-uX+mWmwViILKwXIEyUqTIqszX3tD0ytGoibBMv+Y6sz0LQILSS6YdvW3CRew++Zg3j0mL/OKAvoJ/d9/v9Q3PQ==","shasum":"644b86ae08c176261426b6c68da1139d3bc30d6b","tarball":"https://registry.npmjs.org/@egiftcard/auto-changelog/-/auto-changelog-3.4.4.tgz","fileCount":37,"unpackedSize":208073,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG6aWeSJhj/QA5J4qmZBxqBxVWWgKHrmniSkoEpgphLWAiEA5itxV2BMJZQ3t+BYpmHKVlaHpLRo4MwG+KH1zoPQK+Q="}]},"_npmUser":{"name":"nextlinux","email":"connect@next-linux.systems"},"directories":{},"maintainers":[{"name":"nextlinux","email":"connect@next-linux.systems"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-changelog_3.4.4_1713520257167_0.4928999219447163"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-19T09:50:57.048Z","3.4.4":"2024-04-19T09:50:57.336Z","modified":"2024-04-19T09:50:57.658Z"},"maintainers":[{"name":"nextlinux","email":"connect@next-linux.systems"}],"description":"Utilities for validating and updating \"Keep a Changelog\" formatted changelogs","homepage":"https://github.com/eGiftCard/auto-changelog#readme","repository":{"type":"git","url":"git+https://github.com/eGiftCard/auto-changelog.git"},"bugs":{"url":"https://github.com/eGiftCard/auto-changelog/issues"},"license":"(MIT OR Apache-2.0)","readme":"# @egiftcard/auto-changelog\n\nUtilities for validating and updating \\\"Keep a Changelog\\\" formatted changelogs.\n\nThis package has a CLI (`auto-changelog`), and an API.\n\n## Installation\n\n`yarn add --dev @egiftcard/auto-changelog`\n\nor\n\n`npm install --save-dev @egiftcard/auto-changelog`\n\n## CLI Usage\n\n### Update\n\n#### Update the \"Unreleased\" section of the changelog\n\n`yarn run auto-changelog update`\n\nor\n\n`npm run auto-changelog update`\n\n#### Update the current release section of the changelog\n\n`yarn run auto-changelog update --rc`\n\nor\n\n`npm run auto-changelog update --rc`\n\n#### Update the changelog for a renamed package\n\nThis option is designed to be used for packages that live in a monorepo.\n\nFor instance, if your package is called `polling-controller` and was renamed to `@egiftcard/polling-controller` at version 0.2.3, and thus the Git tags followed suit:\n\n`yarn run auto-changelog update --tag-prefix-before-package-rename \"polling-controller@\" --version-before-package-name 0.2.3 --tag-prefix \"@egiftcard/polling-controller@\"`\n\nor\n\n`npm run auto-changelog update --tag-prefix-before-package-rename \"polling-controller@\" --version-before-package-name 0.2.3 --tag-prefix \"@egiftcard/polling-controller@\"`\n\n### Validate\n\n#### Validate the changelog simply\n\n`yarn run auto-changelog validate`\n\nor\n\n`npm run auto-changelog validate`\n\n#### Validate the changelog for a release candidate\n\n`yarn run auto-changelog validate --rc`\n\nor\n\n`npm run auto-changelog validate --rc`\n\n#### Validate the changelog with package-specific Git tags\n\nThis option is designed to be used for packages that live in a monorepo.\n\nFor instance, if your package is called `@egiftcard/polling-controller` and thus all Git tags for this package are prefixed with `@egiftcard/polling-controller@`:\n\n`yarn run auto-changelog validate --tag-prefix \"@egiftcard/polling-controller@\"`\n\nor\n\n`npm run auto-changelog validate --tag-prefix \"@egiftcard/polling-controller@\"`\n\n#### Validate the changelog for a renamed package\n\nThis option is designed to be used for packages that live in a monorepo.\n\nFor instance, if your package is called `polling-controller` and was renamed to `@egiftcard/polling-controller` at version 0.2.3, and thus the Git tags followed suit:\n\n`yarn run auto-changelog validate --tag-prefix-before-package-rename \"polling-controller@\" --version-before-package-name 0.2.3 --tag-prefix \"@egiftcard/polling-controller@\"`\n\nor\n\n`npm run auto-changelog validate --tag-prefix-before-package-rename \"polling-controller@\" --version-before-package-name 0.2.3 --tag-prefix \"@egiftcard/polling-controller@\"`\n\n## API Usage\n\nEach supported command is a separate named export.\n\n### `updateChangelog`\n\nThis command updates the changelog.\n\n```javascript\nimport { promises as fs } from 'fs';\nimport { updateChangelog } from '@egiftcard/auto-changelog';\n\nconst oldChangelog = await fs.readFile('CHANGELOG.md', {\n  encoding: 'utf8',\n});\nconst updatedChangelog = updateChangelog({\n  changelogContent: oldChangelog,\n  currentVersion: '1.0.0',\n  repoUrl: 'https://github.com/ExampleUsernameOrOrganization/ExampleRepository',\n  isReleaseCandidate: false,\n});\nawait fs.writeFile('CHANGELOG.md', updatedChangelog);\n```\n\n### `validateChangelog`\n\nThis command validates the changelog\n\n```javascript\nimport { promises as fs } from 'fs';\nimport { validateChangelog } from '@egiftcard/auto-changelog';\n\nconst oldChangelog = await fs.readFile('CHANGELOG.md', {\n  encoding: 'utf8',\n});\ntry {\n  validateChangelog({\n    changelogContent: oldChangelog,\n    currentVersion: '1.0.0',\n    repoUrl:\n      'https://github.com/ExampleUsernameOrOrganization/ExampleRepository',\n    isReleaseCandidate: false,\n  });\n  // changelog is valid!\n} catch (error) {\n  // changelog is invalid\n}\n```\n\n## Contributing\n\n### Setup\n\n- Install [Node.js](https://nodejs.org) version 14\n  - If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you.\n- Install [Yarn v3](https://yarnpkg.com/getting-started/install)\n- Run `yarn install` to install dependencies and run any required post-install scripts\n\n### Testing and Linting\n\nRun `yarn test` to run the tests once. To run tests on file changes, run `yarn test:watch`.\n\nRun `yarn lint` to run the linter, or run `yarn lint:fix` to run the linter and fix any automatically fixable issues.\n\n### Release & Publishing\n\nThe project follows the same release process as the other libraries in the eGiftCard organization. The GitHub Actions [`action-create-release-pr`](https://github.com/eGiftCard/action-create-release-pr) and [`action-publish-release`](https://github.com/eGiftCard/action-publish-release) are used to automate the release process; see those repositories for more information about how they work.\n\n1. Choose a release version.\n\n   - The release version should be chosen according to SemVer. Analyze the changes to see whether they include any breaking changes, new features, or deprecations, then choose the appropriate SemVer version. See [the SemVer specification](https://semver.org/) for more information.\n\n2. If this release is backporting changes onto a previous release, then ensure there is a major version branch for that version (e.g. `1.x` for a `v1` backport release).\n\n   - The major version branch should be set to the most recent release with that major version. For example, when backporting a `v1.0.2` release, you'd want to ensure there was a `1.x` branch that was set to the `v1.0.1` tag.\n\n3. Trigger the [`workflow_dispatch`](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch) event [manually](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow) for the `Create Release Pull Request` action to create the release PR.\n\n   - For a backport release, the base branch should be the major version branch that you ensured existed in step 2. For a normal release, the base branch should be the main branch for that repository (which should be the default value).\n   - This should trigger the [`action-create-release-pr`](https://github.com/eGiftCard/action-create-release-pr) workflow to create the release PR.\n\n4. Update the changelog to move each change entry into the appropriate change category ([See here](https://keepachangelog.com/en/1.0.0/#types) for the full list of change categories, and the correct ordering), and edit them to be more easily understood by users of the package.\n\n   - Generally any changes that don't affect consumers of the package (e.g. lockfile changes or development environment changes) are omitted. Exceptions may be made for changes that might be of interest despite not having an effect upon the published package (e.g. major test improvements, security improvements, improved documentation, etc.).\n   - Try to explain each change in terms that users of the package would understand (e.g. avoid referencing internal variables/concepts).\n   - Consolidate related changes into one change entry if it makes it easier to explain.\n   - Run `yarn auto-changelog validate --rc` to check that the changelog is correctly formatted.\n\n5. Review and QA the release.\n\n   - If changes are made to the base branch, the release branch will need to be updated with these changes and review/QA will need to restart again. As such, it's probably best to avoid merging other PRs into the base branch while review is underway.\n\n6. Squash & Merge the release.\n\n   - This should trigger the [`action-publish-release`](https://github.com/eGiftCard/action-publish-release) workflow to tag the final release commit and publish the release on GitHub.\n\n7. Publish the release on npm.\n\n   - Wait for the `publish-release` GitHub Action workflow to finish. This should trigger a second job (`publish-npm`), which will wait for a run approval by the [`npm publishers`](https://github.com/orgs/eGiftCard/teams/npm-publishers) team.\n   - Approve the `publish-npm` job (or ask somebody on the npm publishers team to approve it for you).\n   - Once the `publish-npm` job has finished, check npm to verify that it has been published.\n","readmeFilename":"README.md"}