Skip to content

Commit 9f5aa92

Browse files
authored
Merge pull request #246 from ysk8hori/fix-await
fix: コメントに [object: Promise] と投稿される件を修正
2 parents 74656a9 + fe0a1fd commit 9f5aa92

14 files changed

+33
-547
lines changed

.github/workflows/test-dummy_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
1414
- name: Delta Typescript Graph
1515
id: tsg
16-
uses: ysk8hori/delta-typescript-graph-action@8ca233742696fdeadc7e057ff1772f8bd354d437
16+
uses: ysk8hori/delta-typescript-graph-action@44b8652261a2d95e733bdc7068bde410ab7df09f
1717
with:
1818
access-token: ${{ secrets.GITHUB_TOKEN }}
1919
tsconfig: './dummy_project/tsconfig-dummy.json'

.github/workflows/test-no-params.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
14-
- uses: ysk8hori/delta-typescript-graph-action@8ca233742696fdeadc7e057ff1772f8bd354d437
14+
- uses: ysk8hori/delta-typescript-graph-action@44b8652261a2d95e733bdc7068bde410ab7df09f
1515
with:
1616
max-size: 50

.github/workflows/test-with-params.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
1414
- name: Delta Typescript Graph
1515
id: tsg
16-
uses: ysk8hori/delta-typescript-graph-action@8ca233742696fdeadc7e057ff1772f8bd354d437
16+
uses: ysk8hori/delta-typescript-graph-action@44b8652261a2d95e733bdc7068bde410ab7df09f
1717
with:
1818
access-token: ${{ secrets.GITHUB_TOKEN }}
1919
tsconfig-root: './'

