{"_id":"@dgilperez/semantic-release-gitmoji","name":"@dgilperez/semantic-release-gitmoji","dist-tags":{"latest":"1.6.1"},"versions":{"1.6.1":{"name":"@dgilperez/semantic-release-gitmoji","version":"1.6.1","description":"Different from conventional changelog, Gitmoji commits are used to determine a release type and generate release notes.","main":"index.js","scripts":{"release":"semantic-release","commit":"gitmoji -c","lint":"eslint ./index.js ./lib/**/*.js","link":"npm link && npm link semantic-release-gitmoji","test":"ava test/**/*.test.js"},"repository":{"type":"git","url":"git+https://github.com/dgilperez/semantic-release-gitmoji.git"},"keywords":["changelog","commit-analyzer","github","publish","release","semantic-release","gitmoji"],"author":{"name":"MomoCow"},"license":"MIT","bugs":{"url":"https://github.com/momocow/semantic-release-gitmoji/issues"},"homepage":"https://github.com/momocow/semantic-release-gitmoji#readme","devDependencies":{"@semantic-release/git":"^10.0.1","@semantic-release/github":"^8.0.2","@semantic-release/npm":"^9.0.0","ava":"^4.3.3","eslint":"^7.32.0","eslint-config-standard":"^16.0.3","eslint-plugin-import":"^2.25.4","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.2.0","eslint-plugin-standard":"^4.0.1","gitmoji-cli":"^7.0.3","lodash.set":"^4.3.2","lodash.shuffle":"^4.2.0","semantic-release":"^19.0.2","sinon":"^8.1.1"},"dependencies":{"dateformat":"^3.0.3","debug":"^4.3.2","emoji-regex":"^9.2.2","git-url-parse":"^13.0.0","gitmojis":"^3.13.4","handlebars":"^4.7.6","issue-regex":"^3.1.0","lodash.clonedeep":"^4.5.0","lodash.mergewith":"^4.6.2","lodash.uniq":"^4.5.0","node-emoji":"^1.11.0"},"peerDependencies":{"semantic-release":"<20"},"gitHead":"0d8914ec3a11e1fe8fcfd83556bf93cff0475c38","_id":"@dgilperez/semantic-release-gitmoji@1.6.1","_nodeVersion":"18.8.0","_npmVersion":"8.18.0","dist":{"integrity":"sha512-oELHIa7tJwAK/WKYcn3O4OSP7xC7rOxUNGk1LIQgK5iN55YqZ3Gccs73MnWe74fAVlJxK8rqpHx9WnhRXBJqJQ==","shasum":"199bd276bd1353b5507187d8a3bbfee79931efc3","tarball":"https://registry.npmjs.org/@dgilperez/semantic-release-gitmoji/-/semantic-release-gitmoji-1.6.1.tgz","fileCount":17,"unpackedSize":29677,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDkMzqn1bNLuEJttqZMgqZZs8MPxC5wsO6YcJh+fxZyHgIgLS9SNSv5s+Ey4toPrkYxElJsT/o16D2JGruP30Z1X7Q="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0BEYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoF3g//S4VlY/oOgE7aomNl+jm9LObbK2QJEjWXnaPfz/j/pF9a+jDS\r\nuZJwJ7Wn4MxQ6O2C6EGNEScmhbKSk6Ccny3szPoxRmDz8WF4mrYop+kAEsgb\r\na9HOh5tYWiqLlzE3Ezs1086HwGaj7N1alKoybXb6gQ4PuZ42AhC/nsIeSmEY\r\nczGzF/aeqEfQEDSe8wW5bNXiSwbCZwAygpY77+dDN7ub1DC0l6EWu3r4D0hT\r\nPHg7TQlsAuUNrPfj9ZLuMUFl7M9GxnONzndHuojMBDMUJs0jJQKG2+my4mRI\r\nYgMxBKujZs/ZMIYgn3T1eQagg//w3o2rMpbiHKTK4FSntNbvuEUYG6NnnrVq\r\nOSllMNqU0mgrLpT/7wZg9NisAsMAfIbfSgq1eVilx5p2Vjs2oyCIjqpg3W9B\r\n9smf5bGdowAoXP4CBdGHmKQUZ6/0u0JvxMj4F1imIskUTh2v+4Wx+L2XXiCI\r\nU+HLwS8yitU9a1ySkf9fHZFx3pQOU6GS4PMyIaBNvQHwCDvNxuc8Cwod0LJr\r\nu6i+gCz0Nom5vYKJ7m6rI9CeD3J/eIBo+XnmhXdG97mlemCWJ80/EFkhy+pm\r\nvRPSaxmU6naS6G0GNP+Wl/2SLo19HijLJqOWd0I12O/1INThBi9eYxYd/GrM\r\nuS06p0xrOIr0SWrkry3tlN+ckUDyWOvKBDk=\r\n=yQuj\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dgilperez","email":"dgilperez@gmail.com"},"directories":{},"maintainers":[{"name":"dgilperez","email":"dgilperez@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/semantic-release-gitmoji_1.6.1_1674580247971_0.06440182650860549"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-24T17:10:47.872Z","1.6.1":"2023-01-24T17:10:48.208Z","modified":"2023-01-24T17:10:48.364Z"},"maintainers":[{"name":"dgilperez","email":"dgilperez@gmail.com"}],"description":"Different from conventional changelog, Gitmoji commits are used to determine a release type and generate release notes.","homepage":"https://github.com/momocow/semantic-release-gitmoji#readme","keywords":["changelog","commit-analyzer","github","publish","release","semantic-release","gitmoji"],"repository":{"type":"git","url":"git+https://github.com/dgilperez/semantic-release-gitmoji.git"},"author":{"name":"MomoCow"},"bugs":{"url":"https://github.com/momocow/semantic-release-gitmoji/issues"},"license":"MIT","readme":"# semantic-release-gitmoji\n\n[![Build Status](https://app.travis-ci.com/momocow/semantic-release-gitmoji.svg?branch=master)](https://app.travis-ci.com/momocow/semantic-release-gitmoji)\n[![npm](https://img.shields.io/npm/v/semantic-release-gitmoji.svg)](https://www.npmjs.com/semantic-release-gitmoji)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square)](https://gitmoji.carloscuesta.me/)\n\n✨🐛💥 A [semantic-release](https://github.com/semantic-release/semantic-release) plugin for gitmojis.\n\nFork to quickstart issues\n\nDifferent from [conventional changelog](https://github.com/conventional-changelog/conventional-changelog), [Gitmoji](https://github.com/carloscuesta/gitmoji) commits are used to **determine a release type** and **generate release notes**.\n\n| Step             | Description                                                                                                                  |\n| ---------------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `analyzeCommits` | Determine the type of release by analyzing commits with [Gitmoji](https://github.com/carloscuesta/gitmoji).                  |\n| `generateNotes`  | Generate release notes for the commits added since the last release with [Gitmoji](https://github.com/carloscuesta/gitmoji). |\n\n- [semantic-release-gitmoji](#semantic-release-gitmoji)\n  - [Features](#features)\n  - [Install](#install)\n  - [Usage](#usage)\n  - [Configuration](#configuration)\n    - [ReleaseRules](#releaserules)\n      - [Emoji](#emoji)\n      - [EmojiArrayModifier](#emojiarraymodifier)\n    - [ReleaseNotesOptions](#releasenotesoptions)\n      - [TemplateContent](#templatecontent)\n  - [Templates](#templates)\n    - [Context](#context)\n    - [CommitContext](#commitcontext)\n    - [IssueLink](#issuelink)\n  - [Progressive commits](#progressive-commits)\n    - [Commit Syntax](#commit-syntax)\n  - [Contribution](#contribution)\n\n## Features\n\n- Categorize commits according to Gitmojis\n- Progressive commits composed of a final commit and several WIP (🚧) commits\n\n## Install\n\n```\nnpm install semantic-release-gitmoji -D\n```\n\n## Usage\n\nThe plugin can be configured in the [**semantic-release** configuration file](https://semantic-release.gitbook.io/semantic-release/usage/configuration):\n\n```js\n// in \".releaserc.js\" or \"release.config.js\"\n\nconst { promisify } = require(\"util\");\nconst dateFormat = require(\"dateformat\");\nconst readFileAsync = promisify(require(\"fs\").readFile);\n\n// Given a `const` variable `TEMPLATE_DIR` which points to \"<semantic-release-gitmoji>/lib/assets/templates\"\n\n// the *.hbs template and partials should be passed as strings of contents\nconst template = readFileAsync(path.join(TEMPLATE_DIR, \"default-template.hbs\"));\nconst commitTemplate = readFileAsync(\n  path.join(TEMPLATE_DIR, \"commit-template.hbs\")\n);\n\nmodule.exports = {\n  plugins: [\n    [\n      \"semantic-release-gitmoji\",\n      {\n        releaseRules: {\n          major: [\":boom:\"],\n          minor: [\":sparkles:\"],\n          patch: [\":bug:\", \":ambulance:\", \":lock:\"],\n        },\n        releaseNotes: {\n          template,\n          partials: { commitTemplate },\n          helpers: {\n            datetime: function (format = \"UTC:yyyy-mm-dd\") {\n              return dateFormat(new Date(), format);\n            },\n          },\n          issueResolution: {\n            template: \"{baseUrl}/{owner}/{repo}/issues/{ref}\",\n            baseUrl: \"https://github.com\",\n            source: \"github.com\",\n            removeFromCommit: false,\n            regex: /#\\d+/g,\n          },\n        },\n      },\n    ],\n    \"@semantic-release/github\",\n    \"@semantic-release/npm\",\n  ],\n};\n```\n\nThis configuration is the same semantic as the default configuration of `semantic-release-gitmoji`.\n\n`semantic-release-gitmoji` should be used in place of both [`@semantic-release/commit-analyzer`](https://github.com/semantic-release/commit-analyzer) and [`@semantic-release/release-notes-generator`](https://github.com/semantic-release/release-notes-generator) since the both plugins parse commits following the [conventional changelog](https://github.com/conventional-changelog/conventional-changelog) while this plugin requires [Gitmoji](https://github.com/carloscuesta/gitmoji) commits.\n\n## Configuration\n\nIt is recommended to write the configuration in a **javascript** file since templates are required to be `string`s of their contents.\n\n```ts\ninterface SemanticReleaseGitmojiOptions {\n  releaseRules?: ReleaseRules;\n  releaseNotes?: ReleaseNotesOptions;\n}\n```\n\n### ReleaseRules\n\nThe `ReleaseRules` is a map from a [release type](./lib/assets/release-types.json) to a set of emojis.\n\n```ts\ninterface ReleaseRules {\n  major?: Array<Emoji> | EmojiArrayModifier;\n  premajor?: Array<Emoji> | EmojiArrayModifier;\n  minor?: Array<Emoji> | EmojiArrayModifier;\n  preminor?: Array<Emoji> | EmojiArrayModifier;\n  patch?: Array<Emoji> | EmojiArrayModifier;\n  prepatch?: Array<Emoji> | EmojiArrayModifier;\n  prerelease?: Array<Emoji> | EmojiArrayModifier;\n}\n```\n\n#### Emoji\n\n`Emoji` is a string of valid **GitHub emoji markup** (e.g. `\":boom:\"`, `\":collision:\"`) or **raw emoji characters** (e.g. `\"💥\"`).\n\n> No need to worry about which format to use since this plugin handles it for you!\n\n> See https://github.com/omnidan/node-emoji for more information about emojis.\n\n```ts\ntype Emoji = string;\n```\n\n#### EmojiArrayModifier\n\n```ts\ninterface EmojiArrayModifier {\n  include?: Array<Emoji>;\n  exclude?: Array<Emoji>;\n}\n```\n\n### ReleaseNotesOptions\n\n`ReleaseNotesOptions` defines how to render the release notes from a given set of Gitmoji commits.\n\nAll templates file are compiled and renderered by [`handlebars`](http://handlebarsjs.com/), therefore you may need to get familiar with the `.hbs` format before starting to customize your own templates.\n\n`semver` is a boolean to define if releaseNotes should be based on Gitmoji only or on key semver associated to gitmoji used in commit to determine the next release tag.\n\n`partials` is a map from the partial name to the content of the partial template.\n\n`helpers` is a map from the helper name to the helper function. There is already a default helper `datetime` which takes a format string as the first argument and return a formatted current timestamp. See [npm/dateformat](https://www.npmjs.com/package/dateformat) for more information about how to format a timestamp and see [the default template](https://github.com/momocow/semantic-release-gitmoji/blob/master/lib/assets/templates/default-template.hbs#L2) as an example.\n\nBesides, You are allowed to provide helpers with the same names to override default helpers.\n\n`issueResolution` defines how issues are resolved to. The default and the only supported source currently is `github.com`, or you can provide your own `issueResolution.template` to override the default resolution to GitHub.\n\nThere are five variables that can be used in `issueResolution.template`:\n\n- `baseUrl`\n- `owner`\n- `repo`\n- `ref`, which is the numeric ID of issue\n- `issue`, which is the full issue\n\n```ts\ninterface ReleaseNotesOptions {\n  template?: TemplateContent;\n  semver?: Boolean;\n  partials?: Record<string, TemplateContent>;\n  helpers?: Record<string, Function>;\n  issueResolution?: {\n    template?: string;\n    baseUrl?: string;\n    source?: \"github.com\" | null; // currently only GitHub is supported, PR welcome :)\n    regex?: RegExp; // regex to match the issue(s). If not provided, will find issues thanks to [issue-regex](https://www.npmjs.com/package/issue-regex)\n    removeFromCommit?: boolean; // if true, will remove found issue(s) from commit name\n  };\n}\n```\n\n#### TemplateContent\n\n```ts\ntype TemplateContent = string | Buffer | Promise<string> | Promise<Buffer>;\n```\n\n## Templates\n\n### Context\n\nThe context for templates is inherited from [`semantic-release` context](https://github.com/semantic-release/semantic-release/blob/caribou/docs/developer-guide/js-api.md#result) with some modifications such as `owner`, `repo` and `compareUrl`.\n\n`commits` is a map from [`Emoji`](#emoji) _(don't worry about the format)_ to a list of extended commits.\nValues of `commits` are extended to contain more information related to Gitmoji. See [CommitContext](#commitcontext)\n\n```ts\ninterface TemplateContext {\n  owner: string;\n  repo: string;\n  source: string;\n  commits: Record<string, Array<CommitContext>>;\n  lastRelease: {\n    gitHead: string;\n    version: string;\n    gitTag: string;\n  };\n  nextRelease: {\n    type: string;\n    gitHead: string;\n    version: string;\n    gitTag: string;\n  };\n  compareUrl: string;\n}\n```\n\n### CommitContext\n\n`CommitContext` is extended from [`SemanticReleaseCommitObj`](https://github.com/semantic-release/semantic-release/blob/caribou/docs/developer-guide/js-api.md#commits).\n\nNote that emojis at the beginning of `message` and `subject` are trimmed, which are the same emoji in `gitmoji`.\n\n`gitmoji` is a raw emoji since an emoji may have more than one GitHub emoji markup representation, e.g. `\":boom:\"` and `\":collision:\"` both represent for th emoji, `\"💥\"`.\n\n```ts\ninterface CommitContext extends SemanticReleaseCommitObj {\n  message: string;\n  subject: string;\n  owner: string;\n  repo: string;\n  source: string;\n  gitmoji: string;\n  issues: Array<IssueLink>;\n  wip: Array<CommitContext>;\n}\n```\n\n### IssueLink\n\n```ts\ninterface IssueLink {\n  text: string;\n  link: string;\n}\n```\n\n## Progressive commits\n\nAssume you file an issue (e.g. `#1`) to implement a new feature, then you make 3 commits as belows (the toppest is the latest).\n\n- `✨ Add a new feature.\\n\\n#1`\n- `🚧 Implement part B.\\n\\n#1`\n- `🚧 Implement part A.\\n\\n#1`\n\nThe ✨ commit will be the final commit composed of two 🚧 commits. They are linked together via `#1` in the commit message.\n\nTherefore the `commits` of the [template context](#context) will be as follows.\n\n```json\n{\n  \"commits\": {\n    \"sparkles\": [\n      {\n        \"message\": \"Add a new feature.\\n\\n#1\",\n        \"subject\": \"Add a new feature.\",\n        \"body\": \"#1\",\n        \"gitmoji\": \"✨\",\n        \"// repo\": \"\",\n        \"// owner\": \"\",\n        \"source\": \"github.com\",\n        \"issues\": [\n          {\n            \"text\": \"#1\",\n            \"// link\": \"\"\n          }\n        ],\n\n        \"wip\": [\n          {\n            \"message\": \"Implement part B.\\n\\n#1\",\n            \"subject\": \"Implement part B.\",\n            \"body\": \"#1\",\n            \"gitmoji\": \"🚧\",\n            \"// repo\": \"\",\n            \"// owner\": \"\",\n            \"source\": \"github.com\",\n            \"issues\": [\n              {\n                \"text\": \"#1\",\n                \"// link\": \"\"\n              }\n            ]\n          },\n          {\n            \"message\": \"Implement part A.\\n\\n#1\",\n            \"subject\": \"Implement part A.\",\n            \"body\": \"#1\",\n            \"gitmoji\": \"🚧\",\n            \"// repo\": \"\",\n            \"// owner\": \"\",\n            \"source\": \"github.com\",\n            \"issues\": [\n              {\n                \"text\": \"#1\",\n                \"// link\": \"\"\n              }\n            ]\n          }\n        ]\n      }\n    ],\n\n    \"// other gitmojis\": \"\"\n  }\n}\n```\n\n### Commit Syntax\n\nBeside using issue number to link commits, the following syntax is also available to link commits together.\n\n```\nwip#{target_name}\n```\n\nWhile `target_name` is an identifier for those progressive commits, for example, `wip#feature-A`.\n\n- `target_name` can contain **numbers**, **letters** (both cases), `_` or `-`.\n- `target_name` should not start with `_` or `-`.\n\n## Contribution\n\nPRs are welcome.\n\nBefore sending PRs, please follow the steps below.\n\n- Fork the branch `dev`.\n- Make commits.\n- Run `npm run lint` and ensure you pass the linter.\n- Run `npm test` and ensure nothing broken.\n  - If you introduce new features in the PR, ensure tests have been written for each feature.\n- Send your PR to branch `dev` and wait for reviews.\n\nThanks for all lovers and contributers of this project!\n","readmeFilename":"README.md"}