Skip to content

Commit 33908cf

Browse files
committed
Refactoring: Moved showComponentHierarchy to its own folder
1 parent a1c955d commit 33908cf

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/commands/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export * from './componentHierarchyDgml';
22
export * from './listAllImports';
33
export * from './packageJsonToMarkdown';
44
export * from './projectDirectoryStructure';
5-
export * from './showComponentHierarchy';
5+
export * from './showComponentHierarchy/showComponentHierarchy';
File renamed without changes.

src/commands/showComponentHierarchy.ts renamed to src/commands/showComponentHierarchy/showComponentHierarchy.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from 'vscode';
22
import * as fs from 'fs';
33
import * as path from 'path';
4-
import { FileSystemUtils } from "../filesystemUtils";
4+
import { FileSystemUtils } from "../../filesystemUtils";
55

66
class Component {
77

@@ -95,10 +95,10 @@ export class ShowComponentHierarchy {
9595

9696
try {
9797
const jsContent = this.generateJavascriptContent(nodesJson, rootNodesJson, edgesJson);
98-
const outputJsFilename = 'showComponentHierarchy.js';
98+
const outputJsFilename = 'showComponentHierarchy/showComponentHierarchy.js';
9999
let htmlContent = this.generateHtmlContent(webview, outputJsFilename);
100100

101-
// fsUtils.writeFile(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', 'showComponentHierarchy.html')), htmlContent, () => { } ); // For debugging
101+
fsUtils.writeFile(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', 'showComponentHierarchy/showComponentHierarchy.html')), htmlContent, () => { } ); // For debugging
102102
fsUtils.writeFile(
103103
this.extensionContext?.asAbsolutePath(path.join('src', 'commands', outputJsFilename)),
104104
jsContent,
@@ -222,7 +222,7 @@ export class ShowComponentHierarchy {
222222
}
223223

224224
private generateJavascriptContent(nodesJson: string, rootNodesJson: string, edgesJson: string): string {
225-
const templateJsFilename = 'showComponentHierarchy_Template.js';
225+
const templateJsFilename = 'showComponentHierarchy/showComponentHierarchy_Template.js';
226226
let template = fs.readFileSync(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', templateJsFilename)), 'utf8');
227227
let jsContent = template.replace('var nodes = new vis.DataSet([]);', `var nodes = new vis.DataSet([${nodesJson}]);`);
228228
jsContent = jsContent.replace('var rootNodes = [];', `var rootNodes = [${rootNodesJson}];`);
@@ -231,14 +231,14 @@ export class ShowComponentHierarchy {
231231
}
232232

233233
private generateHtmlContent(webview: vscode.Webview, outputJsFilename: string): string {
234-
const templateHtmlFilename = 'showComponentHierarchy_Template.html';
234+
const templateHtmlFilename = 'showComponentHierarchy/showComponentHierarchy_Template.html';
235235
let htmlContent = fs.readFileSync(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', templateHtmlFilename)), 'utf8');
236236

237-
const visPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'src', 'commands', 'vis-network.min.js');
237+
const visPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'src', 'commands', 'showComponentHierarchy/vis-network.min.js');
238238
const visUri = webview.asWebviewUri(visPath);
239239
htmlContent = htmlContent.replace('vis-network.min.js', visUri.toString());
240240

241-
const cssPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'src', 'commands', 'showComponentHierarchy.css');
241+
const cssPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'src', 'commands', 'showComponentHierarchy/showComponentHierarchy.css');
242242
const cssUri = webview.asWebviewUri(cssPath);
243243
htmlContent = htmlContent.replace('showComponentHierarchy.css', cssUri.toString());
244244

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)