Skip to content

Commit

Permalink
Merge branch 'main' into regexp-bundledPackages
Browse files Browse the repository at this point in the history
  • Loading branch information
Josmithr committed Feb 21, 2024
2 parents 37a51be + 546507c commit b3ed5d6
Show file tree
Hide file tree
Showing 99 changed files with 581 additions and 524 deletions.
6 changes: 3 additions & 3 deletions apps/api-documenter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"@microsoft/api-extractor-model": "workspace:*",
"@microsoft/tsdoc": "0.14.2",
"@rushstack/node-core-library": "workspace:*",
"@rushstack/terminal": "workspace:*",
"@rushstack/ts-command-line": "workspace:*",
"colors": "~1.2.1",
"js-yaml": "~3.13.1",
"resolve": "~1.22.1"
},
"devDependencies": {
"@rushstack/heft": "workspace:*",
"local-node-rig": "workspace:*",
"@types/js-yaml": "3.12.1",
"@types/resolve": "1.20.2"
"@types/resolve": "1.20.2",
"local-node-rig": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions apps/api-documenter/src/cli/BaseAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import * as path from 'path';
import type * as tsdoc from '@microsoft/tsdoc';
import colors from 'colors/safe';

import {
CommandLineAction,
Expand All @@ -18,6 +17,7 @@ import {
ApiDocumentedItem,
type IResolveDeclarationReferenceResult
} from '@microsoft/api-extractor-model';
import { Colorize } from '@rushstack/terminal';

export interface IBuildApiModelResult {
apiModel: ApiModel;
Expand Down Expand Up @@ -94,7 +94,7 @@ export abstract class BaseAction extends CommandLineAction {

if (result.errorMessage) {
console.log(
colors.yellow(
Colorize.yellow(
`Warning: Unresolved @inheritDoc tag for ${apiItem.displayName}: ` + result.errorMessage
)
);
Expand Down
4 changes: 2 additions & 2 deletions apps/api-documenter/src/documenters/OfficeYamlDocumenter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import colors from 'colors';
import * as path from 'path';
import yaml = require('js-yaml');

import type { ApiModel } from '@microsoft/api-extractor-model';
import { FileSystem } from '@rushstack/node-core-library';
import { Colorize } from '@rushstack/terminal';

import type { IYamlTocItem } from '../yaml/IYamlTocFile';
import type { IYamlItem } from '../yaml/IYamlApiFile';
Expand Down Expand Up @@ -59,7 +59,7 @@ export class OfficeYamlDocumenter extends YamlDocumenter {
// After we generate everything, check for any unused snippets
console.log();
for (const apiName of Object.keys(this._snippets)) {
console.error(colors.yellow('Warning: Unused snippet ' + apiName));
console.error(Colorize.yellow('Warning: Unused snippet ' + apiName));
}
}

Expand Down
7 changes: 3 additions & 4 deletions apps/api-documenter/src/markdown/CustomMarkdownEmitter.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import colors from 'colors';

import type { DocNode, DocLinkTag, StringBuilder } from '@microsoft/tsdoc';
import type { ApiModel, IResolveDeclarationReferenceResult, ApiItem } from '@microsoft/api-extractor-model';
import { Colorize } from '@rushstack/terminal';

import { CustomDocNodeKind } from '../nodes/CustomDocNodeKind';
import type { DocHeading } from '../nodes/DocHeading';
Expand Down Expand Up @@ -183,12 +182,12 @@ export class CustomMarkdownEmitter extends MarkdownEmitter {
context.writer.write(encodedLinkText);
context.writer.write(`](${filename!})`);
} else {
console.log(colors.yellow('WARNING: Unable to determine link text'));
console.log(Colorize.yellow('WARNING: Unable to determine link text'));
}
}
} else if (result.errorMessage) {
console.log(
colors.yellow(
Colorize.yellow(
`WARNING: Unable to resolve reference "${docLinkTag.codeDestination!.emitAsTsdoc()}": ` +
result.errorMessage
)
Expand Down
6 changes: 4 additions & 2 deletions apps/api-documenter/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
// See LICENSE in the project root for license information.

import * as os from 'os';
import colors from 'colors';

import { PackageJsonLookup } from '@rushstack/node-core-library';
import { Colorize } from '@rushstack/terminal';

import { ApiDocumenterCommandLine } from './cli/ApiDocumenterCommandLine';

const myPackageVersion: string = PackageJsonLookup.loadOwnPackageJson(__dirname).version;

console.log(
os.EOL +
colors.bold(`api-documenter ${myPackageVersion} ` + colors.cyan(' - https://api-extractor.com/') + os.EOL)
Colorize.bold(
`api-documenter ${myPackageVersion} ` + Colorize.cyan(' - https://api-extractor.com/') + os.EOL
)
);

const parser: ApiDocumenterCommandLine = new ApiDocumenterCommandLine();
Expand Down
10 changes: 5 additions & 5 deletions apps/api-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
},
"dependencies": {
"@microsoft/api-extractor-model": "workspace:*",
"@microsoft/tsdoc": "0.14.2",
"@microsoft/tsdoc-config": "~0.16.1",
"@microsoft/tsdoc": "0.14.2",
"@rushstack/node-core-library": "workspace:*",
"@rushstack/rig-package": "workspace:*",
"@rushstack/terminal": "workspace:*",
"@rushstack/ts-command-line": "workspace:*",
"colors": "~1.2.1",
"lodash": "~4.17.15",
"minimatch": "~3.0.3",
"resolve": "~1.22.1",
Expand All @@ -52,14 +52,14 @@
"typescript": "5.3.3"
},
"devDependencies": {
"local-eslint-config": "workspace:*",
"@rushstack/heft": "0.64.0",
"@rushstack/heft-node-rig": "2.4.0",
"@rushstack/heft": "0.64.0",
"@types/heft-jest": "1.0.1",
"@types/lodash": "4.14.116",
"@types/minimatch": "3.0.5",
"@types/node": "18.17.15",
"@types/resolve": "1.20.2",
"@types/semver": "7.5.0"
"@types/semver": "7.5.0",
"local-eslint-config": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions apps/api-extractor/src/api/CompilerState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

import * as path from 'path';
import * as ts from 'typescript';
import colors = require('colors');

import { JsonFile } from '@rushstack/node-core-library';

import { ExtractorConfig } from './ExtractorConfig';
import type { IExtractorInvokeOptions } from './Extractor';
import { Colorize } from '@rushstack/terminal';

/**
* Options for {@link CompilerState.create}
Expand Down Expand Up @@ -60,7 +60,7 @@ export class CompilerState {
if (!commandLine.options.skipLibCheck && extractorConfig.skipLibCheck) {
commandLine.options.skipLibCheck = true;
console.log(
colors.cyan(
Colorize.cyan(
'API Extractor was invoked with skipLibCheck. This is not recommended and may cause ' +
'incorrect type analysis.'
)
Expand Down
4 changes: 2 additions & 2 deletions apps/api-extractor/src/cli/ApiExtractorCommandLine.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import colors from 'colors';
import * as os from 'os';

import { CommandLineParser, type CommandLineFlagParameter } from '@rushstack/ts-command-line';
import { InternalError } from '@rushstack/node-core-library';
import { Colorize } from '@rushstack/terminal';

import { RunAction } from './RunAction';
import { InitAction } from './InitAction';
Expand Down Expand Up @@ -42,7 +42,7 @@ export class ApiExtractorCommandLine extends CommandLineParser {
if (this._debugParameter.value) {
console.error(os.EOL + error.stack);
} else {
console.error(os.EOL + colors.red('ERROR: ' + error.message.trim()));
console.error(os.EOL + Colorize.red('ERROR: ' + error.message.trim()));
}

process.exitCode = 1;
Expand Down
6 changes: 3 additions & 3 deletions apps/api-extractor/src/cli/InitAction.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import colors from 'colors';
import * as path from 'path';
import { FileSystem } from '@rushstack/node-core-library';
import { CommandLineAction } from '@rushstack/ts-command-line';
import { Colorize } from '@rushstack/terminal';

import type { ApiExtractorCommandLine } from './ApiExtractorCommandLine';
import { ExtractorConfig } from '../api/ExtractorConfig';
Expand All @@ -27,12 +27,12 @@ export class InitAction extends CommandLineAction {
const outputFilePath: string = path.resolve(ExtractorConfig.FILENAME);

if (FileSystem.exists(outputFilePath)) {
console.log(colors.red('The output file already exists:'));
console.log(Colorize.red('The output file already exists:'));
console.log('\n ' + outputFilePath + '\n');
throw new Error('Unable to write output file');
}

console.log(colors.green('Writing file: ') + outputFilePath);
console.log(Colorize.green('Writing file: ') + outputFilePath);
FileSystem.copyFile({
sourcePath: inputFilePath,
destinationPath: outputFilePath
Expand Down
8 changes: 3 additions & 5 deletions apps/api-extractor/src/cli/RunAction.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import colors from 'colors';
import * as os from 'os';
import * as path from 'path';
import { PackageJsonLookup, FileSystem, type IPackageJson, Path } from '@rushstack/node-core-library';

import { Colorize } from '@rushstack/terminal';
import {
CommandLineAction,
type CommandLineStringParameter,
type CommandLineFlagParameter
} from '@rushstack/ts-command-line';

import { Extractor, type ExtractorResult } from '../api/Extractor';

import type { ApiExtractorCommandLine } from './ApiExtractorCommandLine';
import { ExtractorConfig, type IExtractorConfigPrepareOptions } from '../api/ExtractorConfig';

Expand Down Expand Up @@ -144,9 +142,9 @@ export class RunAction extends CommandLineAction {
process.exitCode = 1;

if (extractorResult.errorCount > 0) {
console.log(os.EOL + colors.red('API Extractor completed with errors'));
console.log(os.EOL + Colorize.red('API Extractor completed with errors'));
} else {
console.log(os.EOL + colors.yellow('API Extractor completed with warnings'));
console.log(os.EOL + Colorize.yellow('API Extractor completed with warnings'));
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions apps/api-extractor/src/collector/MessageRouter.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import colors from 'colors';
import * as ts from 'typescript';
import type * as tsdoc from '@microsoft/tsdoc';
import { Sort, InternalError } from '@rushstack/node-core-library';
import { Colorize } from '@rushstack/terminal';

import { AstDeclaration } from '../analyzer/AstDeclaration';
import type { AstSymbol } from '../analyzer/AstSymbol';
Expand Down Expand Up @@ -597,17 +597,17 @@ export class MessageRouter {

switch (message.logLevel) {
case ExtractorLogLevel.Error:
console.error(colors.red('Error: ' + messageText));
console.error(Colorize.red('Error: ' + messageText));
break;
case ExtractorLogLevel.Warning:
console.warn(colors.yellow('Warning: ' + messageText));
console.warn(Colorize.yellow('Warning: ' + messageText));
break;
case ExtractorLogLevel.Info:
console.log(messageText);
break;
case ExtractorLogLevel.Verbose:
if (this.showVerboseMessages) {
console.log(colors.cyan(messageText));
console.log(Colorize.cyan(messageText));
}
break;
default:
Expand Down
8 changes: 5 additions & 3 deletions apps/api-extractor/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
// See LICENSE in the project root for license information.

import * as os from 'os';
import colors from 'colors';
import { Colorize } from '@rushstack/terminal';

import { ApiExtractorCommandLine } from './cli/ApiExtractorCommandLine';
import { Extractor } from './api/Extractor';

console.log(
os.EOL +
colors.bold(`api-extractor ${Extractor.version} ` + colors.cyan(' - https://api-extractor.com/') + os.EOL)
Colorize.bold(
`api-extractor ${Extractor.version} ` + Colorize.cyan(' - https://api-extractor.com/') + os.EOL
)
);

const parser: ApiExtractorCommandLine = new ApiExtractorCommandLine();

parser.execute().catch((error) => {
console.error(colors.red(`An unexpected error occurred: ${error}`));
console.error(Colorize.red(`An unexpected error occurred: ${error}`));
process.exit(1);
});
6 changes: 3 additions & 3 deletions apps/lockfile-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@
},
"devDependencies": {
"@microsoft/rush-lib": "workspace:*",
"local-node-rig": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/lockfile-explorer-web": "workspace:*",
"@types/cors": "~2.8.12",
"@types/express": "4.17.13",
"@types/js-yaml": "3.12.1",
"@types/update-notifier": "~6.0.1"
"@types/update-notifier": "~6.0.1",
"local-node-rig": "workspace:*"
},
"dependencies": {
"@rushstack/node-core-library": "workspace:*",
"@rushstack/terminal": "workspace:*",
"@types/express": "4.17.13",
"colors": "~1.2.1",
"cors": "~2.8.5",
"express": "4.18.1",
"js-yaml": "~3.13.1",
Expand Down
13 changes: 7 additions & 6 deletions apps/lockfile-explorer/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import express from 'express';
import yaml from 'js-yaml';
import cors from 'cors';
import process from 'process';
import colors from 'colors/safe';
import open from 'open';
import updateNotifier from 'update-notifier';
import { AlreadyReportedError } from '@rushstack/node-core-library';
import { FileSystem, type IPackageJson, JsonFile, PackageJsonLookup } from '@rushstack/node-core-library';
import type { IAppContext } from '@rushstack/lockfile-explorer-web/lib/AppContext';
import { Colorize } from '@rushstack/terminal';

import { init } from './init';
import type { IAppState } from './state';
import { AlreadyReportedError } from '@rushstack/node-core-library';

function startApp(debugMode: boolean): void {
const lockfileExplorerProjectRoot: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;
Expand All @@ -22,7 +23,7 @@ function startApp(debugMode: boolean): void {
const appVersion: string = lockfileExplorerPackageJson.version;

console.log(
colors.bold(`\nRush Lockfile Explorer ${appVersion}`) + colors.cyan(' - https://lfx.rushstack.io/\n')
Colorize.bold(`\nRush Lockfile Explorer ${appVersion}`) + Colorize.cyan(' - https://lfx.rushstack.io/\n')
);

updateNotifier({
Expand Down Expand Up @@ -66,7 +67,7 @@ function startApp(debugMode: boolean): void {
let disconnected: boolean = false;
setInterval(() => {
if (!isClientConnected && !awaitingFirstConnect && !disconnected) {
console.log(colors.red('The client has disconnected!'));
console.log(Colorize.red('The client has disconnected!'));
console.log(`Please open a browser window at http://localhost:${PORT}/app`);
disconnected = true;
} else if (!awaitingFirstConnect) {
Expand Down Expand Up @@ -104,7 +105,7 @@ function startApp(debugMode: boolean): void {
isClientConnected = true;
if (disconnected) {
disconnected = false;
console.log(colors.green('The client has reconnected!'));
console.log(Colorize.green('The client has reconnected!'));
}
res.status(200).send();
});
Expand Down Expand Up @@ -201,7 +202,7 @@ if (debugMode) {
} catch (error) {
if (!(error instanceof AlreadyReportedError)) {
console.error();
console.error(colors.red('ERROR: ' + error.message));
console.error(Colorize.red('ERROR: ' + error.message));
}
}
}
5 changes: 2 additions & 3 deletions apps/rush/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@
"dependencies": {
"@microsoft/rush-lib": "workspace:*",
"@rushstack/node-core-library": "workspace:*",
"colors": "~1.2.1",
"semver": "~7.5.4",
"@rushstack/terminal": "workspace:*"
"@rushstack/terminal": "workspace:*",
"semver": "~7.5.4"
},
"devDependencies": {
"@rushstack/heft": "workspace:*",
Expand Down
Loading

0 comments on commit b3ed5d6

Please sign in to comment.