@jakubmazanec/changesets-changelog 2.0.4 → 2.0.5-unstable.91147a2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { type NewChangeset, type VersionType } from '@changesets/types';
2
- export type GetReleaseLineChangeset = NewChangeset & {
2
+ export type GetReleaseLineChangeset = {
3
3
  commit?: string | undefined;
4
- };
4
+ } & NewChangeset;
5
5
  export declare function getReleaseLine(changeset: GetReleaseLineChangeset, type: VersionType, options?: Record<string, unknown>): Promise<string>;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../source/getReleaseLine.ts"],
4
- "sourcesContent": ["import {getInfo, getInfoFromPullRequest} from '@changesets/get-github-info';\nimport {type NewChangeset, type VersionType} from '@changesets/types';\n\nexport type GetReleaseLineChangeset = NewChangeset & {\n commit?: string | undefined;\n};\n\nexport async function getReleaseLine(\n changeset: GetReleaseLineChangeset,\n type: VersionType,\n options?: Record<string, unknown>,\n) {\n if (!options?.repository) {\n throw new Error(\n 'Please provide a repository in Changesets changelog setting, e.g.: \"changelog\": [\"@jakubmazanec/changesets-changelog\", { \"repository\": \"org/repo\" }]',\n );\n }\n\n let pullRequestFromSummary: number | undefined;\n let commitFromSummary: string | undefined;\n let usersFromSummary: string[] = [];\n let replacedChangelog = changeset.summary\n .replace(/^\\s*(?:pr|pull|pull\\s+request):\\s*#?(\\d+)/gim, (_, rawPullRequest) => {\n let pullRequest = Number(rawPullRequest);\n\n if (!Number.isNaN(pullRequest)) {\n pullRequestFromSummary = pullRequest;\n }\n\n return '';\n })\n .replace(/^\\s*commit:\\s*(\\S+)/gim, (_, commit: string) => {\n commitFromSummary = commit;\n\n return '';\n })\n .replace(/^\\s*(?:author|user):\\s*@?(\\S+)/gim, (_, user: string) => {\n usersFromSummary.push(user);\n\n return '';\n })\n .trim();\n let [firstLine, ...lines] = replacedChangelog.split('\\n').map((line) => line.trimEnd());\n let commitLink: string | undefined;\n let pullRequestLink: string | undefined;\n let usersLink: string | undefined;\n\n if (pullRequestFromSummary === undefined) {\n let commitToFetchFrom = commitFromSummary ?? changeset.commit;\n\n if (commitToFetchFrom) {\n try {\n let {links} = await getInfo({\n repo: String(options.repository),\n commit: commitToFetchFrom,\n });\n\n commitLink = links.commit;\n pullRequestLink = links.pull ?? undefined;\n usersLink = links.user ?? undefined;\n } catch {\n commitLink = undefined;\n }\n }\n } else {\n let {links} = await getInfoFromPullRequest({\n repo: String(options.repository),\n pull: pullRequestFromSummary,\n });\n\n if (commitFromSummary) {\n links = {\n ...links,\n commit: `[\\`${commitFromSummary}\\`](https://github.com/${options.repository}/commit/${commitFromSummary})`,\n };\n }\n\n commitLink = links.commit ?? undefined;\n pullRequestLink = links.pull;\n usersLink = links.user ?? undefined;\n }\n\n if (usersFromSummary.length) {\n usersLink = usersFromSummary\n .map((userFromSummary) => `[@${userFromSummary}](https://github.com/${userFromSummary})`)\n .join(', ');\n }\n\n let prefix = [\n pullRequestLink ? ` ${pullRequestLink}` : '',\n commitLink ? ` ${commitLink}` : '',\n usersLink ? ` (${usersLink})` : '',\n ].join('');\n\n return `\\n\\n-${prefix ? `${prefix} \u2013` : ''} ${firstLine}\\n${lines\n .map((line) => ` ${line}`)\n .join('\\n')}`;\n}\n"],
4
+ "sourcesContent": ["import {getInfo, getInfoFromPullRequest} from '@changesets/get-github-info';\nimport {type NewChangeset, type VersionType} from '@changesets/types';\n\nexport type GetReleaseLineChangeset = {\n commit?: string | undefined;\n} & NewChangeset;\n\nexport async function getReleaseLine(\n changeset: GetReleaseLineChangeset,\n type: VersionType,\n options?: Record<string, unknown>,\n) {\n if (!options?.repository) {\n throw new Error(\n 'Please provide a repository in Changesets changelog setting, e.g.: \"changelog\": [\"@jakubmazanec/changesets-changelog\", { \"repository\": \"org/repo\" }]',\n );\n }\n\n let pullRequestFromSummary: number | undefined;\n let commitFromSummary: string | undefined;\n let usersFromSummary: string[] = [];\n let replacedChangelog = changeset.summary\n .replace(/^\\s*(?:pr|pull|pull\\s+request):\\s*#?(\\d+)/gim, (_, rawPullRequest) => {\n let pullRequest = Number(rawPullRequest);\n\n if (!Number.isNaN(pullRequest)) {\n pullRequestFromSummary = pullRequest;\n }\n\n return '';\n })\n .replace(/^\\s*commit:\\s*(\\S+)/gim, (_, commit: string) => {\n commitFromSummary = commit;\n\n return '';\n })\n .replace(/^\\s*(?:author|user):\\s*@?(\\S+)/gim, (_, user: string) => {\n usersFromSummary.push(user);\n\n return '';\n })\n .trim();\n let [firstLine, ...lines] = replacedChangelog.split('\\n').map((line) => line.trimEnd());\n let commitLink: string | undefined;\n let pullRequestLink: string | undefined;\n let usersLink: string | undefined;\n\n if (pullRequestFromSummary === undefined) {\n let commitToFetchFrom = commitFromSummary ?? changeset.commit;\n\n if (commitToFetchFrom) {\n try {\n let {links} = await getInfo({\n repo: String(options.repository),\n commit: commitToFetchFrom,\n });\n\n commitLink = links.commit;\n pullRequestLink = links.pull ?? undefined;\n usersLink = links.user ?? undefined;\n } catch {\n commitLink = undefined;\n }\n }\n } else {\n let {links} = await getInfoFromPullRequest({\n repo: String(options.repository),\n pull: pullRequestFromSummary,\n });\n\n if (commitFromSummary) {\n links = {\n ...links,\n commit: `[\\`${commitFromSummary}\\`](https://github.com/${options.repository}/commit/${commitFromSummary})`,\n };\n }\n\n commitLink = links.commit ?? undefined;\n pullRequestLink = links.pull;\n usersLink = links.user ?? undefined;\n }\n\n if (usersFromSummary.length) {\n usersLink = usersFromSummary\n .map((userFromSummary) => `[@${userFromSummary}](https://github.com/${userFromSummary})`)\n .join(', ');\n }\n\n let prefix = [\n pullRequestLink ? ` ${pullRequestLink}` : '',\n commitLink ? ` ${commitLink}` : '',\n usersLink ? ` (${usersLink})` : '',\n ].join('');\n\n return `\\n\\n-${prefix ? `${prefix} \u2013` : ''} ${firstLine}\\n${lines\n .map((line) => ` ${line}`)\n .join('\\n')}`;\n}\n"],
5
5
  "mappings": ";;;;;;;;;;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,QAAI,mBAAmB;AACrB,cAAQ;AAAA,QACN,GAAG;AAAA,QACH,QAAQ,MAAM,iBAAiB,0BAA0B,QAAQ,UAAU,WAAW,iBAAiB;AAAA,MACzG;AAAA,IACF;AAEA,iBAAa,MAAM,UAAU;AAC7B,sBAAkB,MAAM;AACxB,gBAAY,MAAM,QAAQ;AAAA,EAC5B;AAEA,MAAI,iBAAiB,QAAQ;AAC3B,gBAAY,iBACT,IAAI,CAAC,oBAAoB,KAAK,eAAe,wBAAwB,eAAe,GAAG,EACvF,KAAK,IAAI;AAAA,EACd;AAEA,MAAI,SAAS;AAAA,IACX,kBAAkB,IAAI,eAAe,KAAK;AAAA,IAC1C,aAAa,IAAI,UAAU,KAAK;AAAA,IAChC,YAAY,KAAK,SAAS,MAAM;AAAA,EAClC,EAAE,KAAK,EAAE;AAET,SAAO;AAAA;AAAA,GAAQ,SAAS,GAAG,MAAM,YAAO,EAAE,IAAI,SAAS;AAAA,EAAK,MACzD,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,EACzB,KAAK,IAAI,CAAC;AACf;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jakubmazanec/changesets-changelog",
