Description
Summary
I am using Terminal
and ConsoleTerminalProvider
with projectAnalyzer.getChangedProjectsAsync
const node_modules = path.join(__dirname, '..', 'autoinstallers/rush-publish/node_modules');
const rushLib = require(path.join(node_modules, '@microsoft/rush-lib'));
const rushCore = require(path.join(node_modules, '@rushstack/node-core-library'));
//...
const projectAnalyzer = new rushLib.ProjectChangeAnalyzer(this.rushConfiguration);
const terminal = new rushCore.Terminal(new ConsoleTerminalProvider({ verboseEnabled: false }));
const changedProjects = await projectAnalyzer.getChangedProjectsAsync({
targetBranchName: currentBranch,
terminal: terminal,
enableFiltering: false,
includeExternalDependencies: false
});
It used to work in the past, I am now getting ConsoleTerminalProvider is not a constructor
error.
I see that Terminal moved from @rushstack/node-core-library
to @rushstack/terminal
but even after updating my code I still get an error.
The SPFx\common\autoinstallers\rush-publish\node_modules\@rushstack\terminal\lib\index.d.ts
file has the following contents:
/**
* This library implements a system for processing human readable text that
* will be output by console applications.
*
* @remarks
* See the {@link TerminalWritable} documentation for an overview of the major concepts.
*
* @packageDocumentation
*/
export * from './CallbackWritable';
export * from './DiscardStdoutTransform';
export * from './ITerminalChunk';
export * from './MockWritable';
export * from './NormalizeNewlinesTextRewriter';
export * from './PrintUtilities';
export * from './RemoveColorsTextRewriter';
export * from './SplitterTransform';
export * from './StdioLineTransform';
export * from './StdioSummarizer';
export * from './StdioWritable';
export * from './TerminalTransform';
export * from './TerminalWritable';
export * from './TextRewriter';
export * from './TextRewriterTransform';
//# sourceMappingURL=index.d.ts.map
which would explain why the ConsoleTerminalProvider
is missing.
Checking the repo I see it should be exported:
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/// <reference types="node" preserve="true" />
/**
* This library implements a system for processing human readable text that
* will be output by console applications.
*
* @remarks
* See the {@link TerminalWritable} documentation for an overview of the major concepts.
*
* @packageDocumentation
*/
export { type ICallbackWritableOptions, CallbackWritable } from './CallbackWritable';
export { type IDiscardStdoutTransformOptions, DiscardStdoutTransform } from './DiscardStdoutTransform';
export { TerminalChunkKind, type ITerminalChunk } from './ITerminalChunk';
export { MockWritable } from './MockWritable';
export {
type INormalizeNewlinesTextRewriterOptions,
NormalizeNewlinesTextRewriter
} from './NormalizeNewlinesTextRewriter';
export { DEFAULT_CONSOLE_WIDTH, PrintUtilities } from './PrintUtilities';
export { RemoveColorsTextRewriter } from './RemoveColorsTextRewriter';
export { type ISplitterTransformOptions, SplitterTransform } from './SplitterTransform';
export { type IStdioLineTransformOptions, StderrLineTransform } from './StdioLineTransform';
export { type IStdioSummarizerOptions, StdioSummarizer } from './StdioSummarizer';
export { StdioWritable } from './StdioWritable';
export { type ITerminalTransformOptions, TerminalTransform } from './TerminalTransform';
export { type ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';
export { type TextRewriterState, TextRewriter } from './TextRewriter';
export { type ITextRewriterTransformOptions, TextRewriterTransform } from './TextRewriterTransform';
export { AnsiEscape, type IAnsiEscapeConvertForTestsOptions } from './AnsiEscape';
export type { ITerminal, TerminalWriteParameters, ITerminalWriteOptions } from './ITerminal';
export { Terminal } from './Terminal';
export { Colorize } from './Colorize';
export { type ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider';
👉export { ConsoleTerminalProvider, type IConsoleTerminalProviderOptions } from './ConsoleTerminalProvider';
export {
StringBufferTerminalProvider,
type IStringBufferOutputOptions
} from './StringBufferTerminalProvider';
export {
PrefixProxyTerminalProvider,
type IPrefixProxyTerminalProviderOptions,
type IDynamicPrefixProxyTerminalProviderOptions,
type IPrefixProxyTerminalProviderOptionsBase,
type IStaticPrefixProxyTerminalProviderOptions
} from './PrefixProxyTerminalProvider';
export { NoOpTerminalProvider } from './NoOpTerminalProvider';
export { TerminalStreamWritable, type ITerminalStreamWritableOptions } from './TerminalStreamWritable';
Repro steps
I have an auto-installer and a custom command, but maybe it would be easier to write unit tests and see if the code is working?
Expected result: the ConsoleTerminalProvider
instance should be created
Actual result:
const terminal = new Terminal(new ConsoleTerminalProvider({ verboseEnabled: false }));
^
TypeError: ConsoleTerminalProvider is not a constructor
Details
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Question | Answer |
---|---|
@microsoft/rush globally installed version? |
5.153.2 |
rushVersion from rush.json? |
5.153.2 |
useWorkspaces from rush.json? |
true |
Operating system? | Windows |
Would you consider contributing a PR? | Yes |
Node.js version (node -v )? |
22.14.0 |
Metadata
Metadata
Assignees
Labels
Type
Projects
Status