From 4d1530d75c90a2d761f0fb08c58c32ff5f1531db Mon Sep 17 00:00:00 2001 From: iorate <682043+iorate@users.noreply.github.com> Date: Fri, 13 Jan 2023 20:27:33 +0900 Subject: [PATCH] feat: submit release notes in html --- package.json | 10 ++-- src/publish.ts | 13 ++++- yarn.lock | 131 ++++++++++++++++++++++++++----------------------- 3 files changed, 88 insertions(+), 66 deletions(-) diff --git a/package.json b/package.json index 2ce0f4b..6fcba73 100644 --- a/package.json +++ b/package.json @@ -14,16 +14,18 @@ "form-data": "^4.0.0", "jsonwebtoken": "^9.0.0", "lodash.template": "^4.5.0", + "marked": "^4.2.5", "microstruct": "^2.0.4", "zip-dir": "^2.0.0" }, "devDependencies": { - "@types/jsonwebtoken": "^9.0.0", + "@types/jsonwebtoken": "^9.0.1", "@types/lodash.template": "^4.5.1", + "@types/marked": "^4.0.8", "@types/node": "^16.18.11", - "@types/semantic-release": "^17.2.4", - "@typescript-eslint/eslint-plugin": "^5.48.0", - "@typescript-eslint/parser": "^5.48.0", + "@types/semantic-release": "^17.2.5", + "@typescript-eslint/eslint-plugin": "^5.48.1", + "@typescript-eslint/parser": "^5.48.1", "eslint": "^8.31.0", "eslint-config-prettier": "^8.6.0", "npm-run-all": "^4.1.5", diff --git a/src/publish.ts b/src/publish.ts index a7f1800..208f0a2 100644 --- a/src/publish.ts +++ b/src/publish.ts @@ -1,6 +1,16 @@ +import { marked } from 'marked'; import { FullContext, PluginConfig, applyContext, applyDefaults, createError } from './common'; import { UpdateAddonError, updateAddon } from './update-addon'; +function parseReleaseNotes(releaseNotes: string): string { + marked.use({ + renderer: { + heading: text => `\n${text}\n`, + }, + }); + return marked.parse(releaseNotes).trim(); +} + export async function publish( pluginConfig: Readonly, context: Readonly, @@ -39,7 +49,8 @@ export async function publish( channel, approvalNotes: approvalNotes || null, compatibility, - releaseNotes: (submitReleaseNotes && nextRelease.notes) || null, + releaseNotes: + submitReleaseNotes && nextRelease.notes ? parseReleaseNotes(nextRelease.notes) : null, sourceZipPath: submitSource ? sourceZipPath : null, logger, }); diff --git a/yarn.lock b/yarn.lock index 89a81b5..20e4bd9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -568,12 +568,12 @@ __metadata: languageName: node linkType: hard -"@types/jsonwebtoken@npm:^9.0.0": - version: 9.0.0 - resolution: "@types/jsonwebtoken@npm:9.0.0" +"@types/jsonwebtoken@npm:^9.0.1": + version: 9.0.1 + resolution: "@types/jsonwebtoken@npm:9.0.1" dependencies: "@types/node": "*" - checksum: c7791354ba895759524c18ba609ea04efdc576e2b660bd6f80d5b917db8dc4b01acd4d1bc115a62d35406a82e627067973d475c4b36035dabaa27862b141ae49 + checksum: a7f0925e9a42ad3ae970364c63c5986d40da5c83d51d3f4e624eb0f064a380376f9e3fb3f2f837390a9ab80143f5d75fd51866da30e110f6b486a3379e1c768f languageName: node linkType: hard @@ -593,6 +593,13 @@ __metadata: languageName: node linkType: hard +"@types/marked@npm:^4.0.8": + version: 4.0.8 + resolution: "@types/marked@npm:4.0.8" + checksum: 68278fa7acaa5d920cdc239d675b5daf842e0ad4779e4848cd617d9baf2ac1afccb5a264c331e37d80031d647e1640cb983cd31e73d45b28552670b4853fad8e + languageName: node + linkType: hard + "@types/minimist@npm:^1.2.0": version: 1.2.2 resolution: "@types/minimist@npm:1.2.2" @@ -635,12 +642,12 @@ __metadata: languageName: node linkType: hard -"@types/semantic-release@npm:^17.2.4": - version: 17.2.4 - resolution: "@types/semantic-release@npm:17.2.4" +"@types/semantic-release@npm:^17.2.5": + version: 17.2.5 + resolution: "@types/semantic-release@npm:17.2.5" dependencies: "@types/node": "*" - checksum: b4a51db09fdb3fb823c1c826f21fc519ee37e81e238591d853ff556adee714e125314c0786b1ce3e99c32c6751df17c7008cf0d9aad9559d30fd5291eb942a33 + checksum: 5474ca770d5cdc79ee8e146ce79cd47c1c11c7493484ddb39eb0e114da1cede1a3928e7e31223ab61241155f2b80d5da0345c80a16713bf2230812a0c41acb7f languageName: node linkType: hard @@ -651,13 +658,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.48.0": - version: 5.48.0 - resolution: "@typescript-eslint/eslint-plugin@npm:5.48.0" +"@typescript-eslint/eslint-plugin@npm:^5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/eslint-plugin@npm:5.48.1" dependencies: - "@typescript-eslint/scope-manager": 5.48.0 - "@typescript-eslint/type-utils": 5.48.0 - "@typescript-eslint/utils": 5.48.0 + "@typescript-eslint/scope-manager": 5.48.1 + "@typescript-eslint/type-utils": 5.48.1 + "@typescript-eslint/utils": 5.48.1 debug: ^4.3.4 ignore: ^5.2.0 natural-compare-lite: ^1.4.0 @@ -670,43 +677,43 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: cb9cd62fd56670414795e30d30c9fa11ec7ad3a8b0abda48dd17625053a1c26ba1767184b096149bdd0ccb457bec6392306f22211b75f802f4b27366398d16eb + checksum: d8d73d123d16fc9b50b500ef21816dcabdffe0d2dcfdb15089dc5a1015d57cbad709de565d1c830f5058c0d7b410069e2554c0b53d1485fe7b237ea8089e58be languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.48.0": - version: 5.48.0 - resolution: "@typescript-eslint/parser@npm:5.48.0" +"@typescript-eslint/parser@npm:^5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/parser@npm:5.48.1" dependencies: - "@typescript-eslint/scope-manager": 5.48.0 - "@typescript-eslint/types": 5.48.0 - "@typescript-eslint/typescript-estree": 5.48.0 + "@typescript-eslint/scope-manager": 5.48.1 + "@typescript-eslint/types": 5.48.1 + "@typescript-eslint/typescript-estree": 5.48.1 debug: ^4.3.4 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 41d5ce5c8742d286fb083523295a4f186e57bbe4e3da63b6b2de1edbafbcbf6d5225ed3405da2c56e2b0fe1d52bb72babc37508d2ee9b86f6fadad3c4a7950d0 + checksum: c624d24eb209b4ce7f0a6c8116712363f10a9c9a5138f240e254ff265526ee4b0fd73b7b6b4b6a0e7611bd9934c42036350dd27f96ae2fa4efdade1a7ebd0e9e languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.48.0": - version: 5.48.0 - resolution: "@typescript-eslint/scope-manager@npm:5.48.0" +"@typescript-eslint/scope-manager@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/scope-manager@npm:5.48.1" dependencies: - "@typescript-eslint/types": 5.48.0 - "@typescript-eslint/visitor-keys": 5.48.0 - checksum: 96c0ce33d613490690ae6f34e4152f05dbddf3196a6dec89afba4a63cd2d828ae23a98262920b521fe461e7655d38f3a01e9e43588c12392a27bf8cb4f8ae201 + "@typescript-eslint/types": 5.48.1 + "@typescript-eslint/visitor-keys": 5.48.1 + checksum: f60a7efe917798cccf8652925de6be58b023ded6c6ee44ce74d074f0c2a1927680398a6d73bab33d500c69474ad8c54d63b90fcc6e13256712707d12a60e0a64 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.48.0": - version: 5.48.0 - resolution: "@typescript-eslint/type-utils@npm:5.48.0" +"@typescript-eslint/type-utils@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/type-utils@npm:5.48.1" dependencies: - "@typescript-eslint/typescript-estree": 5.48.0 - "@typescript-eslint/utils": 5.48.0 + "@typescript-eslint/typescript-estree": 5.48.1 + "@typescript-eslint/utils": 5.48.1 debug: ^4.3.4 tsutils: ^3.21.0 peerDependencies: @@ -714,23 +721,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 0d57e3bbcaa46e29b588b86b2271341b264f063e71ff5b6d4d35f50f2fe11bd6cdc3c4c95d78493fd17673ecdbd712992b84da1600947ed3bf6ae09de7b99464 + checksum: 2739b35caf48c9edbeab82936de58ce0759ab34955ce7eec1786690d6a63146ae0a6c5d9c76034605d9fe200c87a73ede0772c6244c5df6e66df992d9ebbab72 languageName: node linkType: hard -"@typescript-eslint/types@npm:5.48.0": - version: 5.48.0 - resolution: "@typescript-eslint/types@npm:5.48.0" - checksum: fa27bd9ec7ec5f256b79a371bb05cfbc26902b6a395f38b0cff0e281633ebd76775ad18e41be1bb156868859287295f6833a2a671da57c6347ac7c6bc08a553b +"@typescript-eslint/types@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/types@npm:5.48.1" + checksum: 8437986e9d86d792b23327517ae2f9861ec55992d5a9cd55991e525409b6244169436cd708f3987ab7c579e45e59b6eab5a9d3583f7729219e25691164293094 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.48.0": - version: 5.48.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.48.0" +"@typescript-eslint/typescript-estree@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/typescript-estree@npm:5.48.1" dependencies: - "@typescript-eslint/types": 5.48.0 - "@typescript-eslint/visitor-keys": 5.48.0 + "@typescript-eslint/types": 5.48.1 + "@typescript-eslint/visitor-keys": 5.48.1 debug: ^4.3.4 globby: ^11.1.0 is-glob: ^4.0.3 @@ -739,35 +746,35 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 2444632243111e51bc83b56140514cb5978bef4d7151fede0dfcff8808afc1ad335b0c60ca86c2811bcc82273b87e59e2e0360bf1b8c014825ff818a1731d127 + checksum: 2b26e5848ef131e1bb99ed54d8c0efa8279cf8e8f7d8b72de00c2ca6cf2799d96c20f5bbbcf26e14e81b7b9d1035ba509bff30f2d852c174815879e8f14c27ed languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.48.0": - version: 5.48.0 - resolution: "@typescript-eslint/utils@npm:5.48.0" +"@typescript-eslint/utils@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/utils@npm:5.48.1" dependencies: "@types/json-schema": ^7.0.9 "@types/semver": ^7.3.12 - "@typescript-eslint/scope-manager": 5.48.0 - "@typescript-eslint/types": 5.48.0 - "@typescript-eslint/typescript-estree": 5.48.0 + "@typescript-eslint/scope-manager": 5.48.1 + "@typescript-eslint/types": 5.48.1 + "@typescript-eslint/typescript-estree": 5.48.1 eslint-scope: ^5.1.1 eslint-utils: ^3.0.0 semver: ^7.3.7 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 53f512ae61f72c2b29f2daf8adbc1f37c400cc71156557f69f0745b62c1265d99917a168245e2ee3d88ae458144818d1bf41ced4a764d7d9534b466b29d362fd + checksum: 2d112cbb6a920f147c6c3322e404ca3c56c1170e1ede3bcbf16fb779960dc24cdba688b1f2d06acd242859fc1dbc8702da5f8fa8bbf53e7081e41d80bec4c236 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.48.0": - version: 5.48.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.48.0" +"@typescript-eslint/visitor-keys@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/visitor-keys@npm:5.48.1" dependencies: - "@typescript-eslint/types": 5.48.0 + "@typescript-eslint/types": 5.48.1 eslint-visitor-keys: ^3.3.0 - checksum: 8d41fb7c93b79df415b43c31da7c9007074d78ab6f16c2d318c23e7974b578ce510f466a9584bd67c526367666974091cb5cfbf6670d29e36fb4ab2e57137515 + checksum: 2bda10cf4e6bc48b0d463767617e48a832d708b9434665dff6ed101f7d33e0d592f02af17a2259bde1bd17e666246448ae78d0fe006148cb93d897fff9b1d134 languageName: node linkType: hard @@ -3454,7 +3461,7 @@ __metadata: languageName: node linkType: hard -"marked@npm:^4.0.10": +"marked@npm:^4.0.10, marked@npm:^4.2.5": version: 4.2.5 resolution: "marked@npm:4.2.5" bin: @@ -4932,12 +4939,13 @@ __metadata: resolution: "semantic-release-amo@workspace:." dependencies: "@semantic-release/error": ^3.0.0 - "@types/jsonwebtoken": ^9.0.0 + "@types/jsonwebtoken": ^9.0.1 "@types/lodash.template": ^4.5.1 + "@types/marked": ^4.0.8 "@types/node": ^16.18.11 - "@types/semantic-release": ^17.2.4 - "@typescript-eslint/eslint-plugin": ^5.48.0 - "@typescript-eslint/parser": ^5.48.0 + "@types/semantic-release": ^17.2.5 + "@typescript-eslint/eslint-plugin": ^5.48.1 + "@typescript-eslint/parser": ^5.48.1 aggregate-error: ^4.0.1 axios: ^1.2.2 eslint: ^8.31.0 @@ -4946,6 +4954,7 @@ __metadata: form-data: ^4.0.0 jsonwebtoken: ^9.0.0 lodash.template: ^4.5.0 + marked: ^4.2.5 microstruct: ^2.0.4 npm-run-all: ^4.1.5 prettier: ^2.8.2