Skip to content

Commit 072615e

Browse files
authored
Merge pull request #57 from Tatsinnit/fix/dependencies
Update packages, vscode engine and associated changes.
2 parents 6721cc8 + 023cb1e commit 072615e

File tree

11 files changed

+3318
-504
lines changed

11 files changed

+3318
-504
lines changed

package-lock.json

Lines changed: 3227 additions & 446 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"publisher": "getporter",
88
"icon": "resources/porter.png",
99
"engines": {
10-
"vscode": "^1.30.0"
10+
"vscode": "^1.74.0"
1111
},
1212
"license": "Apache 2.0",
1313
"categories": [
@@ -256,33 +256,35 @@
256256
"vscode:prepublish": "npm run compile",
257257
"compile": "tsc -p ./",
258258
"watch": "tsc -watch -p ./",
259-
"postinstall": "node ./node_modules/vscode/bin/install",
260-
"test": "npm run compile && node ./node_modules/vscode/bin/test"
259+
"test": "npm run compile && mocha -V && node ./out/test/index.js"
261260
},
262261
"extensionDependencies": [
263262
"redhat.vscode-yaml"
264263
],
265264
"dependencies": {
266-
"@types/shelljs": "^0.8.1",
265+
"@types/shelljs": "^0.8.11",
266+
"@vscode/debugadapter": "^1.58.0",
267+
"@vscode/extension-telemetry": "^0.6.2",
267268
"await-notify": "1.0.1",
268269
"cnabjs": "0.0.5",
270+
"eslint": "^8.30.0",
269271
"js-levenshtein": "^1.1.6",
270-
"mkdirp": "^0.5.1",
272+
"mkdirp": "^1.0.4",
271273
"shelljs": "^0.8.5",
272-
"tmp": "^0.0.33",
273-
"vscode-debugadapter": "^1.37.1",
274-
"vscode-extension-telemetry": "^0.1.2",
275-
"yaml-ast-parser": "0.0.43"
274+
"tmp": "^0.2.1",
275+
"yaml-ast-parser": "0.0.43",
276+
"vscode-test": "^1.5.2",
277+
"tslib": "^2.4.1"
276278
},
277279
"devDependencies": {
278-
"@types/js-levenshtein": "^1.1.0",
279-
"@types/mkdirp": "^0.5.2",
280-
"@types/mocha": "^2.2.42",
281-
"@types/node": "10.12.25",
282-
"@types/tmp": "0.0.33",
283-
"tslint": "^5.8.0",
284-
"typescript": "^3.6.4",
285-
"vscode": "^1.1.37"
280+
"@types/js-levenshtein": "^1.1.1",
281+
"@types/mkdirp": "^0.5.1",
282+
"@types/mocha": "^10.0.1",
283+
"mocha": "^9.0.2",
284+
"@types/node": "18.11.17",
285+
"@types/tmp": "0.2.3",
286+
"@types/vscode": "^1.74.0",
287+
"typescript": "^4.9.4"
286288
},
287289
"repository": {
288290
"type": "git",

src/debugger/install-session.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
TerminatedEvent, StoppedEvent, OutputEvent,
55
Scope, Source, StackFrame, Thread, Handles,
66
Breakpoint, BreakpointEvent, InitializedEvent
7-
} from 'vscode-debugadapter';
8-
import { DebugProtocol } from 'vscode-debugprotocol';
7+
} from '@vscode/debugadapter';
8+
import { DebugProtocol } from '@vscode/debugprotocol';
99
import { basename } from 'path';
1010
import { PorterInstallRuntime } from './runtime';
1111
import {

src/diagnostics/codeactionprovider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class PorterCodeActionProvider implements vscode.CodeActionProvider {
2121
return [];
2222
}
2323

24-
const actions = linters.map((l) => l.fixes(document, manifest, context.diagnostics));
24+
const diagnostics = context.diagnostics;
25+
const actions = linters.map((l) => l.fixes(document, manifest, diagnostics.flat()));
2526
return flatten(...actions);
2627
}
2728
}

src/explorer/installation/installation-explorer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ export class InstallationExplorer implements vscode.TreeDataProvider<Installatio
3838
return installations.result.map((i) => new InstallationNode(this.shell, i));
3939
}
4040

