Skip to content

Commit

Permalink
typings: upgrade to @types/node@12
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
  • Loading branch information
paul-marechal committed Sep 28, 2020
1 parent af68b7c commit 025d633
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 55 deletions.
6 changes: 3 additions & 3 deletions dev-packages/application-manager/src/application-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class ApplicationProcess {
) { }

spawn(command: string, args?: string[], options?: cp.SpawnOptions): cp.ChildProcess {
return cp.spawn(command, args, Object.assign({}, this.defaultOptions, options));
return cp.spawn(command, args || [], Object.assign({}, this.defaultOptions, options));
}

fork(modulePath: string, args?: string[], options?: cp.ForkOptions): cp.ChildProcess {
Expand Down Expand Up @@ -60,8 +60,8 @@ export class ApplicationProcess {

protected promisify(command: string, p: cp.ChildProcess): Promise<void> {
return new Promise((resolve, reject) => {
p.stdout.on('data', data => this.pck.log(data.toString()));
p.stderr.on('data', data => this.pck.error(data.toString()));
p.stdout!.on('data', data => this.pck.log(data.toString()));
p.stderr!.on('data', data => this.pck.error(data.toString()));
p.on('error', reject);
p.on('close', (code, signal) => {
if (signal) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"node": ">=12.14.1 <13"
},
"resolutions": {
"**/@types/node": "~10.3.6",
"**/@types/node": "12",
"**/node-abi": "^2.18.0"
},
"devDependencies": {
"@types/chai-string": "^1.4.0",
"@types/jsdom": "^11.0.4",
"@types/node": "~10.3.6",
"@types/node": "12",
"@types/sinon": "^2.3.5",
"@types/temp": "^0.8.29",
"@types/uuid": "^7.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/node/messaging/ipc-connection-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export class IPCConnectionProvider {
}

const childProcess = cp.fork(path.resolve(__dirname, 'ipc-bootstrap.js'), options.args, forkOptions);
childProcess.stdout.on('data', data => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));
childProcess.stderr.on('data', data => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));
childProcess.stdout!.on('data', data => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));
childProcess.stderr!.on('data', data => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));

this.logger.debug(`[${options.serverName}: ${childProcess.pid}] IPC started`);
childProcess.once('exit', () => this.logger.debug(`[${options.serverName}: ${childProcess.pid}] IPC exited`));
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-dev/src/node/hosted-instance-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export abstract class AbstractHostedInstanceManager implements HostedInstanceMan
const line = data.toString();
const match = THEIA_INSTANCE_REGEX.exec(line);
if (match) {
this.hostedInstanceProcess.stdout.removeListener('data', outputListener);
this.hostedInstanceProcess.stdout!.removeListener('data', outputListener);
started = true;
resolve(new URI(match[1]));
}
Expand All @@ -312,12 +312,12 @@ export abstract class AbstractHostedInstanceManager implements HostedInstanceMan
this.hostedInstanceProcess = cp.spawn(command.shift()!, command, options);
this.hostedInstanceProcess.on('error', () => { this.isPluginRunning = false; });
this.hostedInstanceProcess.on('exit', () => { this.isPluginRunning = false; });
this.hostedInstanceProcess.stdout.addListener('data', outputListener);
this.hostedInstanceProcess.stdout!.addListener('data', outputListener);

this.hostedInstanceProcess.stdout.addListener('data', data => {
this.hostedInstanceProcess.stdout!.addListener('data', data => {
this.hostedPluginSupport.sendLog({ data: data.toString(), type: LogType.Info });
});
this.hostedInstanceProcess.stderr.addListener('data', data => {
this.hostedInstanceProcess.stderr!.addListener('data', data => {
this.hostedPluginSupport.sendLog({ data: data.toString(), type: LogType.Error });
});

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/hosted/node/hosted-plugin-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ export class HostedPluginProcess implements ServerPluginRunner {
}

const childProcess = cp.fork(this.configuration.path, options.args, forkOptions);
childProcess.stdout.on('data', data => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));
childProcess.stderr.on('data', data => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));
childProcess.stdout!.on('data', data => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));
childProcess.stderr!.on('data', data => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));

this.logger.debug(`[${options.serverName}: ${childProcess.pid}] IPC started`);
childProcess.once('exit', (code: number, signal: string) => this.onChildProcessExit(options.serverName, childProcess.pid, code, signal));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export function startDebugAdapter(executable: theia.DebugAdapterExecutable): Com
}

return {
input: childProcess.stdin,
output: childProcess.stdout,
input: childProcess.stdin!,
output: childProcess.stdout!,
dispose: () => childProcess.kill()
};
}
Expand Down
68 changes: 34 additions & 34 deletions packages/process/src/common/shell-command-builder.slow-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,16 @@ for (const shellConfig of shellConfigs) {
[envName]: envValue,
}
}, [
// stderr
scanLines<void>(context, processInfo.shell.stderr, errorScanner, stderrFormat(context.name)),
// stdout
scanLines<void>(context, processInfo.shell.stdout, handle => {
errorScanner(handle);
if (handle.line.includes(`[${envValue}]`)) {
handle.resolve();
}
}, stdoutFormat(context.name)),
]);
// stderr
scanLines<void>(context, processInfo.shell.stderr!, errorScanner, stderrFormat(context.name)),
// stdout
scanLines<void>(context, processInfo.shell.stdout!, handle => {
errorScanner(handle);
if (handle.line.includes(`[${envValue}]`)) {
handle.resolve();
}
}, stdoutFormat(context.name)),
]);
});

