cloudflare/kumo
Publicmirrored fromhttps://github.com/cloudflare/kumoAvailable
ci/reporters/npm-release.ts
37lines · modecode
| 1 | /** |
| 2 | * NPM Release Reporter |
| 3 | * |
| 4 | * Reports the published npm package version with installation instructions. |
| 5 | */ |
| 6 | |
| 7 | import type { CIContext, ReportItem, Reporter } from "./types"; |
| 8 | |
| 9 | export const npmReleaseReporter: Reporter = { |
| 10 | id: "npm-release", |
| 11 | name: "NPM Release", |
| 12 | |
| 13 | async collect(context: CIContext): Promise<ReportItem | null> { |
| 14 | const { packageName, packageVersion } = context; |
| 15 | |
| 16 | if (!packageVersion) { |
| 17 | return null; |
| 18 | } |
| 19 | |
| 20 | const content = `\`${packageName}@${packageVersion}\` has been published to the npm registry. |
| 21 | |
| 22 | **Installation:** |
| 23 | \`\`\`bash |
| 24 | pnpm add ${packageName}@${packageVersion} |
| 25 | \`\`\` |
| 26 | |
| 27 | **Testing:** You can now test this beta version in your projects before the final release.`; |
| 28 | |
| 29 | return { |
| 30 | id: "npm-release", |
| 31 | title: "📦 NPM Package", |
| 32 | priority: 10, |
| 33 | content, |
| 34 | success: true, |
| 35 | }; |
| 36 | }, |
| 37 | }; |
| 38 | |