@jakubmazanec/changesets-changelog 1.0.6 → 1.0.7-a1d4551
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.
|
@@ -7,8 +7,7 @@ Object.defineProperty(exports, "getDependencyReleaseLine", {
|
|
|
7
7
|
});
|
|
8
8
|
const _getgithubinfo = require("@changesets/get-github-info");
|
|
9
9
|
async function getDependencyReleaseLine(changesets, updatedDependencies, options) {
|
|
10
|
-
|
|
11
|
-
if (!((_options = options) === null || _options === void 0 ? void 0 : _options.repository)) {
|
|
10
|
+
if (!options?.repository) {
|
|
12
11
|
throw new Error('Please provide a repository in Changesets changelog setting, e.g.: "changelog": ["@jakubmazanec/changesets-changelog", { "repository": "org/repo" }]');
|
|
13
12
|
}
|
|
14
13
|
if (!updatedDependencies.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/getDependencyReleaseLine.ts"],"sourcesContent":["import {getInfo} from '@changesets/get-github-info';\nimport type {ModCompWithPackage, NewChangesetWithCommit} from '@changesets/types';\n\nexport async function getDependencyReleaseLine(\n changesets: NewChangesetWithCommit[],\n updatedDependencies: ModCompWithPackage[],\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 if (!updatedDependencies.length) {\n return '';\n }\n\n const changesetLink = `- Updated dependencies [${(\n await Promise.all(\n changesets.map(async (changeset) => {\n if (changeset.commit) {\n let {links} = await getInfo({\n repo: String(options.repository),\n commit: changeset.commit,\n });\n\n return links.commit;\n }\n\n return undefined;\n }),\n )\n )\n .filter((_) => _)\n .join(', ')}]:`;\n\n let updatedDepenenciesLines = updatedDependencies.map(\n (dependency) => ` - ${dependency.name}@${dependency.newVersion}`,\n );\n\n return [changesetLink, ...updatedDepenenciesLines].join('\\n');\n}\n"],"names":["getDependencyReleaseLine","changesets","updatedDependencies","options","repository","Error","length","changesetLink","Promise","all","map","changeset","commit","links","getInfo","repo","String","undefined","filter","_","join","updatedDepenenciesLines","dependency","name","newVersion"],"mappings":";+BAGsBA;;;eAAAA;;;+BAHA;AAGf,eAAeA,yBACpBC,UAAoC,EACpCC,mBAAyC,EACzCC,OAAiC;
|
|
1
|
+
{"version":3,"sources":["../src/getDependencyReleaseLine.ts"],"sourcesContent":["import {getInfo} from '@changesets/get-github-info';\nimport type {ModCompWithPackage, NewChangesetWithCommit} from '@changesets/types';\n\nexport async function getDependencyReleaseLine(\n changesets: NewChangesetWithCommit[],\n updatedDependencies: ModCompWithPackage[],\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 if (!updatedDependencies.length) {\n return '';\n }\n\n const changesetLink = `- Updated dependencies [${(\n await Promise.all(\n changesets.map(async (changeset) => {\n if (changeset.commit) {\n let {links} = await getInfo({\n repo: String(options.repository),\n commit: changeset.commit,\n });\n\n return links.commit;\n }\n\n return undefined;\n }),\n )\n )\n .filter((_) => _)\n .join(', ')}]:`;\n\n let updatedDepenenciesLines = updatedDependencies.map(\n (dependency) => ` - ${dependency.name}@${dependency.newVersion}`,\n );\n\n return [changesetLink, ...updatedDepenenciesLines].join('\\n');\n}\n"],"names":["getDependencyReleaseLine","changesets","updatedDependencies","options","repository","Error","length","changesetLink","Promise","all","map","changeset","commit","links","getInfo","repo","String","undefined","filter","_","join","updatedDepenenciesLines","dependency","name","newVersion"],"mappings":";+BAGsBA;;;eAAAA;;;+BAHA;AAGf,eAAeA,yBACpBC,UAAoC,EACpCC,mBAAyC,EACzCC,OAAiC;IAEjC,IAAI,CAACA,SAASC,YAAY;QACxB,MAAM,IAAIC,MACR;IAEJ;IAEA,IAAI,CAACH,oBAAoBI,MAAM,EAAE;QAC/B,OAAO;IACT;IAEA,MAAMC,gBAAgB,CAAC,wBAAwB,EAAE,AAC/C,CAAA,MAAMC,QAAQC,GAAG,CACfR,WAAWS,GAAG,CAAC,OAAOC;QACpB,IAAIA,UAAUC,MAAM,EAAE;YACpB,IAAI,EAACC,KAAK,EAAC,GAAG,MAAMC,IAAAA,sBAAO,EAAC;gBAC1BC,MAAMC,OAAOb,QAAQC,UAAU;gBAC/BQ,QAAQD,UAAUC,MAAM;YAC1B;YAEA,OAAOC,MAAMD,MAAM;QACrB;QAEA,OAAOK;IACT,GACF,EAECC,MAAM,CAAC,CAACC,IAAMA,GACdC,IAAI,CAAC,MAAM,EAAE,CAAC;IAEjB,IAAIC,0BAA0BnB,oBAAoBQ,GAAG,CACnD,CAACY,aAAe,CAAC,IAAI,EAAEA,WAAWC,IAAI,CAAC,CAAC,EAAED,WAAWE,UAAU,CAAC,CAAC;IAGnE,OAAO;QAACjB;WAAkBc;KAAwB,CAACD,IAAI,CAAC;AAC1D"}
|
package/dist/getReleaseLine.js
CHANGED
|
@@ -7,8 +7,7 @@ Object.defineProperty(exports, "getReleaseLine", {
|
|
|
7
7
|
});
|
|
8
8
|
const _getgithubinfo = require("@changesets/get-github-info");
|
|
9
9
|
async function getReleaseLine(changeset, type, options) {
|
|
10
|
-
|
|
11
|
-
if (!((_options = options) === null || _options === void 0 ? void 0 : _options.repository)) {
|
|
10
|
+
if (!options?.repository) {
|
|
12
11
|
throw new Error('Please provide a repository in Changesets changelog setting, e.g.: "changelog": ["@jakubmazanec/changesets-changelog", { "repository": "org/repo" }]');
|
|
13
12
|
}
|
|
14
13
|
let pullRequestFromSummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/getReleaseLine.ts"],"sourcesContent":["import {getInfo, getInfoFromPullRequest} from '@changesets/get-github-info';\nimport type {VersionType, NewChangesetWithCommit} from '@changesets/types';\n\nexport async function getReleaseLine(\n changeset: NewChangesetWithCommit,\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} –` : ''} ${firstLine}\\n${lines\n .map((line) => ` ${line}`)\n .join('\\n')}`;\n}\n"],"names":["getReleaseLine","changeset","type","options","repository","Error","pullRequestFromSummary","commitFromSummary","usersFromSummary","replacedChangelog","summary","replace","_","rawPullRequest","pullRequest","Number","isNaN","commit","user","push","trim","firstLine","lines","split","map","line","trimEnd","commitLink","pullRequestLink","usersLink","undefined","commitToFetchFrom","links","getInfo","repo","String","pull","getInfoFromPullRequest","length","userFromSummary","join","prefix"],"mappings":";+BAGsBA;;;eAAAA;;;+BAHwB;AAGvC,eAAeA,eACpBC,SAAiC,EACjCC,IAAiB,EACjBC,OAAiC;
|
|
1
|
+
{"version":3,"sources":["../src/getReleaseLine.ts"],"sourcesContent":["import {getInfo, getInfoFromPullRequest} from '@changesets/get-github-info';\nimport type {VersionType, NewChangesetWithCommit} from '@changesets/types';\n\nexport async function getReleaseLine(\n changeset: NewChangesetWithCommit,\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} –` : ''} ${firstLine}\\n${lines\n .map((line) => ` ${line}`)\n .join('\\n')}`;\n}\n"],"names":["getReleaseLine","changeset","type","options","repository","Error","pullRequestFromSummary","commitFromSummary","usersFromSummary","replacedChangelog","summary","replace","_","rawPullRequest","pullRequest","Number","isNaN","commit","user","push","trim","firstLine","lines","split","map","line","trimEnd","commitLink","pullRequestLink","usersLink","undefined","commitToFetchFrom","links","getInfo","repo","String","pull","getInfoFromPullRequest","length","userFromSummary","join","prefix"],"mappings":";+BAGsBA;;;eAAAA;;;+BAHwB;AAGvC,eAAeA,eACpBC,SAAiC,EACjCC,IAAiB,EACjBC,OAAiC;IAEjC,IAAI,CAACA,SAASC,YAAY;QAC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