Skip to content

Commit

Permalink
chore: Refactor to put sourcing logic in a separate package
Browse files Browse the repository at this point in the history
Signed-off-by: Yoriyasu Yano <[email protected]>
  • Loading branch information
yorinasub17 committed Oct 25, 2023
1 parent b44ab5e commit 6703289
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/engine/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Copyright (c) Fensak, LLC.
// SPDX-License-Identifier: AGPL-3.0-or-later OR BUSL-1.1

/**
* engine
* Contains the core implementation for the JavaScript based rules engine.
*/

export * from "./compile.ts";
export * from "./from.ts";
export * from "./from_github.ts";
export * from "./interpreter.ts";
export * from "./patch.ts";
export * from "./patch_types.ts";
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
// SPDX-License-Identifier: AGPL-3.0-or-later OR BUSL-1.1

export * from "./engine/index.ts";
export * from "./sourcer/index.ts";
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { expect, test } from "@jest/globals";
import { Octokit } from "@octokit/rest";

import { IPatch, PatchOp, LineOp } from "../engine/patch_types.ts";

import {
IGitHubRepository,
patchFromGitHubPullRequest,
} from "./from_github.ts";
import { IPatch, PatchOp, LineOp } from "./patch_types.ts";

const maybeToken = process.env.GITHUB_TOKEN;
let octokit: Octokit;
Expand Down
5 changes: 3 additions & 2 deletions src/engine/from_github.ts → src/sourcer/from_github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
extract as extractFrontMatter,
} from "@fensak-io/front-matter";

import { parseUnifiedDiff } from "./patch.ts";
import { parseUnifiedDiff } from "../engine/patch.ts";
import {
ILinkedPR,
IChangeSetMetadata,
IPatch,
PatchOp,
} from "./patch_types.ts";
} from "../engine/patch_types.ts";

import { SourcePlatform } from "./from.ts";

const crypto = nodecrypto.webcrypto;
Expand Down
10 changes: 10 additions & 0 deletions src/sourcer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) Fensak, LLC.
// SPDX-License-Identifier: AGPL-3.0-or-later OR BUSL-1.1

/**
* sourcer
* Contains functions and utilities for sourcing patch information from different sources, such as GitHub and GitLab.
*/

export * from "./from.ts";
export * from "./from_github.ts";

0 comments on commit 6703289

Please sign in to comment.