diff --git a/dist/index.js b/dist/index.js index fbbfc2d..3c400b1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -38575,16 +38575,19 @@ function wrappy (fn, cb) { /***/ ((module, __unused_webpack___webpack_exports__, __nccwpck_require__) => { __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { -/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(2186); -/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(_actions_core__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _actions_github__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(5438); -/* harmony import */ var _actions_github__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(_actions_github__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _actions_io__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(7436); -/* harmony import */ var _actions_io__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nccwpck_require__.n(_actions_io__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _src_csvReport_js__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(7925); -/* harmony import */ var _src_isFileExists_js__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(2139); -/* harmony import */ var _src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(4362); -/* harmony import */ var _src_helpers_js__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(3015); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(1017); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(2186); +/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(_actions_core__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _actions_github__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(5438); +/* harmony import */ var _actions_github__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nccwpck_require__.n(_actions_github__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _actions_io__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(7436); +/* harmony import */ var _actions_io__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nccwpck_require__.n(_actions_io__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _src_csvReport_js__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(7925); +/* harmony import */ var _src_isFileExists_js__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(2139); +/* harmony import */ var _src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(4362); +/* harmony import */ var _src_helpers_js__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(3015); + @@ -38596,22 +38599,22 @@ const baseDir = 'report-action'; try { const runTimestamp = Date.now(); // vars - const sourceReportDir = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('report_dir'); - const ghPagesPath = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('gh_pages'); - const reportId = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('report_id'); - const reportType = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('report_type'); - const listDirs = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('list_dirs') == 'true'; - const branchName = (0,_src_helpers_js__WEBPACK_IMPORTED_MODULE_6__/* .getBranchName */ .L)(_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.ref, _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.payload.pull_request); - const reportBaseDir = `${ghPagesPath}/${baseDir}/${branchName}/${reportId}`; + const sourceReportDir = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput('report_dir'); + const ghPagesPath = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput('gh_pages'); + const reportId = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput('report_id'); + const reportType = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput('report_type'); + const listDirs = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput('list_dirs') == 'true'; + const branchName = (0,_src_helpers_js__WEBPACK_IMPORTED_MODULE_7__/* .getBranchName */ .L)(_actions_github__WEBPACK_IMPORTED_MODULE_2__.context.ref, _actions_github__WEBPACK_IMPORTED_MODULE_2__.context.payload.pull_request); + const reportBaseDir = path__WEBPACK_IMPORTED_MODULE_0__.join(ghPagesPath, baseDir, branchName, reportId); /** * `runId` is unique but won't change on job re-run * `runNumber` is not unique and resets from time to time * that's why the `runTimestamp` is used to guarantee uniqueness */ - const runUniqueId = `${_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.runId}_${runTimestamp}`; - const reportDir = `${reportBaseDir}/${runUniqueId}`; + const runUniqueId = `${_actions_github__WEBPACK_IMPORTED_MODULE_2__.context.runId}_${runTimestamp}`; + const reportDir = path__WEBPACK_IMPORTED_MODULE_0__.join(reportBaseDir, runUniqueId); // urls - const ghPagesUrl = `https://${_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.repo.owner}.github.io/${_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.repo.repo}`; + const ghPagesUrl = `https://${_actions_github__WEBPACK_IMPORTED_MODULE_2__.context.repo.owner}.github.io/${_actions_github__WEBPACK_IMPORTED_MODULE_2__.context.repo.repo}`; const ghPagesBaseDir = `${ghPagesUrl}/${baseDir}/${branchName}/${reportId}`.replaceAll(' ', '%20'); const ghPagesReportDir = `${ghPagesBaseDir}/${runUniqueId}`.replaceAll(' ', '%20'); const reportUrl = reportType === 'csv' ? ghPagesBaseDir : ghPagesReportDir; @@ -38621,48 +38624,48 @@ try { gh_pages: ghPagesPath, report_id: reportId, runUniqueId, - ref: _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.ref, - repo: _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.repo, + ref: _actions_github__WEBPACK_IMPORTED_MODULE_2__.context.ref, + repo: _actions_github__WEBPACK_IMPORTED_MODULE_2__.context.repo, branchName, reportBaseDir, reportDir, report_url: reportUrl, listDirs, }); - if (!(await (0,_src_isFileExists_js__WEBPACK_IMPORTED_MODULE_4__/* .isFileExist */ .e)(ghPagesPath))) { + if (!(await (0,_src_isFileExists_js__WEBPACK_IMPORTED_MODULE_5__/* .isFileExist */ .e)(ghPagesPath))) { throw new Error("Folder with gh-pages branch doesn't exist: " + ghPagesPath); } if (!['html', 'csv'].includes(reportType)) { throw new Error('Unsupported report type: ' + reportType); } // action - await _actions_io__WEBPACK_IMPORTED_MODULE_2__.mkdirP(reportBaseDir); + await _actions_io__WEBPACK_IMPORTED_MODULE_3__.mkdirP(reportBaseDir); // process report if (reportType === 'html') { - await _actions_io__WEBPACK_IMPORTED_MODULE_2__.cp(sourceReportDir, reportDir, { recursive: true }); + await _actions_io__WEBPACK_IMPORTED_MODULE_3__.cp(sourceReportDir, reportDir, { recursive: true }); } else if (reportType === 'csv') { - await (0,_src_csvReport_js__WEBPACK_IMPORTED_MODULE_3__/* .csvReport */ .K)(sourceReportDir, reportBaseDir, reportId, { - sha: _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.sha, + await (0,_src_csvReport_js__WEBPACK_IMPORTED_MODULE_4__/* .csvReport */ .K)(sourceReportDir, reportBaseDir, reportId, { + sha: _actions_github__WEBPACK_IMPORTED_MODULE_2__.context.sha, }); } // folder listing if (listDirs) { - if (await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_5__/* .shouldWriteRootHtml */ .z)(ghPagesPath)) { - await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_5__/* .writeFolderListing */ .l)(ghPagesPath, '.'); + if (await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_6__/* .shouldWriteRootHtml */ .z)(ghPagesPath)) { + await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_6__/* .writeFolderListing */ .l)(ghPagesPath, '.'); } - await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_5__/* .writeFolderListing */ .l)(ghPagesPath, baseDir); - await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_5__/* .writeFolderListing */ .l)(ghPagesPath, `${baseDir}/${branchName}`); + await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_6__/* .writeFolderListing */ .l)(ghPagesPath, baseDir); + await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_6__/* .writeFolderListing */ .l)(ghPagesPath, path__WEBPACK_IMPORTED_MODULE_0__.join(baseDir, branchName)); if (reportType === 'html') { - await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_5__/* .writeFolderListing */ .l)(ghPagesPath, `${baseDir}/${branchName}/${reportId}`); + await (0,_src_writeFolderListing_js__WEBPACK_IMPORTED_MODULE_6__/* .writeFolderListing */ .l)(ghPagesPath, path__WEBPACK_IMPORTED_MODULE_0__.join(baseDir, branchName, reportId)); } } // outputs - _actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput('report_url', reportUrl); - _actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput('report_history_url', ghPagesBaseDir); + _actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput('report_url', reportUrl); + _actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput('report_history_url', ghPagesBaseDir); } catch (error) { - _actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed(error.message); + _actions_core__WEBPACK_IMPORTED_MODULE_1__.setFailed(error.message); } __webpack_async_result__(); @@ -38700,7 +38703,7 @@ const chartReport = Buffer.from('PCEtLSByZXBvcnQtYWN0aW9uIC0tPgo8IWRvY3R5cGUgaHR const csvExt = '.csv'; const csvReport = async (sourceReportDir, reportBaseDir, reportId, meta) => { - const dataFile = `${reportBaseDir}/data.json`; + const dataFile = external_path_.join(reportBaseDir, 'data.json'); let csvJson; if (await (0,isFileExists/* isFileExist */.e)(dataFile)) { csvJson = JSON.parse((await promises_.readFile(dataFile)).toString('utf-8')); @@ -38775,7 +38778,7 @@ const csvReport = async (sourceReportDir, reportBaseDir, reportId, meta) => { entry.records.push(record); }); await promises_.writeFile(dataFile, JSON.stringify(csvJson, null, 2)); - await promises_.writeFile(`${reportBaseDir}/index.html`, chartReport); + await promises_.writeFile(external_path_.join(reportBaseDir, 'index.html'), chartReport); }; @@ -38827,6 +38830,8 @@ __nccwpck_require__.d(__webpack_exports__, { "l": () => (/* binding */ writeFolderListing) }); +// EXTERNAL MODULE: external "path" +var external_path_ = __nccwpck_require__(1017); // EXTERNAL MODULE: external "fs/promises" var promises_ = __nccwpck_require__(3292); ;// CONCATENATED MODULE: ./src/report_listing.ts @@ -38839,6 +38844,7 @@ var isFileExists = __nccwpck_require__(2139); + const indexHtmlFirstLine = ''; const writeFolderListing = async (ghPagesPath, relPath) => { const isRoot = relPath === '.'; @@ -38852,12 +38858,12 @@ const writeFolderListing = async (ghPagesPath, relPath) => { .map((d) => d.name); links.push(...listdir); const data = { links }; - await promises_.writeFile(`${fullPath}/data.json`, JSON.stringify(data, null, 2)); - await promises_.writeFile(`${fullPath}/index.html`, listingReport); + await promises_.writeFile(external_path_.join(fullPath, 'data.json'), JSON.stringify(data, null, 2)); + await promises_.writeFile(external_path_.join(fullPath, 'index.html'), listingReport); }; const shouldWriteRootHtml = async (ghPagesPath) => { // do noot overwrite index.html in the folder root to avoid conflicts - const rootHtmlPath = `${ghPagesPath}/index.html`; + const rootHtmlPath = external_path_.join(ghPagesPath, 'index.html'); const isRootHtmlExisting = await (0,isFileExists/* isFileExist */.e)(rootHtmlPath); // write index.html in the folder root if it doesn't exist if (!isRootHtmlExisting) { diff --git a/index.ts b/index.ts index 014dc20..6bca0ea 100644 --- a/index.ts +++ b/index.ts @@ -1,3 +1,4 @@ +import * as path from 'path' import * as core from '@actions/core' import * as github from '@actions/github' import * as io from '@actions/io' @@ -18,7 +19,7 @@ try { const reportType = core.getInput('report_type') const listDirs = core.getInput('list_dirs') == 'true' const branchName = getBranchName(github.context.ref, github.context.payload.pull_request) - const reportBaseDir = `${ghPagesPath}/${baseDir}/${branchName}/${reportId}` + const reportBaseDir = path.join(ghPagesPath, baseDir, branchName, reportId) /** * `runId` is unique but won't change on job re-run @@ -26,7 +27,7 @@ try { * that's why the `runTimestamp` is used to guarantee uniqueness */ const runUniqueId = `${github.context.runId}_${runTimestamp}` - const reportDir = `${reportBaseDir}/${runUniqueId}` + const reportDir = path.join(reportBaseDir, runUniqueId) // urls const ghPagesUrl = `https://${github.context.repo.owner}.github.io/${github.context.repo.repo}` @@ -76,9 +77,9 @@ try { await writeFolderListing(ghPagesPath, '.') } await writeFolderListing(ghPagesPath, baseDir) - await writeFolderListing(ghPagesPath, `${baseDir}/${branchName}`) + await writeFolderListing(ghPagesPath, path.join(baseDir, branchName)) if (reportType === 'html') { - await writeFolderListing(ghPagesPath, `${baseDir}/${branchName}/${reportId}`) + await writeFolderListing(ghPagesPath, path.join(baseDir, branchName, reportId)) } } diff --git a/package-lock.json b/package-lock.json index 1eab711..f96fa26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "html-trend-report-action", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "html-trend-report-action", - "version": "1.0.2", + "version": "1.0.3", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -17,16 +17,16 @@ }, "devDependencies": { "@playwright/test": "^1.41.1", - "@types/node": "^20.11.13", + "@types/node": "^20.11.15", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "@vercel/ncc": "^0.38.1", - "allure-playwright": "^2.11.1", + "allure-playwright": "^2.12.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", "http-server": "^14.1.1", - "husky": "^9.0.7", + "husky": "^9.0.9", "lighthouse": "^11.5.0", "lighthouse-reporting": "^1.6.5", "npm-run-all": "^4.1.5", @@ -603,9 +603,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.13.tgz", - "integrity": "sha512-5G4zQwdiQBSWYTDAH1ctw2eidqdhMJaNsiIDKHFr55ihz5Trl2qqR8fdrT732yPBho5gkNxXm67OxWFBqX9aPg==", + "version": "20.11.15", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.15.tgz", + "integrity": "sha512-gscmuADZfvNULx1eyirVbr3kVOVZtpQtzKMCZpeSZcN6MfbkRXAR4s9/gsQ4CzxLHw6EStDtKLNtSDL3vbq05A==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -882,21 +882,22 @@ } }, "node_modules/allure-js-commons": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-2.11.1.tgz", - "integrity": "sha512-A7Eiofwj46JBbK2XsM9FKmbhTYrdok+5M2EzI5ueJ/S+T12xvINBrrKdtjkqFvz/oH9qA/iKHawlJc4MSQbxLQ==", + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-2.12.0.tgz", + "integrity": "sha512-uVMKT2LBRJQ9nPTrfE61zwryF3WhaUGIaj0PrVP7AoUpAexzGx0nOUjsJxUes1BwomcTIH1ORZo6r3kmIs7N9g==", "dev": true, "dependencies": { - "properties": "^1.2.1" + "properties": "^1.2.1", + "strip-ansi": "^5.2.0" } }, "node_modules/allure-playwright": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/allure-playwright/-/allure-playwright-2.11.1.tgz", - "integrity": "sha512-xzSFJ5Xrc8AxMM9fkpvvEOwjcuGWUiksx3mQiWFHALpUS1cgsJxm5M30omgqe6/rfbMBsIM2w4ufMts4N37+2w==", + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/allure-playwright/-/allure-playwright-2.12.0.tgz", + "integrity": "sha512-H2S7bEGqH/I3kR+6cnUpgRMfUOD1i73Sa8kQtPUGzavAZ6ZuF0vITf8jrlddNo1o4NKm2/HymUp0NnDBphT7uQ==", "dev": true, "dependencies": { - "allure-js-commons": "2.11.1" + "allure-js-commons": "2.12.0" } }, "node_modules/ansi-colors": { @@ -909,12 +910,12 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true, "engines": { - "node": ">=8" + "node": ">=6" } }, "node_modules/ansi-styles": { @@ -1009,9 +1010,9 @@ } }, "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.6.tgz", + "integrity": "sha512-j1QzY8iPNPG4o4xmO3ptzpRxTciqD3MgEHtifP/YnJpIo58Xu+ne4BejlbkuaLfXn/nz6HFiw29bLpj2PNMdGg==", "dev": true, "engines": { "node": ">= 0.4" @@ -1230,6 +1231,27 @@ "node": ">=12" } }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1504,6 +1526,27 @@ "node": ">=8.6" } }, + "node_modules/enquirer/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/enquirer/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1764,6 +1807,15 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/eslint/node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1786,6 +1838,18 @@ "node": "*" } }, + "node_modules/eslint/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -2559,12 +2623,12 @@ } }, "node_modules/husky": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.7.tgz", - "integrity": "sha512-vWdusw+y12DUEeoZqW1kplOFqk3tedGV8qlga8/SF6a3lOiWLqGZZQvfWvY0fQYdfiRi/u1DFNpudTSV9l1aCg==", + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.9.tgz", + "integrity": "sha512-eW92PRr1XPKDWd7/iM2JvAl9gEKK3TF69yvbllQtKSYBw+Wtoi+P38NqH1Z7++sSd80FBkFagBFJkoQvMhCnGw==", "dev": true, "bin": { - "husky": "bin.js" + "husky": "bin.mjs" }, "engines": { "node": ">=18" @@ -2606,9 +2670,9 @@ ] }, "node_modules/ignore": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", - "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true, "engines": { "node": ">= 4" @@ -4667,6 +4731,27 @@ "node": ">=8" } }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/string.prototype.padend": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.5.tgz", @@ -4730,15 +4815,15 @@ } }, "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "dependencies": { - "ansi-regex": "^5.0.1" + "ansi-regex": "^4.1.0" }, "engines": { - "node": ">=8" + "node": ">=6" } }, "node_modules/strip-bom": { @@ -5257,6 +5342,27 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index 7b86cf8..d1c6469 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-trend-report-action", - "version": "1.0.2", + "version": "1.0.3", "description": "Publish html trend reports per branch", "main": "index.js", "type": "module", @@ -39,16 +39,16 @@ }, "devDependencies": { "@playwright/test": "^1.41.1", - "@types/node": "^20.11.13", + "@types/node": "^20.11.15", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "@vercel/ncc": "^0.38.1", - "allure-playwright": "^2.11.1", + "allure-playwright": "^2.12.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", "http-server": "^14.1.1", - "husky": "^9.0.7", + "husky": "^9.0.9", "lighthouse": "^11.5.0", "lighthouse-reporting": "^1.6.5", "npm-run-all": "^4.1.5", diff --git a/src/csvReport.ts b/src/csvReport.ts index 5c35e4a..08f4b40 100644 --- a/src/csvReport.ts +++ b/src/csvReport.ts @@ -12,7 +12,7 @@ export const csvReport = async ( reportId: string, meta: Record ) => { - const dataFile = `${reportBaseDir}/data.json` + const dataFile = path.join(reportBaseDir, 'data.json') let csvJson: CsvJson if (await isFileExist(dataFile)) { @@ -91,5 +91,5 @@ export const csvReport = async ( }) await fs.writeFile(dataFile, JSON.stringify(csvJson, null, 2)) - await fs.writeFile(`${reportBaseDir}/index.html`, chartReport) + await fs.writeFile(path.join(reportBaseDir, 'index.html'), chartReport) } diff --git a/src/writeFolderListing.ts b/src/writeFolderListing.ts index f6244aa..c7bf09d 100644 --- a/src/writeFolderListing.ts +++ b/src/writeFolderListing.ts @@ -1,3 +1,4 @@ +import * as path from 'path' import * as fs from 'fs/promises' import { listingReport } from './report_listing.js' import { isFileExist } from './isFileExists.js' @@ -19,13 +20,13 @@ export const writeFolderListing = async (ghPagesPath: string, relPath: string) = const data = { links } - await fs.writeFile(`${fullPath}/data.json`, JSON.stringify(data, null, 2)) - await fs.writeFile(`${fullPath}/index.html`, listingReport) + await fs.writeFile(path.join(fullPath, 'data.json'), JSON.stringify(data, null, 2)) + await fs.writeFile(path.join(fullPath, 'index.html'), listingReport) } export const shouldWriteRootHtml = async (ghPagesPath: string) => { // do noot overwrite index.html in the folder root to avoid conflicts - const rootHtmlPath = `${ghPagesPath}/index.html` + const rootHtmlPath = path.join(ghPagesPath, 'index.html') const isRootHtmlExisting = await isFileExist(rootHtmlPath) // write index.html in the folder root if it doesn't exist