@jakubmazanec/changesets-changelog 1.0.3 → 1.0.4-11dd4a3
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.
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "getDependencyReleaseLine", {
|
|
3
3
|
enumerable: true,
|
|
4
|
-
get: ()
|
|
4
|
+
get: function() {
|
|
5
|
+
return getDependencyReleaseLine;
|
|
6
|
+
}
|
|
5
7
|
});
|
|
6
|
-
const
|
|
8
|
+
const _getgithubinfo = require("@changesets/get-github-info");
|
|
7
9
|
async function getDependencyReleaseLine(changesets, updatedDependencies, options) {
|
|
8
10
|
if (!(options === null || options === void 0 ? void 0 : options.repository)) {
|
|
9
11
|
throw new Error('Please provide a repository in Changesets changelog setting, e.g.: "changelog": ["@jakubmazanec/changesets-changelog", { "repository": "org/repo" }]');
|
|
@@ -13,7 +15,7 @@ async function getDependencyReleaseLine(changesets, updatedDependencies, options
|
|
|
13
15
|
}
|
|
14
16
|
const changesetLink = `- Updated dependencies [${(await Promise.all(changesets.map(async (changeset)=>{
|
|
15
17
|
if (changeset.commit) {
|
|
16
|
-
let { links } = await (0,
|
|
18
|
+
let { links } = await (0, _getgithubinfo.getInfo)({
|
|
17
19
|
repo: String(options.repository),
|
|
18
20
|
commit: changeset.commit
|
|
19
21
|
});
|
|
@@ -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":"
|
|
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,CAAAA,oBAAAA,qBAAAA,KAAAA,IAAAA,QAASC,UAAS,GAAG;QACxB,MAAM,IAAIC,MACR;IAEJ;IAEA,IAAI,CAACH,oBAAoBI,QAAQ;QAC/B,OAAO;IACT;IAEA,MAAMC,gBAAgB,CAAC,wBAAwB,EAAE,AAC/C,CAAA,MAAMC,QAAQC,IACZR,WAAWS,IAAI,OAAOC;QACpB,IAAIA,UAAUC,QAAQ;YACpB,IAAI,EAACC,MAAK,EAAC,GAAG,MAAMC,IAAAA,wBAAQ;gBAC1BC,MAAMC,OAAOb,QAAQC;gBACrBQ,QAAQD,UAAUC;YACpB;YAEA,OAAOC,MAAMD;QACf;QAEA,OAAOK;IACT,GACF,EAECC,OAAO,CAACC,IAAMA,GACdC,KAAK,MAAM,EAAE,CAAC;IAEjB,IAAIC,0BAA0BnB,oBAAoBQ,IAChD,CAACY,aAAe,CAAC,IAAI,EAAEA,WAAWC,KAAK,CAAC,EAAED,WAAWE,WAAW,CAAC;IAGnE,OAAO;QAACjB;WAAkBc;KAAwB,CAACD,KAAK;AAC1D"}
|
package/dist/getReleaseLine.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "getReleaseLine", {
|
|
3
3
|
enumerable: true,
|
|
4
|
-
get: ()
|
|
4
|
+
get: function() {
|
|
5
|
+
return getReleaseLine;
|
|
6
|
+
}
|
|
5
7
|
});
|
|
6
|
-
const
|
|
8
|
+
const _getgithubinfo = require("@changesets/get-github-info");
|
|
7
9
|
async function getReleaseLine(changeset, type, options) {
|
|
8
10
|
if (!(options === null || options === void 0 ? void 0 : options.repository)) {
|
|
9
11
|
throw new Error('Please provide a repository in Changesets changelog setting, e.g.: "changelog": ["@jakubmazanec/changesets-changelog", { "repository": "org/repo" }]');
|
|
@@ -31,7 +33,7 @@ async function getReleaseLine(changeset, type, options) {
|
|
|
31
33
|
if (pullRequestFromSummary === undefined) {
|
|
32
34
|
let commitToFetchFrom = commitFromSummary ?? changeset.commit;
|
|
33
35
|
if (commitToFetchFrom) {
|
|
34
|
-
let { links } = await (0,
|
|
36
|
+
let { links } = await (0, _getgithubinfo.getInfo)({
|
|
35
37
|
repo: String(options.repository),
|
|
36
38
|
commit: commitToFetchFrom
|
|
37
39
|
});
|
|
@@ -40,19 +42,19 @@ async function getReleaseLine(changeset, type, options) {
|
|
|
40
42
|
usersLink = links.user ?? undefined;
|
|
41
43
|
}
|
|
42
44
|
} else {
|
|
43
|
-
let { links
|
|
45
|
+
let { links } = await (0, _getgithubinfo.getInfoFromPullRequest)({
|
|
44
46
|
repo: String(options.repository),
|
|
45
47
|
pull: pullRequestFromSummary
|
|
46
48
|
});
|
|
47
49
|
if (commitFromSummary) {
|
|
48
|
-
|
|
49
|
-
...
|
|
50
|
+
links = {
|
|
51
|
+
...links,
|
|
50
52
|
commit: `[\`${commitFromSummary}\`](https://github.com/${options.repository}/commit/${commitFromSummary})`
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
|
-
commitLink =
|
|
54
|
-
pullRequestLink =
|
|
55
|
-
usersLink =
|
|
55
|
+
commitLink = links.commit ?? undefined;
|
|
56
|
+
pullRequestLink = links.pull;
|
|
57
|
+
usersLink = links.user ?? undefined;
|
|
56
58
|
}
|
|
57
59
|
if (usersFromSummary.length) {
|
|
58
60
|
usersLink = usersFromSummary.map((userFromSummary)=>`[@${userFromSummary}](https://github.com/${userFromSummary})`).join(', ');
|
|
@@ -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 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 }\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":"
|
|
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 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 }\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,CAAAA,oBAAAA,qBAAAA,KAAAA,IAAAA,QAASC,UAAS,GAAG;QACxB,MAAM,IAAIC,MACR;IAEJ;IA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;QAC3BT,YAAYrB,iBACTgB,IAAI,CAACe,kBAAoB,CAAC,EAAE,EAAEA,gBAAgB,qBAAqB,EAAEA,gBAAgB,CAAC,CAAC,EACvFC,KAAK;IACV;IAEA,IAAIC,SAAS;QACXb,kBAAkB,CAAC,CAAC,EAAEA,gBAAgB,CAAC,GAAG;QAC1CD,aAAa,CAAC,CAAC,EAAEA,WAAW,CAAC,GAAG;QAChCE,YAAY,CAAC,EAAE,EAAEA,UAAU,CAAC,CAAC,GAAG;KACjC,CAACW,KAAK;IAEP,OAAO,CAAC,KAAK,EAAEC,SAAS,CAAC,EAAEA,OAAO,EAAE,CAAC,GAAG,GAAG,CAAC,EAAEpB,UAAU,EAAE,EAAEC,MACzDE,IAAI,CAACC,OAAS,CAAC,EAAE,EAAEA,KAAK,CAAC,EACzBe,KAAK,MAAM,CAAC;AACjB"}
|
package/dist/main.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const _dotenv = require("dotenv");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function
|
|
3
|
+
_export_star(require("./getDependencyReleaseLine"), exports);
|
|
4
|
+
_export_star(require("./getReleaseLine"), exports);
|
|
5
|
+
function _export_star(from, to) {
|
|
6
6
|
Object.keys(from).forEach(function(k) {
|
|
7
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
8
|
+
Object.defineProperty(to, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function() {
|
|
11
|
+
return from[k];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
13
15
|
});
|
|
14
16
|
return from;
|
|
15
17
|
}
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.ts"],"sourcesContent":["import {config} from 'dotenv';\n\nconfig();\n\nexport * from './getDependencyReleaseLine';\nexport * from './getReleaseLine';\n"],"names":["config"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/main.ts"],"sourcesContent":["import {config} from 'dotenv';\n\nconfig();\n\nexport * from './getDependencyReleaseLine';\nexport * from './getReleaseLine';\n"],"names":["config"],"mappings":";wBAAqB;qBAIP;qBACA;;;;;;;;;;;;;;AAHdA,IAAAA"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jakubmazanec/changesets-changelog",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4-11dd4a3",
|
|
4
4
|
"description": "Changelog for projects using Changesets.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "
|
|
7
|
+
"url": "https://github.com/jakubmazanec/js-tools",
|
|
8
8
|
"directory": "packages/changesets-changelog"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"clean": "del-cli dist *.tsbuildinfo",
|
|
22
22
|
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
|
|
23
23
|
"lint": "eslint .",
|
|
24
|
-
"test": "jest",
|
|
24
|
+
"test": "jest --passWithNoTests",
|
|
25
25
|
"typecheck": "tsc --project tsconfig.typecheck.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|