From a8b7cc474cadd0c00cc8b5113d87b9ff1571704c Mon Sep 17 00:00:00 2001 From: David Bosschaert Date: Wed, 18 Sep 2024 10:27:44 +0200 Subject: [PATCH] feat(release) Generate checksum of the rum enhancer on release Fixes: #282 --- .releaserc.cjs | 13 ++++++++++++- package-lock.json | 13 +++++++++++++ package.json | 1 + rollup.config.js | 9 ++++++++- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.releaserc.cjs b/.releaserc.cjs index 997270f..c97ac40 100644 --- a/.releaserc.cjs +++ b/.releaserc.cjs @@ -10,7 +10,18 @@ module.exports = { "assets": ["package.json", "CHANGELOG.md"], "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" }], - ["@semantic-release/github", {}] + ["@semantic-release/github", { + "assets": [ + { + "path": "dist/index.js", + "label": "RUM Enhancer JS" + }, + { + "path": "dist/index.md5", + "label": "RUM Enhancer Hash" + } + ] + }] ], branches: ['main'], }; diff --git a/package-lock.json b/package-lock.json index 8535872..e8c6c90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "mocha": "10.7.3", "mocha-multi-reporters": "1.5.1", "rollup": "4.21.2", + "rollup-plugin-checksum": "1.0.1", "rollup-plugin-cleanup": "3.2.1", "rollup-plugin-eslint-bundle": "9.0.0", "semantic-release": "24.1.0", @@ -12428,6 +12429,18 @@ "fsevents": "~2.3.2" } }, + "node_modules/rollup-plugin-checksum": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-checksum/-/rollup-plugin-checksum-1.0.1.tgz", + "integrity": "sha512-znhm+LrDSBEWmIBQqZOJ5tPdtp9PaaAd1uJMbuiEKuO0qxPXkMbVUmlCvhK2NDeo8/h0a1xGuSPGCPG16UB+bQ==", + "dev": true, + "dependencies": { + "@types/node": ">=12" + }, + "peerDependencies": { + "rollup": ">=1.26.0" + } + }, "node_modules/rollup-plugin-cleanup": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/rollup-plugin-cleanup/-/rollup-plugin-cleanup-3.2.1.tgz", diff --git a/package.json b/package.json index 8887e7c..bdbd21d 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "mocha-multi-reporters": "1.5.1", "rollup": "4.21.2", "rollup-plugin-cleanup": "3.2.1", + "rollup-plugin-checksum": "1.0.1", "rollup-plugin-eslint-bundle": "9.0.0", "semantic-release": "24.1.0", "web-vitals": "4.2.3" diff --git a/rollup.config.js b/rollup.config.js index 720b2c0..6c3b237 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -12,6 +12,9 @@ import cleanup from 'rollup-plugin-cleanup'; import eslint from 'rollup-plugin-eslint-bundle'; +import pkg from 'rollup-plugin-checksum'; + +const checksum = pkg.default; const banner = `/* * Copyright 2024 Adobe. All rights reserved. @@ -31,7 +34,7 @@ const banner = `/* const bundles = [ { source: 'modules/index.js', - outputFile: 'src/index', + outputFile: 'dist/index', }, ]; @@ -63,5 +66,9 @@ export default [...bundles.map(({ outputFile, source }) => ({ fix: true, }, }), + checksum({ + filename: `${outputFile.split('/').pop()}.md5`, + includeAssets: false, + }), ], }))];