Migrate to ESM (#484)

* Migrate to ESM

* just use `require.resolve`

* reuse setup action

* checkout PR head for a sec

* ls things

* try a thing

* the dirname had a trailing whitespace, lol
This commit is contained in:
Mateusz Burzyński
2025-05-16 11:39:43 +02:00
committed by GitHub
parent 7ed1955546
commit 5078b4b48b
21 changed files with 384 additions and 1231 deletions
+7 -7
View File
@@ -1,12 +1,12 @@
import { Changeset } from "@changesets/types";
import type { Changeset } from "@changesets/types";
import writeChangeset from "@changesets/write";
import fixturez from "fixturez";
import fs from "node:fs/promises";
import path from "node:path";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { Git } from "./git";
import { setupOctokit } from "./octokit";
import { runVersion } from "./run";
import { Git } from "./git.ts";
import { setupOctokit } from "./octokit.ts";
import { runVersion } from "./run.ts";
vi.mock("@actions/github", () => ({
context: {
@@ -21,7 +21,7 @@ vi.mock("@actions/github", () => ({
rest: mockedGithubMethods,
}),
}));
vi.mock("./git");
vi.mock("./git.ts");
vi.mock("@changesets/ghcommit/git");
let mockedGithubMethods = {
@@ -34,11 +34,11 @@ let mockedGithubMethods = {
},
};
let f = fixturez(__dirname);
let f = fixturez(import.meta.dirname);
const linkNodeModules = async (cwd: string) => {
await fs.symlink(
path.join(__dirname, "..", "node_modules"),
path.join(import.meta.dirname, "..", "node_modules"),
path.join(cwd, "node_modules")
);
};