Skip to content

Commit

Permalink
Migrate to ESM, fixes #36
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniovazquezblanco committed Jun 24, 2024
1 parent 691059c commit 2dcbf77
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 488 deletions.
734 changes: 254 additions & 480 deletions dist/index.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
7 changes: 5 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
import type { Config } from "jest";

const config: Config = {
preset: "ts-jest",
preset: "ts-jest/presets/default-esm",
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
verbose: true,
collectCoverage: true,
coverageDirectory: "coverage",
coverageProvider: "v8",
coverageProvider: "v8"
};

export default config;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"setup",
"ghidra"
],
"type": "module",
"main": "index.js",
"scripts": {
"build": "ncc build src/setup-ghidra.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/github_helper.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as github_helper from "./github_helper";
import * as github_helper from "./github_helper.js";

test("Oktokit getter, no token", () => {
const octokit = github_helper.getOctokit();
Expand Down
2 changes: 1 addition & 1 deletion src/github_helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Octokit } from "@octokit/rest";
import { getOctokitOptions } from "@actions/github/lib/utils";
import { getOctokitOptions } from "@actions/github/lib/utils.js";

export function getOctokit(auth_token?: string) {
let options = {};
Expand Down
4 changes: 2 additions & 2 deletions src/installer.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path = require("path");
import io = require("@actions/io");
import * as github_helper from "./github_helper";
import * as installer from "./installer";
import * as github_helper from "./github_helper.js";
import * as installer from "./installer.js";
import * as fs from "fs";

describe("Installer tests", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/setup-ghidra.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as core from "@actions/core";
import * as github_helper from "./github_helper";
import * as installer from "./installer";
import * as github_helper from "./github_helper.js";
import * as installer from "./installer.js";

const regexVersion = new RegExp("^\\d+(\\.\\d+)*(\\.\\d+)*$");
const regexSha256sum = new RegExp("^[\\da-fA-F]{64}$");
Expand Down

1 comment on commit 2dcbf77

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 91.16% 134/147
🟡 Branches 78.26% 18/23
🟢 Functions 100% 10/10
🟢 Lines 91.16% 134/147

Test suite run success

6 tests passing in 2 suites.

Report generated by 🧪jest coverage report action from 2dcbf77

Please sign in to comment.