Skip to content

Commit 689ea3b

Browse files
committed
Moved the showComponentHierarchy templates out of the command folder and in to their own folders to make sure they are included in the vsix package
1 parent bb17ea5 commit 689ea3b

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed
File renamed without changes.

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/showComponentHierarchy';
5+
export * from './showComponentHierarchy';

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

Lines changed: 9 additions & 9 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
import { Base64 } from 'js-base64';
66

77
class Component {
@@ -109,10 +109,10 @@ export class ShowComponentHierarchy {
109109

110110
try {
111111
const jsContent = this.generateJavascriptContent(nodesJson, rootNodesJson, edgesJson);
112-
const outputJsFilename = 'showComponentHierarchy/showComponentHierarchy.js';
112+
const outputJsFilename = 'showComponentHierarchy.js';
113113
let htmlContent = this.generateHtmlContent(webview, outputJsFilename);
114114

115-
this.fsUtils.writeFile(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', 'showComponentHierarchy/showComponentHierarchy.html')), htmlContent, () => { }); // For debugging
115+
this.fsUtils.writeFile(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', 'showComponentHierarchy.html')), htmlContent, () => { }); // For debugging
116116
this.fsUtils.writeFile(
117117
this.extensionContext?.asAbsolutePath(path.join('src', 'commands', outputJsFilename)),
118118
jsContent,
@@ -236,23 +236,23 @@ export class ShowComponentHierarchy {
236236
}
237237

238238
private generateJavascriptContent(nodesJson: string, rootNodesJson: string, edgesJson: string): string {
239-
const templateJsFilename = 'showComponentHierarchy/showComponentHierarchy_Template.js';
240-
let template = fs.readFileSync(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', templateJsFilename)), 'utf8');
239+
const templateJsFilename = 'showComponentHierarchy_Template.js';
240+
let template = fs.readFileSync(this.extensionContext?.asAbsolutePath(path.join('templates', templateJsFilename)), 'utf8');
241241
let jsContent = template.replace('var nodes = new vis.DataSet([]);', `var nodes = new vis.DataSet([${nodesJson}]);`);
242242
jsContent = jsContent.replace('var rootNodes = [];', `var rootNodes = [${rootNodesJson}];`);
243243
jsContent = jsContent.replace('var edges = new vis.DataSet([]);', `var edges = new vis.DataSet([${edgesJson}]);`);
244244
return jsContent;
245245
}
246246

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

251-
const visPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'src', 'commands', 'showComponentHierarchy/vis-network.min.js');
251+
const visPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'javascript', 'vis-network.min.js');
252252
const visUri = webview.asWebviewUri(visPath);
253253
htmlContent = htmlContent.replace('vis-network.min.js', visUri.toString());
254254

255-
const cssPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'src', 'commands', 'showComponentHierarchy/showComponentHierarchy.css');
255+
const cssPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'stylesheet', 'showComponentHierarchy.css');
256256
const cssUri = webview.asWebviewUri(cssPath);
257257
htmlContent = htmlContent.replace('showComponentHierarchy.css', cssUri.toString());
258258

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

0 commit comments

Comments
 (0)