Skip to content

Commit a314e14

Browse files
authored
fix: Organize Exports (#37)
* chore: util/ -> internal/ * fix: move concurrencyJSON to internal * fix: move envJSON to internal * fix: move onJSON to internal * fix: move permissionsJSON to internal * fix: move stepJSON to internal
1 parent 0288bf0 commit a314e14

23 files changed

+483
-473
lines changed

lib/cli/install.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {
66
loadActionsLockJson,
77
saveActionsJson,
88
saveActionsLockJson,
9-
} from "../util/actions";
10-
import { getCommit, getFileContent, getLatestRelease } from "../util/git";
11-
import { toUpperCamelCase } from "../util/util";
9+
} from "../internal/actions";
10+
import { getCommit, getFileContent, getLatestRelease } from "../internal/git";
11+
import { toUpperCamelCase } from "../internal/util";
1212

1313
export async function install(actions: string[]) {
1414
const actionsJson = loadActionsJson();
File renamed without changes.

lib/package/concurrency.spec.ts renamed to lib/internal/concurrency.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, expect, test } from "bun:test";
2-
import { type Concurrency, concurrencyJSON } from "./concurrency";
2+
import { concurrencyJSON } from "../internal/concurrency";
3+
import { type Concurrency } from "../package/concurrency";
34

45
describe("concurrencyJSON", () => {
56
test.each<[Concurrency, ReturnType<typeof concurrencyJSON>]>([

lib/internal/concurrency.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { Concurrency } from "../package/concurrency";
2+
3+
export function concurrencyJSON(
4+
concurrency: Concurrency,
5+
): string | Record<string, unknown> {
6+
if (typeof concurrency === "string") {
7+
return concurrency;
8+
}
9+
10+
return {
11+
group: concurrency.group,
12+
...(concurrency.cancelInProgress != null && {
13+
"cancel-in-progress": concurrency.cancelInProgress,
14+
}),
15+
};
16+
}

lib/internal/env.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { describe, expect, test } from "bun:test";
2+
import type { Env } from "../package/env";
3+
import { envJSON } from "./env";
4+
5+
describe("envJSON", () => {
6+
test.each<[Env, ReturnType<typeof envJSON>]>([
7+
[{}, {}],
8+
[
9+
{ HOGE: "hoge", FUGA: "fuga" },
10+
{ HOGE: "hoge", FUGA: "fuga" },
11+
],
12+
])("envJSON(%j) returns %j", (input, expected) => {
13+
expect(envJSON(input)).toEqual(expected);
14+
});
15+
});

lib/internal/env.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { Env } from "../package/env";
2+
3+
export function envJSON(env: Env): Record<string, unknown> {
4+
return env;
5+
}
File renamed without changes.

lib/package/on.spec.ts renamed to lib/internal/on.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, expect, test } from "bun:test";
2-
import { type On, onJSON } from "./on";
2+
import { type On } from "../package/on";
3+
import { onJSON } from "./on";
34

45
describe("onJSON", () => {
56
test.each<[On, ReturnType<typeof onJSON>]>([

0 commit comments

Comments
 (0)