dist/index.js

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -237868,15 +237868,6 @@ function applyMutualDifferences(fullBaseGraph, fullHeadGraph, context) {
237868237868

237869237869
"use strict";
237870237870

237871-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
237872-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
237873-
return new (P || (P = Promise))(function (resolve, reject) {
237874-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
237875-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
237876-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
237877-
step((generator = generator.apply(thisArg, _arguments || [])).next());
237878-
});
237879-
};
237880237871
var __importDefault = (this && this.__importDefault) || function (mod) {
237881237872
return (mod && mod.__esModule) ? mod : { "default": mod };
237882237873
};
@@ -237889,26 +237880,24 @@ const applyMutualDifferences_1 = __importDefault(__nccwpck_require__(57938));
237889237880
* ファイルの削除またはリネームがある場合は Graph を2つ表示する
237890237881
*/
237891237882
function build2GraphsMessage(fullBaseGraph, fullHeadGraph, context) {
237892-
return __awaiter(this, void 0, void 0, function* () {
237893-
const { baseGraph, headGraph, tsgCommand } = (0, applyMutualDifferences_1.default)(fullBaseGraph, fullHeadGraph, context);
237894-
if (baseGraph.nodes.length === 0 && headGraph.nodes.length === 0) {
237895-
// base と head のグラフが空の場合は表示しない
237896-
return 'The graph is empty.\n\n';
237897-
}
237898-
if (baseGraph.nodes.length > (0, config_1.getMaxSize)() ||
237899-
headGraph.nodes.length > (0, config_1.getMaxSize)()) {
237900-
// base または head のグラフが大きすぎる場合は表示しない
237901-
return buildGraphSizeExceededMessage(baseGraph, headGraph, tsgCommand);
237902-
}
237903-
// base の書き出し
237904-
const baseLines = [];
237905-
const orientation = (0, config_1.getOrientation)();
237906-
yield (0, typescript_graph_1.mermaidify)((arg) => baseLines.push(arg), baseGraph, orientation);
237907-
// head の書き出し
237908-
const headLines = [];
237909-
yield (0, typescript_graph_1.mermaidify)((arg) => headLines.push(arg), headGraph, orientation);
237910-
return buildNormal2GraphMessage(tsgCommand, baseLines, headLines);
237911-
});
237883+
const { baseGraph, headGraph, tsgCommand } = (0, applyMutualDifferences_1.default)(fullBaseGraph, fullHeadGraph, context);
237884+
if (baseGraph.nodes.length === 0 && headGraph.nodes.length === 0) {
237885+
// base と head のグラフが空の場合は表示しない
237886+
return 'The graph is empty.\n\n';
237887+
}
237888+
if (baseGraph.nodes.length > (0, config_1.getMaxSize)() ||
237889+
headGraph.nodes.length > (0, config_1.getMaxSize)()) {
237890+
// base または head のグラフが大きすぎる場合は表示しない
237891+
return buildGraphSizeExceededMessage(baseGraph, headGraph, tsgCommand);
237892+
}
237893+
// base の書き出し
237894+
const baseLines = [];
237895+
const orientation = (0, config_1.getOrientation)();
237896+
(0, typescript_graph_1.mermaidify)((arg) => baseLines.push(arg), baseGraph, orientation);
237897+
// head の書き出し
237898+
const headLines = [];
237899+
(0, typescript_graph_1.mermaidify)((arg) => headLines.push(arg), headGraph, orientation);
237900+
return buildNormal2GraphMessage(tsgCommand, baseLines, headLines);
237912237901
}
237913237902
function buildNormal2GraphMessage(tsgCommand, baseLines, headLines) {
237914237903
return `

src/graph/__snapshots__/output2Graphs.test.ts.snap

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/graph/__snapshots__/outputGraph.test.ts.snap

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/graph/build2GraphsMessage.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const e: Node = {
3030
changeStatus: 'not_modified',
3131
};
3232

33-
test('削除がある場合', async () => {
33+
test('削除がある場合', () => {
3434
const base: Graph = {
3535
nodes: [a, b, c, d, e],
3636
relations: [
@@ -84,7 +84,7 @@ test('削除がある場合', async () => {
8484
],
8585
};
8686
const context = getDummyContext();
87-
const result = await build2GraphsMessage(base, head, {
87+
const result = build2GraphsMessage(base, head, {
8888
...context,
8989
filesChanged: {
9090
created: [],

src/graph/build2GraphsMessage.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import applyMutualDifferences from './applyMutualDifferences';
77
/**
88
* ファイルの削除またはリネームがある場合は Graph を2つ表示する
99
*/
10-
export async function build2GraphsMessage(
10+
export function build2GraphsMessage(
1111
fullBaseGraph: Graph,
1212
fullHeadGraph: Graph,
1313
context: Context,
14-
): Promise<string> {
14+
): string {
1515
const { baseGraph, headGraph, tsgCommand } = applyMutualDifferences(
1616
fullBaseGraph,
1717
fullHeadGraph,
@@ -34,19 +34,11 @@ export async function build2GraphsMessage(
3434
// base の書き出し
3535
const baseLines: string[] = [];
3636
const orientation = getOrientation();
37-
await mermaidify(
38-
(arg: string) => baseLines.push(arg),
39-
baseGraph,
40-
orientation,
41-
);
37+
mermaidify((arg: string) => baseLines.push(arg), baseGraph, orientation);
4238

4339
// head の書き出し
4440
const headLines: string[] = [];
45-
await mermaidify(
46-
(arg: string) => headLines.push(arg),
47-
headGraph,
48-
orientation,
49-
);
41+
mermaidify((arg: string) => headLines.push(arg), headGraph, orientation);
5042

5143
return buildNormal2GraphMessage(tsgCommand, baseLines, headLines);
5244
}

src/graph/buildGraphMessage.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ const e: Node = {
3030
changeStatus: 'not_modified',
3131
};
3232

33-
test('出力可能なグラフがない場合は何も出力しない', async () => {
33+
test('出力可能なグラフがない場合は何も出力しない', () => {
3434
const graph = {
3535
nodes: [],
3636
relations: [],
3737
};
3838
const context = getDummyContext();
39-
const message = await buildGraphMessage(graph, graph, context);
39+
const message = buildGraphMessage(graph, graph, context);
4040
expect(message).toBe('The graph is empty.\n\n');
4141
});
4242

43-
test('グラフが大きすぎる場合はその旨を出力する', async () => {
43+
test('グラフが大きすぎる場合はその旨を出力する', () => {
4444
const graphA: Graph = {
4545
nodes: [a, c, d, e],
4646
relations: [
@@ -88,7 +88,7 @@ test('グラフが大きすぎる場合はその旨を出力する', async () =>
8888
],
8989
};
9090
const context = getDummyContext();
91-
const message = await buildGraphMessage(graphA, graphB, {
91+
const message = buildGraphMessage(graphA, graphB, {
9292
...context,
9393
config: { ...context.config, maxSize: 1 },
9494
filesChanged: {
@@ -105,7 +105,7 @@ test('グラフが大きすぎる場合はその旨を出力する', async () =>
105105
expect(message).toMatchSnapshot();
106106
});
107107

108-
test('追加や依存の削除がある場合', async () => {
108+
test('追加や依存の削除がある場合', () => {
109109
const graphA: Graph = {
110110
nodes: [a, c, d, e],
111111
relations: [
@@ -153,7 +153,7 @@ test('追加や依存の削除がある場合', async () => {
153153
],
154154
};
155155
const context = getDummyContext();
156-
const message = await buildGraphMessage(graphA, graphB, {
156+
const message = buildGraphMessage(graphA, graphB, {
157157
...context,
158158
filesChanged: {
159159
created: [

src/graph/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)