Skip to content

Commit

Permalink
fix ignore node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
romgerman committed May 20, 2024
1 parent 37479be commit 400dfec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 6 additions & 2 deletions src/blueprint/nodes/aggregation/file-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ export class FileListNode extends BlueprintNode<{ ignoreNodeModules: boolean }>
}

if (isArrayOfType(array, ts.isSourceFile)) {
return array;
return this.filterNodeModules(array);
}

return array.map((n) => n.getSourceFile());
return this.filterNodeModules(array.map((n) => n.getSourceFile()));
}

private filterNodeModules(array: ts.SourceFile[]): ts.SourceFile[] {
return array.filter((sf) => (this.state?.ignoreNodeModules ? !sf.fileName.includes("/node_modules") : true));
}

private getFileNames(array: ts.SourceFile[]): string[] {
Expand Down
12 changes: 4 additions & 8 deletions src/webview/nodes/actions/RenameFileActionNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@

<script setup lang="ts">
import { ref } from "vue";
import { Handle, Position, useNode } from "@vue-flow/core";
import { useEventCommandResult } from "@/webview/event-utils";
import { GraphNodeSendViewData } from "@/shared/events";
import { Handle, Position } from "@vue-flow/core";
import NodeWrapper from "../NodeWrapper.vue";
import { useViewData } from "@/webview/composables/use-view-data";
const { id: nodeId } = useNode();
const names = ref<string[]>([]);
useEventCommandResult<GraphNodeSendViewData, { id: string; data: string[] }>("graph:node-send-view-data", ({ id, data }) => {
if (id === nodeId) {
names.value = data;
}
useViewData<string[]>((data) => {
names.value = data;
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/webview/nodes/aggregation/FileListNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ file }}
</div>
<div class="font-bold" v-if="greaterThanMaxItems">and {{ otherItemsCount }} more</div>
<vscode-checkbox :checked="model.ignoreNodeModules" @change="model.ignoreNodeModules = !model.ignoreNodeModules">
<vscode-checkbox :checked="model.ignoreNodeModules" @change="event => model.ignoreNodeModules = event.target.checked">
Ignore
<pre style="display: inline;">node_modules</pre>
</vscode-checkbox>
Expand Down

0 comments on commit 400dfec

Please sign in to comment.