Skip to content

Commit 4044684

Browse files
authored
Merge pull request #14 from ysk8hori/12-duplicate-exclude-node_modules
fix: tsgコマンドのexcludeにnode_modulesが2つ出力される件を修正
2 parents 174c988 + a5eb204 commit 4044684

File tree

7 files changed

+21
-24
lines changed

7 files changed

+21
-24
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
14-
- uses: ysk8hori/delta-typescript-graph-action@5ff73e88adec73915862a2d2c0080b9196e3a9f7
14+
- uses: ysk8hori/delta-typescript-graph-action@71cfddc120d657edf7c951f4f7fd9db5cd080410

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jobs:
1313
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
1414
- name: Delta Typescript Graph
1515
id: tsg
16-
uses: ysk8hori/delta-typescript-graph-action@5ff73e88adec73915862a2d2c0080b9196e3a9f7
16+
uses: ysk8hori/delta-typescript-graph-action@71cfddc120d657edf7c951f4f7fd9db5cd080410
1717
with:
1818
access-token: ${{ secrets.GITHUB_TOKEN }}
1919
tsconfig-root: './src'
2020
max-size: 3
2121
orientation: LR
2222
debug: true
2323
in-details: true
24-
exclude: 'node_modules, test'
24+
exclude: 'test'
2525
include-index-file-dependencies: true