3
- "version": "2.0.4",
3
+ "version": "2.0.5-unstable.91147a2",
4
4
  "description": "Changelog for projects using Changesets.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,13 +31,13 @@
31
31
  "devDependencies": {
32
32
  "@changesets/parse": "^0.4.0",
33
33
  "@changesets/types": "^6.0.0",
34
- "@jakubmazanec/eslint-config": "^3.2.0",
34
+ "@jakubmazanec/eslint-config": "4.0.0-unstable.91147a2",
35
35
  "@types/lodash": "^4.17.13",
36
36
  "@types/node": "^22.9.0",
37
37
  "@vitest/coverage-v8": "^2.1.4",
38
38
  "del-cli": "^6.0.0",
39
39
  "esbuild": "^0.24.0",
40
- "eslint": "^8.56.0",
40
+ "eslint": "^9.14.0",
41
41
  "lodash": "^4.17.21",
42
42
  "prettier": "^3.3.3",
43
43
  "prettier-plugin-packagejson": "^2.5.3",
@@ -1,9 +1,9 @@
1
1
  import {getInfo, getInfoFromPullRequest} from '@changesets/get-github-info';
2
2
  import {type NewChangeset, type VersionType} from '@changesets/types';
3
3
 
4
- export type GetReleaseLineChangeset = NewChangeset & {
4
+ export type GetReleaseLineChangeset = {
5
5
  commit?: string | undefined;
6
- };
6
+ } & NewChangeset;
7
7
 
8
8
  export async function getReleaseLine(
9
9
  changeset: GetReleaseLineChangeset,