Skip to content

Commit

Permalink
[repo-wide] Update @types/node from 14 to 18 (#4324)
Browse files Browse the repository at this point in the history
* Update @types/node from 14 to 18

* install-test-workspace

---------

Co-authored-by: David Michon <[email protected]>
  • Loading branch information
dmichon-msft and dmichon-msft authored Sep 14, 2023
1 parent dfb8ca4 commit 3ab024c
Show file tree
Hide file tree
Showing 155 changed files with 1,625 additions and 1,087 deletions.
2 changes: 1 addition & 1 deletion apps/api-documenter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@rushstack/heft": "workspace:*",
"@rushstack/heft-node-rig": "workspace:*",
"@types/js-yaml": "3.12.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"@types/resolve": "1.20.2"
}
}
2 changes: 1 addition & 1 deletion apps/api-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@rushstack/heft-node-rig": "2.2.6",
"@types/heft-jest": "1.0.1",
"@types/lodash": "4.14.116",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"@types/resolve": "1.20.2",
"@types/semver": "7.5.0"
}
Expand Down
6 changes: 2 additions & 4 deletions apps/heft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@types/tapable": "1.0.6",
"argparse": "~1.0.9",
"chokidar": "~3.4.0",
"fast-glob": "~3.2.4",
"fast-glob": "~3.3.1",
"git-repo-info": "~2.1.0",
"ignore": "~5.1.6",
"tapable": "1.1.3",
Expand All @@ -50,14 +50,12 @@
},
"devDependencies": {
"@microsoft/api-extractor": "workspace:*",
"@nodelib/fs.scandir": "2.1.5",
"@nodelib/fs.stat": "2.0.5",
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "0.54.0",
"@rushstack/heft-node-rig": "2.2.6",
"@types/argparse": "1.0.38",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"@types/watchpack": "2.4.0",
"typescript": "~5.0.4"
}
Expand Down
28 changes: 13 additions & 15 deletions apps/heft/src/pluginFramework/StaticFileSystemAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as fs from 'fs';
import * as path from 'path';
import type { ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from '@nodelib/fs.scandir';
import type { StatAsynchronousMethod, StatSynchronousMethod } from '@nodelib/fs.stat';
import type { FileSystemAdapter } from 'fast-glob';
import { Path } from '@rushstack/node-core-library';

Expand Down Expand Up @@ -35,7 +33,7 @@ export class StaticFileSystemAdapter implements FileSystemAdapter {
private _directoryMap: Map<string, IVirtualFileSystemEntry> = new Map<string, IVirtualFileSystemEntry>();

/** { @inheritdoc fs.lstat } */
public lstat: StatAsynchronousMethod = ((filePath: string, callback: StatCallback) => {
public lstat: FileSystemAdapter['lstat'] = ((filePath: string, callback: StatCallback) => {
process.nextTick(() => {
let result: fs.Stats;
try {
Expand All @@ -47,10 +45,10 @@ export class StaticFileSystemAdapter implements FileSystemAdapter {
// eslint-disable-next-line @rushstack/no-new-null
callback(null, result);
});
}) as StatAsynchronousMethod;
}) as FileSystemAdapter['lstat'];

/** { @inheritdoc fs.lstatSync } */
public lstatSync: StatSynchronousMethod = ((filePath: string) => {
public lstatSync: FileSystemAdapter['lstatSync'] = ((filePath: string) => {
filePath = this._normalizePath(filePath);
const entry: IVirtualFileSystemEntry | undefined = this._directoryMap.get(filePath);
if (!entry) {
Expand All @@ -71,20 +69,20 @@ export class StaticFileSystemAdapter implements FileSystemAdapter {
isFIFO: () => false,
isSocket: () => false
};
}) as StatSynchronousMethod;
}) as FileSystemAdapter['lstatSync'];

/** { @inheritdoc fs.stat } */
public stat: StatAsynchronousMethod = ((filePath: string, callback: StatCallback) => {
public stat: FileSystemAdapter['stat'] = ((filePath: string, callback: StatCallback) => {
this.lstat(filePath, callback);
}) as StatAsynchronousMethod;
}) as FileSystemAdapter['stat'];

/** { @inheritdoc fs.statSync } */
public statSync: StatSynchronousMethod = ((filePath: string) => {
public statSync: FileSystemAdapter['statSync'] = ((filePath: string) => {
return this.lstatSync(filePath);
}) as StatSynchronousMethod;
}) as FileSystemAdapter['statSync'];

/** { @inheritdoc fs.readdir } */
public readdir: ReaddirAsynchronousMethod = ((
public readdir: FileSystemAdapter['readdir'] = ((
filePath: string,
optionsOrCallback: IReaddirOptions | ReaddirStringCallback,
callback?: ReaddirDirentCallback | ReaddirStringCallback
Expand All @@ -102,7 +100,7 @@ export class StaticFileSystemAdapter implements FileSystemAdapter {
let result: fs.Dirent[] | string[];
try {
if (options?.withFileTypes) {
result = this.readdirSync(filePath, options);
result = this.readdirSync(filePath, options) as fs.Dirent[];
} else {
result = this.readdirSync(filePath);
}
Expand All @@ -121,10 +119,10 @@ export class StaticFileSystemAdapter implements FileSystemAdapter {
(callback as ReaddirStringCallback)(null, result as string[]);
}
});
}) as ReaddirAsynchronousMethod;
}) as FileSystemAdapter['readdir'];

/** { @inheritdoc fs.readdirSync } */
public readdirSync: ReaddirSynchronousMethod = ((filePath: string, options?: IReaddirOptions) => {
public readdirSync: FileSystemAdapter['readdirSync'] = ((filePath: string, options?: IReaddirOptions) => {
filePath = this._normalizePath(filePath);
const virtualDirectory: IVirtualFileSystemEntry | undefined = this._directoryMap.get(filePath);
if (!virtualDirectory) {
Expand Down Expand Up @@ -167,7 +165,7 @@ export class StaticFileSystemAdapter implements FileSystemAdapter {
} else {
return result.map((entry: IVirtualFileSystemEntry) => entry.name);
}
}) as ReaddirSynchronousMethod;
}) as FileSystemAdapter['readdirSync'];

/**
* Create a new StaticFileSystemAdapter instance with the provided file paths.
Expand Down
4 changes: 2 additions & 2 deletions apps/heft/src/plugins/FileGlobSpecifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ export async function getFileSelectionSpecifierPathsAsync(
path.normalize(filePath)
);
if (state.changed) {
results.set(filePath, dirent);
results.set(filePath, dirent as fs.Dirent);
}
},
{
concurrency: 20
}
);
} else {
results = new Map(rawEntries.map((entry) => [entry.path, entry.dirent]));
results = new Map(rawEntries.map((entry) => [entry.path, entry.dirent as fs.Dirent]));
}

return results;
Expand Down
12 changes: 10 additions & 2 deletions apps/heft/src/plugins/NodeServicePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ export default class NodeServicePlugin implements IHeftTaskPlugin {

// Passing a negative PID terminates the entire group instead of just the one process.
// This works because we set detached=true for child_process.spawn()
process.kill(-this._activeChildProcess.pid, 'SIGTERM');

const pid: number | undefined = this._activeChildProcess.pid;
if (pid !== undefined) {
// If pid was undefined, the process failed to spawn
process.kill(-pid, 'SIGTERM');
}

this._clearTimeout();
this._timeout = setTimeout(() => {
Expand Down Expand Up @@ -289,7 +294,10 @@ export default class NodeServicePlugin implements IHeftTaskPlugin {
});
SubprocessTerminator.killProcessTreeOnExit(childProcess, SubprocessTerminator.RECOMMENDED_OPTIONS);

const childPid: number = childProcess.pid;
const childPid: number | undefined = childProcess.pid;
if (childPid === undefined) {
throw new InternalError(`Failed to spawn child process`);
}
this._logger.terminal.writeVerboseLine(`Started service process #${childPid}`);

// Create a promise that resolves when the child process exits
Expand Down
16 changes: 7 additions & 9 deletions apps/heft/src/utilities/WatchFileSystemAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';

import type { ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from '@nodelib/fs.scandir';
import type { StatAsynchronousMethod, StatSynchronousMethod } from '@nodelib/fs.stat';
import type { FileSystemAdapter } from 'fast-glob';
import Watchpack from 'watchpack';

Expand Down Expand Up @@ -71,7 +69,7 @@ export class WatchFileSystemAdapter implements IWatchFileSystemAdapter {
private _times: Map<string, ITimeEntry> | undefined;

/** { @inheritdoc fs.readdirSync } */
public readdirSync: ReaddirSynchronousMethod = ((filePath: string, options?: IReaddirOptions) => {
public readdirSync: FileSystemAdapter['readdirSync'] = ((filePath: string, options?: IReaddirOptions) => {
filePath = path.normalize(filePath);

try {
Expand All @@ -88,10 +86,10 @@ export class WatchFileSystemAdapter implements IWatchFileSystemAdapter {
this._missing.set(filePath, Date.now());
throw err;
}
}) as ReaddirSynchronousMethod;
}) as FileSystemAdapter['readdirSync'];

/** { @inheritdoc fs.readdir } */
public readdir: ReaddirAsynchronousMethod = (
public readdir: FileSystemAdapter['readdir'] = (
filePath: string,
optionsOrCallback: IReaddirOptions | ReaddirStringCallback,
callback?: ReaddirDirentCallback | ReaddirStringCallback
Expand Down Expand Up @@ -127,7 +125,7 @@ export class WatchFileSystemAdapter implements IWatchFileSystemAdapter {
};

/** { @inheritdoc fs.lstat } */
public lstat: StatAsynchronousMethod = (filePath: string, callback: StatCallback): void => {
public lstat: FileSystemAdapter['lstat'] = (filePath: string, callback: StatCallback): void => {
filePath = path.normalize(filePath);
fs.lstat(filePath, (err: NodeJS.ErrnoException | null, stats: fs.Stats) => {
if (err) {
Expand All @@ -140,7 +138,7 @@ export class WatchFileSystemAdapter implements IWatchFileSystemAdapter {
};

/** { @inheritdoc fs.lstatSync } */
public lstatSync: StatSynchronousMethod = (filePath: string): fs.Stats => {
public lstatSync: FileSystemAdapter['lstatSync'] = (filePath: string): fs.Stats => {
filePath = path.normalize(filePath);
try {
const stats: fs.Stats = fs.lstatSync(filePath);
Expand All @@ -153,7 +151,7 @@ export class WatchFileSystemAdapter implements IWatchFileSystemAdapter {
};

/** { @inheritdoc fs.stat } */
public stat: StatAsynchronousMethod = (filePath: string, callback: StatCallback): void => {
public stat: FileSystemAdapter['stat'] = (filePath: string, callback: StatCallback): void => {
filePath = path.normalize(filePath);
fs.stat(filePath, (err: NodeJS.ErrnoException | null, stats: fs.Stats) => {
if (err) {
Expand All @@ -166,7 +164,7 @@ export class WatchFileSystemAdapter implements IWatchFileSystemAdapter {
};

/** { @inheritdoc fs.statSync } */
public statSync: StatSynchronousMethod = (filePath: string) => {
public statSync: FileSystemAdapter['statSync'] = (filePath: string) => {
filePath = path.normalize(filePath);
try {
const stats: fs.Stats = fs.statSync(filePath);
Expand Down
2 changes: 1 addition & 1 deletion apps/lockfile-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@types/express": "4.17.13",
"@types/heft-jest": "1.0.1",
"@types/js-yaml": "3.12.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"@types/update-notifier": "~6.0.1"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion apps/rundown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"@rushstack/heft": "workspace:*",
"@rushstack/heft-node-rig": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36"
"@types/node": "18.17.15"
}
}
2 changes: 1 addition & 1 deletion apps/rush/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@rushstack/rush-azure-storage-build-cache-plugin": "workspace:*",
"@rushstack/rush-http-build-cache-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"@types/semver": "7.5.0"
}
}
2 changes: 1 addition & 1 deletion apps/trace-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@rushstack/heft": "workspace:*",
"@rushstack/heft-node-rig": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"@types/resolve": "1.20.2",
"@types/semver": "7.5.0"
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests-samples/heft-node-basic-tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@rushstack/heft-lint-plugin": "workspace:*",
"@rushstack/heft-typescript-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"eslint": "~8.7.0",
"typescript": "~5.0.4"
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests-samples/heft-node-jest-tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@rushstack/heft-lint-plugin": "workspace:*",
"@rushstack/heft-typescript-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"eslint": "~8.7.0",
"typescript": "~5.0.4"
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests-samples/heft-node-rig-tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"@rushstack/heft": "workspace:*",
"@rushstack/heft-node-rig": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36"
"@types/node": "18.17.15"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@serverless-stack/resources": "0.67.0",
"@types/aws-lambda": "8.10.93",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"aws-cdk-lib": "2.7.0",
"constructs": "~10.0.98",
"eslint": "~8.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@storybook/react": "~6.4.18",
"@storybook/theming": "~6.4.18",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"@types/react-dom": "16.9.14",
"@types/react": "16.14.23",
"@types/webpack-env": "1.18.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@rushstack/webpack4-module-minifier-plugin": "workspace:*",
"@storybook/react": "~6.4.18",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"@types/react-dom": "16.9.14",
"@types/react": "16.14.23",
"@types/webpack-env": "1.18.0",
Expand Down
2 changes: 1 addition & 1 deletion build-tests-samples/packlets-tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@rushstack/heft": "workspace:*",
"@rushstack/heft-lint-plugin": "workspace:*",
"@rushstack/heft-typescript-plugin": "workspace:*",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"eslint": "~8.7.0",
"typescript": "~5.0.4"
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests/api-documenter-scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@microsoft/teams-js": "1.3.0-beta.4",
"@rushstack/node-core-library": "workspace:*",
"@types/jest": "29.2.5",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"fs-extra": "~7.0.1",
"typescript": "~5.0.4"
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests/api-documenter-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@microsoft/api-documenter": "workspace:*",
"@microsoft/api-extractor": "workspace:*",
"@types/jest": "29.2.5",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"fs-extra": "~7.0.1",
"typescript": "~5.0.4"
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests/api-extractor-lib2-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"@microsoft/api-extractor": "workspace:*",
"@types/jest": "29.2.5",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"fs-extra": "~7.0.1",
"typescript": "~5.0.4"
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests/api-extractor-lib3-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"devDependencies": {
"@microsoft/api-extractor": "workspace:*",
"@types/jest": "29.2.5",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"fs-extra": "~7.0.1",
"typescript": "~5.0.4"
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests/api-extractor-scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@microsoft/teams-js": "1.3.0-beta.4",
"@rushstack/node-core-library": "workspace:*",
"@types/jest": "29.2.5",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"api-extractor-lib1-test": "workspace:*",
"api-extractor-lib2-test": "workspace:*",
"api-extractor-lib3-test": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion build-tests/api-extractor-test-01/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"devDependencies": {
"@microsoft/api-extractor": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "14.18.36",
"@types/node": "18.17.15",
"fs-extra": "~7.0.1",
"typescript": "~5.0.4"
}
Expand Down
Loading

0 comments on commit 3ab024c

Please sign in to comment.