dist/index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216404,7 +216404,7 @@ function applyMutualDifferences(created, deleted, modified, renamed, fullBaseGra
216404216404
(0, log_1.log)('includes:', includes);
216405216405
const abstractionTargetsForBase = (0, remeda_1.pipe)(includes, extractNoAbstractionDirs_1.default, dirs => (0, extractAbstractionTarget_1.default)(dirs, fullBaseGraph));
216406216406
(0, log_1.log)('abstractionTargetsForBase:', abstractionTargetsForBase);
216407-
const baseGraph = (0, remeda_1.pipe)(fullBaseGraph, graph => (0, filterGraph_1.filterGraph)(includes, ['node_modules', ...(0, config_1.exclude)()], graph), graph => ((0, log_1.log)('filtered base graph.nodes.length:', graph.nodes.length),
216407+
const baseGraph = (0, remeda_1.pipe)(fullBaseGraph, graph => (0, filterGraph_1.filterGraph)(includes, (0, config_1.exclude)(), graph), graph => ((0, log_1.log)('filtered base graph.nodes.length:', graph.nodes.length),
216408216408
(0, log_1.log)('filtered base graph.relations.length:', graph.relations.length),
216409216409
graph), graph => (0, abstraction_1.abstraction)(abstractionTargetsForBase, graph), graph => ((0, log_1.log)('abstracted base graph.nodes.length:', graph.nodes.length),
216410216410
(0, log_1.log)('abstracted base graph.relations.length:', graph.relations.length),
@@ -216413,7 +216413,7 @@ function applyMutualDifferences(created, deleted, modified, renamed, fullBaseGra
216413216413
(0, log_1.log)('baseGraph.relations.length:', baseGraph.relations.length);
216414216414
const abstractionTargetsForHead = (0, remeda_1.pipe)(includes, extractNoAbstractionDirs_1.default, dirs => (0, extractAbstractionTarget_1.default)(dirs, fullHeadGraph));
216415216415
(0, log_1.log)('abstractionTargetsForHead:', abstractionTargetsForHead);
216416-
const headGraph = (0, remeda_1.pipe)(fullHeadGraph, graph => (0, filterGraph_1.filterGraph)(includes, ['node_modules', ...(0, config_1.exclude)()], graph), graph => ((0, log_1.log)('filtered head graph.nodes.length:', graph.nodes.length),
216416+
const headGraph = (0, remeda_1.pipe)(fullHeadGraph, graph => (0, filterGraph_1.filterGraph)(includes, (0, config_1.exclude)(), graph), graph => ((0, log_1.log)('filtered head graph.nodes.length:', graph.nodes.length),
216417216417
(0, log_1.log)('filtered head graph.relations.length:', graph.relations.length),
216418216418
graph), graph => (0, abstraction_1.abstraction)(abstractionTargetsForHead, graph), graph => ((0, log_1.log)('abstracted head graph.nodes.length:', graph.nodes.length),
216419216419
(0, log_1.log)('abstracted head graph.relations.length:', graph.relations.length),
@@ -216422,7 +216422,7 @@ function applyMutualDifferences(created, deleted, modified, renamed, fullBaseGra
216422216422
(0, log_1.log)('headGraph.relations.length:', headGraph.relations.length);
216423216423
const tsgCommand = (0, createTsgCommand_1.createTsgCommand)({
216424216424
includes,
216425-
excludes: ['node_modules', ...(0, config_1.exclude)()],
216425+
excludes: (0, config_1.exclude)(),
216426216426
abstractions: (0, extractAbstractionTargetFromGraphs_1.extractAbstractionTargetFromGraphs)(baseGraph, headGraph),
216427216427
});
216428216428
return { baseGraph, headGraph, tsgCommand };
@@ -216713,7 +216713,7 @@ function mergeGraphsWithDifferences(fullBaseGraph, fullHeadGraph, created, delet
216713216713
(0, log_1.log)('includes:', includes);
216714216714
const abstractionTarget = (0, remeda_1.pipe)(includes, extractNoAbstractionDirs_1.default, dirs => (0, extractAbstractionTarget_1.default)(dirs, mergedGraph));
216715216715
(0, log_1.log)('abstractionTarget:', abstractionTarget);
216716-
const graph = (0, remeda_1.pipe)(mergedGraph, graph => (0, filterGraph_1.filterGraph)(includes, ['node_modules', ...(0, config_1.exclude)()], graph), graph => ((0, log_1.log)('filteredGraph.nodes.length:', graph.nodes.length),
216716+
const graph = (0, remeda_1.pipe)(mergedGraph, graph => (0, filterGraph_1.filterGraph)(includes, (0, config_1.exclude)(), graph), graph => ((0, log_1.log)('filteredGraph.nodes.length:', graph.nodes.length),
216717216717
(0, log_1.log)('filteredGraph.relations.length:', graph.relations.length),
216718216718
graph), graph => (0, abstraction_1.abstraction)(abstractionTarget, graph), graph => ((0, log_1.log)('abstractedGraph.nodes.length:', graph.nodes.length),
216719216719
(0, log_1.log)('abstractedGraph.relations.length:', graph.relations.length),
@@ -216722,7 +216722,7 @@ function mergeGraphsWithDifferences(fullBaseGraph, fullHeadGraph, created, delet
216722216722
graph));
216723216723
const tsgCommand = (0, createTsgCommand_1.createTsgCommand)({
216724216724
includes,
216725-
excludes: ['node_modules', ...(0, config_1.exclude)()],
216725+
excludes: (0, config_1.exclude)(),
216726216726
abstractions: (0, extractAbstractionTargetFromGraphs_1.extractAbstractionTargetFromGraphs)(graph),
216727216727
});
216728216728
return { graph, tsgCommand };
@@ -217038,6 +217038,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
217038217038
Object.defineProperty(exports, "__esModule", ({ value: true }));
217039217039
exports.isIncludeIndexFileDependencies = exports.exclude = exports.isInDetails = exports.isDebugEnabled = exports.getOrientation = exports.getMaxSize = exports.getTsconfigRoot = void 0;
217040217040
const core = __importStar(__nccwpck_require__(2186));
217041+
const reducer_1 = __nccwpck_require__(2021);
217041217042
/** tsconfig のルートディレクトリ */
217042217043
const TSCONFIG_ROOT = 'tsconfig-root';
217043217044
/** 変更ファイル数が多い場合にグラフの表示を抑止するが、その際のノード数を指定する値 */
@@ -217097,7 +217098,9 @@ function exclude() {
217097217098
.getInput(EXCLUDE)
217098217099
.split(',')
217099217100
.map(s => s.trim())
217100-
.filter(Boolean);
217101+
.filter(Boolean)
217102+
.with(0, 'node_modules') // デフォルトで node_modules を含める
217103+
.reduce(reducer_1.uniqueString, []);
217101217104
}
217102217105
exports.exclude = exclude;
217103217106
/** 変更対象のファイルが同階層の index.ts などから参照されている場合、その index.ts への依存ファイルも表示するかどうか */

src/graph/applyMutualDifferences.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function applyMutualDifferences(
4343
log('abstractionTargetsForBase:', abstractionTargetsForBase);
4444
const baseGraph = pipe(
4545
fullBaseGraph,
46-
graph => filterGraph(includes, ['node_modules', ...exclude()], graph),
46+
graph => filterGraph(includes, exclude(), graph),
4747
graph => (
4848
log('filtered base graph.nodes.length:', graph.nodes.length),
4949
log('filtered base graph.relations.length:', graph.relations.length),
@@ -68,7 +68,7 @@ export default function applyMutualDifferences(
6868
log('abstractionTargetsForHead:', abstractionTargetsForHead);
6969
const headGraph = pipe(
7070
fullHeadGraph,
71-
graph => filterGraph(includes, ['node_modules', ...exclude()], graph),
71+
graph => filterGraph(includes, exclude(), graph),
7272
graph => (
7373
log('filtered head graph.nodes.length:', graph.nodes.length),
7474
log('filtered head graph.relations.length:', graph.relations.length),
@@ -87,7 +87,7 @@ export default function applyMutualDifferences(
8787

8888
const tsgCommand = createTsgCommand({
8989
includes,
90-
excludes: ['node_modules', ...exclude()],
90+
excludes: exclude(),
9191
abstractions: extractAbstractionTargetFromGraphs(baseGraph, headGraph),
9292
});
9393

src/graph/mergeGraphsWithDifferences.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function mergeGraphsWithDifferences(
5252

5353
const graph = pipe(
5454
mergedGraph,
55-
graph => filterGraph(includes, ['node_modules', ...exclude()], graph),
55+
graph => filterGraph(includes, exclude(), graph),
5656
graph => (
5757
log('filteredGraph.nodes.length:', graph.nodes.length),
5858
log('filteredGraph.relations.length:', graph.relations.length),
@@ -74,7 +74,7 @@ export default function mergeGraphsWithDifferences(
7474

7575
const tsgCommand = createTsgCommand({
7676
includes,
77-
excludes: ['node_modules', ...exclude()],
77+
excludes: exclude(),
7878
abstractions: extractAbstractionTargetFromGraphs(graph),
7979
});
8080

src/utils/.test-danger-tsgrc.json

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

src/utils/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type mermaidify from '@ysk8hori/typescript-graph/dist/src/mermaidify';
22
import * as core from '@actions/core';
3+
import { uniqueString } from './reducer';
34

45
/** tsconfig のルートディレクトリ */
56
const TSCONFIG_ROOT = 'tsconfig-root';
@@ -63,7 +64,9 @@ export function exclude(): string[] {
6364
.getInput(EXCLUDE)
6465
.split(',')
6566
.map(s => s.trim())
66-
.filter(Boolean);
67+
.filter(Boolean)
68+
.with(0, 'node_modules') // デフォルトで node_modules を含める
69+
.reduce(uniqueString, []);
6770
}
6871

6972
/** 変更対象のファイルが同階層の index.ts などから参照されている場合、その index.ts への依存ファイルも表示するかどうか */

0 commit comments

Comments
 (0)