41-
refresh(): CommandResult {
42-
this.onDidChangeEmitter.fire();
41+
async refresh(): Promise<CommandResult> {
42+
(await this.rootNodes()).forEach((element: InstallationExplorerTreeNode) => {
43+
this.onDidChangeEmitter.fire(element);
44+
});
4345
return CommandResult.Succeeded;
4446
}
4547
}

src/telemetry/telemetry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import TelemetryReporter from 'vscode-extension-telemetry';
1+
import TelemetryReporter from '@vscode/extension-telemetry';
22
import vscode = require('vscode');
33

44
export let reporter: TelemetryReporter | undefined;

src/test/extension.test.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/test/index.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
//
2-
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
3-
//
4-
// This file is providing the test runner to use when running extension tests.
5-
// By default the test runner in use is Mocha based.
6-
//
7-
// You can provide your own test runner if you want to override it by exporting
8-
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
9-
// host can call to run the tests. The test runner is expected to use console.log
10-
// to report the results back to the caller. When the tests are finished, return
11-
// a possible error to the callback or null if none.
1+
import * as path from 'path';
2+
import { runTests } from 'vscode-test';
123

13-
import * as testRunner from 'vscode/lib/testrunner';
4+
async function main() {
5+
try {
6+
// The folder containing the Extension Manifest package.json
7+
// Passed to `--extensionDevelopmentPath`
8+
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
149

15-
// You can directly control Mocha options by uncommenting the following lines
16-
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
17-
testRunner.configure({
18-
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
19-
useColors: true // colored output from test results
20-
});
10+
// The path to test runner
11+
// Passed to --extensionTestsPath
12+
const extensionTestsPath = path.resolve(__dirname, './suite/index');
2113

22-
module.exports = testRunner;
14+
// Download VS Code, unzip it and run the integration test
15+
await runTests({ extensionDevelopmentPath, extensionTestsPath });
16+
} catch (err) {
17+
console.error('Failed to run tests');
18+
process.exit(1);
19+
}
20+
}
21+
22+
main();

src/test/suite/index.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import * as path from 'path';
2+
import * as Mocha from 'mocha';
3+
import * as glob from 'glob';
4+
5+
export function run(): Promise<void> {
6+
// Create the mocha test
7+
const mocha = new Mocha({
8+
ui: 'tdd'
9+
});
10+
11+
const testsRoot = path.resolve(__dirname);
12+
13+
return new Promise((c, e) => {
14+
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
15+
if (err) {
16+
return e(err);
17+
}
18+
19+
// Add files to the test suite
20+
files.forEach((f) => {
21+
mocha.addFile(path.resolve(testsRoot, f));
22+
console.log(`Added file : ${f} to the test suite.`);
23+
});
24+
25+
try {
26+
// Run the mocha test
27+
mocha.run((failures) => {
28+
if (failures > 0) {
29+
e(new Error(`${failures} tests failed.`));
30+
} else {
31+
console.log("Test passed.");
32+
c();
33+
}
34+
});
35+
} catch (err) {
36+
console.error(err);
37+
e(err);
38+
}
39+
});
40+
});
41+
}

src/utils/manifestselection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ async function porterFolders(): Promise<readonly string[]> {
4141
return [];
4242
}
4343

44-
const matches = await folders.filterAsync(async (f) => await fs.exists(path.join(f.uri.fsPath, 'porter.yaml')));
45-
return matches.map((f) => f.uri.fsPath);
44+
const matches = folders.filter(async (f: { uri: { fsPath: string; }; }) => await fs.exists(path.join(f.uri.fsPath, 'porter.yaml')));
45+
return matches.map((f: { uri: { fsPath: any; }; }) => f.uri.fsPath);
4646
}

src/utils/shell.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function execCore(cmd: string, opts: any, stdin?: string): Promise<ShellResult>
136136
return new Promise<ShellResult>((resolve, reject) => {
137137
const proc = shelljs.exec(cmd, opts, (code, stdout, stderr) => resolve({ code: code, stdout: stdout, stderr: stderr }));
138138
if (stdin) {
139-
proc.stdin.end(stdin);
139+
proc.stdin?.end(stdin);
140140
}
141141
});
142142
}

0 commit comments

Comments
 (0)