Skip to content

Commit

Permalink
Upgrade Node.js to version 12 (#61587)
Browse files Browse the repository at this point in the history
  • Loading branch information
watson authored Nov 12, 2020
1 parent 3412843 commit 4c49d5d
Show file tree
Hide file tree
Showing 80 changed files with 520 additions and 296 deletions.
2 changes: 1 addition & 1 deletion .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts

ARG NODE_VERSION=10.22.1
ARG NODE_VERSION=12.19.0

FROM node:${NODE_VERSION} AS base

Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.22.1
12.19.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.22.1
12.19.0
6 changes: 3 additions & 3 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ In addition to this setting, trusted certificates may be specified via <<server-

| `server.ssl.cipherSuites:`
| Details on the format, and the valid options, are available via the
https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT[OpenSSL cipher list format documentation].
*Default: `ECDHE-RSA-AES128-GCM-SHA256, ECDHE-ECDSA-AES128-GCM-SHA256, ECDHE-RSA-AES256-GCM-SHA384, ECDHE-ECDSA-AES256-GCM-SHA384, DHE-RSA-AES128-GCM-SHA256, ECDHE-RSA-AES128-SHA256, DHE-RSA-AES128-SHA256, ECDHE-RSA-AES256-SHA384, DHE-RSA-AES256-SHA384, ECDHE-RSA-AES256-SHA256, DHE-RSA-AES256-SHA256, HIGH,!aNULL, !eNULL, !EXPORT, !DES, !RC4, !MD5, !PSK, !SRP, !CAMELLIA`*.
https://www.openssl.org/docs/man1.1.1/man1/ciphers.html#CIPHER-LIST-FORMAT[OpenSSL cipher list format documentation].
*Default: `TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 TLS_AES_128_GCM_SHA256 ECDHE-RSA-AES128-GCM-SHA256, ECDHE-ECDSA-AES128-GCM-SHA256, ECDHE-RSA-AES256-GCM-SHA384, ECDHE-ECDSA-AES256-GCM-SHA384, DHE-RSA-AES128-GCM-SHA256, ECDHE-RSA-AES128-SHA256, DHE-RSA-AES128-SHA256, ECDHE-RSA-AES256-SHA384, DHE-RSA-AES256-SHA384, ECDHE-RSA-AES256-SHA256, DHE-RSA-AES256-SHA256, HIGH,!aNULL, !eNULL, !EXPORT, !DES, !RC4, !MD5, !PSK, !SRP, !CAMELLIA`*.

| `server.ssl.clientAuthentication:`
| Controls the behavior in {kib} for requesting a certificate from client
Expand Down Expand Up @@ -571,7 +571,7 @@ all http requests to https over the port configured as <<server-port, `server.po

| `server.ssl.supportedProtocols:`
| An array of supported protocols with versions.
Valid protocols: `TLSv1`, `TLSv1.1`, `TLSv1.2`. *Default: TLSv1.1, TLSv1.2*
Valid protocols: `TLSv1`, `TLSv1.1`, `TLSv1.2`, `TLSv1.3`. *Default: TLSv1.1, TLSv1.2, TLSv1.3*

| [[settings-xsrf-whitelist]] `server.xsrf.whitelist:`
| It is not recommended to disable protections for
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"**/@types/hapi__boom": "^7.4.1",
"**/@types/hapi__hapi": "^18.2.6",
"**/@types/hapi__mimos": "4.1.0",
"**/@types/node": ">=10.17.17 <10.20.0",
"**/@types/node": "12.19.4",
"**/cross-fetch/node-fetch": "^2.6.1",
"**/deepmerge": "^4.2.2",
"**/fast-deep-equal": "^3.1.1",
Expand All @@ -97,7 +97,7 @@
"**/typescript": "4.0.2"
},
"engines": {
"node": "10.22.1",
"node": "12.19.0",
"yarn": "^1.21.1"
},
"dependencies": {
Expand Down Expand Up @@ -497,7 +497,7 @@
"@types/mustache": "^0.8.31",
"@types/ncp": "^2.0.1",
"@types/nock": "^10.0.3",
"@types/node": ">=10.17.17 <10.20.0",
"@types/node": "12.19.4",
"@types/node-fetch": "^2.5.7",
"@types/node-forge": "^0.9.5",
"@types/nodemailer": "^6.2.1",
Expand Down Expand Up @@ -560,7 +560,7 @@
"@types/vinyl-fs": "^2.4.11",
"@types/watchpack": "^1.1.5",
"@types/webpack": "^4.41.3",
"@types/webpack-env": "^1.15.2",
"@types/webpack-env": "^1.15.3",
"@types/webpack-merge": "^4.1.5",
"@types/write-pkg": "^3.1.0",
"@types/xml-crypto": "^1.4.1",
Expand Down
8 changes: 7 additions & 1 deletion packages/kbn-config-schema/src/types/stream_type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ test('includes namespace in failure', () => {
describe('#defaultValue', () => {
test('returns default when undefined', () => {
const value = new Stream();
expect(schema.stream({ defaultValue: value }).validate(undefined)).toStrictEqual(value);
expect(schema.stream({ defaultValue: value }).validate(undefined)).toMatchInlineSnapshot(`
Stream {
"_events": Object {},
"_eventsCount": 0,
"_maxListeners": undefined,
}
`);
});

test('returns value when specified', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-dev-utils/src/proc_runner/proc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) {
});

if (stdin) {
childProcess.stdin.end(stdin, 'utf8');
childProcess.stdin!.end(stdin, 'utf8'); // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdin will not be null
} else {
childProcess.stdin.end();
childProcess.stdin!.end(); // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdin will not be null
}

let stopCalled = false;
Expand Down Expand Up @@ -123,8 +123,8 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) {
).pipe(share());

const lines$ = Rx.merge(
observeLines(childProcess.stdout),
observeLines(childProcess.stderr)
observeLines(childProcess.stdout!), // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
observeLines(childProcess.stderr!) // TypeScript note: As long as the proc stdio[1] is 'pipe', then stderr will not be null
).pipe(
tap((line) => log.write(` ${chalk.gray('proc')} [${chalk.gray(name)}] ${line}`)),
share()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/kbn-es-archiver/src/actions/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
// are not listened for
const pipeline = (...streams: Readable[]) =>
streams.reduce((source, dest) =>
source.once('error', (error) => dest.emit('error', error)).pipe(dest as any)
source.once('error', (error) => dest.destroy(error)).pipe(dest as any)
);

export async function loadAction({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('concatStreamProviders() helper', () => {
() =>
new Readable({
read() {
this.emit('error', new Error('foo'));
this.destroy(new Error('foo'));
},
}),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function concatStreamProviders(

source
// proxy errors from the source to the destination
.once('error', (error) => destination.emit('error', error))
.once('error', (error) => destination.destroy(error))
// pipe the source to the destination but only proxy the
// end event if this is the last source
.pipe(destination, { end: isLast });
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-i18n/src/__snapshots__/loader.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ const expectFileMatchesSnapshotWithCompression = (filePath: string, snapshotLabe

// Verify the brotli variant matches
expect(
// @ts-expect-error @types/node is missing the brotli functions
Zlib.brotliDecompressSync(
Fs.readFileSync(Path.resolve(MOCK_REPO_DIR, `${filePath}.br`))
).toString()
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/src/optimizer/get_mtimes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import * as Rx from 'rxjs';
import { mergeMap, map, catchError } from 'rxjs/operators';
import { allValuesFrom } from '../common';

const stat$ = Rx.bindNodeCallback(Fs.stat);
const stat$ = Rx.bindNodeCallback<Fs.PathLike, Fs.Stats>(Fs.stat);

/**
* get mtimes of referenced paths concurrently, limit concurrency to 100
Expand Down
6 changes: 4 additions & 2 deletions packages/kbn-optimizer/src/optimizer/observe_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ export function observeWorker(
type: 'worker started',
bundles,
}),
observeStdio$(proc.stdout).pipe(
// TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
observeStdio$(proc.stdout!).pipe(
map(
(line): WorkerStdio => ({
type: 'worker stdio',
Expand All @@ -173,7 +174,8 @@ export function observeWorker(
})
)
),
observeStdio$(proc.stderr).pipe(
// TypeScript note: As long as the proc stdio[2] is 'pipe', then stderr will not be null
observeStdio$(proc.stderr!).pipe(
map(
(line): WorkerStdio => ({
type: 'worker stdio',
Expand Down
9 changes: 6 additions & 3 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32273,8 +32273,10 @@ function spawnStreaming(command, args, opts, {
mergeMultiline: true,
tag: color.bold(prefix)
});
spawned.stdout.pipe(prefixedStdout).pipe(streamToLog(debug));
spawned.stderr.pipe(prefixedStderr).pipe(streamToLog(debug));
spawned.stdout.pipe(prefixedStdout).pipe(streamToLog(debug)); // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null

spawned.stderr.pipe(prefixedStderr).pipe(streamToLog(debug)); // TypeScript note: As long as the proc stdio[2] is 'pipe', then stderr will not be null

return spawned;
}

Expand Down Expand Up @@ -51377,7 +51379,8 @@ const WatchCommand = {
await Object(_utils_parallelize__WEBPACK_IMPORTED_MODULE_2__["parallelizeBatches"])(batchedProjects, async pkg => {
const completionHint = await Object(_utils_watch__WEBPACK_IMPORTED_MODULE_4__["waitUntilWatchIsReady"])(pkg.runScriptStreaming(watchScriptName, {
debug: false
}).stdout);
}).stdout // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
);
_utils_log__WEBPACK_IMPORTED_MODULE_1__["log"].success(`[${pkg.name}] Initial build completed (${completionHint}).`);
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/src/commands/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const WatchCommand: ICommand = {
const completionHint = await waitUntilWatchIsReady(
pkg.runScriptStreaming(watchScriptName, {
debug: false,
}).stdout
}).stdout! // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
);

log.success(`[${pkg.name}] Initial build completed (${completionHint}).`);
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-pm/src/utils/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export function spawnStreaming(
const prefixedStdout = logTransformer({ tag: color.bold(prefix) });
const prefixedStderr = logTransformer({ mergeMultiline: true, tag: color.bold(prefix) });

spawned.stdout.pipe(prefixedStdout).pipe(streamToLog(debug));
spawned.stderr.pipe(prefixedStderr).pipe(streamToLog(debug));
spawned.stdout!.pipe(prefixedStdout).pipe(streamToLog(debug)); // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
spawned.stderr!.pipe(prefixedStderr).pipe(streamToLog(debug)); // TypeScript note: As long as the proc stdio[2] is 'pipe', then stderr will not be null

return spawned;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export function observeContainerLogs(name: string, containerId: string, log: Too
const logLine$ = new Rx.Subject<string>();

Rx.merge(
observeLines(logsProc.stdout).pipe(tap((line) => log.info(`[docker:${name}] ${line}`))),
observeLines(logsProc.stderr).pipe(tap((line) => log.error(`[docker:${name}] ${line}`)))
observeLines(logsProc.stdout!).pipe(tap((line) => log.info(`[docker:${name}] ${line}`))), // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
observeLines(logsProc.stderr!).pipe(tap((line) => log.error(`[docker:${name}] ${line}`))) // TypeScript note: As long as the proc stdio[2] is 'pipe', then stderr will not be null
).subscribe(logLine$);

return logLine$.asObservable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ describe('with randomness', () => {
);

await phase.trigger();

// `phase.trigger()` uses `Math.random` to sort the internal array of
// handlers. But since the sorting algorithm used internally in
// `Array.prototype.sort` is not spec'ed, it can change between Node.js
// versions, and as a result the expected output below might not match if
// you up/downgrade Node.js.
expect(order).toMatchInlineSnapshot(`
Array [
"one",
"three",
"two",
"one",
]
`);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-test/src/kbn/kbn_test_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export const kbnTestConfig = new (class KbnTestConfig {
const testKibanaUrl = url.parse(process.env.TEST_KIBANA_URL);
return {
protocol: testKibanaUrl.protocol?.slice(0, -1),
hostname: testKibanaUrl.hostname,
hostname: testKibanaUrl.hostname === null ? undefined : testKibanaUrl.hostname,
port: testKibanaUrl.port ? parseInt(testKibanaUrl.port, 10) : undefined,
auth: testKibanaUrl.auth,
auth: testKibanaUrl.auth === null ? undefined : testKibanaUrl.auth,
username: testKibanaUrl.auth?.split(':')[0],
password: testKibanaUrl.auth?.split(':')[1],
};
Expand Down
30 changes: 24 additions & 6 deletions src/cli/repl/__snapshots__/repl.test.js.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/cli/serve/integration_tests/reload_logging_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ describe('Server logging configuration', function () {
'--verbose',
]);

const message$ = Rx.fromEvent(child.stdout, 'data').pipe(
// TypeScript note: As long as the child stdio[1] is 'pipe', then stdout will not be null
const message$ = Rx.fromEvent(child.stdout!, 'data').pipe(
map((messages) => String(messages).split('\n').filter(Boolean))
);

await message$
.pipe(
// We know the sighup handler will be registered before this message logged
filter((messages) => messages.some((m) => m.includes('setting up root'))),
filter((messages: string[]) => messages.some((m) => m.includes('setting up root'))),
take(1)
)
.toPromise();
Expand Down Expand Up @@ -189,14 +190,15 @@ describe('Server logging configuration', function () {

child = Child.spawn(process.execPath, [kibanaPath, '--oss', '--config', configFilePath]);

const message$ = Rx.fromEvent(child.stdout, 'data').pipe(
// TypeScript note: As long as the child stdio[1] is 'pipe', then stdout will not be null
const message$ = Rx.fromEvent(child.stdout!, 'data').pipe(
map((messages) => String(messages).split('\n').filter(Boolean))
);

await message$
.pipe(
// We know the sighup handler will be registered before this message logged
filter((messages) => messages.some((m) => m.includes('setting up root'))),
filter((messages: string[]) => messages.some((m) => m.includes('setting up root'))),
take(1)
)
.toPromise();
Expand Down
19 changes: 13 additions & 6 deletions src/core/public/http/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,19 @@ export interface HttpRequestInit {

/** @public */
export interface HttpFetchQuery {
[key: string]:
| string
| number
| boolean
| undefined
| Array<string | number | boolean | undefined>;
/**
* TypeScript note: Technically we should use this interface instead, but @types/node uses the below stricter
* definition, so to avoid TypeScript errors, we'll restrict our version.
*
* [key: string]:
* | string
* | number
* | boolean
* | Array<string | number | boolean>
* | undefined
* | null;
*/
[key: string]: string | number | boolean | string[] | number[] | boolean[] | undefined | null;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,7 @@ export interface HttpFetchOptionsWithPath extends HttpFetchOptions {

// @public (undocumented)
export interface HttpFetchQuery {
// (undocumented)
[key: string]: string | number | boolean | undefined | Array<string | number | boolean | undefined>;
[key: string]: string | number | boolean | string[] | number[] | boolean[] | undefined | null;
}

// @public
Expand Down
Loading

0 comments on commit 4c49d5d

Please sign in to comment.