diff --git a/init/action.yml b/init/action.yml index 05f49942..ba5e4318 100644 --- a/init/action.yml +++ b/init/action.yml @@ -22,4 +22,4 @@ outputs: runs: using: "node20" - main: "src/index.mjs" + main: "src/index.js" diff --git a/init/package.json b/init/package.json index b5dd93e8..2f6c7c3a 100644 --- a/init/package.json +++ b/init/package.json @@ -2,7 +2,7 @@ "name": "dashlord-init-action", "version": "1.0.0", "description": "Load the dashlord configuration", - "main": "src/index.mjs", + "main": "src/index.js", "scripts": { "lint": "eslint .", "test": "jest", diff --git a/init/src/index.mjs b/init/src/index.js similarity index 93% rename from init/src/index.mjs rename to init/src/index.js index bc21abaa..f09f1505 100644 --- a/init/src/index.mjs +++ b/init/src/index.js @@ -1,7 +1,7 @@ -import fs from "fs"; -import core from "@actions/core"; -import YAML from "yaml"; -import { createMissingUpdownEntries } from "./updown.mjs"; +const fs = require("fs"); +const core = require("@actions/core"); +const YAML = require("yaml"); +const { createMissingUpdownEntries } = require("./updown"); const getDashlordConfig = () => { let dashlordConfig; @@ -135,5 +135,10 @@ async function run() { if (require.main === module) { run(); } - -module.exports = { run, getOutputs, getSiteTools, getSiteSubpages }; +module.exports = { + run, + getOutputs, + getDashlordConfig, + getSiteTools, + getSiteSubpages, +}; diff --git a/init/src/index.test.js b/init/src/index.test.js index 10dd3607..1a8b51f6 100644 --- a/init/src/index.test.js +++ b/init/src/index.test.js @@ -7,6 +7,7 @@ const sampleConfig = jest .readFileSync(path.join(__dirname, "..", "dashlord.yml")) .toString(); +//jest.mock("fs"); jest.mock("fs", () => ({ promises: { access: jest.fn(), diff --git a/init/src/updown.mjs b/init/src/updown.js similarity index 97% rename from init/src/updown.mjs rename to init/src/updown.js index e61fb92d..d677e4b3 100644 --- a/init/src/updown.mjs +++ b/init/src/updown.js @@ -65,4 +65,4 @@ const createMissingUpdownEntries = async (dashlordConfig) => { }); }; -module.exports = { createMissingUpdownEntries }; +module.export = { createMissingUpdownEntries };