it('use problematic environment variables', async () => {
Expand All @@ -265,19 +265,19 @@ for (const shellConfig of shellConfigs) {
[envName]: envValue,
}
}, [
// stderr
scanLines<void>(context, processInfo.shell.stderr, errorScanner, stderrFormat(context.name)),
// stdout
scanLines<void>(context, processInfo.shell.stdout, handle => {
errorScanner(handle);
if (handle.line.includes(`[${envValue}]`)) {
handle.resolve();
}
if (handle.line.includes('[undefined]')) {
handle.reject(new Error(handle.text));
}
}, stdoutFormat(context.name)),
]);
// stderr
scanLines<void>(context, processInfo.shell.stderr!, errorScanner, stderrFormat(context.name)),
// stdout
scanLines<void>(context, processInfo.shell.stdout!, handle => {
errorScanner(handle);
if (handle.line.includes(`[${envValue}]`)) {
handle.resolve();
}
if (handle.line.includes('[undefined]')) {
handle.reject(new Error(handle.text));
}
}, stdoutFormat(context.name)),
]);
});

it('command with complex arguments', async () => {
Expand All @@ -292,16 +292,16 @@ for (const shellConfig of shellConfigs) {
console.log(\`[\${left}|\${right}]\`);
}`],
}, [
// stderr
scanLines<void>(context, processInfo.shell.stderr, errorScanner, stderrFormat(context.name)),
// stdout
scanLines<void>(context, processInfo.shell.stdout, handle => {
errorScanner(handle);
if (handle.line.includes(`[${left}|${right}]`)) {
handle.resolve();
}
}, stdoutFormat(context.name)),
]);
// stderr
scanLines<void>(context, processInfo.shell.stderr!, errorScanner, stderrFormat(context.name)),
// stdout
scanLines<void>(context, processInfo.shell.stdout!, handle => {
errorScanner(handle);
if (handle.line.includes(`[${left}|${right}]`)) {
handle.resolve();
}
}, stdoutFormat(context.name)),
]);
});

});
Expand Down Expand Up @@ -353,7 +353,7 @@ async function testCommandLine(
): Promise<any> {
const commandLine = shellCommandBuilder.buildCommand(processInfo, options);
debug(`${bold(white(`${context.name} STDIN:`))} ${bgWhite(black(displayWhitespaces(commandLine)))}`);
processInfo.shell.stdin.write(commandLine + context.submit);
processInfo.shell.stdin!.write(commandLine + context.submit);
return Promise.race(firstOf);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/process/src/node/multi-ring-buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class MultiRingBuffer implements Disposable {
}

enq(str: string, encoding = 'utf8'): void {
let buffer: Buffer = Buffer.from(str, encoding);
let buffer: Buffer = Buffer.from(str, encoding as BufferEncoding);

// Take the last elements of string if it's too big, drop the rest
if (buffer.length > this.maxSize) {
Expand Down
2 changes: 1 addition & 1 deletion packages/process/src/node/raw-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class RawProcess extends Process {

kill(signal?: string): void {
if (this.process && this.killed === false) {
this.process.kill(signal);
this.process.kill(signal as NodeJS.Signals);
}
}

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1335,10 +1335,10 @@
"@types/node" "*"
form-data "^3.0.0"

"@types/node@*", "@types/node@^10.14.22", "@types/node@^12.0.12", "@types/node@~10.3.6":
version "10.3.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.6.tgz#ea8aab9439b59f40d19ec5f13b44642344872b11"
integrity sha512-h7VDRFL8IhdPw1JjiNVvhr+WynfKW09q2BOflIOA0yeuXNeXBP1bIRuBrysSryH4keaJ5bYUNp63aIyQL9YpDQ==
"@types/node@*", "@types/node@12", "@types/node@^10.14.22", "@types/node@^12.0.12":
version "12.12.62"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.62.tgz#733923d73669188d35950253dd18a21570085d2b"
integrity sha512-qAfo81CsD7yQIM9mVyh6B/U47li5g7cfpVQEDMfQeF8pSZVwzbhwU3crc0qG4DmpsebpJPR49AKOExQyJ05Cpg==

"@types/normalize-package-data@^2.4.0":
version "2.4.0"
Expand Down

0 comments on commit 025d633

Please sign in to comment.