Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"access": "public"
},
"scripts": {
"build": "pnpm codegen:github && tsc --noEmit && tsdown",
"build": "pnpm codegen:github && tsc && tsdown",
"codegen:github": "graphql-codegen --config src/github/codegen.ts",
"format": "oxfmt --check",
"format:fix": "oxfmt",
Expand All @@ -66,6 +66,7 @@
"@graphql-codegen/cli": "^7.0.0",
"@octokit/core": "^6.1.2",
"@octokit/graphql": "^8.1.1",
"@tsconfig/node22": "^22.0.5",
"@types/node": "^20.11.24",
"dotenv": "^16.4.5",
"oxfmt": "^0.51.0",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/core.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { GetRepositoryMetadataQuery } from "./github/graphql/generated/operations.js";
import { CommitMessage } from "./github/graphql/generated/types.js";
import type { CommitMessage } from "./github/graphql/generated/types.ts";
import {
createCommitOnBranchQuery,
getRepositoryMetadata,
} from "./github/graphql/queries.js";
import {
} from "./github/graphql/queries.ts";
import type {
CommitFilesFromBase64Args,
CommitFilesResult,
GitBase,
} from "./interface.js";
} from "./interface.ts";

const getBaseRef = (base: GitBase): string => {
if ("branch" in base) {
Expand Down
8 changes: 4 additions & 4 deletions src/fs.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { promises as fs } from "fs";
import * as path from "path";
import type { FileAddition } from "./github/graphql/generated/types.js";
import {
import type { FileAddition } from "./github/graphql/generated/types.ts";
import type {
CommitFilesFromDirectoryArgs,
CommitFilesResult,
} from "./interface.js";
import { commitFilesFromBuffers } from "./node.js";
} from "./interface.ts";
import { commitFilesFromBuffers } from "./node.ts";

export const commitFilesFromDirectory = async ({
cwd,
Expand Down
6 changes: 3 additions & 3 deletions src/git.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { promises as fs } from "fs";
import { relative, resolve } from "path";
import git from "isomorphic-git";
import {
import type {
CommitChangesFromRepoArgs,
CommitFilesFromBuffersArgs,
CommitFilesResult,
} from "./interface";
import { commitFilesFromBuffers } from "./node";
} from "./interface.ts";
import { commitFilesFromBuffers } from "./node.ts";

/**
* @see https://isomorphic-git.org/docs/en/walk#walkerentry-mode
Expand Down
2 changes: 2 additions & 0 deletions src/github/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const config: CodegenConfig = {
config: {
// TODO: Look into adding stricter types or use `unknown`
defaultScalarType: "any",
enumsAsTypes: true,
},
},
"src/github/graphql/generated/operations.ts": {
Expand All @@ -34,6 +35,7 @@ const config: CodegenConfig = {
// TODO: Look into adding stricter types or use `unknown`
defaultScalarType: "any",
importSchemaTypesFrom: "src/github/graphql/generated/types.ts",
importExtension: ".ts",
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * as queries from "./github/graphql/queries.js";
export { commitFilesFromBase64 } from "./core.js";
export { commitChangesFromRepo } from "./git.js";
export { commitFilesFromDirectory } from "./fs.js";
export * as queries from "./github/graphql/queries.ts";
export { commitFilesFromBase64 } from "./core.ts";
export { commitChangesFromRepo } from "./git.ts";
export { commitFilesFromDirectory } from "./fs.ts";
6 changes: 3 additions & 3 deletions src/interface.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {
CommitMessage,
FileChanges,
} from "./github/graphql/generated/types.js";
import type { GitHubClient } from "./github/graphql/queries.js";
import type { Logger } from "./logging.js";
} from "./github/graphql/generated/types.ts";
import type { GitHubClient } from "./github/graphql/queries.ts";
import type { Logger } from "./logging.ts";

export type CommitFilesResult = {
refId: string | null;
Expand Down
5 changes: 4 additions & 1 deletion src/node.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { commitFilesFromBase64 } from "./core.js";
import { CommitFilesFromBuffersArgs, CommitFilesResult } from "./interface.js";
import type {
CommitFilesFromBuffersArgs,
CommitFilesResult,
} from "./interface.ts";

export const commitFilesFromBuffers = async ({
fileChanges,
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/fs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { promises as fs } from "fs";
import * as path from "path";
import { getOctokit } from "@actions/github";
import { afterAll, describe, it } from "vitest";
import { commitFilesFromDirectory } from "../../src/fs.js";
import { commitFilesFromDirectory } from "../../src/fs.ts";
import {
ENV,
REPO,
ROOT_TEMP_DIRECTORY,
ROOT_TEST_BRANCH_PREFIX,
log,
} from "./env.js";
import { deleteBranches } from "./util.js";
} from "./env.ts";
import { deleteBranches } from "./util.ts";

const octokit = getOctokit(ENV.GITHUB_TOKEN);

Expand Down
8 changes: 4 additions & 4 deletions tests/integration/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import path from "path";
import { getOctokit } from "@actions/github";
import git from "isomorphic-git";
import { afterAll, describe, expect, it, vi } from "vitest";
import { commitChangesFromRepo } from "../../src/git";
import { getRefTreeQuery } from "../../src/github/graphql/queries";
import { commitChangesFromRepo } from "../../src/git.ts";
import { getRefTreeQuery } from "../../src/github/graphql/queries.ts";
import {
ENV,
REPO,
ROOT_TEMP_DIRECTORY,
ROOT_TEST_BRANCH_PREFIX,
log,
} from "./env";
import { deleteBranches, waitForGitHubToBeReady } from "./util";
} from "./env.ts";
import { deleteBranches, waitForGitHubToBeReady } from "./util.ts";

const octokit = getOctokit(ENV.GITHUB_TOKEN);

Expand Down
10 changes: 5 additions & 5 deletions tests/integration/node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { promises as fs } from "fs";
import { getOctokit } from "@actions/github";
import git from "isomorphic-git";
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import { CommitMessage } from "../../src/github/graphql/generated/types.js";
import type { CommitMessage } from "../../src/github/graphql/generated/types.ts";
import {
createRefMutation,
getRefTreeQuery,
getRepositoryMetadata,
} from "../../src/github/graphql/queries.js";
import { commitFilesFromBuffers } from "../../src/node.js";
import { ENV, REPO, ROOT_TEST_BRANCH_PREFIX, log } from "./env.js";
import { deleteBranches, waitForGitHubToBeReady } from "./util.js";
} from "../../src/github/graphql/queries.ts";
import { commitFilesFromBuffers } from "../../src/node.ts";
import { ENV, REPO, ROOT_TEST_BRANCH_PREFIX, log } from "./env.ts";
import { deleteBranches, waitForGitHubToBeReady } from "./util.ts";

// TODO: re-enable strict tree tests when GitHub have addressed the createRef
// bug that's currently used in integration tests
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
deleteRefMutation,
getRepositoryMetadata,
GitHubClient,
type GitHubClient,
} from "../../src/github/graphql/queries.js";
import { REPO } from "./env.js";

Expand Down
22 changes: 0 additions & 22 deletions tsconfig.base.json

This file was deleted.

21 changes: 15 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
"extends": "./tsconfig.base.json",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"types": ["node"],
"rootDir": ".",
"outDir": "dist"
"allowImportingTsExtensions": true,
"erasableSyntaxOnly": true,
"verbatimModuleSyntax": true,
"strict": true,
"noEmit": true,
"lib": [
"ES2024",
"ES2025.Promise",
"ESNext.Array",
"ESNext.Collection",
"ESNext.Iterator"
],
"types": ["node"]
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
"include": ["./"]
}
8 changes: 0 additions & 8 deletions tsconfig.lint.json

This file was deleted.