Skip to content

Commit 51bffe6

Browse files
author
Amelia Wattenbeger
committed
add excluded paths arg
1 parent 440338a commit 51bffe6

File tree

6 files changed

+28
-8
lines changed

6 files changed

+28
-8
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,19 @@ A GitHub Action that creates an SVG diagram of your repo.
66

77
## `output_file`
88

9-
A path (relative to the root of your repo) to where you would like the diagram to live. For example: images/diagram.svg. Default: diagram.svg
9+
A path (relative to the root of your repo) to where you would like the diagram to live.
10+
11+
For example: images/diagram.svg
12+
13+
Default: diagram.svg
14+
15+
## `excluded_paths`
16+
17+
A list of paths to exclude from the diagram.
18+
19+
For example: dist
20+
21+
Default: ""
1022

1123
## Example usage
1224

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
output_file:
66
description: "A path (relative to the root of your repo) to where you would like the diagram to live. For example: images/diagram.svg. Default: diagram.svg"
77
required: false
8+
excluded_paths:
9+
description: "A list of paths to exclude from the diagram. For example: dist"
10+
required: false
811
runs:
912
using: "node12"
1013
main: "index.js"

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10153,7 +10153,7 @@ var import_fs2 = __toModule(require("fs"));
1015310153

1015410154
// src/process-dir.js
1015510155
var import_fs = __toModule(require("fs"));
10156-
var processDir = async (rootPath) => {
10156+
var processDir = async (rootPath, excludedPaths = []) => {
1015710157
if (!rootPath) {
1015810158
console.log("no rootPath specified");
1015910159
return;
@@ -10171,7 +10171,8 @@ var processDir = async (rootPath) => {
1017110171
".git",
1017210172
".vscode",
1017310173
"package-lock.json",
10174-
"yarn.lock"
10174+
"yarn.lock",
10175+
...excludedPaths
1017510176
];
1017610177
const fullPathFoldersToIgnore = foldersToIgnore.map((d) => `${rootPath}/${d}`);
1017710178
const getFileStats = async (path = "") => {
@@ -15072,7 +15073,8 @@ var main = async () => {
1507215073
1507315074
]);
1507415075
core.endGroup();
15075-
const data = await processDir(`./`);
15076+
const excludedPaths = core.getInput("excluded_paths") || [];
15077+
const data = await processDir(`./`, excludedPaths);
1507615078
const componentCodeString = import_server.default.renderToStaticMarkup(/* @__PURE__ */ import_react3.default.createElement(Tree, {
1507715079
data
1507815080
}));

src/Tree.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
pack,
99
scaleLinear,
1010
timeDay,
11-
timeFormat,
1211
} from "d3";
1312
import { FileType } from "./types";
1413
import countBy from "lodash/countBy";

src/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ const main = async () => {
2323
core.endGroup()
2424

2525

26-
const data = await processDir(`./`);
26+
const excludedPaths = core.getInput("excluded_paths") || []
27+
const data = await processDir(`./`, excludedPaths);
2728

28-
const componentCodeString = ReactDOMServer.renderToStaticMarkup(<Tree data={data} />);
29+
const componentCodeString = ReactDOMServer.renderToStaticMarkup(
30+
<Tree data={data} />
31+
);
2932

3033
const outputFile = core.getInput("output_file") || "./diagram.svg"
3134

src/process-dir.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from "fs";
22

3-
export const processDir = async (rootPath) => {
3+
export const processDir = async (rootPath, excludedPaths = []) => {
44
if (!rootPath) {
55
console.log("no rootPath specified");
66
return;
@@ -20,6 +20,7 @@ export const processDir = async (rootPath) => {
2020
".vscode",
2121
"package-lock.json",
2222
"yarn.lock",
23+
...excludedPaths,
2324
];
2425
const fullPathFoldersToIgnore = foldersToIgnore.map((d) =>
2526
`${rootPath}/${d}`

0 commit comments

Comments
 (0)