Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump node.js from v14.21.3 to v18.15.0 #3608

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build_and_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ jobs:

- name: Run unit tests with coverage
id: unit-tests
env:
NODE_OPTIONS: --max-old-space-size=8192
run: yarn test:jest:ci:coverage

- name: Run mocha tests with coverage
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.21.3
18.15.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.21.3
18.15.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=14.20.1
ARG NODE_VERSION=18.15.0
FROM node:${NODE_VERSION} AS base

ENV HOME '.'
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 @@
"url": "https://github.com/opensearch-project/opensearch-dashboards.git"
},
"resolutions": {
"**/@types/node": "^14.17.32",
"**/@types/node": "18.11.18",
"**/ansi-regex": "^5.0.1",
"**/async": "^3.2.3",
"**/d3-color": "^3.1.0",
Expand Down Expand Up @@ -166,7 +166,7 @@
"deep-freeze-strict": "^1.1.1",
"del": "^6.1.1",
"dns-sync": "^0.2.1",
"elastic-apm-node": "^3.7.0",
"elastic-apm-node": "^3.43.0",
"elasticsearch": "^16.7.0",
"http-aws-es": "6.0.0",
"execa": "^4.0.2",
Expand Down Expand Up @@ -301,7 +301,7 @@
"@types/mock-fs": "^4.10.0",
"@types/moment-timezone": "^0.5.12",
"@types/mustache": "^0.8.31",
"@types/node": "^14.17.32",
"@types/node": "18.11.18",
"@types/node-forge": "^1.0.1",
"@types/normalize-path": "^3.0.0",
"@types/pegjs": "^0.10.1",
Expand Down Expand Up @@ -468,7 +468,7 @@
"zlib": "^1.0.5"
},
"engines": {
"node": "^14.20.1",
"node": "^18.15.0",
"yarn": "^1.22.10"
}
}

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

8 changes: 4 additions & 4 deletions packages/osd-cross-platform/src/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import path from 'path';
import fs from 'fs';
import { access, rmdir, mkdir, writeFile, symlink } from 'fs/promises';
import { access, rm, mkdir, writeFile, symlink } from 'fs/promises';

