Skip to content

Commit 4a9d605

Browse files
committed
Fix relative paths in source now that extension is bundled
Since bundling produces a single (bundled) file at `out/main.js` all the relative paths that expected `out/src/...` needed to drop one set of `../` to be correct. We cannot emit the bundled extension to `out/src/main.js` because, as mentioned previously, we still must transpile everything for the unit tests, so `out/src/` is already full.
1 parent d6446de commit 4a9d605

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/features/Examples.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ExamplesFeature implements vscode.Disposable {
99
private examplesPath: string;
1010

1111
constructor() {
12-
this.examplesPath = path.resolve(__dirname, "../../../examples");
12+
this.examplesPath = path.resolve(__dirname, "../../examples");
1313
this.command = vscode.commands.registerCommand("PowerShell.OpenExamplesFolder", () => {
1414
vscode.commands.executeCommand(
1515
"vscode.openFolder",

src/features/PesterTests.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class PesterTestsFeature implements vscode.Disposable {
1818
private invokePesterStubScriptPath: string;
1919

2020
constructor(private sessionManager: SessionManager) {
21-
this.invokePesterStubScriptPath = path.resolve(__dirname, "../../../modules/PowerShellEditorServices/InvokePesterStub.ps1");
21+
this.invokePesterStubScriptPath = path.resolve(__dirname, "../../modules/PowerShellEditorServices/InvokePesterStub.ps1");
2222

2323
// File context-menu command - Run Pester Tests
2424
this.command = vscode.commands.registerCommand(

src/logging.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class Logger implements ILogger {
4040
constructor() {
4141
this.logChannel = vscode.window.createOutputChannel("PowerShell Extension Logs");
4242

43-
this.logBasePath = path.resolve(__dirname, "../../logs");
43+
this.logBasePath = path.resolve(__dirname, "../logs");
4444
utils.ensurePathExists(this.logBasePath);
4545

4646
this.commands = [

src/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { LanguageClientConsumer } from "./languageClientConsumer";
3636

3737
// The most reliable way to get the name and version of the current extension.
3838
// tslint:disable-next-line: no-var-requires
39-
const PackageJSON: any = require("../../package.json");
39+
const PackageJSON: any = require("../package.json");
4040

4141
// the application insights key (also known as instrumentation key) used for telemetry.
4242
const AI_KEY: string = "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217";
@@ -197,7 +197,7 @@ function checkForUpdatedVersion(context: vscode.ExtensionContext, version: strin
197197
if (choice === showReleaseNotes) {
198198
vscode.commands.executeCommand(
199199
"markdown.showPreview",
200-
vscode.Uri.file(path.resolve(__dirname, "../../CHANGELOG.md")));
200+
vscode.Uri.file(path.resolve(__dirname, "../CHANGELOG.md")));
201201
}
202202
});
203203
}

src/settings.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export function load(): ISettings {
157157

158158
const defaultDeveloperSettings: IDeveloperSettings = {
159159
featureFlags: [],
160-
bundledModulesPath: "../../../PowerShellEditorServices/module",
160+
bundledModulesPath: "../../PowerShellEditorServices/module",
161161
editorServicesLogLevel: "Normal",
162162
editorServicesWaitForDebugger: false,
163163
waitForSessionFileTimeoutSeconds: 240,
@@ -234,7 +234,7 @@ export function load(): ISettings {
234234
promptToUpdatePackageManagement:
235235
configuration.get<boolean>("promptToUpdatePackageManagement", true),
236236
bundledModulesPath:
237-
"../../modules",
237+
"../modules",
238238
useX86Host:
239239
configuration.get<boolean>("useX86Host", false),
240240
enableProfileLoading:

test/features/CustomViews.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ hello
7070
content: "console.log('asdf');",
7171
},
7272
{
73-
fileName: "../testCustomViews.js",
73+
fileName: "../../testCustomViews.js",
7474
content: "console.log('asdf');",
7575
},
7676
],
7777
cssFiles: [],
7878
expectedHtmlString: `<html><head></head><body>
7979
hello
8080
<script src="${convertToVSCodeResourceScheme(path.join(__dirname, "testCustomViews.js"))}"></script>
81-
<script src="${convertToVSCodeResourceScheme(path.join(__dirname, "../testCustomViews.js"))}"></script>
81+
<script src="${convertToVSCodeResourceScheme(path.join(__dirname, "../../testCustomViews.js"))}"></script>
8282
</body></html>`,
8383
},
8484

0 commit comments

Comments
 (0)