@webiny/cli-core 0.0.0-unstable.0d717d18dd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cli.d.ts +8 -0
- package/Cli.js +17 -0
- package/Cli.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/abstractions/createAbstraction.d.ts +2 -0
- package/abstractions/createAbstraction.js +7 -0
- package/abstractions/createAbstraction.js.map +1 -0
- package/abstractions/features/CliCommand.d.ts +41 -0
- package/abstractions/features/CliCommand.js +5 -0
- package/abstractions/features/CliCommand.js.map +1 -0
- package/abstractions/features/ErrorHandler.d.ts +15 -0
- package/abstractions/features/ErrorHandler.js +5 -0
- package/abstractions/features/ErrorHandler.js.map +1 -0
- package/abstractions/features/GlobalCliOption.d.ts +20 -0
- package/abstractions/features/GlobalCliOption.js +5 -0
- package/abstractions/features/GlobalCliOption.js.map +1 -0
- package/abstractions/features/IsCi.d.ts +8 -0
- package/abstractions/features/IsCi.js +5 -0
- package/abstractions/features/IsCi.js.map +1 -0
- package/abstractions/features/index.d.ts +4 -0
- package/abstractions/features/index.js +4 -0
- package/abstractions/features/types.d.ts +8 -0
- package/abstractions/features/types.js +0 -0
- package/abstractions/index.d.ts +2 -0
- package/abstractions/index.js +2 -0
- package/abstractions/services/ArgvParserService.d.ts +7 -0
- package/abstractions/services/ArgvParserService.js +5 -0
- package/abstractions/services/ArgvParserService.js.map +1 -0
- package/abstractions/services/CliParamsService.d.ts +15 -0
- package/abstractions/services/CliParamsService.js +5 -0
- package/abstractions/services/CliParamsService.js.map +1 -0
- package/abstractions/services/CommandsRegistryService.d.ts +8 -0
- package/abstractions/services/CommandsRegistryService.js +5 -0
- package/abstractions/services/CommandsRegistryService.js.map +1 -0
- package/abstractions/services/DefaultAppsService.d.ts +8 -0
- package/abstractions/services/DefaultAppsService.js +5 -0
- package/abstractions/services/DefaultAppsService.js.map +1 -0
- package/abstractions/services/GetArgvService.d.ts +7 -0
- package/abstractions/services/GetArgvService.js +5 -0
- package/abstractions/services/GetArgvService.js.map +1 -0
- package/abstractions/services/GetCliRunnerService.d.ts +7 -0
- package/abstractions/services/GetCliRunnerService.js +5 -0
- package/abstractions/services/GetCliRunnerService.js.map +1 -0
- package/abstractions/services/GetIsCiService.d.ts +8 -0
- package/abstractions/services/GetIsCiService.js +5 -0
- package/abstractions/services/GetIsCiService.js.map +1 -0
- package/abstractions/services/GetProjectSdkService.d.ts +8 -0
- package/abstractions/services/GetProjectSdkService.js +5 -0
- package/abstractions/services/GetProjectSdkService.js.map +1 -0
- package/abstractions/services/GlobalOptionsRegistryService.d.ts +8 -0
- package/abstractions/services/GlobalOptionsRegistryService.js +5 -0
- package/abstractions/services/GlobalOptionsRegistryService.js.map +1 -0
- package/abstractions/services/LoggerService.d.ts +13 -0
- package/abstractions/services/LoggerService.js +5 -0
- package/abstractions/services/LoggerService.js.map +1 -0
- package/abstractions/services/RunCliRunnerService.d.ts +7 -0
- package/abstractions/services/RunCliRunnerService.js +5 -0
- package/abstractions/services/RunCliRunnerService.js.map +1 -0
- package/abstractions/services/StdioService.d.ts +9 -0
- package/abstractions/services/StdioService.js +5 -0
- package/abstractions/services/StdioService.js.map +1 -0
- package/abstractions/services/UiService.d.ts +15 -0
- package/abstractions/services/UiService.js +5 -0
- package/abstractions/services/UiService.js.map +1 -0
- package/abstractions/services/index.d.ts +13 -0
- package/abstractions/services/index.js +13 -0
- package/createCliContainer.d.ts +3 -0
- package/createCliContainer.js +92 -0
- package/createCliContainer.js.map +1 -0
- package/decorators/CommandsWithGracefulErrorHandling.d.ts +10 -0
- package/decorators/CommandsWithGracefulErrorHandling.js +40 -0
- package/decorators/CommandsWithGracefulErrorHandling.js.map +1 -0
- package/decorators/index.d.ts +1 -0
- package/decorators/index.js +1 -0
- package/exports/cli/command.d.ts +1 -0
- package/exports/cli/command.js +1 -0
- package/exports/cli.d.ts +2 -0
- package/exports/cli.js +2 -0
- package/extensions/CliCommand.d.ts +4 -0
- package/extensions/CliCommand.js +20 -0
- package/extensions/CliCommand.js.map +1 -0
- package/extensions/CliCommandDecorator.d.ts +4 -0
- package/extensions/CliCommandDecorator.js +20 -0
- package/extensions/CliCommandDecorator.js.map +1 -0
- package/extensions/index.d.ts +5 -0
- package/extensions/index.js +9 -0
- package/extensions/index.js.map +1 -0
- package/features/AboutCommand.d.ts +12 -0
- package/features/AboutCommand.js +88 -0
- package/features/AboutCommand.js.map +1 -0
- package/features/BuildCommand/BuildCommand.d.ts +15 -0
- package/features/BuildCommand/BuildCommand.js +75 -0
- package/features/BuildCommand/BuildCommand.js.map +1 -0
- package/features/BuildCommand/buildRunners/BaseBuildRunner.d.ts +14 -0
- package/features/BuildCommand/buildRunners/BaseBuildRunner.js +13 -0
- package/features/BuildCommand/buildRunners/BaseBuildRunner.js.map +1 -0
- package/features/BuildCommand/buildRunners/BuildRunner.d.ts +6 -0
- package/features/BuildCommand/buildRunners/BuildRunner.js +27 -0
- package/features/BuildCommand/buildRunners/BuildRunner.js.map +1 -0
- package/features/BuildCommand/buildRunners/MultipleBuildsRunner.d.ts +4 -0
- package/features/BuildCommand/buildRunners/MultipleBuildsRunner.js +26 -0
- package/features/BuildCommand/buildRunners/MultipleBuildsRunner.js.map +1 -0
- package/features/BuildCommand/buildRunners/SingleBuildRunner.d.ts +4 -0
- package/features/BuildCommand/buildRunners/SingleBuildRunner.js +20 -0
- package/features/BuildCommand/buildRunners/SingleBuildRunner.js.map +1 -0
- package/features/BuildCommand/buildRunners/ZeroBuildsRunner.d.ts +4 -0
- package/features/BuildCommand/buildRunners/ZeroBuildsRunner.js +7 -0
- package/features/BuildCommand/buildRunners/ZeroBuildsRunner.js.map +1 -0
- package/features/BuildCommand/index.d.ts +1 -0
- package/features/BuildCommand/index.js +1 -0
- package/features/ConfigCommand.d.ts +16 -0
- package/features/ConfigCommand.js +63 -0
- package/features/ConfigCommand.js.map +1 -0
- package/features/DeployCommand/index.d.ts +20 -0
- package/features/DeployCommand/index.js +0 -0
- package/features/DepsSync/BuildDependencyTree.d.ts +9 -0
- package/features/DepsSync/BuildDependencyTree.js +22 -0
- package/features/DepsSync/BuildDependencyTree.js.map +1 -0
- package/features/DepsSync/DependencyTree.d.ts +12 -0
- package/features/DepsSync/DependencyTree.js +120 -0
- package/features/DepsSync/DependencyTree.js.map +1 -0
- package/features/DepsSync/ListAllPackageJsonFiles.d.ts +7 -0
- package/features/DepsSync/ListAllPackageJsonFiles.js +23 -0
- package/features/DepsSync/ListAllPackageJsonFiles.js.map +1 -0
- package/features/DepsSync/ListAllPackages.d.ts +3 -0
- package/features/DepsSync/ListAllPackages.js +13 -0
- package/features/DepsSync/ListAllPackages.js.map +1 -0
- package/features/DepsSync/commands/SyncDepsCommand.d.ts +13 -0
- package/features/DepsSync/commands/SyncDepsCommand.js +38 -0
- package/features/DepsSync/commands/SyncDepsCommand.js.map +1 -0
- package/features/DepsSync/commands/VerifyDepsCommand.d.ts +13 -0
- package/features/DepsSync/commands/VerifyDepsCommand.js +80 -0
- package/features/DepsSync/commands/VerifyDepsCommand.js.map +1 -0
- package/features/DepsSync/createDependencyTree.d.ts +3 -0
- package/features/DepsSync/createDependencyTree.js +31 -0
- package/features/DepsSync/createDependencyTree.js.map +1 -0
- package/features/DepsSync/createReferenceFile.d.ts +7 -0
- package/features/DepsSync/createReferenceFile.js +26 -0
- package/features/DepsSync/createReferenceFile.js.map +1 -0
- package/features/DepsSync/index.d.ts +2 -0
- package/features/DepsSync/index.js +2 -0
- package/features/DepsSync/paths.d.ts +3 -0
- package/features/DepsSync/paths.js +5 -0
- package/features/DepsSync/paths.js.map +1 -0
- package/features/DepsSync/types.d.ts +45 -0
- package/features/DepsSync/types.js +10 -0
- package/features/DepsSync/types.js.map +1 -0
- package/features/DisableTelemetryCommand.d.ts +11 -0
- package/features/DisableTelemetryCommand.js +34 -0
- package/features/DisableTelemetryCommand.js.map +1 -0
- package/features/EnableTelemetryCommand.d.ts +11 -0
- package/features/EnableTelemetryCommand.js +34 -0
- package/features/EnableTelemetryCommand.js.map +1 -0
- package/features/ExtensionCommand/ExtensionCommand.d.ts +12 -0
- package/features/ExtensionCommand/ExtensionCommand.js +68 -0
- package/features/ExtensionCommand/ExtensionCommand.js.map +1 -0
- package/features/ExtensionCommand/index.d.ts +1 -0
- package/features/ExtensionCommand/index.js +1 -0
- package/features/InfoCommand/InfoCommand.d.ts +10 -0
- package/features/InfoCommand/InfoCommand.js +62 -0
- package/features/InfoCommand/InfoCommand.js.map +1 -0
- package/features/InfoCommand/PrintInfoForEnv.d.ts +14 -0
- package/features/InfoCommand/PrintInfoForEnv.js +37 -0
- package/features/InfoCommand/PrintInfoForEnv.js.map +1 -0
- package/features/InfoCommand/index.d.ts +1 -0
- package/features/InfoCommand/index.js +1 -0
- package/features/IsCi/IsCi.d.ts +7 -0
- package/features/IsCi/IsCi.js +20 -0
- package/features/IsCi/IsCi.js.map +1 -0
- package/features/IsCi/index.d.ts +1 -0
- package/features/IsCi/index.js +1 -0
- package/features/OpenCommand.d.ts +10 -0
- package/features/OpenCommand.js +55 -0
- package/features/OpenCommand.js.map +1 -0
- package/features/UpgradeCommand/UpgradeCommand.d.ts +29 -0
- package/features/UpgradeCommand/UpgradeCommand.js +123 -0
- package/features/UpgradeCommand/UpgradeCommand.js.map +1 -0
- package/features/UpgradeCommand/UpgradeCommandHandler.d.ts +11 -0
- package/features/UpgradeCommand/UpgradeCommandHandler.js +105 -0
- package/features/UpgradeCommand/UpgradeCommandHandler.js.map +1 -0
- package/features/UpgradeCommand/abstraction.d.ts +23 -0
- package/features/UpgradeCommand/abstraction.js +5 -0
- package/features/UpgradeCommand/abstraction.js.map +1 -0
- package/features/UpgradeCommand/feature.d.ts +4 -0
- package/features/UpgradeCommand/feature.js +13 -0
- package/features/UpgradeCommand/feature.js.map +1 -0
- package/features/UpgradeCommand/index.d.ts +2 -0
- package/features/UpgradeCommand/index.js +2 -0
- package/features/Wcp/LinkProjectCommand.d.ts +13 -0
- package/features/Wcp/LinkProjectCommand.js +127 -0
- package/features/Wcp/LinkProjectCommand.js.map +1 -0
- package/features/Wcp/LoginCommand.d.ts +13 -0
- package/features/Wcp/LoginCommand.js +112 -0
- package/features/Wcp/LoginCommand.js.map +1 -0
- package/features/Wcp/LogoutCommand.d.ts +13 -0
- package/features/Wcp/LogoutCommand.js +35 -0
- package/features/Wcp/LogoutCommand.js.map +1 -0
- package/features/Wcp/WhoAmICommand.d.ts +15 -0
- package/features/Wcp/WhoAmICommand.js +38 -0
- package/features/Wcp/WhoAmICommand.js.map +1 -0
- package/features/common/index.d.ts +1 -0
- package/features/common/index.js +1 -0
- package/features/common/options.d.ts +20 -0
- package/features/common/options.js +43 -0
- package/features/common/options.js.map +1 -0
- package/features/globalOptions/LogLevelGlobalOption.d.ts +5 -0
- package/features/globalOptions/LogLevelGlobalOption.js +31 -0
- package/features/globalOptions/LogLevelGlobalOption.js.map +1 -0
- package/features/globalOptions/ShowLogsGlobalOption.d.ts +5 -0
- package/features/globalOptions/ShowLogsGlobalOption.js +22 -0
- package/features/globalOptions/ShowLogsGlobalOption.js.map +1 -0
- package/features/globalOptions/StackTraceGlobalOption.d.ts +5 -0
- package/features/globalOptions/StackTraceGlobalOption.js +22 -0
- package/features/globalOptions/StackTraceGlobalOption.js.map +1 -0
- package/features/globalOptions/index.d.ts +3 -0
- package/features/globalOptions/index.js +3 -0
- package/features/gracefulErrorHandlers/MissingFilesInBuildGracefulErrorHandler.d.ts +6 -0
- package/features/gracefulErrorHandlers/MissingFilesInBuildGracefulErrorHandler.js +21 -0
- package/features/gracefulErrorHandlers/MissingFilesInBuildGracefulErrorHandler.js.map +1 -0
- package/features/gracefulErrorHandlers/index.d.ts +1 -0
- package/features/gracefulErrorHandlers/index.js +1 -0
- package/features/index.d.ts +18 -0
- package/features/index.js +18 -0
- package/features/utils/index.d.ts +1 -0
- package/features/utils/index.js +1 -0
- package/features/utils/measureDuration.d.ts +1 -0
- package/features/utils/measureDuration.js +10 -0
- package/features/utils/measureDuration.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +52 -0
- package/services/ArgvParserService/ArgvParserService.d.ts +7 -0
- package/services/ArgvParserService/ArgvParserService.js +35 -0
- package/services/ArgvParserService/ArgvParserService.js.map +1 -0
- package/services/ArgvParserService/index.d.ts +1 -0
- package/services/ArgvParserService/index.js +1 -0
- package/services/CliParamsService/CliParamsService.d.ts +7 -0
- package/services/CliParamsService/CliParamsService.js +24 -0
- package/services/CliParamsService/CliParamsService.js.map +1 -0
- package/services/CliParamsService/index.d.ts +1 -0
- package/services/CliParamsService/index.js +1 -0
- package/services/CommandsRegistryService/CommandsRegistryService.d.ts +7 -0
- package/services/CommandsRegistryService/CommandsRegistryService.js +25 -0
- package/services/CommandsRegistryService/CommandsRegistryService.js.map +1 -0
- package/services/CommandsRegistryService/index.d.ts +1 -0
- package/services/CommandsRegistryService/index.js +1 -0
- package/services/DefaultAppsService/DefaultAppsService.d.ts +5 -0
- package/services/DefaultAppsService/DefaultAppsService.js +15 -0
- package/services/DefaultAppsService/DefaultAppsService.js.map +1 -0
- package/services/DefaultAppsService/index.d.ts +1 -0
- package/services/DefaultAppsService/index.js +1 -0
- package/services/GetArgvService/GetArgvService.d.ts +7 -0
- package/services/GetArgvService/GetArgvService.js +20 -0
- package/services/GetArgvService/GetArgvService.js.map +1 -0
- package/services/GetArgvService/index.d.ts +1 -0
- package/services/GetArgvService/index.js +1 -0
- package/services/GetCliRunnerService/GetCliRunnerService.d.ts +13 -0
- package/services/GetCliRunnerService/GetCliRunnerService.js +131 -0
- package/services/GetCliRunnerService/GetCliRunnerService.js.map +1 -0
- package/services/GetCliRunnerService/index.d.ts +1 -0
- package/services/GetCliRunnerService/index.js +1 -0
- package/services/GetIsCiService/GetIsCiService.d.ts +5 -0
- package/services/GetIsCiService/GetIsCiService.js +16 -0
- package/services/GetIsCiService/GetIsCiService.js.map +1 -0
- package/services/GetIsCiService/index.d.ts +1 -0
- package/services/GetIsCiService/index.js +1 -0
- package/services/GetProjectSdkService/GetProjectSdkService.d.ts +9 -0
- package/services/GetProjectSdkService/GetProjectSdkService.js +32 -0
- package/services/GetProjectSdkService/GetProjectSdkService.js.map +1 -0
- package/services/GetProjectSdkService/index.d.ts +1 -0
- package/services/GetProjectSdkService/index.js +1 -0
- package/services/GlobalOptionsRegistryService/GlobalOptionsRegistryService.d.ts +7 -0
- package/services/GlobalOptionsRegistryService/GlobalOptionsRegistryService.js +25 -0
- package/services/GlobalOptionsRegistryService/GlobalOptionsRegistryService.js.map +1 -0
- package/services/GlobalOptionsRegistryService/index.d.ts +1 -0
- package/services/GlobalOptionsRegistryService/index.js +1 -0
- package/services/LoggerService/LoggerService.d.ts +18 -0
- package/services/LoggerService/LoggerService.js +88 -0
- package/services/LoggerService/LoggerService.js.map +1 -0
- package/services/LoggerService/index.d.ts +1 -0
- package/services/LoggerService/index.js +1 -0
- package/services/RunCliRunnerService/RunCliRunnerService.d.ts +11 -0
- package/services/RunCliRunnerService/RunCliRunnerService.js +22 -0
- package/services/RunCliRunnerService/RunCliRunnerService.js.map +1 -0
- package/services/RunCliRunnerService/index.d.ts +1 -0
- package/services/RunCliRunnerService/index.js +1 -0
- package/services/StdioService/StdioService.d.ts +13 -0
- package/services/StdioService/StdioService.js +21 -0
- package/services/StdioService/StdioService.js.map +1 -0
- package/services/StdioService/index.d.ts +1 -0
- package/services/StdioService/index.js +1 -0
- package/services/UiService/UiService.d.ts +17 -0
- package/services/UiService/UiService.js +67 -0
- package/services/UiService/UiService.js.map +1 -0
- package/services/UiService/index.d.ts +1 -0
- package/services/UiService/index.js +1 -0
- package/services/index.d.ts +13 -0
- package/services/index.js +13 -0
- package/utils/ManuallyReportedError.d.ts +3 -0
- package/utils/ManuallyReportedError.js +10 -0
- package/utils/ManuallyReportedError.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions.js +63 -0
- package/utils/ensureSameWebinyPackageVersions.js.map +1 -0
- package/utils/suppressPunycodeWarnings.d.ts +4 -0
- package/utils/suppressPunycodeWarnings.js +7 -0
- package/utils/suppressPunycodeWarnings.js.map +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GetArgvService, LoggerService } from "../../abstractions/index.js";
|
|
2
|
+
export declare class DefaultLoggerService implements LoggerService.Interface {
|
|
3
|
+
private readonly getArgvService;
|
|
4
|
+
private pinoLogger;
|
|
5
|
+
constructor(getArgvService: GetArgvService.Interface);
|
|
6
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
7
|
+
fatal(message?: any, ...optionalParams: any[]): void;
|
|
8
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
9
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
10
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
11
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
12
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
13
|
+
private getLogger;
|
|
14
|
+
private getLogStream;
|
|
15
|
+
private getLogFileName;
|
|
16
|
+
private getLogLevel;
|
|
17
|
+
}
|
|
18
|
+
export declare const loggerService: import("@webiny/di").Implementation<typeof DefaultLoggerService>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { GetArgvService, LoggerService } from "../../abstractions/index.js";
|
|
3
|
+
import node_path from "node:path";
|
|
4
|
+
import { findUpSync } from "find-up";
|
|
5
|
+
import { pino } from "pino";
|
|
6
|
+
import pino_pretty from "pino-pretty";
|
|
7
|
+
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
8
|
+
const DEFAULT_LOG_LEVEL = "info";
|
|
9
|
+
class DefaultLoggerService {
|
|
10
|
+
constructor(getArgvService){
|
|
11
|
+
this.getArgvService = getArgvService;
|
|
12
|
+
this.pinoLogger = null;
|
|
13
|
+
}
|
|
14
|
+
trace(message, ...optionalParams) {
|
|
15
|
+
const logger = this.getLogger();
|
|
16
|
+
logger.trace(message, ...optionalParams);
|
|
17
|
+
}
|
|
18
|
+
fatal(message, ...optionalParams) {
|
|
19
|
+
const logger = this.getLogger();
|
|
20
|
+
logger.fatal(message, ...optionalParams);
|
|
21
|
+
}
|
|
22
|
+
debug(message, ...optionalParams) {
|
|
23
|
+
const logger = this.getLogger();
|
|
24
|
+
logger.debug(message, ...optionalParams);
|
|
25
|
+
}
|
|
26
|
+
info(message, ...optionalParams) {
|
|
27
|
+
const logger = this.getLogger();
|
|
28
|
+
logger.info(message, ...optionalParams);
|
|
29
|
+
}
|
|
30
|
+
warn(message, ...optionalParams) {
|
|
31
|
+
const logger = this.getLogger();
|
|
32
|
+
logger.warn(message, ...optionalParams);
|
|
33
|
+
}
|
|
34
|
+
error(message, ...optionalParams) {
|
|
35
|
+
const logger = this.getLogger();
|
|
36
|
+
logger.error(message, ...optionalParams);
|
|
37
|
+
}
|
|
38
|
+
log(message, ...optionalParams) {
|
|
39
|
+
const logger = this.getLogger();
|
|
40
|
+
logger.info(message, ...optionalParams);
|
|
41
|
+
}
|
|
42
|
+
getLogger() {
|
|
43
|
+
if (this.pinoLogger) return this.pinoLogger;
|
|
44
|
+
const logStream = this.getLogStream();
|
|
45
|
+
const level = this.getLogLevel();
|
|
46
|
+
this.pinoLogger = pino({
|
|
47
|
+
level
|
|
48
|
+
}, logStream);
|
|
49
|
+
return this.pinoLogger;
|
|
50
|
+
}
|
|
51
|
+
getLogStream() {
|
|
52
|
+
const argv = this.getArgvService.execute();
|
|
53
|
+
if (argv.showLogs) return pino_pretty({
|
|
54
|
+
ignore: "pid,hostname"
|
|
55
|
+
});
|
|
56
|
+
const webinyConfigPath = findUpSync("webiny.config.tsx");
|
|
57
|
+
if (!webinyConfigPath) throw new Error("Could not find project root path.");
|
|
58
|
+
const projectRootPath = node_path.dirname(webinyConfigPath);
|
|
59
|
+
const logsFolderPath = node_path.join(projectRootPath, ".webiny", "logs");
|
|
60
|
+
const logsFileName = this.getLogFileName();
|
|
61
|
+
if (!__rspack_external_node_fs_1b05aee1.existsSync(logsFolderPath)) __rspack_external_node_fs_1b05aee1.mkdirSync(logsFolderPath, {
|
|
62
|
+
recursive: true
|
|
63
|
+
});
|
|
64
|
+
const logFilePath = node_path.join(logsFolderPath, logsFileName);
|
|
65
|
+
return __rspack_external_node_fs_1b05aee1.createWriteStream(logFilePath, {
|
|
66
|
+
flags: "a"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
getLogFileName() {
|
|
70
|
+
const now = new Date();
|
|
71
|
+
const dateStr = now.toISOString().split("T")[0];
|
|
72
|
+
return `logs-${dateStr}.log`;
|
|
73
|
+
}
|
|
74
|
+
getLogLevel() {
|
|
75
|
+
const argv = this.getArgvService.execute();
|
|
76
|
+
return process.env.WEBINY_CLI_LOG_LEVEL || argv.logLevel || DEFAULT_LOG_LEVEL;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const loggerService = createImplementation({
|
|
80
|
+
abstraction: LoggerService,
|
|
81
|
+
implementation: DefaultLoggerService,
|
|
82
|
+
dependencies: [
|
|
83
|
+
GetArgvService
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
export { DefaultLoggerService, loggerService };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=LoggerService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/LoggerService/LoggerService.js","sources":["../../../src/services/LoggerService/LoggerService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GetArgvService, LoggerService } from \"~/abstractions/index.js\";\nimport * as fs from \"node:fs\";\nimport path from \"node:path\";\nimport { findUpSync } from \"find-up\";\nimport { pino, type Logger } from \"pino\";\nimport pinoPretty from \"pino-pretty\";\n\nconst DEFAULT_LOG_LEVEL = \"info\";\n\nexport class DefaultLoggerService implements LoggerService.Interface {\n private pinoLogger: Logger | null = null;\n\n constructor(private readonly getArgvService: GetArgvService.Interface) {}\n\n trace(message?: any, ...optionalParams: any[]) {\n const logger = this.getLogger();\n logger.trace(message, ...optionalParams);\n }\n\n fatal(message?: any, ...optionalParams: any[]) {\n const logger = this.getLogger();\n logger.fatal(message, ...optionalParams);\n }\n\n debug(message?: any, ...optionalParams: any[]) {\n const logger = this.getLogger();\n logger.debug(message, ...optionalParams);\n }\n\n info(message?: any, ...optionalParams: any[]) {\n const logger = this.getLogger();\n logger.info(message, ...optionalParams);\n }\n\n warn(message?: any, ...optionalParams: any[]) {\n const logger = this.getLogger();\n logger.warn(message, ...optionalParams);\n }\n\n error(message?: any, ...optionalParams: any[]) {\n const logger = this.getLogger();\n logger.error(message, ...optionalParams);\n }\n\n log(message?: any, ...optionalParams: any[]) {\n const logger = this.getLogger();\n logger.info(message, ...optionalParams);\n }\n\n private getLogger() {\n if (this.pinoLogger) {\n return this.pinoLogger;\n }\n\n const logStream = this.getLogStream();\n const level = this.getLogLevel();\n\n this.pinoLogger = pino({ level }, logStream);\n\n return this.pinoLogger;\n }\n\n private getLogStream() {\n const argv = this.getArgvService.execute();\n if (argv.showLogs) {\n return pinoPretty({\n ignore: \"pid,hostname\"\n });\n }\n\n // Wanted to use `GetProjectSdkService` to get project root path, but\n // to get that, had to call async method, which is not allowed in constructor.\n // TODO: implement a better way to get project root path.\n const webinyConfigPath = findUpSync(\"webiny.config.tsx\");\n if (!webinyConfigPath) {\n // Should not happen, but just in case.\n throw new Error(\"Could not find project root path.\");\n }\n\n const projectRootPath = path.dirname(webinyConfigPath!);\n\n const logsFolderPath = path.join(projectRootPath, \".webiny\", \"logs\");\n const logsFileName = this.getLogFileName();\n\n if (!fs.existsSync(logsFolderPath)) {\n fs.mkdirSync(logsFolderPath, { recursive: true });\n }\n\n const logFilePath = path.join(logsFolderPath, logsFileName);\n\n // Ensure the file exists or can be appended to\n return fs.createWriteStream(logFilePath, { flags: \"a\" });\n }\n\n private getLogFileName() {\n const now = new Date();\n const dateStr = now.toISOString().split(\"T\")[0];\n return `logs-${dateStr}.log`;\n }\n\n private getLogLevel() {\n const argv = this.getArgvService.execute();\n return process.env.WEBINY_CLI_LOG_LEVEL || argv.logLevel || DEFAULT_LOG_LEVEL;\n }\n}\n\nexport const loggerService = createImplementation({\n abstraction: LoggerService,\n implementation: DefaultLoggerService,\n dependencies: [GetArgvService]\n});\n"],"names":["DEFAULT_LOG_LEVEL","DefaultLoggerService","getArgvService","message","optionalParams","logger","logStream","level","pino","argv","pinoPretty","webinyConfigPath","findUpSync","Error","projectRootPath","path","logsFolderPath","logsFileName","fs","logFilePath","now","Date","dateStr","process","loggerService","createImplementation","LoggerService","GetArgvService"],"mappings":";;;;;;;AAQA,MAAMA,oBAAoB;AAEnB,MAAMC;IAGT,YAA6BC,cAAwC,CAAE;aAA1CA,cAAc,GAAdA;aAFrB,UAAU,GAAkB;IAEoC;IAExE,MAAMC,OAAa,EAAE,GAAGC,cAAqB,EAAE;QAC3C,MAAMC,SAAS,IAAI,CAAC,SAAS;QAC7BA,OAAO,KAAK,CAACF,YAAYC;IAC7B;IAEA,MAAMD,OAAa,EAAE,GAAGC,cAAqB,EAAE;QAC3C,MAAMC,SAAS,IAAI,CAAC,SAAS;QAC7BA,OAAO,KAAK,CAACF,YAAYC;IAC7B;IAEA,MAAMD,OAAa,EAAE,GAAGC,cAAqB,EAAE;QAC3C,MAAMC,SAAS,IAAI,CAAC,SAAS;QAC7BA,OAAO,KAAK,CAACF,YAAYC;IAC7B;IAEA,KAAKD,OAAa,EAAE,GAAGC,cAAqB,EAAE;QAC1C,MAAMC,SAAS,IAAI,CAAC,SAAS;QAC7BA,OAAO,IAAI,CAACF,YAAYC;IAC5B;IAEA,KAAKD,OAAa,EAAE,GAAGC,cAAqB,EAAE;QAC1C,MAAMC,SAAS,IAAI,CAAC,SAAS;QAC7BA,OAAO,IAAI,CAACF,YAAYC;IAC5B;IAEA,MAAMD,OAAa,EAAE,GAAGC,cAAqB,EAAE;QAC3C,MAAMC,SAAS,IAAI,CAAC,SAAS;QAC7BA,OAAO,KAAK,CAACF,YAAYC;IAC7B;IAEA,IAAID,OAAa,EAAE,GAAGC,cAAqB,EAAE;QACzC,MAAMC,SAAS,IAAI,CAAC,SAAS;QAC7BA,OAAO,IAAI,CAACF,YAAYC;IAC5B;IAEQ,YAAY;QAChB,IAAI,IAAI,CAAC,UAAU,EACf,OAAO,IAAI,CAAC,UAAU;QAG1B,MAAME,YAAY,IAAI,CAAC,YAAY;QACnC,MAAMC,QAAQ,IAAI,CAAC,WAAW;QAE9B,IAAI,CAAC,UAAU,GAAGC,KAAK;YAAED;QAAM,GAAGD;QAElC,OAAO,IAAI,CAAC,UAAU;IAC1B;IAEQ,eAAe;QACnB,MAAMG,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO;QACxC,IAAIA,KAAK,QAAQ,EACb,OAAOC,YAAW;YACd,QAAQ;QACZ;QAMJ,MAAMC,mBAAmBC,WAAW;QACpC,IAAI,CAACD,kBAED,MAAM,IAAIE,MAAM;QAGpB,MAAMC,kBAAkBC,UAAAA,OAAY,CAACJ;QAErC,MAAMK,iBAAiBD,UAAAA,IAAS,CAACD,iBAAiB,WAAW;QAC7D,MAAMG,eAAe,IAAI,CAAC,cAAc;QAExC,IAAI,CAACC,mCAAAA,UAAa,CAACF,iBACfE,mCAAAA,SAAY,CAACF,gBAAgB;YAAE,WAAW;QAAK;QAGnD,MAAMG,cAAcJ,UAAAA,IAAS,CAACC,gBAAgBC;QAG9C,OAAOC,mCAAAA,iBAAoB,CAACC,aAAa;YAAE,OAAO;QAAI;IAC1D;IAEQ,iBAAiB;QACrB,MAAMC,MAAM,IAAIC;QAChB,MAAMC,UAAUF,IAAI,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE;QAC/C,OAAO,CAAC,KAAK,EAAEE,QAAQ,IAAI,CAAC;IAChC;IAEQ,cAAc;QAClB,MAAMb,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO;QACxC,OAAOc,QAAQ,GAAG,CAAC,oBAAoB,IAAId,KAAK,QAAQ,IAAIT;IAChE;AACJ;AAEO,MAAMwB,gBAAgBC,qBAAqB;IAC9C,aAAaC;IACb,gBAAgBzB;IAChB,cAAc;QAAC0B;KAAe;AAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./LoggerService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./LoggerService.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GetCliRunnerService, RunCliRunnerService } from "../../abstractions/index.js";
|
|
2
|
+
export declare class DefaultRunCliRunnerService implements RunCliRunnerService.Interface {
|
|
3
|
+
private readonly getCliRunnerService;
|
|
4
|
+
constructor(getCliRunnerService: GetCliRunnerService.Interface);
|
|
5
|
+
execute(): Promise<{
|
|
6
|
+
[x: string]: unknown;
|
|
7
|
+
$0: string;
|
|
8
|
+
_: (string | number)[];
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export declare const runCliRunnerService: import("@webiny/di").Implementation<typeof DefaultRunCliRunnerService>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { GetCliRunnerService, RunCliRunnerService } from "../../abstractions/index.js";
|
|
3
|
+
import { hideBin } from "yargs/helpers";
|
|
4
|
+
class DefaultRunCliRunnerService {
|
|
5
|
+
constructor(getCliRunnerService){
|
|
6
|
+
this.getCliRunnerService = getCliRunnerService;
|
|
7
|
+
}
|
|
8
|
+
async execute() {
|
|
9
|
+
const cliRunner = await this.getCliRunnerService.execute();
|
|
10
|
+
return cliRunner.parseAsync(hideBin(process.argv));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const runCliRunnerService = createImplementation({
|
|
14
|
+
abstraction: RunCliRunnerService,
|
|
15
|
+
implementation: DefaultRunCliRunnerService,
|
|
16
|
+
dependencies: [
|
|
17
|
+
GetCliRunnerService
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
export { DefaultRunCliRunnerService, runCliRunnerService };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=RunCliRunnerService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/RunCliRunnerService/RunCliRunnerService.js","sources":["../../../src/services/RunCliRunnerService/RunCliRunnerService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GetCliRunnerService, RunCliRunnerService } from \"~/abstractions/index.js\";\nimport { hideBin } from \"yargs/helpers\";\nimport { Argv } from \"yargs\";\n\nexport class DefaultRunCliRunnerService implements RunCliRunnerService.Interface {\n constructor(private readonly getCliRunnerService: GetCliRunnerService.Interface) {}\n\n async execute() {\n const cliRunner = (await this.getCliRunnerService.execute()) as Argv;\n // Use process.argv directly since it's the actual argv being used\n return cliRunner.parseAsync(hideBin(process.argv));\n }\n}\n\nexport const runCliRunnerService = createImplementation({\n abstraction: RunCliRunnerService,\n implementation: DefaultRunCliRunnerService,\n dependencies: [GetCliRunnerService]\n});\n"],"names":["DefaultRunCliRunnerService","getCliRunnerService","cliRunner","hideBin","process","runCliRunnerService","createImplementation","RunCliRunnerService","GetCliRunnerService"],"mappings":";;;AAKO,MAAMA;IACT,YAA6BC,mBAAkD,CAAE;aAApDA,mBAAmB,GAAnBA;IAAqD;IAElF,MAAM,UAAU;QACZ,MAAMC,YAAa,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO;QAEzD,OAAOA,UAAU,UAAU,CAACC,QAAQC,QAAQ,IAAI;IACpD;AACJ;AAEO,MAAMC,sBAAsBC,qBAAqB;IACpD,aAAaC;IACb,gBAAgBP;IAChB,cAAc;QAACQ;KAAoB;AACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./RunCliRunnerService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./RunCliRunnerService.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StdioService } from "../../abstractions/index.js";
|
|
2
|
+
export declare class DefaultStdioService implements StdioService.Interface {
|
|
3
|
+
getStdout(): NodeJS.WriteStream & {
|
|
4
|
+
fd: 1;
|
|
5
|
+
};
|
|
6
|
+
getStderr(): NodeJS.WriteStream & {
|
|
7
|
+
fd: 2;
|
|
8
|
+
};
|
|
9
|
+
getStdin(): NodeJS.ReadStream & {
|
|
10
|
+
fd: 0;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare const stdioService: import("@webiny/di").Implementation<typeof DefaultStdioService>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { StdioService } from "../../abstractions/index.js";
|
|
3
|
+
class DefaultStdioService {
|
|
4
|
+
getStdout() {
|
|
5
|
+
return process.stdout;
|
|
6
|
+
}
|
|
7
|
+
getStderr() {
|
|
8
|
+
return process.stderr;
|
|
9
|
+
}
|
|
10
|
+
getStdin() {
|
|
11
|
+
return process.stdin;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const stdioService = createImplementation({
|
|
15
|
+
abstraction: StdioService,
|
|
16
|
+
implementation: DefaultStdioService,
|
|
17
|
+
dependencies: []
|
|
18
|
+
});
|
|
19
|
+
export { DefaultStdioService, stdioService };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=StdioService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/StdioService/StdioService.js","sources":["../../../src/services/StdioService/StdioService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { StdioService } from \"~/abstractions/index.js\";\n\nexport class DefaultStdioService implements StdioService.Interface {\n getStdout() {\n return process.stdout;\n }\n\n getStderr() {\n return process.stderr;\n }\n\n getStdin() {\n return process.stdin;\n }\n}\n\nexport const stdioService = createImplementation({\n abstraction: StdioService,\n implementation: DefaultStdioService,\n dependencies: []\n});\n"],"names":["DefaultStdioService","process","stdioService","createImplementation","StdioService"],"mappings":";;AAGO,MAAMA;IACT,YAAY;QACR,OAAOC,QAAQ,MAAM;IACzB;IAEA,YAAY;QACR,OAAOA,QAAQ,MAAM;IACzB;IAEA,WAAW;QACP,OAAOA,QAAQ,KAAK;IACxB;AACJ;AAEO,MAAMC,eAAeC,qBAAqB;IAC7C,aAAaC;IACb,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StdioService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StdioService.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UiService, StdioService, IsCi } from "../../abstractions/index.js";
|
|
2
|
+
export declare class DefaultUiService implements UiService.Interface {
|
|
3
|
+
private readonly stdio;
|
|
4
|
+
private readonly isCi;
|
|
5
|
+
constructor(stdio: StdioService.Interface, isCi: IsCi.Interface);
|
|
6
|
+
raw(text: string): void;
|
|
7
|
+
text(text: string): void;
|
|
8
|
+
textBold(text: string): void;
|
|
9
|
+
emptyLine(): void;
|
|
10
|
+
success(text: string, ...args: any[]): void;
|
|
11
|
+
info(text: string, ...args: any[]): void;
|
|
12
|
+
warning(text: string, ...args: any[]): void;
|
|
13
|
+
error(text: string, ...args: any[]): void;
|
|
14
|
+
debug(text: string, ...args: any[]): void;
|
|
15
|
+
private typedColorizedText;
|
|
16
|
+
}
|
|
17
|
+
export declare const uiService: import("@webiny/di").Implementation<typeof DefaultUiService>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import util from "util";
|
|
4
|
+
import { IsCi, StdioService, UiService } from "../../abstractions/index.js";
|
|
5
|
+
const NEW_LINE = "\n";
|
|
6
|
+
const PIPE_SYMBOL = "┃";
|
|
7
|
+
const LOG_COLORS = {
|
|
8
|
+
info: chalk.blueBright,
|
|
9
|
+
error: chalk.red,
|
|
10
|
+
warning: chalk.yellow,
|
|
11
|
+
success: chalk.green,
|
|
12
|
+
debug: chalk.gray
|
|
13
|
+
};
|
|
14
|
+
class DefaultUiService {
|
|
15
|
+
constructor(stdio, isCi){
|
|
16
|
+
this.stdio = stdio;
|
|
17
|
+
this.isCi = isCi;
|
|
18
|
+
}
|
|
19
|
+
raw(text) {
|
|
20
|
+
this.stdio.getStdout().write(text);
|
|
21
|
+
}
|
|
22
|
+
text(text) {
|
|
23
|
+
this.stdio.getStdout().write(text);
|
|
24
|
+
this.stdio.getStdout().write(NEW_LINE);
|
|
25
|
+
}
|
|
26
|
+
textBold(text) {
|
|
27
|
+
this.text(chalk.bold(text));
|
|
28
|
+
}
|
|
29
|
+
emptyLine() {
|
|
30
|
+
this.stdio.getStdout().write(chalk.gray("∙") + NEW_LINE);
|
|
31
|
+
}
|
|
32
|
+
success(text, ...args) {
|
|
33
|
+
this.typedColorizedText("success", text, ...args);
|
|
34
|
+
}
|
|
35
|
+
info(text, ...args) {
|
|
36
|
+
this.typedColorizedText("info", text, ...args);
|
|
37
|
+
}
|
|
38
|
+
warning(text, ...args) {
|
|
39
|
+
this.typedColorizedText("warning", text, ...args);
|
|
40
|
+
}
|
|
41
|
+
error(text, ...args) {
|
|
42
|
+
this.typedColorizedText("error", text, ...args);
|
|
43
|
+
}
|
|
44
|
+
debug(text, ...args) {
|
|
45
|
+
this.typedColorizedText("debug", text, ...args);
|
|
46
|
+
}
|
|
47
|
+
typedColorizedText(type, text, ...args) {
|
|
48
|
+
if (this.isCi.execute()) {
|
|
49
|
+
const prefix = `${type}: `;
|
|
50
|
+
return this.text(prefix + util.format(text, ...args));
|
|
51
|
+
}
|
|
52
|
+
const prefix = `${LOG_COLORS[type](PIPE_SYMBOL)} `;
|
|
53
|
+
const textWithColorizedPlaceholders = text.replace(/%[a-zA-Z]/g, (match)=>LOG_COLORS[type](match));
|
|
54
|
+
return this.text(prefix + util.format(textWithColorizedPlaceholders, ...args));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const uiService = createImplementation({
|
|
58
|
+
abstraction: UiService,
|
|
59
|
+
implementation: DefaultUiService,
|
|
60
|
+
dependencies: [
|
|
61
|
+
StdioService,
|
|
62
|
+
IsCi
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
export { DefaultUiService, uiService };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=UiService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/UiService/UiService.js","sources":["../../../src/services/UiService/UiService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport chalk from \"chalk\";\nimport util from \"util\";\nimport { UiService, StdioService, IsCi } from \"~/abstractions/index.js\";\n\nconst NEW_LINE = \"\\n\";\nconst PIPE_SYMBOL = \"┃\";\n\nconst LOG_COLORS = {\n info: chalk.blueBright,\n error: chalk.red,\n warning: chalk.yellow,\n success: chalk.green,\n debug: chalk.gray\n} as const;\n\nexport class DefaultUiService implements UiService.Interface {\n constructor(\n private readonly stdio: StdioService.Interface,\n private readonly isCi: IsCi.Interface\n ) {}\n\n raw(text: string) {\n this.stdio.getStdout().write(text);\n }\n\n text(text: string) {\n this.stdio.getStdout().write(text);\n this.stdio.getStdout().write(NEW_LINE);\n }\n\n textBold(text: string) {\n this.text(chalk.bold(text));\n }\n\n emptyLine() {\n this.stdio.getStdout().write(chalk.gray(\"∙\") + NEW_LINE);\n }\n\n // The following methods are used to print texts with a specific type prefix.\n success(text: string, ...args: any[]) {\n this.typedColorizedText(\"success\", text, ...args);\n }\n\n info(text: string, ...args: any[]) {\n this.typedColorizedText(\"info\", text, ...args);\n }\n\n warning(text: string, ...args: any[]) {\n this.typedColorizedText(\"warning\", text, ...args);\n }\n\n error(text: string, ...args: any[]) {\n this.typedColorizedText(\"error\", text, ...args);\n }\n\n debug(text: string, ...args: any[]) {\n this.typedColorizedText(\"debug\", text, ...args);\n }\n\n private typedColorizedText(type: keyof typeof LOG_COLORS, text: string, ...args: any[]) {\n // Use plain text format in CI environments.\n if (this.isCi.execute()) {\n const prefix = `${type}: `;\n return this.text(prefix + util.format(text, ...args));\n }\n\n const prefix = `${LOG_COLORS[type](PIPE_SYMBOL)} `;\n\n // Replace all placeholders (match with `/%[a-zA-Z]/g` regex) with colorized values.\n const textWithColorizedPlaceholders = text.replace(/%[a-zA-Z]/g, match => {\n return LOG_COLORS[type](match);\n });\n\n return this.text(prefix + util.format(textWithColorizedPlaceholders, ...args));\n }\n}\n\nexport const uiService = createImplementation({\n abstraction: UiService,\n implementation: DefaultUiService,\n dependencies: [StdioService, IsCi]\n});\n"],"names":["NEW_LINE","PIPE_SYMBOL","LOG_COLORS","chalk","DefaultUiService","stdio","isCi","text","args","type","prefix","util","textWithColorizedPlaceholders","match","uiService","createImplementation","UiService","StdioService","IsCi"],"mappings":";;;;AAKA,MAAMA,WAAW;AACjB,MAAMC,cAAc;AAEpB,MAAMC,aAAa;IACf,MAAMC,MAAM,UAAU;IACtB,OAAOA,MAAM,GAAG;IAChB,SAASA,MAAM,MAAM;IACrB,SAASA,MAAM,KAAK;IACpB,OAAOA,MAAM,IAAI;AACrB;AAEO,MAAMC;IACT,YACqBC,KAA6B,EAC7BC,IAAoB,CACvC;aAFmBD,KAAK,GAALA;aACAC,IAAI,GAAJA;IAClB;IAEH,IAAIC,IAAY,EAAE;QACd,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAACA;IACjC;IAEA,KAAKA,IAAY,EAAE;QACf,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAACA;QAC7B,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAACP;IACjC;IAEA,SAASO,IAAY,EAAE;QACnB,IAAI,CAAC,IAAI,CAACJ,MAAM,IAAI,CAACI;IACzB;IAEA,YAAY;QACR,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAACJ,MAAM,IAAI,CAAC,OAAOH;IACnD;IAGA,QAAQO,IAAY,EAAE,GAAGC,IAAW,EAAE;QAClC,IAAI,CAAC,kBAAkB,CAAC,WAAWD,SAASC;IAChD;IAEA,KAAKD,IAAY,EAAE,GAAGC,IAAW,EAAE;QAC/B,IAAI,CAAC,kBAAkB,CAAC,QAAQD,SAASC;IAC7C;IAEA,QAAQD,IAAY,EAAE,GAAGC,IAAW,EAAE;QAClC,IAAI,CAAC,kBAAkB,CAAC,WAAWD,SAASC;IAChD;IAEA,MAAMD,IAAY,EAAE,GAAGC,IAAW,EAAE;QAChC,IAAI,CAAC,kBAAkB,CAAC,SAASD,SAASC;IAC9C;IAEA,MAAMD,IAAY,EAAE,GAAGC,IAAW,EAAE;QAChC,IAAI,CAAC,kBAAkB,CAAC,SAASD,SAASC;IAC9C;IAEQ,mBAAmBC,IAA6B,EAAEF,IAAY,EAAE,GAAGC,IAAW,EAAE;QAEpF,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI;YACrB,MAAME,SAAS,GAAGD,KAAK,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC,IAAI,CAACC,SAASC,KAAK,MAAM,CAACJ,SAASC;QACnD;QAEA,MAAME,SAAS,GAAGR,UAAU,CAACO,KAAK,CAACR,aAAa,CAAC,CAAC;QAGlD,MAAMW,gCAAgCL,KAAK,OAAO,CAAC,cAAcM,CAAAA,QACtDX,UAAU,CAACO,KAAK,CAACI;QAG5B,OAAO,IAAI,CAAC,IAAI,CAACH,SAASC,KAAK,MAAM,CAACC,kCAAkCJ;IAC5E;AACJ;AAEO,MAAMM,YAAYC,qBAAqB;IAC1C,aAAaC;IACb,gBAAgBZ;IAChB,cAAc;QAACa;QAAcC;KAAK;AACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./UiService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./UiService.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./ArgvParserService/index.js";
|
|
2
|
+
export * from "./DefaultAppsService/index.js";
|
|
3
|
+
export * from "./CliParamsService/index.js";
|
|
4
|
+
export * from "./CommandsRegistryService/index.js";
|
|
5
|
+
export * from "./GetArgvService/index.js";
|
|
6
|
+
export * from "./GetCliRunnerService/index.js";
|
|
7
|
+
export * from "./GetIsCiService/index.js";
|
|
8
|
+
export * from "./GlobalOptionsRegistryService/index.js";
|
|
9
|
+
export * from "./GetProjectSdkService/index.js";
|
|
10
|
+
export * from "./LoggerService/index.js";
|
|
11
|
+
export * from "./RunCliRunnerService/index.js";
|
|
12
|
+
export * from "./StdioService/index.js";
|
|
13
|
+
export * from "./UiService/index.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./ArgvParserService/index.js";
|
|
2
|
+
export * from "./DefaultAppsService/index.js";
|
|
3
|
+
export * from "./CliParamsService/index.js";
|
|
4
|
+
export * from "./CommandsRegistryService/index.js";
|
|
5
|
+
export * from "./GetArgvService/index.js";
|
|
6
|
+
export * from "./GetCliRunnerService/index.js";
|
|
7
|
+
export * from "./GetIsCiService/index.js";
|
|
8
|
+
export * from "./GlobalOptionsRegistryService/index.js";
|
|
9
|
+
export * from "./GetProjectSdkService/index.js";
|
|
10
|
+
export * from "./LoggerService/index.js";
|
|
11
|
+
export * from "./RunCliRunnerService/index.js";
|
|
12
|
+
export * from "./StdioService/index.js";
|
|
13
|
+
export * from "./UiService/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/ManuallyReportedError.js","sources":["../../src/utils/ManuallyReportedError.ts"],"sourcesContent":["export class ManuallyReportedError extends Error {\n static from(cause: Error): ManuallyReportedError {\n return new ManuallyReportedError(cause.message, { cause });\n }\n}\n"],"names":["ManuallyReportedError","Error","cause"],"mappings":"AAAO,MAAMA,8BAA8BC;IACvC,OAAO,KAAKC,KAAY,EAAyB;QAC7C,OAAO,IAAIF,sBAAsBE,MAAM,OAAO,EAAE;YAAEA;QAAM;IAC5D;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ensureSameWebinyPackageVersions: () => void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { execaSync } from "execa";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
const DEBUG_FLAG = "--debug";
|
|
4
|
+
const usingDebugFlag = process.argv.includes(DEBUG_FLAG);
|
|
5
|
+
const SKIP_WEBINY_VERSIONS_CHECK_FLAG = "--no-package-versions-check";
|
|
6
|
+
const skippingWebinyVersionsCheck = process.argv.includes(SKIP_WEBINY_VERSIONS_CHECK_FLAG);
|
|
7
|
+
const listWebinyPackageVersions = ()=>{
|
|
8
|
+
const { stdout } = execaSync("yarn", [
|
|
9
|
+
"info",
|
|
10
|
+
"@webiny/*",
|
|
11
|
+
"--name-only",
|
|
12
|
+
"--all",
|
|
13
|
+
"--json"
|
|
14
|
+
], {
|
|
15
|
+
encoding: "utf8"
|
|
16
|
+
});
|
|
17
|
+
const lines = stdout.trim().split("\n").map((line)=>JSON.parse(line));
|
|
18
|
+
const versionMap = new Map();
|
|
19
|
+
for (const entry of lines){
|
|
20
|
+
const match = entry.match(/^(@webiny\/[^@]+)@npm:(.+)$/);
|
|
21
|
+
if (!match) continue;
|
|
22
|
+
const [, pkg, version] = match;
|
|
23
|
+
if (!versionMap.has(pkg)) versionMap.set(pkg, new Set());
|
|
24
|
+
versionMap.get(pkg).add(version);
|
|
25
|
+
}
|
|
26
|
+
return versionMap;
|
|
27
|
+
};
|
|
28
|
+
const ensureSameWebinyPackageVersions = ()=>{
|
|
29
|
+
if (skippingWebinyVersionsCheck) return;
|
|
30
|
+
let webinyVersions;
|
|
31
|
+
try {
|
|
32
|
+
webinyVersions = listWebinyPackageVersions();
|
|
33
|
+
} catch (e) {
|
|
34
|
+
const message = [
|
|
35
|
+
"Failed to inspect Webiny package versions."
|
|
36
|
+
];
|
|
37
|
+
if (!usingDebugFlag) message.push(`For more information, try running with ${chalk.yellow(DEBUG_FLAG)}.`);
|
|
38
|
+
message.push("Learn more: https://webiny.link/webiny-package-versions-check");
|
|
39
|
+
console.warn(chalk.yellow(message.join(" ")));
|
|
40
|
+
if (usingDebugFlag) console.warn(e);
|
|
41
|
+
console.log();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const mismatchedPackages = [];
|
|
45
|
+
for (const [pkg, versions] of webinyVersions.entries())if (versions.size > 1) mismatchedPackages.push([
|
|
46
|
+
pkg,
|
|
47
|
+
versions
|
|
48
|
+
]);
|
|
49
|
+
if (mismatchedPackages.length > 0) {
|
|
50
|
+
const message = [
|
|
51
|
+
"The following Webiny packages have mismatched versions:",
|
|
52
|
+
"",
|
|
53
|
+
...mismatchedPackages.map(([pkg, versions])=>`‣ ${pkg}: ${Array.from(versions).join(", ")}`),
|
|
54
|
+
"",
|
|
55
|
+
`Please ensure all Webiny packages are using the same version. If you think this is a mistake, you can also skip this check by appending the ${chalk.red(SKIP_WEBINY_VERSIONS_CHECK_FLAG)} flag. Learn more: https://webiny.link/webiny-package-versions-check`
|
|
56
|
+
];
|
|
57
|
+
console.error(chalk.red(message.join("\n")));
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export { ensureSameWebinyPackageVersions };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=ensureSameWebinyPackageVersions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/ensureSameWebinyPackageVersions.js","sources":["../../src/utils/ensureSameWebinyPackageVersions.ts"],"sourcesContent":["import { execaSync } from \"execa\";\nimport chalk from \"chalk\";\n\nconst DEBUG_FLAG = \"--debug\";\nconst usingDebugFlag = process.argv.includes(DEBUG_FLAG);\n\nconst SKIP_WEBINY_VERSIONS_CHECK_FLAG = \"--no-package-versions-check\";\nconst skippingWebinyVersionsCheck = process.argv.includes(SKIP_WEBINY_VERSIONS_CHECK_FLAG);\n\nconst listWebinyPackageVersions = (): Map<string, Set<string>> => {\n const { stdout } = execaSync(\"yarn\", [\"info\", \"@webiny/*\", \"--name-only\", \"--all\", \"--json\"], {\n encoding: \"utf8\"\n });\n\n // Each line is a JSON string, so parse them individually.\n const lines = stdout\n .trim()\n .split(\"\\n\")\n .map(line => JSON.parse(line) as string);\n\n const versionMap = new Map<string, Set<string>>();\n\n for (const entry of lines) {\n // An example entry: \"@webiny/cli@npm:5.42.3\".\n const match = entry.match(/^(@webiny\\/[^@]+)@npm:(.+)$/);\n if (!match) {\n continue;\n }\n\n const [, pkg, version] = match;\n if (!versionMap.has(pkg)) {\n versionMap.set(pkg, new Set());\n }\n\n versionMap.get(pkg)!.add(version);\n }\n\n return versionMap;\n};\n\nexport const ensureSameWebinyPackageVersions = (): void => {\n // Just in case, we want to allow users to skip the check.\n if (skippingWebinyVersionsCheck) {\n return;\n }\n\n let webinyVersions: Map<string, Set<string>>;\n try {\n webinyVersions = listWebinyPackageVersions();\n } catch (e) {\n const message = [\"Failed to inspect Webiny package versions.\"];\n\n if (!usingDebugFlag) {\n message.push(`For more information, try running with ${chalk.yellow(DEBUG_FLAG)}.`);\n }\n\n message.push(\"Learn more: https://webiny.link/webiny-package-versions-check\");\n\n console.warn(chalk.yellow(message.join(\" \")));\n if (usingDebugFlag) {\n console.warn(e);\n }\n\n console.log();\n return;\n }\n\n const mismatchedPackages: Array<[string, Set<string>]> = [];\n for (const [pkg, versions] of webinyVersions.entries()) {\n if (versions.size > 1) {\n mismatchedPackages.push([pkg, versions]);\n }\n }\n\n if (mismatchedPackages.length > 0) {\n const message = [\n \"The following Webiny packages have mismatched versions:\",\n \"\",\n ...mismatchedPackages.map(([pkg, versions]) => {\n return `‣ ${pkg}: ${Array.from(versions).join(\", \")}`;\n }),\n \"\",\n `Please ensure all Webiny packages are using the same version. If you think this is a mistake, you can also skip this check by appending the ${chalk.red(\n SKIP_WEBINY_VERSIONS_CHECK_FLAG\n )} flag. Learn more: https://webiny.link/webiny-package-versions-check`\n ];\n\n console.error(chalk.red(message.join(\"\\n\")));\n process.exit(1);\n }\n};\n"],"names":["DEBUG_FLAG","usingDebugFlag","process","SKIP_WEBINY_VERSIONS_CHECK_FLAG","skippingWebinyVersionsCheck","listWebinyPackageVersions","stdout","execaSync","lines","line","JSON","versionMap","Map","entry","match","pkg","version","Set","ensureSameWebinyPackageVersions","webinyVersions","e","message","chalk","console","mismatchedPackages","versions","Array"],"mappings":";;AAGA,MAAMA,aAAa;AACnB,MAAMC,iBAAiBC,QAAQ,IAAI,CAAC,QAAQ,CAACF;AAE7C,MAAMG,kCAAkC;AACxC,MAAMC,8BAA8BF,QAAQ,IAAI,CAAC,QAAQ,CAACC;AAE1D,MAAME,4BAA4B;IAC9B,MAAM,EAAEC,MAAM,EAAE,GAAGC,UAAU,QAAQ;QAAC;QAAQ;QAAa;QAAe;QAAS;KAAS,EAAE;QAC1F,UAAU;IACd;IAGA,MAAMC,QAAQF,OACT,IAAI,GACJ,KAAK,CAAC,MACN,GAAG,CAACG,CAAAA,OAAQC,KAAK,KAAK,CAACD;IAE5B,MAAME,aAAa,IAAIC;IAEvB,KAAK,MAAMC,SAASL,MAAO;QAEvB,MAAMM,QAAQD,MAAM,KAAK,CAAC;QAC1B,IAAI,CAACC,OACD;QAGJ,MAAM,GAAGC,KAAKC,QAAQ,GAAGF;QACzB,IAAI,CAACH,WAAW,GAAG,CAACI,MAChBJ,WAAW,GAAG,CAACI,KAAK,IAAIE;QAG5BN,WAAW,GAAG,CAACI,KAAM,GAAG,CAACC;IAC7B;IAEA,OAAOL;AACX;AAEO,MAAMO,kCAAkC;IAE3C,IAAId,6BACA;IAGJ,IAAIe;IACJ,IAAI;QACAA,iBAAiBd;IACrB,EAAE,OAAOe,GAAG;QACR,MAAMC,UAAU;YAAC;SAA6C;QAE9D,IAAI,CAACpB,gBACDoB,QAAQ,IAAI,CAAC,CAAC,uCAAuC,EAAEC,MAAM,MAAM,CAACtB,YAAY,CAAC,CAAC;QAGtFqB,QAAQ,IAAI,CAAC;QAEbE,QAAQ,IAAI,CAACD,MAAM,MAAM,CAACD,QAAQ,IAAI,CAAC;QACvC,IAAIpB,gBACAsB,QAAQ,IAAI,CAACH;QAGjBG,QAAQ,GAAG;QACX;IACJ;IAEA,MAAMC,qBAAmD,EAAE;IAC3D,KAAK,MAAM,CAACT,KAAKU,SAAS,IAAIN,eAAe,OAAO,GAChD,IAAIM,SAAS,IAAI,GAAG,GAChBD,mBAAmB,IAAI,CAAC;QAACT;QAAKU;KAAS;IAI/C,IAAID,mBAAmB,MAAM,GAAG,GAAG;QAC/B,MAAMH,UAAU;YACZ;YACA;eACGG,mBAAmB,GAAG,CAAC,CAAC,CAACT,KAAKU,SAAS,GAC/B,CAAC,EAAE,EAAEV,IAAI,EAAE,EAAEW,MAAM,IAAI,CAACD,UAAU,IAAI,CAAC,OAAO;YAEzD;YACA,CAAC,4IAA4I,EAAEH,MAAM,GAAG,CACpJnB,iCACF,oEAAoE,CAAC;SAC1E;QAEDoB,QAAQ,KAAK,CAACD,MAAM,GAAG,CAACD,QAAQ,IAAI,CAAC;QACrCnB,QAAQ,IAAI,CAAC;IACjB;AACJ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const originalConsoleError = console.error;
|
|
2
|
+
console.error = (message, ...args)=>{
|
|
3
|
+
if ("string" == typeof message && message.includes("punycode")) return;
|
|
4
|
+
originalConsoleError.call(console, message, ...args);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=suppressPunycodeWarnings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/suppressPunycodeWarnings.js","sources":["../../src/utils/suppressPunycodeWarnings.ts"],"sourcesContent":["// Suppress the `punycode` deprecation warning emitted by transitive deps.\n// This is a known upstream issue we can't fix, so we filter it out.\nconst originalConsoleError = console.error;\nconsole.error = (message: unknown, ...args: unknown[]) => {\n if (typeof message === \"string\" && message.includes(\"punycode\")) {\n return;\n }\n originalConsoleError.call(console, message, ...args);\n};\n"],"names":["originalConsoleError","console","message","args"],"mappings":"AAEA,MAAMA,uBAAuBC,QAAQ,KAAK;AAC1CA,QAAQ,KAAK,GAAG,CAACC,SAAkB,GAAGC;IAClC,IAAI,AAAmB,YAAnB,OAAOD,WAAwBA,QAAQ,QAAQ,CAAC,aAChD;IAEJF,qBAAqB,IAAI,CAACC,SAASC,YAAYC;AACnD"}
|