refactor: replace esbuild with rolldown

This commit is contained in:
2026-07-18 07:44:03 +02:00
parent 67c903d427
commit 37e649efc3
8 changed files with 1525 additions and 4593 deletions
+46 -82
View File
File diff suppressed because one or more lines are too long
-13
View File
@@ -1,13 +0,0 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
roots: ["<rootDir>/src"],
testMatch: ["**/*.spec.ts"],
moduleNameMapper: {
"^@actions/core$": "<rootDir>/src/__mocks__/actions-core.ts",
},
transform: {
"^.+\\.ts$": "ts-jest",
},
moduleFileExtensions: ["ts", "js", "json"],
};
+1433 -4474
View File
File diff suppressed because it is too large Load Diff
+6 -7
View File
@@ -6,8 +6,8 @@
"main": "src/index.ts",
"scripts": {
"typecheck": "tsc --noEmit",
"build": "esbuild src/index.ts --bundle --outfile=dist/index.js --platform=node --target=node24 --minify",
"test": "jest",
"build": "rolldown -c",
"test": "vitest",
"format": "oxfmt",
"format:check": "oxfmt --check"
},
@@ -17,12 +17,11 @@
},
"devDependencies": {
"@types/conventional-commits-parser": "5.0.2",
"@types/jest": "30.0.0",
"@types/node": "24.13.2",
"esbuild": "0.28.1",
"jest": "30.4.2",
"@vitest/coverage-v8": "4.1.10",
"oxfmt": "0.59.0",
"ts-jest": "29.4.11",
"typescript": "5.9.3"
"rolldown": "1.2.0",
"typescript": "5.9.3",
"vitest": "4.1.10"
}
}
+12
View File
@@ -0,0 +1,12 @@
import { defineConfig } from "rolldown/config";
export default defineConfig({
input: "src/index.ts",
output: {
file: "dist/index.js",
format: "esm",
minify: true,
},
platform: "node",
treeshake: true,
});
-5
View File
@@ -1,5 +0,0 @@
export const getInput = jest.fn(() => "");
export const info = jest.fn();
export const warning = jest.fn();
export const setOutput = jest.fn();
export const setFailed = jest.fn();
+12 -12
View File
@@ -1,22 +1,24 @@
import { afterEach, beforeEach, describe, expect, it, vi, type MockedFunction } from "vitest";
import {
IncrementType,
Tag,
GitService,
CoreService,
ConventionalCommitAnalyzer,
TagService,
TagIncrementer,
LocalGitService,
CoreService,
GitService,
IncrementType,
LocalCoreService,
LocalGitService,
Tag,
TagIncrementer,
TagService,
} from "./main";
// Mock child_process.execSync
jest.mock("child_process", () => ({
execSync: jest.fn(),
vi.mock("child_process", () => ({
execSync: vi.fn(),
}));
import { execSync } from "child_process";
const mockExecSync = execSync as jest.MockedFunction<typeof execSync>;
const mockExecSync = execSync as MockedFunction<typeof execSync>;
// Mock interfaces for testing
class MockGitService implements GitService {
@@ -439,8 +441,6 @@ describe("LocalCoreService", () => {
localCoreService = new LocalCoreService();
});
// @actions/core is mocked via jest.config.js moduleNameMapper
it("should have all required methods", () => {
expect(typeof localCoreService.getInput).toBe("function");
expect(typeof localCoreService.info).toBe("function");
+16
View File
@@ -0,0 +1,16 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
environment: "node",
include: ["src/**/*.{spec,test}.ts"],
coverage: {
enabled: true,
provider: "v8",
include: ["src/**/*.ts"],
exclude: ["src/**/*.{spec,test}.ts"],
reporter: ["lcov"],
reportsDirectory: "coverage",
},
},
});