import {
resolveToFullNameSync,
Expand Down Expand Up @@ -43,9 +43,9 @@ describe('Cross Platform', () => {
try {
// If leftover artifacts were found, get rid of them
await access(tmpTestFolder);
await rmdir(tmpTestFolder, { recursive: true });
await rm(tmpTestFolder, { recursive: true });
} catch (ex) {
// Do nothing; if `rmdir` failed, let the `mkdir` below throw the error
// Do nothing; if `rm` failed, let the `mkdir` below throw the error
}

await mkdir(tmpTestFolder);
Expand All @@ -60,7 +60,7 @@ describe('Cross Platform', () => {

afterAll(async () => {
try {
await rmdir(tmpTestFolder, { recursive: true });
await rm(tmpTestFolder, { recursive: true });
} catch (ex) {
// Do nothing
}
Expand Down
4 changes: 2 additions & 2 deletions packages/osd-dev-utils/src/proc_runner/proc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) {
await withTimeout(
async () => {
log.debug(`Sending "${signal}" to proc "${name}"`);
await treeKillAsync(childProcess.pid, signal);
await treeKillAsync(childProcess.pid!, signal);
await outcomePromise;
},
STOP_TIMEOUT,
async () => {
log.warning(
`Proc "${name}" was sent "${signal}" didn't emit the "exit" or "error" events after ${STOP_TIMEOUT} ms, sending SIGKILL`
);
await treeKillAsync(childProcess.pid, 'SIGKILL');
await treeKillAsync(childProcess.pid!, 'SIGKILL');
}
);

Expand Down
2 changes: 1 addition & 1 deletion packages/osd-interpreter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"del": "^6.1.1",
"getopts": "^2.2.5",
"pegjs": "0.10.0",
"sass-loader": "^10.2.0",
"sass-loader": "^10.4.1",
"style-loader": "^1.1.3",
"supports-color": "^7.0.0",
"url-loader": "^2.2.0",
Expand Down
7 changes: 3 additions & 4 deletions packages/osd-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@
"dedent": "^0.7.0",
"del": "^6.1.1",
"execa": "^4.0.2",
"fibers": "^5.0.3",
"jest-diff": "^27.5.1",
"js-yaml": "^3.14.0",
"json-stable-stringify": "^1.0.1",
"lmdb-store": "^1.6.11",
"lmdb": "^2.7.10",
"node-sass": "^8.0.0",
"normalize-path": "^3.0.0",
"pirates": "^4.0.1",
"postcss": "^8.4.5",
"rxjs": "^6.5.5",
"sass": "~1.26.11",
"source-map-support": "^0.5.19",
"terser-webpack-plugin": "^2.1.2",
"tinymath": "1.2.1",
Expand All @@ -54,7 +53,7 @@
"loader-utils": "^2.0.4",
"postcss-loader": "^4.2.0",
"raw-loader": "^4.0.2",
"sass-loader": "^10.2.0",
"sass-loader": "^10.4.1",
"style-loader": "^1.1.3",
"url-loader": "^2.2.0",
"val-loader": "^2.1.2",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ const TMP_DIR = Path.resolve(__dirname, '../__fixtures__/__tmp__');
const MOCK_REPO_SRC = Path.resolve(__dirname, '../__fixtures__/mock_repo');
const MOCK_REPO_DIR = Path.resolve(TMP_DIR, 'mock_repo');

jest.mock('lmdb', () => {
const mockedLmdb = {
open: jest.fn(() => ({
openDB: jest.fn(() => ({
get: jest.fn(),
putSync: jest.fn(),
remove: jest.fn(),
})),
})),
};
return mockedLmdb;
});

expect.addSnapshotSerializer({
serialize: (value: string) => value.split(REPO_ROOT).join('<absolute path>').replace(/\\/g, '/'),
test: (value: any) => typeof value === 'string' && value.includes(REPO_ROOT),
Expand Down
24 changes: 12 additions & 12 deletions packages/osd-optimizer/src/node/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Path from 'path';
import { Writable } from 'stream';

import chalk from 'chalk';
import * as LmdbStore from 'lmdb-store';
import * as LmdbStore from 'lmdb';
import { getMatchingRoot } from '@osd/cross-platform';

const GLOBAL_ATIME = `${Date.now()}`;
Expand Down Expand Up @@ -96,8 +96,8 @@ export class Cache {
// keys which haven't been used in 30 days. We use `unref()` to
// make sure this timer doesn't hold other processes open
// unexpectedly
this.timer = setTimeout(() => {
this.pruneOldKeys();
this.timer = setTimeout(async () => {
await this.pruneOldKeys();
}, 30 * MINUTE);

// timer.unref is not defined in jest which emulates the dom by default
Expand Down Expand Up @@ -134,12 +134,13 @@ export class Cache {
async update(path: string, file: { mtime: string; code: string; map: any }) {
const key = this.getKey(path);

await Promise.all([
this.safePut(this.atimes, key, GLOBAL_ATIME),
this.safePut(this.mtimes, key, file.mtime),
this.safePut(this.codes, key, file.code),
this.safePut(this.sourceMaps, key, JSON.stringify(file.map)),
]);
this.safePut(this.atimes, key, GLOBAL_ATIME);
this.safePut(this.mtimes, key, file.mtime);
this.safePut(this.codes, key, file.code);

if (file.map != null) {
this.safePut(this.sourceMaps, key, JSON.stringify(file.map));
}
}

close() {
Expand Down Expand Up @@ -172,9 +173,9 @@ export class Cache {
}
}

private async safePut<V>(db: LmdbStore.Database<V, string>, key: string, value: V) {
private safePut<V>(db: LmdbStore.Database<V, string>, key: string, value: V) {
try {
await db.put(key, value);
db.putSync(key, value);
this.debug('PUT', db, key);
} catch (error) {
this.logError('PUT', db, key, error);
Expand Down Expand Up @@ -204,7 +205,6 @@ export class Cache {
const validKeys: string[] = [];
const invalidKeys: string[] = [];

// @ts-expect-error See https://github.com/DoctorEvidence/lmdb-store/pull/18
for (const { key, value } of this.atimes.getRange()) {
const atime = parseInt(`${value}`, 10);
if (Number.isNaN(atime) || atime < ATIME_LIMIT) {
Expand Down
1 change: 1 addition & 0 deletions packages/osd-optimizer/src/optimizer/observe_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function usingWorkerProc<T>(
? [`${inspectFlag}=${inspectPortCounter++}`]
: []),
...(config.maxWorkerCount <= 3 ? ['--max-old-space-size=2048'] : []),
'--openssl-legacy-provider',
],
buffer: false,
stderr: 'pipe',
Expand Down
Loading