From 463e2b55454af48543bcbd9c59cb37f7d52fe5d7 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Wed, 19 Nov 2025 13:51:13 -0500 Subject: [PATCH] Re-doing bundling... --- action.js | 23 ++++++++++++----------- dist/index.js | 22 +++++++++++----------- package.json | 3 ++- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/action.js b/action.js index 089dbac..bcddd02 100644 --- a/action.js +++ b/action.js @@ -5,9 +5,7 @@ import fs from "fs"; export function main() { const converter = new Converter(); const input = core.getInput("input", { required: false }); - const encoding = core.getInput("encoding", { - required: true, - }); + const encoding = core.getInput("encoding", { required: true }); const path = core.getInput("path", { required: false }); if (!input && !path) { @@ -15,20 +13,23 @@ export function main() { } if (input && path) { - return core.setFailed( - "You must provide either an input or path, not both." - ); + return core.setFailed("You must provide either an input or path, not both."); } - if (input && input !== "") { + if (input) { core.setOutput("contents", converter.toHtml(input)); - } else if (path && path !== "") { + } else { if (!fs.existsSync(path)) { return core.setFailed(`Path ${path} does not exist.`); } - const rawContents = fs.readFileSync(path).toString(encoding); - - core.setOutput("contents", converter.toHtml(rawContents)); + const raw = fs.readFileSync(path).toString(encoding); + core.setOutput("contents", converter.toHtml(raw)); } } + +try { + main(); +} catch (err) { + core.setFailed(err.message); +} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 04a7e90..0ff13ee 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3762,9 +3762,7 @@ var __webpack_exports__ = {}; function main() { const converter = new ansi_to_html__WEBPACK_IMPORTED_MODULE_0__(); const input = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput("input", { required: false }); - const encoding = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput("encoding", { - required: true, - }); + const encoding = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput("encoding", { required: true }); const path = _actions_core__WEBPACK_IMPORTED_MODULE_1__.getInput("path", { required: false }); if (!input && !path) { @@ -3772,24 +3770,26 @@ function main() { } if (input && path) { - return _actions_core__WEBPACK_IMPORTED_MODULE_1__.setFailed( - "You must provide either an input or path, not both." - ); + return _actions_core__WEBPACK_IMPORTED_MODULE_1__.setFailed("You must provide either an input or path, not both."); } - if (input && input !== "") { + if (input) { _actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput("contents", converter.toHtml(input)); - } else if (path && path !== "") { + } else { if (!fs__WEBPACK_IMPORTED_MODULE_2__.existsSync(path)) { return _actions_core__WEBPACK_IMPORTED_MODULE_1__.setFailed(`Path ${path} does not exist.`); } - const rawContents = fs__WEBPACK_IMPORTED_MODULE_2__.readFileSync(path).toString(encoding); - - _actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput("contents", converter.toHtml(rawContents)); + const raw = fs__WEBPACK_IMPORTED_MODULE_2__.readFileSync(path).toString(encoding); + _actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput("contents", converter.toHtml(raw)); } } +try { + main(); +} catch (err) { + _actions_core__WEBPACK_IMPORTED_MODULE_1__.setFailed(err.message); +} })(); var __webpack_exports__main = __webpack_exports__.D; diff --git a/package.json b/package.json index 4304e07..aece5b2 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "scripts": { "lint": "eslint --ext js .", "release": "npx semantic-release", - "test": "npx cross-env FORCE_COLOR=1 npx jest" + "test": "npx cross-env FORCE_COLOR=1 npx jest", + "build": "ncc build action.js -o dist" }, "dependencies": { "@actions/core": "^1.9.1",