Skip to content

Commit

Permalink
☕ fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
hudsonm62 committed Apr 25, 2024
1 parent c9bb93b commit b818ada
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=lf
*.lockb binary diff=lockb
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ async function run() {
/////////////////////////////
}

module.exports = { run }
export { run }
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const version = require("../package.json").version
const core = require("@actions/core")
const run = require("./action")
const action = require("./action")
async function runWrapper() {
try {
core.info(
`Running Compare Action v${version}\nhttps://github.com/hudsonm62/compare-action`,
)
await run()
await action.run()
} catch (error) {
core.setFailed("Compare failed: " + error.message)
}
Expand Down
9 changes: 4 additions & 5 deletions src/logger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const core = require("@actions/core")
import { appendFile } from "node:fs"
const fs = require("fs")
//import { appendFile } from "node:fs"

const logPathInput = core.getInput("log_path")
const logPath = core.toPlatformPath(logPathInput)
Expand All @@ -18,7 +19,6 @@ if (logPathInput !== "" || logPath !== null) {
* @returns {string} The error message
*/
function myError(err, bNoError = false, bWarnOnly = false) {
core.debug("myError handler called: " + err)
if (!bNoError) {
writeLog(err)
if (bWarnOnly) {
Expand All @@ -45,11 +45,10 @@ function echo(str) {
// writes to file
function writeLog(str) {
if (bWriteLog) {
core.debug("Writing to log file")
const now = new Date()
const time = now.toISOString().replace(/\..+/, "")
appendFile(logPath, time + " " + str + "\n", (err) => {})
fs.appendFile(logPath, time + " " + str + "\n", (err) => {})
}
}

module.exports = { myError, echo }
export { echo, myError }

0 comments on commit b818ada

Please sign in to comment.